liujiandao
2023-11-18 115bd9b51f5d8eade4658f844de37516486c60e7
api/v1/serviceContract.go
@@ -35,6 +35,23 @@
      return
   }
   count, err := model.NewServiceContractSearch().SetNumber(params.Number).Count()
   if err != nil {
      ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败")
      return
   }
   if count > 0 {
      ctx.FailWithMsg(ecode.UnknownErr, "编码已存在")
      return
   }
   if params.MemberId == 0 {
      userInfo := utils.GetUserInfo(c)
      if userInfo.UserType == constvar.UserTypeSub {
         params.MemberId = userInfo.CrmUserId
      }
   }
   errCode := serviceContractService.AddServiceContract(serviceContract)
   if errCode != ecode.OK {
      ctx.Fail(errCode)
@@ -43,30 +60,6 @@
   ctx.Ok()
}
//// Delete
////
////   @Tags      ServiceContract
////   @Summary   删除服务合同
////   @Produce   application/json
////   @Param      object   body      request.DeleteServiceContract true   "查询参数"
////   @Success   200   {object}   contextx.Response{}
////   @Router      /api/serviceContract/delete [delete]
//func (s *ServiceContractApi) Delete(c *gin.Context) {
//   var params request.DeleteServiceContract
//   ctx, ok := contextx.NewContext(c, &params)
//   if !ok {
//      return
//   }
//
//   errCode := serviceContractService.DeleteServiceContract(params.Ids)
//   if errCode != ecode.OK {
//      ctx.Fail(errCode)
//      return
//   }
//
//   ctx.Ok()
//}
// BatchDelete
// @Tags   ServiceContract
@@ -141,10 +134,10 @@
   var memberIds []int
   userInfo := utils.GetUserInfo(c)
   if userInfo.UserType == constvar.UserTypeSub {
      memberIds = []int{userInfo.CrmUserId}
      memberIds = userInfo.SubUserIds
   }
   serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.QueryClass, params.KeywordType, params.Keyword, memberIds)
   serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params, memberIds)
   if errCode != ecode.OK {
      ctx.Fail(errCode)
      return