作者 yangfu

Merge branch 'dev' into test

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