zhangqian
2023-11-01 530fed8ec225453572d57b15c200ab062c335457
api/v1/contract.go
@@ -35,6 +35,16 @@
      return
   }
   count, err := model.NewContractSearch().SetNumber(params.Number).Count()
   if err != nil {
      ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
      return
   }
   if count > 0 {
      ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
      return
   }
   if contract.MemberId == 0 {
      userInfo := utils.GetUserInfo(c)
      if userInfo.UserType == constvar.UserTypeSub {
@@ -46,14 +56,6 @@
   if errCode != ecode.OK {
      ctx.Fail(errCode)
      return
   }
   if params.CodeRule.Method == 1 {
      autoCode := model.GetAutoCode(contract.Id, &params.CodeRule)
      m := map[string]interface{}{
         "number": autoCode,
      }
      _ = model.NewContractSearch().SetId(contract.Id).UpdateByMap(m)
   }
   ctx.Ok()
@@ -138,6 +140,7 @@
      File:         contract.File,
      CodeStandID:  contract.CodeStandID,
      ContractName: contract.ContractName,
      SendTime:     contract.SendTime,
   }
   return ecode.OK, contractModel
@@ -163,7 +166,7 @@
      if params.SearchMap == nil {
         params.SearchMap = make(map[string]interface{}, 0)
      }
      params.SearchMap["member_id"] = userInfo.CrmUserId
      params.SearchMap["member_ids"] = userInfo.SubUserIds
   }
   contracts, total, errCode := contractService.GetContractList(params.Page, params.PageSize, params.SearchMap)