liujiandao
2023-10-17 d4bf53dd19a45ef09a367babcf7a2ac04ae1d08f
api/v1/followRecord.go
@@ -1,11 +1,13 @@
package v1
import (
   "aps_crm/constvar"
   "aps_crm/model"
   "aps_crm/model/request"
   "aps_crm/model/response"
   "aps_crm/pkg/contextx"
   "aps_crm/pkg/ecode"
   "aps_crm/utils"
   "errors"
   "github.com/gin-gonic/gin"
   "time"
@@ -34,10 +36,24 @@
      return
   }
   if followRecord.MemberId == 0 {
      userInfo := utils.GetUserInfo(c)
      if userInfo.UserType == constvar.UserTypeSub {
         followRecord.MemberId = userInfo.CrmUserId
      }
   }
   errCode = followRecordService.AddFollowRecord(followRecord)
   if errCode != ecode.OK {
      ctx.Fail(errCode)
      return
   }
   if params.FollowRecord.CodeRule.Method == 1 {
      autoCode := model.GetAutoCode(followRecord.Id, &params.FollowRecord.CodeRule)
      m := map[string]interface{}{
         "number": autoCode,
      }
      _ = model.NewFollowRecordSearch().SetId(followRecord.Id).UpdateMap(m)
   }
   ctx.Ok()
@@ -167,6 +183,7 @@
   followRecordModel.Purpose = followRecord.Purpose
   followRecordModel.Content = followRecord.Content
   followRecordModel.Record = followRecord.Record
   followRecordModel.CodeStandID = followRecord.CodeStandID
   return ecode.OK, &followRecordModel
}
@@ -221,6 +238,14 @@
      return
   }
   userInfo := utils.GetUserInfo(c)
   if userInfo.UserType == constvar.UserTypeSub {
      if params.SearchMap == nil {
         params.SearchMap = make(map[string]interface{}, 0)
      }
      params.SearchMap["member_id"] = userInfo.CrmUserId
   }
   followRecords, total, errCode := followRecordService.GetFollowRecordList(params.Page, params.PageSize, params.SearchMap)
   if errCode != ecode.OK {
      ctx.Fail(errCode)