...
|
...
|
@@ -26,6 +26,14 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs |
|
|
log.Error("chance_type_id:%v 不存在 ,err:%v", request.Template.ChanceTypeId, err.Error())
|
|
|
return
|
|
|
}
|
|
|
if len([]rune(request.Template.Code)) != 6 {
|
|
|
err = protocol.NewErrWithMessage("10065")
|
|
|
return
|
|
|
}
|
|
|
if _, err = models.GetAuditTemplateByCode(companyId, request.Template.Code); err == nil {
|
|
|
err = protocol.NewErrWithMessage("10064")
|
|
|
return
|
|
|
}
|
|
|
orm := orm2.NewOrm()
|
|
|
//模板
|
|
|
{
|
...
|
...
|
@@ -199,6 +207,7 @@ func TemplateList(uid, companyId int64, request *protocol.TemplateListRequest) ( |
|
|
Id: t.Id,
|
|
|
Name: t.Name,
|
|
|
Icon: t.Icon,
|
|
|
Code: t.Code,
|
|
|
}
|
|
|
rsp.List = append(rsp.List, item)
|
|
|
if templates, err = models.GetAuditTemplateByTypeId(t.Id); err != nil {
|
...
|
...
|
@@ -222,6 +231,7 @@ func TemplateList(uid, companyId int64, request *protocol.TemplateListRequest) ( |
|
|
Id: temp.Id,
|
|
|
Name: temp.Name,
|
|
|
Doc: temp.Doc,
|
|
|
Code: temp.Code,
|
|
|
Icon: temp.Icon,
|
|
|
EnableStatus: temp.EnableStatus,
|
|
|
Sort: temp.SortNum,
|
...
|
...
|
@@ -423,6 +433,10 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe |
|
|
}
|
|
|
return
|
|
|
}
|
|
|
if len([]rune(request.Code)) != 6 {
|
|
|
err = protocol.NewErrWithMessage("10065")
|
|
|
return
|
|
|
}
|
|
|
chanceType = &models.ChanceType{
|
|
|
Name: request.Name,
|
|
|
Icon: request.Icon,
|
...
|
...
|
@@ -431,6 +445,10 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe |
|
|
CreateAt: time.Now(),
|
|
|
UpdateAt: time.Now(),
|
|
|
}
|
|
|
if _, err = models.GetChanceTypeByCode(companyId, chanceType.Code); err == nil {
|
|
|
err = protocol.NewErrWithMessage("10064")
|
|
|
return
|
|
|
}
|
|
|
if _, err = models.AddChanceType(chanceType); err != nil {
|
|
|
log.Error(err.Error())
|
|
|
}
|
...
|
...
|
|