mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-26 16:46:14 +08:00
fix generate
接口返回list如果是nil,则赋值为空数组 前端State类加构造函数
This commit is contained in:
@@ -42,7 +42,7 @@ func (c *cEms) SendTest(ctx context.Context, req *common.SendTestEmailReq) (res
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SendBindEms 发送换绑邮件
|
// SendBindEms 发送换绑邮件
|
||||||
func (c *cSms) SendBindEms(ctx context.Context, _ *common.SendBindEmsReq) (res *common.SendBindEmsRes, err error) {
|
func (c *cEms) SendBindEms(ctx context.Context, _ *common.SendBindEmsReq) (res *common.SendBindEmsRes, err error) {
|
||||||
var (
|
var (
|
||||||
memberId = contexts.GetUserId(ctx)
|
memberId = contexts.GetUserId(ctx)
|
||||||
models *entity.AdminMember
|
models *entity.AdminMember
|
||||||
|
@@ -46,6 +46,7 @@ func (l *gCurd) generateWebModelState(ctx context.Context, in *CurdPreviewInput)
|
|||||||
}
|
}
|
||||||
buffer.WriteString(fmt.Sprintf(" public %s = %v; // %s\n", field.TsName, value, field.Dc))
|
buffer.WriteString(fmt.Sprintf(" public %s = %v; // %s\n", field.TsName, value, field.Dc))
|
||||||
}
|
}
|
||||||
|
buffer.WriteString("\n constructor(state?: Partial<State>) {\n if (state) {\n Object.assign(this, state);\n }\n }")
|
||||||
buffer.WriteString("}")
|
buffer.WriteString("}")
|
||||||
return buffer.String()
|
return buffer.String()
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,10 @@ func (c *c@{.varName}) List(ctx context.Context, req *@{.varName | ToLower}.List
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if list == nil {
|
||||||
|
list = []*@{.templateGroup}in.@{.varName}ListModel{}
|
||||||
|
}
|
||||||
|
|
||||||
res = new(@{.varName | ToLower}.ListRes)
|
res = new(@{.varName | ToLower}.ListRes)
|
||||||
res.List = list
|
res.List = list
|
||||||
|
Reference in New Issue
Block a user