zhangqian
2023-10-28 05582688724c78bc70a7bc860193c67677f6c8cf
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