You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
741 B
37 lines
741 B
package {{.pkgName}}
|
|
|
|
import (
|
|
{{.imports}}
|
|
)
|
|
|
|
type {{.logic}} struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
{{if .hasDoc}}{{.doc}}{{end}}
|
|
func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) *{{.logic}} {
|
|
return &{{.logic}}{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *{{.logic}}) {{.function}}({{.request}}) {{.responseType}} {
|
|
// 这里编写业务逻辑,要注意错误处理,写好注释
|
|
// 示例1. 查询
|
|
// var xxx model.XXX
|
|
// err := l.svcCtx.Db.Model(model.XXX{}).Where("id = ?", id).Find(&xxx).Error
|
|
|
|
|
|
return &types.Response{
|
|
Success: true,
|
|
Code : 200,
|
|
Msg: "{{if .hasDoc}}{{.doc}}{{end}}"+" success",
|
|
Data: nil,
|
|
},nil
|
|
|
|
|
|
}
|
|
|