作者 yangfu

公告上架下架

... ... @@ -19,7 +19,7 @@ mysql_db_name = "${MYSQL_DB_NAME||opportunity_dev}"
##redis相关配置
redis_add = "${REDIS_HOST||127.0.0.1}"
redis_add_port = "${REDIS_PORT||6379}"
redis_auth = ""
redis_auth = "123456"
##log相关配置
##out_put:"console","file"
log_output = "file"
... ...
... ... @@ -205,6 +205,7 @@ func (this *BulletinController) ExportFeedBacks() {
msg = protocol.BadRequestParam("1")
return
}
//excel.FileName = fmt.Sprintf("商品列表%v.xlsx","")
if err = this.ResponseExcelByFile(this.Ctx, excel); err != nil {
log.Error(err.Error())
msg = protocol.BadRequestParam("1")
... ...
... ... @@ -43,6 +43,18 @@ func (this *TemplateController) TemplateAdd() {
msg = m
return
}
if len([]rune(request.Template.Name)) > 10 {
msg = protocol.BadRequestParam("10070")
return
}
if len([]rune(request.Template.Doc)) > 30 {
msg = protocol.BadRequestParam("10272")
return
}
{
//名称不能超过20字
//字段只能10个字段
}
{
//审批人配置
v := request.AuditFlowConfig.NoApprover
... ... @@ -125,6 +137,10 @@ func (this *TemplateController) TemplateUpdate() {
msg = m
return
}
if len([]rune(request.Template.Doc)) > 30 {
msg = protocol.BadRequestParam("10272")
return
}
rsp, err := audit.TemplateUpdate(uid, companyId, request)
msg = protocol.NewReturnResponse(rsp, err)
return
... ... @@ -272,6 +288,10 @@ func (this *TemplateController) TemplateOperateCategory() {
msg = m
return
}
if len([]rune(request.Name)) > 10 {
msg = protocol.BadRequestParam("10070")
return
}
rsp, err := audit.TemplateOperateCategory(uid, companyId, request)
msg = protocol.NewReturnResponse(rsp, err)
}
... ...
... ... @@ -106,9 +106,18 @@ func GetAuditTemplateByTypeId(chanceTypeId int) (v []*AuditTemplate, err error)
func GetAuditTemplateByCode(companyId int64, code string) (v *ChanceType, err error) {
o := orm.NewOrm()
sql := "select * from audit_template where code=? and company_id=?"
sql := "select * from audit_template where binary code=? and company_id=?"
if err = o.Raw(sql, code, companyId).QueryRow(&v); err == nil {
return
}
return
}
func GetAuditTemplateByName(companyId int64, name string) (v *ChanceType, err error) {
o := orm.NewOrm()
sql := "select * from audit_template where binary name=? and company_id=?"
if err = o.Raw(sql, name, companyId).QueryRow(&v); err == nil {
return
}
return
}
... ...
... ... @@ -95,9 +95,18 @@ func GetChanceTypeByCompany(companyId int) (v []*ChanceType, err error) {
func GetChanceTypeByCode(companyId int64, code string) (v *ChanceType, err error) {
o := orm.NewOrm()
sql := "select * from chance_type where code=? and company_id=?"
sql := "select * from chance_type where binary code=? and company_id=?"
if err = o.Raw(sql, code, companyId).QueryRow(&v); err == nil {
return
}
return
}
func GetChanceTypeByName(companyId int64, name string) (v *ChanceType, err error) {
o := orm.NewOrm()
sql := "select * from chance_type where binary name=? and company_id=?"
if err = o.Raw(sql, name, companyId).QueryRow(&v); err == nil {
return
}
return
}
... ...
... ... @@ -67,6 +67,15 @@ var errmessge ErrorMap = map[string]string{
"10067": "一级分类不存在",
"10068": "审核人为空参数有误",
"10069": "未设置审核人",
"10070": "分类名称输入大于10个字符",
"10271": "模板已存在",
"10272": "说明信息输入大于30个字符",
"10273": "表单列最多20个字符",
"10274": "最多添加10个字段",
"10275": "最多添加1个节点",
"10276": "最多选择1个角色",
"10277": "最多一个小数",
"10170": "请选择指定成员",
"10171": "请选择审批人类别",
"10172": "请选择审批方式",
... ...
... ... @@ -35,6 +35,10 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs
err = protocol.NewErrWithMessage("10064")
return
}
if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name); err == nil {
err = protocol.NewErrWithMessage("10271")
return
}
orm := orm2.NewOrm()
//模板
{
... ... @@ -156,6 +160,10 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques
log.Error("template_id:%v 不存在 ,err:%v", request.Template.Id, err.Error())
return
}
if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name); err == nil {
err = protocol.NewErrWithMessage("10271")
return
}
orm := orm2.NewOrm()
//模板
{
... ... @@ -549,6 +557,10 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe
log.Error("template_id:%v companyId:%v want:%v not equal.", request.Id, companyId, chanceType.CompanyId)
return
}
if _, err = models.GetChanceTypeByName(companyId, chanceType.Name); err == nil {
err = protocol.NewErrWithMessage("10271")
return
}
if err = utils.UpdateTableByMap(chanceType, map[string]interface{}{"Name": request.Name, "Icon": request.Icon, "SortNum": chanceType.SortNum, "UpdateAt": time.Now()}); err != nil {
log.Error(err.Error())
return
... ... @@ -572,6 +584,10 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe
err = protocol.NewErrWithMessage("10064")
return
}
if _, err = models.GetChanceTypeByName(companyId, chanceType.Name); err == nil {
err = protocol.NewErrWithMessage("10271")
return
}
if _, err = models.AddChanceType(chanceType); err != nil {
log.Error(err.Error())
}
... ...