作者 唐旭辉

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/oppmg into dev

... ... @@ -104,10 +104,10 @@ func GetAuditTemplateByTypeId(chanceTypeId int) (v []*AuditTemplate, err error)
return
}
func GetAuditTemplateByCode(companyId int64, code string) (v *ChanceType, err error) {
func GetAuditTemplateByCode(companyId int64, code string, chanceTypeId int) (v *ChanceType, err error) {
o := orm.NewOrm()
sql := "select * from audit_template where binary code=? and company_id=?"
if err = o.Raw(sql, code, companyId).QueryRow(&v); err == nil {
sql := "select * from audit_template where binary code=? and company_id=? and chance_type_id=?"
if err = o.Raw(sql, code, companyId, chanceTypeId).QueryRow(&v); err == nil {
return
}
return
... ...
... ... @@ -30,7 +30,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs
err = protocol.NewErrWithMessage("10065")
return
}
if _, err = models.GetAuditTemplateByCode(companyId, request.Template.Code); err == nil {
if _, err = models.GetAuditTemplateByCode(companyId, request.Template.Code, request.Template.ChanceTypeId); err == nil {
err = protocol.NewErrWithMessage("10064")
return
}
... ...