1 Star 4 Fork 0

jingshanccc / course

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
section.go 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
jingshanccc 提交于 2021-04-02 16:15 . [feature] #76
package handler
import (
"context"
"gitee.com/jingshanccc/course/course/proto/dto"
"gitee.com/jingshanccc/course/public/config"
"gitee.com/jingshanccc/course/public/proto/basic"
"gitee.com/jingshanccc/course/public/util"
"github.com/micro/go-micro/v2/errors"
)
func (c *CourseServiceHandler) ListSection(ctx context.Context, in *dto.SectionPageDto, out *dto.SectionPageDto) error {
total, list, exception := sectionDao.List(in)
if exception != nil {
return errors.New(config.Conf.BasicConfig.BasicName+config.Conf.Services["course"].Name, exception.Error(), exception.Code())
}
_ = util.CopyProperties(out, in)
out.Rows = list
out.Total = total
return nil
}
func (c *CourseServiceHandler) SaveSection(ctx context.Context, in *dto.SectionDto, out *dto.SectionDto) error {
sectionDto, exception := sectionDao.Save(in)
if exception != nil {
return errors.New(config.Conf.BasicConfig.BasicName+config.Conf.Services["course"].Name, exception.Error(), exception.Code())
}
exception = courseDao.UpdateCourseDuration(in.CourseId)
if exception != nil {
return errors.New(config.Conf.BasicConfig.BasicName+config.Conf.Services["course"].Name, exception.Error(), exception.Code())
}
_ = util.CopyProperties(out, sectionDto)
return nil
}
func (c *CourseServiceHandler) DeleteSection(ctx context.Context, in *basic.StringList, out *basic.String) error {
exception := sectionDao.Delete(in.Rows)
if exception != nil {
return errors.New(config.Conf.BasicConfig.BasicName+config.Conf.Services["course"].Name, exception.Error(), exception.Code())
}
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jingshanccc/course.git
git@gitee.com:jingshanccc/course.git
jingshanccc
course
course
23f538baa694

搜索帮助

344bd9b3 5694891 D2dac590 5694891