activity_special.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "hongze/hongze_clpt/models"
  6. "hongze/hongze_clpt/services"
  7. "hongze/hongze_clpt/utils"
  8. "strconv"
  9. "time"
  10. )
  11. // 专项调研活动
  12. type ActivitySpecialController struct {
  13. BaseAuthController
  14. }
  15. // @Title 专项产业调研列表
  16. // @Description 获取专项产业调研列表接口
  17. // @Param PageSize query int true "每页数据条数"
  18. // @Param CurrentIndex query int true "当前页页码,从1开始"
  19. // @Param ChartPermissionIds query string false "行业id 多个用 , 隔开"
  20. // @Param ActiveState query string false "活动进行状态 未开始:1、进行中2、已结束3"
  21. // @Param WhichDay query string false "哪一天 今天:1、明天:2, 本周:3 上周:4,本月:5上月:6多个用 , 隔开"
  22. // @Success 200 {object} models.GetCygxActivitySpecialDetailListResp
  23. // @router /list [get]
  24. func (this *ActivitySpecialController) SpecialList() {
  25. br := new(models.BaseResponse).Init()
  26. defer func() {
  27. this.Data["json"] = br
  28. this.ServeJSON()
  29. }()
  30. user := this.User
  31. if user == nil {
  32. br.Msg = "请登录"
  33. br.ErrMsg = "请登录,SysUser Is Empty"
  34. return
  35. }
  36. pageSize, _ := this.GetInt("PageSize")
  37. currentIndex, _ := this.GetInt("CurrentIndex")
  38. chartPermissionIds := this.GetString("ChartPermissionIds")
  39. whichDay := this.GetString("WhichDay")
  40. activeState := this.GetString("ActiveState")
  41. if pageSize <= 0 {
  42. pageSize = utils.PageSize20
  43. }
  44. if currentIndex <= 0 {
  45. currentIndex = 1
  46. }
  47. if activeState == "1" {
  48. activeState = ""
  49. }
  50. conditionActivity := services.ActivityLabelSpecialSql(chartPermissionIds, whichDay, activeState)
  51. list, total, errList := services.GetActivitySpecialList(user, currentIndex, pageSize, "", conditionActivity, activeState)
  52. if errList != nil {
  53. br.Msg = "获取失败"
  54. br.ErrMsg = "获取失败,Err:" + errList.Error()
  55. return
  56. }
  57. page := paging.GetPaging(currentIndex, pageSize, total)
  58. resp := new(models.GetCygxActivitySpecialDetailListResp)
  59. count, err := models.GetCygxUserFollowSpecial(user.UserId)
  60. if err != nil {
  61. br.Msg = "获取数据失败!"
  62. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  63. return
  64. }
  65. if count == 1 && user.UserId > 0 {
  66. resp.IsFollow = true
  67. }
  68. if user.Mobile != "" {
  69. resp.IsBindingMobile = true
  70. }
  71. if len(list) == 0 {
  72. list = make([]*models.CygxActivitySpecialDetail, 0)
  73. }
  74. resp.List = list
  75. resp.Paging = page
  76. br.Ret = 200
  77. br.Success = true
  78. br.Msg = "获取成功"
  79. br.Data = resp
  80. }
  81. // @Title 专项产业调研详情
  82. // @Description 获取专项产业调研详情接口
  83. // @Param ActivityId query int true "活动ID"
  84. // @Success Ret=200 {object} models.CygxActivitySpecialResp
  85. // @router /detail [get]
  86. func (this *ActivitySpecialController) SpecialDetail() {
  87. br := new(models.BaseResponse).Init()
  88. defer func() {
  89. this.Data["json"] = br
  90. this.ServeJSON()
  91. }()
  92. user := this.User
  93. if user == nil {
  94. br.Msg = "请登录"
  95. br.ErrMsg = "请登录,用户信息为空"
  96. br.Ret = 408
  97. return
  98. }
  99. uid := user.UserId
  100. activityId, _ := this.GetInt("ActivityId")
  101. if activityId < 1 {
  102. br.Msg = "请输入活动ID"
  103. return
  104. }
  105. resp := new(models.CygxActivitySpecialResp)
  106. activityInfo, err := models.GetCygxActivitySpecialDetailById(uid, activityId)
  107. if err != nil && err.Error() != utils.ErrNoRow() {
  108. br.Msg = "获取信息失败"
  109. br.ErrMsg = "活动ID错误,Err:" + "activityId:" + strconv.Itoa(activityId)
  110. return
  111. }
  112. if activityInfo == nil {
  113. br.Msg = "活动不存在"
  114. br.ErrMsg = "活动ID错误,Err:" + "activityId:" + strconv.Itoa(activityId)
  115. return
  116. }
  117. havePower, err := services.GetSpecialDetailUserPower(user, activityInfo)
  118. if err != nil {
  119. br.Msg = "获取信息失败"
  120. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  121. return
  122. }
  123. //判断有没有对应的权限,如果没有则给出对应的状态码
  124. if havePower {
  125. resp.HasPermission = 1
  126. count, err := models.GetCygxUserFollowSpecial(user.UserId)
  127. if err != nil {
  128. br.Msg = "获取数据失败!"
  129. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  130. return
  131. }
  132. if count == 1 {
  133. resp.IsFollow = true
  134. }
  135. activityInfo, err := services.HandleActivitySpecialShow(activityInfo, user)
  136. if err != nil {
  137. br.Msg = "获取数据失败!"
  138. br.ErrMsg = "HandleActivitySpecialShow,Err:" + err.Error()
  139. return
  140. }
  141. var condition string
  142. var pars []interface{}
  143. condition += ` AND t.activity_id = ? AND t.is_cancel = 0 `
  144. pars = append(pars, activityInfo.ActivityId)
  145. tripTota, err := models.GetActivitySpecialTripCountByActivityId(condition, pars)
  146. if err != nil {
  147. br.Msg = "获取数据失败!"
  148. br.ErrMsg = "GetActivitySpecialTripCountByActivityId,Err:" + err.Error()
  149. return
  150. }
  151. activityInfo.TripNum = tripTota
  152. activityInfo.ActivityTypeName = "专项调研"
  153. resp.Detail = activityInfo
  154. resp.Detail = activityInfo
  155. } else {
  156. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
  157. if err != nil {
  158. br.Msg = "获取信息失败"
  159. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  160. return
  161. }
  162. resp.PopupMsg = popupMsg
  163. resp.HasPermission = hasPermission
  164. resp.SellerName = sellerName
  165. resp.SellerMobile = sellerMobile
  166. }
  167. br.Ret = 200
  168. br.Success = true
  169. br.Msg = "获取成功"
  170. br.Data = resp
  171. }
  172. // @Title报名
  173. // @Description 报名
  174. // @Param request body models.ActivityIdRep true "type json string"
  175. // @Success Ret=200 {object} models.SignupSpecialStatus
  176. // @router /trip/add [post]
  177. func (this *ActivitySpecialController) SpecialTripAdd() {
  178. br := new(models.BaseResponse).Init()
  179. defer func() {
  180. this.Data["json"] = br
  181. this.ServeJSON()
  182. }()
  183. user := this.User
  184. if user == nil {
  185. br.Msg = "请登录"
  186. br.ErrMsg = "请登录,用户信息为空"
  187. br.Ret = 408
  188. return
  189. }
  190. uid := user.UserId
  191. var req models.ActivityIdRep
  192. resp := new(models.SignupSpecialStatus)
  193. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  194. if err != nil {
  195. br.Msg = "参数解析异常!"
  196. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  197. return
  198. }
  199. activityId := req.ActivityId
  200. activityInfo, errInfo := models.GetCygxActivitySpecialDetail(activityId)
  201. if activityInfo == nil {
  202. br.Msg = "操作失败"
  203. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  204. return
  205. }
  206. if errInfo != nil {
  207. br.Msg = "操作失败"
  208. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  209. return
  210. }
  211. havePower, err := services.GetSpecialDetailUserPower(user, activityInfo)
  212. if err != nil {
  213. br.Msg = "获取信息失败"
  214. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  215. return
  216. }
  217. //判断有没有对应的权限,如果没有则给出对应的状态码
  218. if havePower {
  219. resp.HasPermission = 1
  220. signupStatus, popupMsg, popupMsg2, err := services.SpecialTripPopupMsg(activityInfo, user)
  221. if err != nil {
  222. br.Msg = "获取信息失败"
  223. br.ErrMsg = "SpecialTripPopupMsg,Err:" + err.Error()
  224. return
  225. }
  226. resp.PopupMsg = popupMsg
  227. resp.PopupMsg2 = popupMsg2
  228. resp.SignupStatus = signupStatus
  229. if signupStatus == 1 {
  230. total, err := models.GetUserActivitySpecialTripCount(user.UserId, activityId)
  231. if err != nil {
  232. br.Msg = "获取信息失败"
  233. br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
  234. return
  235. }
  236. //流水记录表
  237. itemBill := new(models.CygxActivitySpecialTripBill)
  238. itemBill.UserId = user.UserId
  239. itemBill.ActivityId = activityInfo.ActivityId
  240. itemBill.CreateTime = time.Now()
  241. itemBill.Mobile = user.Mobile
  242. itemBill.Email = user.Email
  243. itemBill.CompanyId = user.CompanyId
  244. itemBill.CompanyName = user.CompanyName
  245. itemBill.RealName = user.RealName
  246. itemBill.Source = 1
  247. itemBill.DoType = 1
  248. itemBill.BillDetailed = -1 // 流水减一
  249. itemBill.RegisterPlatform = 1
  250. itemBill.ChartPermissionId = activityInfo.ChartPermissionId
  251. go services.ActivitySpecialUserRmind(user, activityId, 2)
  252. //判断是删除还是添加
  253. if total == 0 {
  254. //获取销售信息
  255. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  256. if err != nil {
  257. br.Msg = "操作失败"
  258. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  259. return
  260. }
  261. item := new(models.CygxActivitySpecialTrip)
  262. item.UserId = uid
  263. item.RealName = user.RealName
  264. item.ActivityId = activityId
  265. item.CreateTime = time.Now()
  266. item.Mobile = user.Mobile
  267. item.Email = user.Email
  268. item.CompanyId = user.CompanyId
  269. item.CompanyName = user.CompanyName
  270. item.IsValid = 1
  271. if sellerItem != nil {
  272. item.SellerName = sellerItem.RealName
  273. }
  274. if user.OutboundMobile != "" {
  275. item.OutboundMobile = user.OutboundMobile
  276. if user.OutboundCountryCode == "" {
  277. item.CountryCode = "86"
  278. } else {
  279. item.CountryCode = user.OutboundCountryCode
  280. }
  281. } else {
  282. item.OutboundMobile = user.Mobile
  283. if user.CountryCode == "" {
  284. item.CountryCode = "86"
  285. } else {
  286. item.CountryCode = user.CountryCode
  287. }
  288. }
  289. err = models.AddCygxActivitySpecialTrip(item)
  290. if err != nil {
  291. br.Msg = "操作失败"
  292. br.ErrMsg = "操作失败,Err:" + err.Error()
  293. return
  294. }
  295. //SignupStatus int `description:"返回状态:1:成功 、2 :人数已满 、3:调研次数已用完、 4:超时"`
  296. } else {
  297. updateParams := make(map[string]interface{})
  298. updateParams["IsValid"] = 1
  299. updateParams["CreateTime"] = time.Now()
  300. updateParams["IsCancel"] = 0
  301. whereParam := map[string]interface{}{"user_id": user.UserId, "activity_id": activityId}
  302. err = models.UpdateByExpr(models.CygxActivitySpecialTrip{}, whereParam, updateParams)
  303. if err != nil {
  304. br.Msg = "报名失败,"
  305. br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
  306. return
  307. }
  308. resultTime := utils.StrTimeToTime(activityInfo.ActivityTime)
  309. //48小时之内的取消也扣除一次参会记录
  310. if time.Now().Add(+time.Hour * 48).After(resultTime) {
  311. itemBill.BillDetailed = 0 //48小时之内,取消报名之后二次报名,不扣除流水记录
  312. }
  313. }
  314. go models.AddCygxActivitySpecialTripBill(itemBill)
  315. }
  316. } else {
  317. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
  318. if err != nil {
  319. br.Msg = "获取信息失败"
  320. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  321. return
  322. }
  323. resp.PopupMsg = popupMsg
  324. resp.HasPermission = hasPermission
  325. resp.SellerName = sellerName
  326. resp.SellerMobile = sellerMobile
  327. }
  328. resp.ActivityId = activityId
  329. br.Ret = 200
  330. br.Success = true
  331. br.Msg = "操作成功"
  332. br.Data = resp
  333. }
  334. // @Title 取消报名
  335. // @Description 取消报名
  336. // @Param request body models.ActivityIdRep true "type json string"
  337. // @Success Ret=200 {object} models.SignupStatus
  338. // @router /trip/cancel [post]
  339. func (this *ActivitySpecialController) Tripcancel() {
  340. br := new(models.BaseResponse).Init()
  341. defer func() {
  342. this.Data["json"] = br
  343. this.ServeJSON()
  344. }()
  345. user := this.User
  346. if user == nil {
  347. br.Msg = "请登录"
  348. br.ErrMsg = "请登录,用户信息为空"
  349. br.Ret = 408
  350. return
  351. }
  352. uid := user.UserId
  353. var req models.ActivityIdRep
  354. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  355. if err != nil {
  356. br.Msg = "参数解析异常!"
  357. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  358. return
  359. }
  360. activityId := req.ActivityId
  361. activityInfo, errInfo := models.GetCygxActivitySpecialDetailById(uid, activityId)
  362. if activityInfo == nil {
  363. br.Msg = "操作失败"
  364. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  365. return
  366. }
  367. if errInfo != nil {
  368. br.Msg = "操作失败"
  369. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  370. return
  371. }
  372. //流水记录表
  373. itemBill := new(models.CygxActivitySpecialTripBill)
  374. itemBill.UserId = user.UserId
  375. itemBill.ActivityId = activityInfo.ActivityId
  376. itemBill.CreateTime = time.Now()
  377. itemBill.Mobile = user.Mobile
  378. itemBill.Email = user.Email
  379. itemBill.CompanyId = user.CompanyId
  380. itemBill.CompanyName = user.CompanyName
  381. itemBill.RealName = user.RealName
  382. itemBill.Source = 1
  383. itemBill.DoType = 2
  384. itemBill.BillDetailed = 1 // 流水加一
  385. itemBill.RegisterPlatform = 1
  386. itemBill.ChartPermissionId = activityInfo.ChartPermissionId
  387. resultTime := utils.StrTimeToTime(activityInfo.ActivityTime)
  388. //48小时之内的取消也扣除一次参会记录
  389. var isValid int
  390. if time.Now().Add(+time.Hour * 48).After(resultTime) {
  391. isValid = 1
  392. itemBill.BillDetailed = 0 //48小时之内取消的活动扣点不返回
  393. }
  394. err = models.CancelActivitySpecialTripIsValid(isValid, activityInfo.ActivityId, uid)
  395. if err != nil {
  396. br.Msg = "操作失败"
  397. br.ErrMsg = "CancelActivitySpecialTrip,Err:" + err.Error()
  398. return
  399. }
  400. go models.AddCygxActivitySpecialTripBill(itemBill)
  401. br.Ret = 200
  402. br.Success = true
  403. br.Msg = "已取消"
  404. }
  405. // @Title 感兴趣、不感兴趣
  406. // @Description 感兴趣、不感兴趣接口
  407. // @Param request body models.ActivityIdRep true "type json string"
  408. // @Success Ret=200 {object} models.SignupSpecialStatus
  409. // @router /signup/add [post]
  410. func (this *ActivitySpecialController) SpecialSignupAdd() {
  411. br := new(models.BaseResponse).Init()
  412. defer func() {
  413. this.Data["json"] = br
  414. this.ServeJSON()
  415. }()
  416. user := this.User
  417. if user == nil {
  418. br.Msg = "请登录"
  419. br.ErrMsg = "请登录,用户信息为空"
  420. br.Ret = 408
  421. return
  422. }
  423. uid := user.UserId
  424. var req models.ActivityIdRep
  425. resp := new(models.SignupSpecialStatus)
  426. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  427. if err != nil {
  428. br.Msg = "参数解析异常!"
  429. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  430. return
  431. }
  432. activityId := req.ActivityId
  433. activityInfo, errInfo := models.GetCygxActivitySpecialDetail(activityId)
  434. if activityInfo == nil {
  435. br.Msg = "操作失败"
  436. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  437. return
  438. }
  439. if errInfo != nil {
  440. br.Msg = "操作失败"
  441. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  442. return
  443. }
  444. havePower, err := services.GetSpecialDetailUserPower(user, activityInfo)
  445. if err != nil {
  446. br.Msg = "获取信息失败"
  447. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  448. return
  449. }
  450. //判断有没有对应的权限,如果没有则给出对应的状态码
  451. if havePower {
  452. resp.HasPermission = 1
  453. total, err := models.GetUserCygxActivitySpecialSignup(user.UserId, activityId)
  454. if err != nil {
  455. br.Msg = "获取信息失败"
  456. br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
  457. return
  458. }
  459. resp.SignupStatus = 1
  460. //判断是删除还是添加
  461. if total == 0 {
  462. //获取销售信息
  463. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  464. if err != nil {
  465. br.Msg = "操作失败"
  466. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  467. return
  468. }
  469. item := new(models.CygxActivitySpecialSignup)
  470. item.RegisterPlatform = utils.REGISTER_PLATFORM
  471. item.UserId = uid
  472. item.RealName = user.RealName
  473. item.ActivityId = activityId
  474. item.CreateTime = time.Now()
  475. item.Mobile = user.Mobile
  476. item.Email = user.Email
  477. item.CompanyId = user.CompanyId
  478. item.CompanyName = user.CompanyName
  479. if sellerItem != nil {
  480. item.SellerName = sellerItem.RealName
  481. }
  482. err = models.AddCygxActivitySpecialSignup(item)
  483. if err != nil {
  484. br.Msg = "操作失败"
  485. br.ErrMsg = "操作失败,Err:" + err.Error()
  486. return
  487. }
  488. resp.Status = 1
  489. resp.PopupMsg = "感谢反馈"
  490. resp.PopupMsg2 = "此调研具体行程尚未确认,待预报名人数满10人后弘则会确定行程并推送给您活动日期,只有在确认行程中再次报名才完成占位。"
  491. //给所属销售发送消息
  492. //if sellerItem.Mobile != "" {
  493. // openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
  494. // if openIpItem != nil && openIpItem.OpenId != "" {
  495. // if sellerItem != nil {
  496. // //go services.SendSpecialTemplateMsg(user.RealName+"【"+user.CompanyName+"】", time.Now().Format(utils.FormatDateTime), user.Mobile, activityInfo.ResearchTheme, "sale", openIpItem)
  497. // }
  498. // }
  499. //}
  500. // 给芳姐发消息
  501. actList, _ := models.GetActivityListSpecialByActivityId(activityId)
  502. if len(actList) == 10 {
  503. go services.SendWxMsgActivitySpecial10(activityInfo)
  504. }
  505. //用户专项调研操作行为,模板消息推送
  506. //go services.SpecialActivityUserRemind(user, activityInfo, 1)
  507. } else {
  508. err = models.DeleteCygxActivitySpecialSignup(user.UserId, activityId)
  509. if err != nil {
  510. br.Msg = "操作失败"
  511. br.ErrMsg = "操作失败,Err:" + err.Error()
  512. return
  513. }
  514. resp.Status = 2
  515. }
  516. } else {
  517. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
  518. if err != nil {
  519. br.Msg = "获取信息失败"
  520. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  521. return
  522. }
  523. resp.PopupMsg = popupMsg
  524. resp.HasPermission = hasPermission
  525. resp.SellerName = sellerName
  526. resp.SellerMobile = sellerMobile
  527. }
  528. br.Ret = 200
  529. br.Success = true
  530. br.Msg = "操作成功"
  531. br.Data = resp
  532. }
  533. // @Title 新调研通知取消跟添加
  534. // @Description 新调研通知取消跟添加接口
  535. // @Param request body models.ArticleCollectResp true "type json string"
  536. // @Success 200
  537. // @router /follow [post]
  538. func (this *ActivitySpecialController) SpecialMsg() {
  539. br := new(models.BaseResponse).Init()
  540. defer func() {
  541. this.Data["json"] = br
  542. this.ServeJSON()
  543. }()
  544. user := this.User
  545. if user == nil {
  546. br.Msg = "请重新登录"
  547. br.Ret = 408
  548. return
  549. }
  550. resp := new(models.ArticleCollectResp)
  551. count, err := models.GetCygxUserFollowSpecial(user.UserId)
  552. if err != nil {
  553. br.Msg = "获取数据失败!"
  554. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  555. return
  556. }
  557. if count == 0 {
  558. item := new(models.CygxUserFollowSpecial)
  559. item.UserId = user.UserId
  560. item.RealName = user.RealName
  561. item.CreateTime = time.Now()
  562. item.Mobile = user.Mobile
  563. item.Email = user.Email
  564. item.CompanyId = user.CompanyId
  565. item.CompanyName = user.CompanyName
  566. item.CreateTime = time.Now()
  567. err := models.AddUserFollowSpecial(item)
  568. if err != nil {
  569. br.Msg = "操作失败!"
  570. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  571. return
  572. }
  573. resp.Status = 1
  574. } else {
  575. err := models.DeleteCygxUserFollowSpecial(user.UserId)
  576. if err != nil {
  577. br.Msg = "操作失败!"
  578. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  579. return
  580. }
  581. resp.Status = 2
  582. }
  583. br.Ret = 200
  584. br.Data = resp
  585. br.Success = true
  586. br.Msg = "操作成功!"
  587. }