user.go 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "github.com/rdlucklib/rdluck_tools/paging"
  6. "hongze/hongze_web_mfyx/models"
  7. "hongze/hongze_web_mfyx/services"
  8. "hongze/hongze_web_mfyx/utils"
  9. "sort"
  10. "strconv"
  11. "strings"
  12. "time"
  13. )
  14. type UserController struct {
  15. BaseAuthController
  16. }
  17. type UserCommonController struct {
  18. BaseCommonController
  19. }
  20. // @Title 登录
  21. // @Description 登录接口
  22. // @Param request body models.LoginReq true "type json string"
  23. // @Success 200 {object} models.LoginResp
  24. // @router /login [post]
  25. func (this *UserCommonController) Login() {
  26. br := new(models.BaseResponse).Init()
  27. defer func() {
  28. this.Data["json"] = br
  29. this.ServeJSON()
  30. }()
  31. var token string
  32. var req models.LoginReq
  33. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  34. if err != nil {
  35. br.Msg = "参数解析异常!"
  36. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  37. return
  38. }
  39. mobile := req.Mobile
  40. req.Mobile = strings.Trim(req.Mobile, " ")
  41. if req.Mobile == "" {
  42. br.Msg = "参数错误"
  43. br.ErrMsg = "参数错误,手机号为空"
  44. return
  45. }
  46. code := req.VCode
  47. if code == "" {
  48. br.Msg = "参数错误"
  49. br.ErrMsg = "Code 为空"
  50. return
  51. }
  52. authorization := req.Token
  53. inviteShareCode := req.InviteShareCode
  54. item, err := models.GetMsgCode(req.Mobile, req.VCode)
  55. if err != nil {
  56. if err.Error() == utils.ErrNoRow() {
  57. br.Msg = "验证码错误,请重新输入"
  58. br.ErrMsg = "校验验证码失败,Err:" + err.Error()
  59. return
  60. } else {
  61. br.Msg = "验证码错误,请重新输入"
  62. br.ErrMsg = "校验验证码失败,Err:" + err.Error()
  63. return
  64. }
  65. }
  66. if item == nil {
  67. br.Msg = "验证码错误,请重新输入"
  68. return
  69. }
  70. user, err := services.BindWxUser(mobile, "86", inviteShareCode)
  71. //user, err := models.GetWxUserItemByMobile(mobile)
  72. if err != nil {
  73. br.Msg = "登录失败"
  74. br.ErrMsg = "获取用户信息失败,GetUserDetailByMobile Err:" + err.Error()
  75. return
  76. }
  77. if authorization != "" {
  78. session, err := models.GetSessionByToken(authorization)
  79. if err != nil {
  80. br.Msg = "登录失败"
  81. br.ErrMsg = "绑定失败,GetSessionByToken err:" + err.Error()
  82. return
  83. }
  84. openid := session.OpenId
  85. if openid == "" {
  86. br.Msg = "登录失败"
  87. br.ErrMsg = "获取用户信息失败,绑定用户openid失败,OpenId不能为空 "
  88. return
  89. }
  90. err = models.BindSessionMobile(mobile, authorization)
  91. if err != nil {
  92. br.Msg = "登录失败"
  93. br.ErrMsg = "获取用户信息失败,BindSessionMobile Err:" + err.Error()
  94. return
  95. }
  96. err = models.BindUserRecordByOpenid(user.UserId, openid, mobile)
  97. if err != nil {
  98. br.Msg = "登录失败"
  99. br.ErrMsg = "获取用户信息失败,BindUserRecordByOpenid Err:" + err.Error()
  100. return
  101. }
  102. token = authorization
  103. } else {
  104. timeUnix := time.Now().Unix()
  105. timeUnixStr := strconv.FormatInt(timeUnix, 10)
  106. token = utils.MD5(mobile) + utils.MD5(timeUnixStr)
  107. itemsSession := new(models.CygxMfyxWebSession)
  108. itemsSession.UserId = user.UserId
  109. itemsSession.Mobile = mobile
  110. itemsSession.AccessToken = token
  111. itemsSession.CreatedTime = time.Now()
  112. itemsSession.LastUpdatedTime = time.Now()
  113. itemsSession.ExpireTime = time.Now().AddDate(0, 3, 0)
  114. err = models.AddCygxMfyxWebSession(itemsSession)
  115. if err != nil {
  116. br.Msg = "获取用户信息失败"
  117. br.ErrMsg = "添加Token失败,Err:" + err.Error()
  118. return
  119. }
  120. }
  121. {
  122. services.AddInviteCompany(user) //记录通过三方合作机构过来的公司
  123. }
  124. resp := new(models.LoginResp)
  125. resp.UserId = user.UserId
  126. resp.Headimgurl = user.Headimgurl
  127. resp.Mobile = user.Mobile
  128. resp.Email = user.Email
  129. resp.CompanyName = user.CompanyName
  130. resp.Authorization = token
  131. br.Ret = 200
  132. br.Success = true
  133. br.Msg = "获取成功"
  134. br.Data = resp
  135. }
  136. // @Title 获取用户详情
  137. // @Description 获取用户详情接口
  138. // @Success 200 {object} models.UserDetailResp
  139. // @router /detail [get]
  140. func (this *UserController) Detail() {
  141. br := new(models.BaseResponse).Init()
  142. defer func() {
  143. this.Data["json"] = br
  144. this.ServeJSON()
  145. }()
  146. user := this.User
  147. if user == nil {
  148. br.Msg = "请登录"
  149. br.ErrMsg = "请登录,用户信息为空"
  150. br.Ret = 408
  151. return
  152. }
  153. resp := new(models.UserDetailResp)
  154. resp.UserId = user.UserId
  155. resp.UserName = user.RealName
  156. resp.Headimgurl = user.Headimgurl
  157. resp.Mobile = user.Mobile
  158. resp.Email = user.Email
  159. resp.CompanyName = user.CompanyName
  160. userDetail, err := models.GetUserDetailByUserId(user.UserId)
  161. if err != nil {
  162. br.Msg = "获取用户信息失败"
  163. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  164. return
  165. }
  166. if userDetail.Mobile != "" {
  167. resp.InviteShareCode = services.GetInviteShareCode(userDetail.Mobile) //判断用户是否属于销售,并且获取对应加密的分享码
  168. }
  169. resp.OutboundCountryCode = userDetail.OutboundCountryCode
  170. resp.OutboundMobile = userDetail.OutboundMobile
  171. var hasPermission int
  172. if user.CompanyId > 1 {
  173. companyItem, err := models.GetCompanyDetailById(user.CompanyId)
  174. if err != nil && err.Error() != utils.ErrNoRow() {
  175. br.Msg = "获取信息失败"
  176. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  177. return
  178. }
  179. if companyItem != nil && companyItem.CompanyId > 0 {
  180. resp.CompanyName = companyItem.CompanyName
  181. // 获取用户所在公司剩余的点
  182. companyPointsNum, err := models.GetCompanyPoints(user.CompanyId)
  183. if err != nil && err.Error() != utils.ErrNoRow() {
  184. br.Msg = "获取信息失败"
  185. br.ErrMsg = "获取用户所在公司剩余的点失败,Err:" + err.Error()
  186. return
  187. }
  188. resp.CompanyPointsNum = companyPointsNum
  189. userYanxunaDetail, err := models.GetCygxUserYanxuanPermissionDetailByUserId(user.UserId)
  190. if err != nil && err.Error() != utils.ErrNoRow() {
  191. br.Msg = "获取信息失败"
  192. br.ErrMsg = "获取信息失败,GetCygxUserYanxuanPermissionDetailByUserId Err:" + err.Error()
  193. return
  194. }
  195. if userYanxunaDetail != nil {
  196. resp.PermissionStatus = userYanxunaDetail.Status
  197. resp.StartDate = userYanxunaDetail.StartDate
  198. resp.EndDate = userYanxunaDetail.EndDate
  199. hasPermission = 1
  200. //resp.PermissionName = utils.CHART_PERMISSION_NAME_MF_YANXUAN
  201. } else {
  202. //查询研选的权限状态
  203. var condition string
  204. var pars []interface{}
  205. condition += " AND company_id = ? AND status IN ('正式','试用') AND chart_permission_id IN (31,52) "
  206. pars = append(pars, user.CompanyId)
  207. companyReportPermissionDetail, err := models.GetCompanyReportPermissionDetailByCondition(condition, pars)
  208. if err != nil && err.Error() != utils.ErrNoRow() {
  209. br.Msg = "获取信息失败"
  210. br.ErrMsg = "获取用户所在公司剩余的点失败,Err:" + err.Error()
  211. return
  212. }
  213. companyReportPermissionList, err := models.GetCompanyReportPermissionList(condition, pars)
  214. if err != nil && err.Error() != utils.ErrNoRow() {
  215. br.Msg = "获取信息失败"
  216. br.ErrMsg = "获取用户所在公司剩余的点失败,Err:" + err.Error()
  217. return
  218. }
  219. companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
  220. if err != nil && err.Error() != utils.ErrNoRow() {
  221. br.Msg = "获取信息失败"
  222. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  223. return
  224. }
  225. var isSuspend int
  226. if companyProduct == nil {
  227. isSuspend = 1
  228. } else {
  229. isSuspend = companyProduct.IsSuspend
  230. }
  231. if companyReportPermissionDetail == nil || isSuspend == 1 {
  232. //hasPermission = 1
  233. hasPermission, err = services.GetUserDetailPermissionCode(user.UserId, user.CompanyId)
  234. if err != nil && err.Error() != utils.ErrNoRow() {
  235. br.Msg = "获取信息失败"
  236. br.ErrMsg = "获取信息失败,GetUserDetailPermissionCode Err:" + err.Error()
  237. return
  238. }
  239. } else {
  240. hasPermission = 1
  241. //有研选订阅或研选扣点包任意一项试用权限,即为试用客户,期限显示两项合并之后的最长时间
  242. minDate := time.Now()
  243. maxDate := time.Now()
  244. var permissionStatus string
  245. for _, v := range companyReportPermissionList {
  246. if utils.StrDateToDate(v.StartDate).Before(minDate) {
  247. minDate = utils.StrDateToDate(v.StartDate)
  248. }
  249. if utils.StrDateToDate(v.EndDate).After(maxDate) {
  250. maxDate = utils.StrDateToDate(v.EndDate)
  251. }
  252. if permissionStatus != "正式" {
  253. permissionStatus = v.Status
  254. }
  255. }
  256. resp.PermissionStatus = companyReportPermissionDetail.Status
  257. resp.StartDate = companyReportPermissionDetail.StartDate
  258. resp.EndDate = companyReportPermissionDetail.EndDate
  259. }
  260. }
  261. }
  262. } else {
  263. userYanxunaDetail, err := models.GetCygxUserYanxuanPermissionDetailByUserId(user.UserId)
  264. if err != nil && err.Error() != utils.ErrNoRow() {
  265. br.Msg = "获取信息失败"
  266. br.ErrMsg = "获取信息失败,GetCygxUserYanxuanPermissionDetailByUserId Err:" + err.Error()
  267. return
  268. }
  269. if userYanxunaDetail != nil {
  270. if !utils.InArrayByStr(resp.PermissionName, utils.CHART_PERMISSION_NAME_MF_YANXUAN) {
  271. resp.PermissionName = append(resp.PermissionName, utils.CHART_PERMISSION_NAME_MF_YANXUAN)
  272. }
  273. resp.PermissionStatus = userYanxunaDetail.Status
  274. resp.StartDate = userYanxunaDetail.StartDate
  275. resp.EndDate = userYanxunaDetail.EndDate
  276. hasPermission = 1
  277. } else {
  278. hasPermission, err = services.GetUserDetailPermissionCode(user.UserId, user.CompanyId)
  279. if err != nil && err.Error() != utils.ErrNoRow() {
  280. br.Msg = "获取信息失败"
  281. br.ErrMsg = "获取信息失败,GetUserDetailPermissionCode Err:" + err.Error()
  282. return
  283. }
  284. }
  285. }
  286. if resp.Headimgurl == "" {
  287. resp.Headimgurl = utils.DefaultHeadimgurl
  288. }
  289. specialAuthorCheck := services.GetYanxuanSpecialAuthorInfo(user) //用户是否没开通研选专栏以及,专栏信息是否完善
  290. resp.IsAuthor = specialAuthorCheck.IsAuthor
  291. resp.SpecialColumnId = specialAuthorCheck.SpecialColumnId
  292. resp.IsImproveInformation = specialAuthorCheck.IsImproveInformation
  293. resp.HasPermission = hasPermission
  294. br.Ret = 200
  295. br.Success = true
  296. br.Msg = "获取成功"
  297. br.Data = resp
  298. }
  299. // @Title 未付费申请试用
  300. // @Description 未付费申请试用
  301. // @Param request body models.ApplyTryReq true "type json string"
  302. // @Success 200
  303. // @router /apply/try [post]
  304. func (this *UserController) ApplyTryOut() {
  305. br := new(models.BaseResponse).Init()
  306. defer func() {
  307. this.Data["json"] = br
  308. this.ServeJSON()
  309. }()
  310. user := this.User
  311. if user == nil {
  312. br.Msg = "请登录"
  313. br.ErrMsg = "请登录,SysUser Is Empty"
  314. br.Ret = 408
  315. return
  316. }
  317. mobile := user.Mobile
  318. var req models.ApplyTryReq
  319. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  320. if err != nil {
  321. br.Msg = "参数解析异常!"
  322. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  323. return
  324. }
  325. if req.RealName == "" {
  326. req.RealName = user.RealName
  327. }
  328. if req.CompanyName == "" {
  329. req.CompanyName = user.CompanyName
  330. }
  331. uid := user.UserId
  332. var title string
  333. var sourceId int
  334. var source string
  335. tryType := req.TryType
  336. detailId := req.DetailId
  337. sourceId = detailId
  338. source = tryType
  339. var isResearch bool // 是否属于研选
  340. redirectUrl := ""
  341. if tryType == "Article" {
  342. detail, err := models.GetArticleDetailById(detailId)
  343. if err != nil {
  344. br.Msg = "获取信息失败"
  345. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  346. return
  347. }
  348. title = detail.Title
  349. if detail.ArticleTypeId > 0 {
  350. isResearch = true
  351. }
  352. redirectUrl = utils.WX_MSG_PATH_YX_ARTICLE_DETAIL + strconv.Itoa(detailId)
  353. } else if tryType == "Activity" {
  354. detail, err := models.GetAddActivityInfoById(detailId)
  355. if err != nil {
  356. br.Msg = "操作失败"
  357. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(detailId)
  358. return
  359. }
  360. title = detail.ActivityName
  361. if strings.Contains(detail.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  362. isResearch = true
  363. }
  364. redirectUrl = utils.WX_MSG_PATH_YX_ACTIVITY_DETAIL + strconv.Itoa(detailId)
  365. } else if tryType == "MicroAudio" {
  366. // 微路演音频
  367. microAudio, e := models.GetCygxActivityVoiceById(detailId)
  368. if e != nil {
  369. br.Msg = "操作失败"
  370. br.ErrMsg = "微路演音频信息有误, 不存在的VoiceId: " + strconv.Itoa(detailId)
  371. return
  372. }
  373. title = microAudio.VoiceName
  374. sourceId = microAudio.ActivityId
  375. source = "activityvoice"
  376. } else if tryType == "ActivityVideo" {
  377. // 活动视频
  378. activityVideo, e := models.GetCygxActivityVideoById(detailId)
  379. if e != nil {
  380. br.Msg = "操作失败"
  381. br.ErrMsg = "微路演音频信息有误, 不存在的VoiceId: " + strconv.Itoa(detailId)
  382. return
  383. }
  384. title = activityVideo.Title
  385. sourceId = activityVideo.ActivityId
  386. source = "activityvideo"
  387. } else if tryType == "MicroVideo" {
  388. // 微路演视频
  389. microVideo, e := models.GetMicroRoadshowVideoById(detailId)
  390. if e != nil {
  391. br.Msg = "操作失败"
  392. br.ErrMsg = "微路演视频信息有误, 不存在的VideoId: " + strconv.Itoa(detailId)
  393. return
  394. }
  395. title = microVideo.VideoName
  396. source = "roadshow"
  397. } else if tryType == "Researchsummary" {
  398. // 本周研究汇总
  399. ResearchSummaryInfo, e := models.GetCygxResearchSummaryInfoById(detailId)
  400. if e != nil {
  401. br.Msg = "操作失败"
  402. br.ErrMsg = "本周研究汇总信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
  403. return
  404. }
  405. title = ResearchSummaryInfo.Title
  406. source = "researchsummary"
  407. } else if tryType == "Minutessummary" {
  408. // 上周纪要汇总
  409. MinutesSummaryInfo, e := models.GetCygxMinutesSummaryInfoById(detailId)
  410. if e != nil {
  411. br.Msg = "操作失败"
  412. br.ErrMsg = "上周纪要汇总信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
  413. return
  414. }
  415. title = MinutesSummaryInfo.Title
  416. source = "minutessummary"
  417. } else if tryType == "ReportSelection" {
  418. // 报告精选
  419. ReportSelectionInfo, e := models.GetCygxReportSelectionInfoById(detailId)
  420. if e != nil {
  421. br.Msg = "操作失败"
  422. br.ErrMsg = "报告精选信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
  423. return
  424. }
  425. title = ReportSelectionInfo.Title
  426. source = "reportselection"
  427. } else if tryType == "ProductInterior" {
  428. // 产品内测
  429. ProductInteriorDetail, e := models.GetCygxProductInteriorDetail(detailId)
  430. if e != nil {
  431. br.Msg = "操作失败"
  432. br.ErrMsg = "产品内测信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
  433. return
  434. }
  435. title = ProductInteriorDetail.Title
  436. source = "productinterior"
  437. } else if tryType == "YanxuanSpecial" {
  438. // 研选专栏
  439. YanxuanSpecialBySpeciaDetail, e := models.GetYanxuanSpecialBySpecialId(detailId)
  440. if e != nil {
  441. br.Msg = "操作失败"
  442. br.ErrMsg = "产品内测信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
  443. return
  444. }
  445. title = YanxuanSpecialBySpeciaDetail.Title
  446. source = "yanxuanspecial"
  447. isResearch = true
  448. }
  449. //缓存校验
  450. cacheKey := fmt.Sprint("xygx:apply_record:add:", uid)
  451. ttlTime := utils.Rc.GetRedisTTL(cacheKey)
  452. if ttlTime > 0 {
  453. br.Msg = "申请失败,申请过于频繁"
  454. br.ErrMsg = "申请失败,申请过于频繁"
  455. return
  456. }
  457. utils.Rc.SetNX(cacheKey, user.Mobile, time.Second*10)
  458. //判断是否已经申请过
  459. applyCount, err := models.GetApplyRecordCount(uid)
  460. if err != nil && err.Error() != utils.ErrNoRow() {
  461. br.Msg = "获取信息失败"
  462. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  463. return
  464. }
  465. if applyCount > 0 {
  466. br.Msg = "您已提交申请,请耐心等待。"
  467. br.IsSendEmail = false
  468. return
  469. }
  470. //判断是否存在申请
  471. var sellerMobile string
  472. if req.ApplyMethod == 2 {
  473. if req.BusinessCardUrl == "" {
  474. br.Msg = "请上传名片"
  475. return
  476. }
  477. if req.RealName == "" {
  478. br.Msg = "请输入姓名"
  479. return
  480. }
  481. if req.CompanyName == "" {
  482. br.Msg = "请输入公司名称"
  483. return
  484. }
  485. if req.BusinessCardUrl != "" && utils.RunMode == "release" {
  486. card, err := services.GetBusinessCard(req.BusinessCardUrl)
  487. if err != nil {
  488. br.Msg = "名片识别失败"
  489. br.ErrMsg = "名片识别失败,Err:" + err.Error()
  490. return
  491. }
  492. mobileStr := strings.Join(card.WordsResult.MOBILE, ",")
  493. isFlag := true
  494. if mobile != "" {
  495. if strings.Contains(mobileStr, mobile) || mobileStr == "" {
  496. isFlag = true
  497. } else {
  498. isFlag = false
  499. }
  500. }
  501. if !isFlag {
  502. //阿里云识别
  503. if utils.RunMode == "release" {
  504. aliyunResult, err := services.AliyunBusinessCard(req.BusinessCardUrl)
  505. if err != nil {
  506. br.Msg = "识别失败"
  507. br.ErrMsg = "识别失败,Err:" + err.Error()
  508. return
  509. }
  510. if !aliyunResult.Success {
  511. br.Msg = "识别失败"
  512. br.ErrMsg = "识别失败"
  513. return
  514. }
  515. mobileStr := strings.Join(aliyunResult.TelCell, ",")
  516. if mobile != "" {
  517. if strings.Contains(mobileStr, mobile) {
  518. isFlag = true
  519. } else {
  520. isFlag = false
  521. }
  522. }
  523. }
  524. }
  525. if !isFlag {
  526. br.Msg = "名片手机号与所填手机号不匹配,请重新填写"
  527. br.ErrMsg = "mobile:" + mobile
  528. return
  529. }
  530. }
  531. }
  532. //获取销售信息
  533. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  534. if err != nil && err.Error() != utils.ErrNoRow() {
  535. br.Msg = "申请失败"
  536. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  537. return
  538. }
  539. if sellerItem != nil {
  540. sellerMobile = sellerItem.Mobile
  541. //推送模板消息
  542. mobile := user.Mobile
  543. if mobile == "" {
  544. mobile = user.Email
  545. }
  546. }
  547. //用户状态,1:潜在客户 、2:现有客户 、3:FICC客户 、4:现有客户(正式,无对应权限) 、5:现有客户(试用,无对应权限) 、6:现有客户(试用暂停) 、7:现有客户(冻结) 、8:现有客户(流失)、9:永续客户(流失)?
  548. CompanyIdType := 1
  549. applyMethod := ""
  550. categoryApplyMethod := ""
  551. if sellerItem != nil {
  552. companyItem, err := models.GetCompanyDetailById(user.CompanyId)
  553. if err != nil && err.Error() != utils.ErrNoRow() {
  554. br.Msg = "获取信息失败"
  555. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  556. return
  557. }
  558. if companyItem != nil && companyItem.CompanyId > 0 {
  559. companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
  560. if err != nil && err.Error() != utils.ErrNoRow() {
  561. br.Msg = "获取信息失败"
  562. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  563. return
  564. }
  565. if companyProduct != nil && companyProduct.IsSuspend == 1 {
  566. CompanyIdType = 6
  567. } else {
  568. switch companyItem.Status {
  569. case "正式":
  570. CompanyIdType = 4
  571. case "试用":
  572. CompanyIdType = 5
  573. case "冻结":
  574. CompanyIdType = 7
  575. categoryApplyMethod = "冻结客户"
  576. case "流失":
  577. CompanyIdType = 8
  578. categoryApplyMethod = "流失客户"
  579. case "永续":
  580. CompanyIdType = 9
  581. }
  582. }
  583. applyMethod = companyItem.Status + "客户申请"
  584. if detailId > 0 {
  585. if companyProduct != nil && companyProduct.IsSuspend == 1 {
  586. applyMethod = "试用暂停客户"
  587. categoryApplyMethod = "试用暂停客户"
  588. } else {
  589. if companyItem.Status == "正式" || companyItem.Status == "试用" {
  590. applyMethod = companyItem.Status + "客户申请,无对应权限"
  591. categoryApplyMethod = companyItem.Status + "客户无对应权限"
  592. } else if companyItem.Status == "冻结" || companyItem.Status == "流失" {
  593. applyMethod = companyItem.Status + "客户"
  594. }
  595. }
  596. applyMethod = applyMethod + "," + title
  597. }
  598. openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
  599. if openIpItem != nil && openIpItem.OpenId != "" {
  600. if req.ApplyMethod != 2 {
  601. req.RealName = user.RealName
  602. req.CompanyName = user.CompanyName
  603. }
  604. //go services.SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, mobile, applyMethod, openIpItem)
  605. }
  606. }
  607. } else {
  608. //获取销售信息
  609. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
  610. if err != nil && err.Error() != utils.ErrNoRow() {
  611. br.Msg = "申请失败"
  612. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  613. return
  614. }
  615. if sellerItem != nil {
  616. CompanyIdType = 3
  617. applyMethod = "FICC客户"
  618. categoryApplyMethod = "FICC客户"
  619. } else {
  620. CompanyIdType = 1
  621. applyMethod = "潜在客户"
  622. categoryApplyMethod = "潜在客户"
  623. }
  624. if detailId > 0 {
  625. applyMethod = applyMethod + "," + title
  626. }
  627. }
  628. if categoryApplyMethod == "" {
  629. categoryApplyMethod = applyMethod
  630. }
  631. //openIpItem, _ := models.GetUserRecordByMobile(4, cnf.ConfigValue)
  632. //if openIpItem != nil && openIpItem.OpenId != "" {
  633. // if req.ApplyMethod != 2 {
  634. // req.RealName = user.RealName
  635. // req.CompanyName = user.CompanyName
  636. // }
  637. // utils.FileLog.Info("推送消息 %s %s,%s,%s,%s", req.RealName, req.CompanyName, mobile, openIpItem.OpenId, applyMethod)
  638. // go services.SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, mobile, applyMethod, openIpItem)
  639. //}
  640. //go services.SendPermissionApplyTemplateMsgAdmin(req, mobile, applyMethod, isResearch)
  641. item := new(models.CygxApplyRecord)
  642. item.UserId = user.UserId
  643. item.BusinessCardUrl = req.BusinessCardUrl
  644. item.RealName = req.RealName
  645. item.CompanyName = req.CompanyName
  646. item.Mobile = user.Mobile
  647. item.CreateTime = time.Now()
  648. item.ApplyMethod = req.ApplyMethod
  649. item.CompanyIdPay = user.CompanyId
  650. item.CompanyNamePay = user.CompanyName
  651. item.CompanyIdType = CompanyIdType
  652. if user.InviteCompany == utils.LUODING_CODE && user.CompanyId == 1 {
  653. //如果是潜在客户就标记来源
  654. item.InviteCompanySource = utils.REGISTER_PLATFORM
  655. }
  656. item.Title = title
  657. item.SourceId = sourceId
  658. item.Source = strings.ToLower(source)
  659. item.RegisterPlatform = utils.REGISTER_PLATFORM
  660. err = models.AddApplyRecord(item)
  661. if err != nil {
  662. br.Msg = "申请失败"
  663. br.ErrMsg = "申请失败,Err:" + err.Error()
  664. return
  665. }
  666. if sellerItem == nil {
  667. go services.SendPermissionApplyTemplateMsgAdmin(req, mobile, applyMethod, categoryApplyMethod, redirectUrl, isResearch)
  668. } else {
  669. openIpItem, _ := models.GetMfyxUserRecordByMobile(12, sellerItem.Mobile)
  670. if openIpItem != nil && openIpItem.OpenId != "" {
  671. //go services.SendPermissionApplyTemplateMsg(req.RealName, req.CompanyName, mobile, applyMethod, openIpItem)
  672. go services.SendPermissionApplyCategoryTemplateMsg(req.RealName, req.CompanyName, mobile, categoryApplyMethod, openIpItem, redirectUrl)
  673. }
  674. }
  675. //添加成功后,设置5分钟缓存,不允许重复添加
  676. //utils.Rc.SetNX(cacheKey, user.Mobile, time.Second*60)
  677. br.Msg = "申请成功!"
  678. br.Ret = 200
  679. br.Success = true
  680. br.Data = sellerMobile
  681. }
  682. // @Title 用户修改外呼手机号以及区号
  683. // @Description 用户修改外呼手机号以及区号接口
  684. // @Param request body models.OutboundMobileItem true "type json string"
  685. // @Success Ret=200 操作成功
  686. // @router /countryCcode/addOutboundMobile [POST]
  687. func (this *UserController) AddOutboundMobile() {
  688. br := new(models.BaseResponse).Init()
  689. defer func() {
  690. this.Data["json"] = br
  691. this.ServeJSON()
  692. }()
  693. user := this.User
  694. uid := user.UserId
  695. if user == nil {
  696. br.Msg = "请登录"
  697. br.ErrMsg = "请登录,用户信息为空"
  698. br.Ret = 408
  699. return
  700. }
  701. var req models.OutboundMobileItem
  702. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  703. if err != nil {
  704. br.Msg = "参数解析异常!"
  705. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  706. return
  707. }
  708. if req.OutboundMobile == "" {
  709. br.Msg = "请填写区号!"
  710. return
  711. }
  712. item := new(models.OutboundMobileItem)
  713. item.OutboundMobile = req.OutboundMobile
  714. item.OutboundCountryCode = req.OutboundCountryCode
  715. //item.ActivityId = req.ActivityId
  716. //if req.ActivityId == 0 {
  717. // err = models.AddOutboundMobile(item, uid)
  718. //} else {
  719. // if user.Mobile == "" && user.OutboundMobile == "" {
  720. // items := new(models.CygxActivitySignup)
  721. // items.UserId = uid
  722. // items.ActivityId = req.ActivityId
  723. // items.CreateTime = time.Now()
  724. // items.Mobile = user.Mobile
  725. // items.Email = user.Email
  726. // items.CompanyId = user.CompanyId
  727. // items.CompanyName = user.CompanyName
  728. // items.SignupType = 1
  729. // items.FailType = 0
  730. // items.DoFailType = 0
  731. // items.OutboundMobile = req.OutboundMobile
  732. // items.CountryCode = req.OutboundCountryCode
  733. // _, err = models.AddActivitySignupFromEmail(items)
  734. // } else {
  735. // total, err := models.GetActivityCountByIdWithUid(item.ActivityId, uid)
  736. // if total == 0 {
  737. // br.Msg = "报名信息不存在"
  738. // br.ErrMsg = "报名信息不存在,Err:" + "活动ActivityId:" + strconv.Itoa(item.ActivityId) + "用户Uid:" + strconv.Itoa(uid)
  739. // return
  740. // }
  741. // if err != nil {
  742. // br.Msg = "操作失败"
  743. // br.ErrMsg = "操作失败,Err:" + err.Error()
  744. // return
  745. // }
  746. // err = models.AddOutboundMobile(item, uid)
  747. // }
  748. //}
  749. err = models.AddOutboundMobile(item, uid)
  750. if err != nil {
  751. br.Msg = "操作失败"
  752. br.ErrMsg = "操作失败,Err:" + err.Error()
  753. return
  754. }
  755. br.Ret = 200
  756. br.Success = true
  757. br.Msg = "操作成功"
  758. }
  759. // @Title 校验用户状态信息
  760. // @Description 校验用户状态信息
  761. // @Success 200 {object} models.CheckStatusResp
  762. // @router /check/status [get]
  763. func (this *UserController) CheckLogin() {
  764. br := new(models.BaseResponse).Init()
  765. defer func() {
  766. this.Data["json"] = br
  767. this.ServeJSON()
  768. }()
  769. user := this.User
  770. if user == nil {
  771. br.Msg = "请登录"
  772. br.ErrMsg = "请登录"
  773. br.Ret = 408
  774. return
  775. }
  776. uid := user.UserId
  777. resp := new(models.CheckStatusResp)
  778. if uid > 0 {
  779. //判断token是否过期
  780. userRecord, err := models.GetUserSessionByUserId(uid)
  781. if err != nil {
  782. br.Msg = "获取用户信息失败"
  783. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  784. return
  785. }
  786. permissionStr, err := models.GetCompanyPermission(user.CompanyId)
  787. if err != nil {
  788. br.Msg = "获取信息失败"
  789. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  790. return
  791. }
  792. resp.PermissionName = permissionStr
  793. if user.Mobile == "" && user.Email == "" {
  794. resp.IsBind = true
  795. }
  796. if userRecord.UnionId == "" {
  797. resp.IsAuth = true
  798. }
  799. } else {
  800. resp.IsBind = true
  801. if user.UnionId == "" {
  802. resp.IsAuth = true
  803. }
  804. resp.PermissionName = ""
  805. }
  806. br.Success = true
  807. br.Msg = "获取成功"
  808. br.Data = resp
  809. br.Ret = 200
  810. }
  811. // @Title 更改用户微信头像
  812. // @Description 更改用户微信头像
  813. // @Param request body models.Headimgurl true "type json string"
  814. // @Success 200 {object} models.ArticleDetailFileLink
  815. // @router /headimgurl/update [post]
  816. func (this *UserController) HeadimgurlUpdate() {
  817. br := new(models.BaseResponse).Init()
  818. defer func() {
  819. this.Data["json"] = br
  820. this.ServeJSON()
  821. }()
  822. user := this.User
  823. if user == nil {
  824. br.Msg = "请登录"
  825. br.ErrMsg = "请登录,用户信息为空"
  826. br.Ret = 408
  827. return
  828. }
  829. var req models.Headimgurl
  830. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  831. if err != nil {
  832. br.Msg = "参数解析异常!"
  833. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  834. return
  835. }
  836. uid := user.UserId
  837. headimgurl := req.Headimgurl
  838. if headimgurl == "" {
  839. br.Msg = "操作失败"
  840. br.ErrMsg = "头像信息不能为空"
  841. return
  842. }
  843. err = models.UpdateUserHeadimgurl(headimgurl, uid)
  844. if err != nil {
  845. br.Msg = "操作失败"
  846. br.ErrMsg = "头像信息不能为空"
  847. }
  848. br.Ret = 200
  849. br.Success = true
  850. br.Msg = "操作成功"
  851. }
  852. // @Title 获取我的收藏
  853. // @Description 获取我的收藏列表
  854. // @Param PageSize query int true "PageSize"
  855. // @Param CurrentIndex query int true "CurrentIndex"
  856. // @Success 200 {object} models.ArticleCollectListResp
  857. // @router /collect/list [get]
  858. func (this *UserController) CollectList() {
  859. br := new(models.BaseResponse).Init()
  860. defer func() {
  861. this.Data["json"] = br
  862. this.ServeJSON()
  863. }()
  864. user := this.User
  865. if user == nil {
  866. br.Msg = "请登录"
  867. br.ErrMsg = "请登录,用户信息为空"
  868. br.Ret = 408
  869. return
  870. }
  871. userId := this.User.UserId
  872. var pageSize, currentIndex, startSize int
  873. pageSize, _ = this.GetInt("PageSize")
  874. currentIndex, _ = this.GetInt("CurrentIndex")
  875. if pageSize <= 0 {
  876. pageSize = utils.PageSize20
  877. }
  878. if currentIndex <= 0 {
  879. currentIndex = 1
  880. }
  881. startSize = utils.StartIndex(currentIndex, pageSize)
  882. total, err := models.GetArticleUserCollectCount(userId)
  883. if err != nil {
  884. br.Msg = "获取数据失败"
  885. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  886. return
  887. }
  888. list, err := models.GetArticleUserCollectList(startSize, pageSize, userId)
  889. if err != nil {
  890. br.Msg = "获取数据失败"
  891. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  892. return
  893. }
  894. resp := new(models.ArticleReportBillboardLIstPageResp)
  895. if len(list) == 0 {
  896. page := paging.GetPaging(currentIndex, pageSize, total)
  897. resp.List = make([]*models.ArticleReportBillboardResp, 0)
  898. resp.Paging = page
  899. br.Msg = "获取成功!"
  900. br.Ret = 200
  901. br.Success = true
  902. br.Data = resp
  903. return
  904. }
  905. list, err = services.HandleArticleCategoryImg(list, user)
  906. if err != nil {
  907. br.Msg = "获取信息失败"
  908. br.ErrMsg = "HandleArticleCategoryImg,Err:" + err.Error()
  909. return
  910. }
  911. page := paging.GetPaging(currentIndex, pageSize, total)
  912. for _, v := range list {
  913. item := models.ArticleReportBillboardResp{
  914. ArticleId: v.ArticleId,
  915. ArticleTypeId: v.ArticleTypeId,
  916. Title: v.Title,
  917. PublishDate: v.PublishDate,
  918. DepartmentId: v.DepartmentId,
  919. NickName: v.NickName,
  920. IsCollect: v.IsCollect,
  921. Pv: v.Pv,
  922. CollectNum: v.CollectNum,
  923. ImgUrlPc: v.ImgUrlPc,
  924. LabelKeywordImgLink: v.LabelKeywordImgLink,
  925. List: v.List,
  926. SpecialColumnId: v.SpecialColumnId,
  927. }
  928. if v.IsSpecial == 1 {
  929. item.IsSpecial = true
  930. item.ImgUrlPc = utils.CYGX_YANXUAN_SPECIAL_IMG_PC
  931. if v.CompanyTags != "" {
  932. item.CompanyTags = strings.Split(v.CompanyTags, ",")
  933. } else {
  934. item.CompanyTags = []string{}
  935. }
  936. if v.IndustryTags != "" {
  937. item.IndustryTags = strings.Split(v.IndustryTags, ",")
  938. } else {
  939. item.IndustryTags = []string{}
  940. }
  941. //item.ArticleTypeName = utils.CYGX_YANXUAN_SPECIAL
  942. //if v.SpecialType == 1 {
  943. // item.Title = "【笔记】" + item.Title
  944. //} else if v.SpecialType == 2 {
  945. // item.Title = "【观点】" + item.Title
  946. //}
  947. //if v.MyCollectNum > 0 {
  948. // item.IsCollect = true
  949. //}
  950. }
  951. resp.List = append(resp.List, &item)
  952. }
  953. //var condition string
  954. //var pars []interface{}
  955. //var articleIds []string
  956. //for _, v := range list {
  957. // articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
  958. //}
  959. //articleIdStr := strings.Join(articleIds, ",")
  960. //
  961. ////获取文章关联的产业
  962. //pars = make([]interface{}, 0)
  963. //condition = ` AND mg.article_id IN ( ` + utils.GetOrmInReplace(len(articleIds)) + ` ) `
  964. //pars = append(pars, articleIds)
  965. //industrialList, err := models.GetIndustrialListByarticleId(pars, condition)
  966. //if err != nil {
  967. // br.Msg = "获取失败"
  968. // br.ErrMsg = "获取失败,GetSubjectList Err:" + err.Error()
  969. // return
  970. //}
  971. //industrialMap := make(map[int][]*models.IndustrialManagementIdInt)
  972. //if len(industrialList) > 0 {
  973. // for _, v := range industrialList {
  974. // item := new(models.IndustrialManagementIdInt)
  975. // item.ArticleId = v.ArticleId
  976. // if v.ArticleId > utils.SummaryArticleId {
  977. // item.IsResearch = true
  978. // }
  979. // item.IndustrialManagementId = v.IndustrialManagementId
  980. // item.IndustryName = v.IndustryName
  981. // item.ChartPermissionId = v.ChartPermissionId
  982. // industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
  983. // }
  984. //}
  985. //for k, v := range list {
  986. // if len(industrialMap[v.ArticleId]) > 0 {
  987. // list[k].List = industrialMap[v.ArticleId]
  988. // } else {
  989. // list[k].List = make([]*models.IndustrialManagementIdInt, 0)
  990. // }
  991. //}
  992. //
  993. //articleMap := make(map[int]*models.ArticleDetail)
  994. //if articleIdStr != "" {
  995. // articleList, err := models.GetArticleDetailByIdStr(articleIdStr)
  996. // if err != nil {
  997. // br.Msg = "获取数据失败"
  998. // br.ErrMsg = "获取报告详情信息失败,Err:" + err.Error()
  999. // return
  1000. // }
  1001. // for _, v := range articleList {
  1002. // if _, ok := articleMap[v.ArticleId]; !ok {
  1003. // articleMap[v.ArticleId] = v
  1004. // }
  1005. // }
  1006. //}
  1007. //
  1008. ////处理文章PV收藏等数量
  1009. //mapArticleCollectNum := make(map[int]*models.CygxArticleNum)
  1010. //if len(articleIds) > 0 {
  1011. // articleCollectNumList, err := models.GetArticleCollectNum(articleIds, userId)
  1012. // if err != nil && err.Error() != utils.ErrNoRow() {
  1013. // br.Msg = "获取失败"
  1014. // br.ErrMsg = "获取失败,GetArticleCollectNum Err:" + err.Error()
  1015. // return
  1016. // }
  1017. // for _, v := range articleCollectNumList {
  1018. // mapArticleCollectNum[v.ArticleId] = v
  1019. // }
  1020. //}
  1021. //
  1022. ////研选的五张图片
  1023. //detailResearch, err := models.GetConfigByCode("category_research_img_url")
  1024. //if err != nil {
  1025. // br.Msg = "获取失败"
  1026. // br.ErrMsg = "获取失败,GetConfigByCode Err:" + err.Error()
  1027. // return
  1028. //}
  1029. //researchList := strings.Split(detailResearch.ConfigValue, "{|}")
  1030. //
  1031. //lenList := len(list)
  1032. //for i := 0; i < lenList; i++ {
  1033. // item := list[i]
  1034. // knum := item.ArticleId % 5
  1035. // list[i].ImgUrlPc = researchList[knum]
  1036. //
  1037. // article := articleMap[item.ArticleId]
  1038. // if list[i].IsSpecialInt != 1 {
  1039. // list[i].Title = article.Title
  1040. // list[i].DepartmentId = article.DepartmentId
  1041. // list[i].NickName = article.NickName
  1042. // list[i].PublishDate = article.PublishDate
  1043. // if article.ArticleTypeId == 0 {
  1044. // list[i].Source = 1
  1045. // } else {
  1046. // list[i].Source = 2
  1047. // list[i].IsResearch = true
  1048. // }
  1049. // if mapArticleCollectNum[article.ArticleId] != nil {
  1050. // list[i].CollectNum = mapArticleCollectNum[article.ArticleId].CollectNum
  1051. // list[i].Pv = mapArticleCollectNum[article.ArticleId].Pv
  1052. // list[i].IsCollect = mapArticleCollectNum[article.ArticleId].IsCollect
  1053. // }
  1054. // } else {
  1055. // //处理研选专栏
  1056. // list[i].IsSpecial = true
  1057. // if list[i].CompanyTagsStr != "" {
  1058. // list[i].CompanyTags = strings.Split(list[i].CompanyTagsStr, ",")
  1059. // } else {
  1060. // list[i].CompanyTags = []string{}
  1061. // }
  1062. // if list[i].IndustryTagStr != "" {
  1063. // list[i].IndustryTags = strings.Split(list[i].IndustryTagStr, ",")
  1064. // } else {
  1065. // list[i].IndustryTags = []string{}
  1066. // }
  1067. // list[i].IsResearch = true
  1068. // }
  1069. // if item.ArticleTypeId == -1 {
  1070. // list[i].ArticleTypeName = utils.CYGX_YANXUAN_SPECIAL
  1071. // }
  1072. // if item.SpecialType == 1 {
  1073. // list[i].Title = "【笔记】" + list[i].Title
  1074. // } else if list[i].SpecialType == 2 {
  1075. // list[i].Title = "【观点】" + list[i].Title
  1076. // }
  1077. // if item.MyCollectNum > 0 {
  1078. // list[i].IsCollect = true
  1079. // }
  1080. //
  1081. //}
  1082. //page := paging.GetPaging(currentIndex, pageSize, total)
  1083. //resp.List = list
  1084. resp.Paging = page
  1085. br.Msg = "获取成功!"
  1086. br.Ret = 200
  1087. br.Success = true
  1088. br.Data = resp
  1089. }
  1090. // @Title 获取我的留言
  1091. // @Description 获取我的留言列表
  1092. // @Param PageSize query int true "PageSize"
  1093. // @Param CurrentIndex query int true "CurrentIndex"
  1094. // @Success 200 {object} models.CygxCommentListResp
  1095. // @router /comment/list [get]
  1096. func (this *UserController) CommnetList() {
  1097. br := new(models.BaseResponse).Init()
  1098. defer func() {
  1099. this.Data["json"] = br
  1100. this.ServeJSON()
  1101. }()
  1102. user := this.User
  1103. if user == nil {
  1104. br.Msg = "请登录"
  1105. br.ErrMsg = "请登录,用户信息为空"
  1106. br.Ret = 408
  1107. return
  1108. }
  1109. var pageSize, currentIndex, startSize int
  1110. pageSize, _ = this.GetInt("PageSize")
  1111. currentIndex, _ = this.GetInt("CurrentIndex")
  1112. if pageSize <= 0 {
  1113. pageSize = utils.PageSize20
  1114. }
  1115. if currentIndex <= 0 {
  1116. currentIndex = 1
  1117. }
  1118. startSize = utils.StartIndex(currentIndex, pageSize)
  1119. userId := this.User.UserId
  1120. total, err := models.GetCommentListCount(userId)
  1121. if err != nil {
  1122. br.Msg = "获取数据失败"
  1123. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1124. return
  1125. }
  1126. commentlist, err := models.GetCommentList(userId, startSize, pageSize)
  1127. if err != nil && err.Error() != utils.ErrNoRow() {
  1128. br.Msg = "获取失败"
  1129. br.ErrMsg = "获取我的留言列表失败,Err:" + err.Error()
  1130. return
  1131. }
  1132. resp := new(models.CygxCommentListResp)
  1133. for _, comment := range commentlist {
  1134. item := models.CygxArticleCommentResp{
  1135. Id: comment.Id,
  1136. UserId: comment.UserId,
  1137. ArticleId: comment.ArticleId,
  1138. IndustryId: comment.IndustryId,
  1139. ActivityId: comment.ActivityId,
  1140. VideoId: comment.VideoId,
  1141. CreateTime: comment.CreateTime.Format(utils.FormatDateTime),
  1142. Mobile: comment.Mobile,
  1143. Email: comment.Email,
  1144. CompanyId: comment.CompanyId,
  1145. CompanyName: comment.CompanyName,
  1146. Content: comment.Content,
  1147. Title: comment.Title,
  1148. }
  1149. if comment.ArticleId > 0 {
  1150. item.RedirectType = 1
  1151. } else if comment.IndustryId > 0 {
  1152. detail, err := models.GetIndustrialManagementDetail(comment.IndustryId)
  1153. if err != nil {
  1154. br.Msg = "获取信息失败"
  1155. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1156. return
  1157. }
  1158. item.RedirectType = 3
  1159. item.ChartPermissionId = detail.ChartPermissionId
  1160. } else if comment.ActivityId > 0 && comment.VideoId == 0 {
  1161. item.RedirectType = 2
  1162. } else if comment.IndustryId == 0 && comment.VideoId > 0 {
  1163. item.RedirectType = 4
  1164. }
  1165. resp.List = append(resp.List, &item)
  1166. }
  1167. page := paging.GetPaging(currentIndex, pageSize, total)
  1168. resp.Paging = page
  1169. br.Msg = "获取成功!"
  1170. br.Ret = 200
  1171. br.Success = true
  1172. br.Data = resp
  1173. }
  1174. // @Title 我的足迹
  1175. // @Description 获取我的足迹列表
  1176. // @Param PageSize query int true "PageSize"
  1177. // @Param CurrentIndex query int true "CurrentIndex"
  1178. // @Success 200 {object} models.ArticleBrowseHistoryListResp
  1179. // @router /browse/history/list [get]
  1180. func (this *UserController) BrowseHistoryList() {
  1181. br := new(models.BaseResponse).Init()
  1182. defer func() {
  1183. this.Data["json"] = br
  1184. this.ServeJSON()
  1185. }()
  1186. user := this.User
  1187. if user == nil {
  1188. br.Msg = "请登录"
  1189. br.ErrMsg = "请登录,用户信息为空"
  1190. br.Ret = 408
  1191. return
  1192. }
  1193. userId := this.User.UserId
  1194. var pageSize, currentIndex, startSize int
  1195. pageSize, _ = this.GetInt("PageSize")
  1196. currentIndex, _ = this.GetInt("CurrentIndex")
  1197. if pageSize <= 0 {
  1198. pageSize = utils.PageSize20
  1199. }
  1200. if currentIndex <= 0 {
  1201. currentIndex = 1
  1202. }
  1203. startSize = utils.StartIndex(currentIndex, pageSize)
  1204. endDate := time.Now().AddDate(0, -1, 0).Format(utils.FormatDate)
  1205. total, err := models.GetArticleUserBrowseHistoryCount(userId, endDate)
  1206. if err != nil {
  1207. br.Msg = "获取数据失败"
  1208. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1209. return
  1210. }
  1211. list, err := models.GetArticleUserBrowseHistoryList(startSize, pageSize, userId, endDate)
  1212. if err != nil {
  1213. br.Msg = "获取数据失败"
  1214. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1215. return
  1216. }
  1217. resp := new(models.ArticleReportBillboardLIstPageResp)
  1218. if len(list) == 0 {
  1219. page := paging.GetPaging(currentIndex, pageSize, total)
  1220. resp.List = make([]*models.ArticleReportBillboardResp, 0)
  1221. resp.Paging = page
  1222. br.Msg = "获取成功!"
  1223. br.Ret = 200
  1224. br.Success = true
  1225. br.Data = resp
  1226. return
  1227. }
  1228. list, err = services.HandleArticleCategoryImg(list, user)
  1229. if err != nil {
  1230. br.Msg = "获取信息失败"
  1231. br.ErrMsg = "HandleArticleCategoryImg,Err:" + err.Error()
  1232. return
  1233. }
  1234. page := paging.GetPaging(currentIndex, pageSize, total)
  1235. for _, v := range list {
  1236. item := models.ArticleReportBillboardResp{
  1237. ArticleId: v.ArticleId,
  1238. ArticleTypeId: v.ArticleTypeId,
  1239. Title: v.Title,
  1240. PublishDate: v.PublishDate,
  1241. DepartmentId: v.DepartmentId,
  1242. NickName: v.NickName,
  1243. IsCollect: v.IsCollect,
  1244. Pv: v.Pv,
  1245. CollectNum: v.CollectNum,
  1246. ImgUrlPc: v.ImgUrlPc,
  1247. LabelKeywordImgLink: v.LabelKeywordImgLink,
  1248. List: v.List,
  1249. SpecialColumnId: v.SpecialColumnId,
  1250. }
  1251. if v.IsSpecial == 1 {
  1252. item.IsSpecial = true
  1253. item.ImgUrlPc = utils.CYGX_YANXUAN_SPECIAL_IMG_PC
  1254. if v.CompanyTags != "" {
  1255. item.CompanyTags = strings.Split(v.CompanyTags, ",")
  1256. } else {
  1257. item.CompanyTags = []string{}
  1258. }
  1259. if v.IndustryTags != "" {
  1260. item.IndustryTags = strings.Split(v.IndustryTags, ",")
  1261. } else {
  1262. item.IndustryTags = []string{}
  1263. }
  1264. //item.ArticleTypeName = utils.CYGX_YANXUAN_SPECIAL
  1265. //if v.SpecialType == 1 {
  1266. // item.Title = "【笔记】" + item.Title
  1267. //} else if v.SpecialType == 2 {
  1268. // item.Title = "【观点】" + item.Title
  1269. //}
  1270. //if v.MyCollectNum > 0 {
  1271. // item.IsCollect = true
  1272. //}
  1273. }
  1274. resp.List = append(resp.List, &item)
  1275. }
  1276. //var articleIds []string
  1277. //var condition string
  1278. //var pars []interface{}
  1279. //for _, v := range list {
  1280. // if v.IsSpecial == 1 {
  1281. // //if v.CompanyTags != "" {
  1282. // // v.CompanyTags = strings.Split(v.CompanyTags, ",")
  1283. // //} else {
  1284. // // v.CompanyTags = []string{}
  1285. // //}
  1286. // } else {
  1287. // articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
  1288. // }
  1289. //}
  1290. //articleIdStr := strings.Join(articleIds, ",")
  1291. //
  1292. ////获取文章关联的产业
  1293. //pars = make([]interface{}, 0)
  1294. //condition = ` AND mg.article_id IN ( ` + utils.GetOrmInReplace(len(articleIds)) + ` ) `
  1295. //pars = append(pars, articleIds)
  1296. //industrialList, err := models.GetIndustrialListByarticleId(pars, condition)
  1297. //if err != nil {
  1298. // br.Msg = "获取失败"
  1299. // br.ErrMsg = "获取失败,GetSubjectList Err:" + err.Error()
  1300. // return
  1301. //}
  1302. //industrialMap := make(map[int][]*models.IndustrialManagementIdInt)
  1303. //if len(industrialList) > 0 {
  1304. // for _, v := range industrialList {
  1305. // item := new(models.IndustrialManagementIdInt)
  1306. // item.ArticleId = v.ArticleId
  1307. // item.IndustrialManagementId = v.IndustrialManagementId
  1308. // item.IndustryName = v.IndustryName
  1309. // item.ChartPermissionId = v.ChartPermissionId
  1310. // industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
  1311. // }
  1312. //}
  1313. //for k, v := range list {
  1314. // if len(industrialMap[v.ArticleId]) > 0 {
  1315. // list[k].List = industrialMap[v.ArticleId]
  1316. // } else {
  1317. // list[k].List = make([]*models.IndustrialManagementIdInt, 0)
  1318. // }
  1319. //}
  1320. //
  1321. //articleMap := make(map[int]*models.ArticleDetail)
  1322. //if articleIdStr != "" {
  1323. // articleList, err := models.GetArticleDetailByIdStr(articleIdStr)
  1324. // if err != nil {
  1325. // br.Msg = "获取数据失败"
  1326. // br.ErrMsg = "获取报告详情信息失败,Err:" + err.Error()
  1327. // return
  1328. // }
  1329. // for _, v := range articleList {
  1330. // if _, ok := articleMap[v.ArticleId]; !ok {
  1331. // articleMap[v.ArticleId] = v
  1332. // }
  1333. // }
  1334. //}
  1335. //
  1336. ////处理文章PV收藏等数量
  1337. //mapArticleCollectNum := make(map[int]*models.CygxArticleNum)
  1338. //if len(articleIds) > 0 {
  1339. // articleCollectNumList, err := models.GetArticleCollectNum(articleIds, userId)
  1340. // if err != nil && err.Error() != utils.ErrNoRow() {
  1341. // br.Msg = "获取失败"
  1342. // br.ErrMsg = "获取失败,GetArticleCollectNum Err:" + err.Error()
  1343. // return
  1344. // }
  1345. // for _, v := range articleCollectNumList {
  1346. // mapArticleCollectNum[v.ArticleId] = v
  1347. // }
  1348. //}
  1349. //
  1350. //lenList := len(list)
  1351. //for i := 0; i < lenList; i++ {
  1352. // item := list[i]
  1353. // article := articleMap[item.ArticleId]
  1354. // if article != nil {
  1355. // list[i].Title = article.Title
  1356. // list[i].PublishDate = utils.TimeRemoveHms2(article.PublishDate)
  1357. // list[i].DepartmentId = article.DepartmentId
  1358. // list[i].NickName = article.NickName
  1359. // if mapArticleCollectNum[article.ArticleId] != nil {
  1360. // list[i].CollectNum = mapArticleCollectNum[article.ArticleId].CollectNum
  1361. // list[i].Pv = mapArticleCollectNum[article.ArticleId].Pv
  1362. // list[i].IsCollect = mapArticleCollectNum[article.ArticleId].IsCollect
  1363. // }
  1364. // }
  1365. //}
  1366. //page := paging.GetPaging(currentIndex, pageSize, total)
  1367. //
  1368. //resp.List = list
  1369. resp.Paging = page
  1370. br.Msg = "获取成功!"
  1371. br.Ret = 200
  1372. br.Success = true
  1373. br.Data = resp
  1374. }
  1375. // @Title 获取我的提问
  1376. // @Description 获取我的提问列表
  1377. // @Param PageSize query int true "PageSize"
  1378. // @Param CurrentIndex query int true "CurrentIndex"
  1379. // @Success 200 {object} models.CygxAskListResp
  1380. // @router /ask/list [get]
  1381. func (this *UserController) AskList() {
  1382. br := new(models.BaseResponse).Init()
  1383. defer func() {
  1384. this.Data["json"] = br
  1385. this.ServeJSON()
  1386. }()
  1387. user := this.User
  1388. if user == nil {
  1389. br.Msg = "请登录"
  1390. br.ErrMsg = "请登录,用户信息为空"
  1391. br.Ret = 408
  1392. return
  1393. }
  1394. var pageSize, currentIndex, startSize int
  1395. pageSize, _ = this.GetInt("PageSize")
  1396. currentIndex, _ = this.GetInt("CurrentIndex")
  1397. if pageSize <= 0 {
  1398. pageSize = utils.PageSize20
  1399. }
  1400. if currentIndex <= 0 {
  1401. currentIndex = 1
  1402. }
  1403. startSize = utils.StartIndex(currentIndex, pageSize)
  1404. userId := this.User.UserId
  1405. total, err := models.GetActivityAskCount(userId)
  1406. if err != nil {
  1407. br.Msg = "获取数据失败"
  1408. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1409. return
  1410. }
  1411. listActcivity, err := models.GetActivityAskList(userId, startSize, pageSize)
  1412. if err != nil && err.Error() != utils.ErrNoRow() {
  1413. br.Msg = "获取失败"
  1414. br.ErrMsg = "获取活动问题失败,Err:" + err.Error()
  1415. return
  1416. }
  1417. for _, v := range listActcivity {
  1418. v.AskType = "Activity"
  1419. }
  1420. listArticle, err := models.GetArticleAskList(userId)
  1421. if err != nil && err.Error() != utils.ErrNoRow() {
  1422. br.Msg = "获取失败"
  1423. br.ErrMsg = "获取文章问题失败,Err:" + err.Error()
  1424. return
  1425. }
  1426. for _, v := range listArticle {
  1427. v.AskType = "Report"
  1428. listActcivity = append(listActcivity, v)
  1429. }
  1430. resp := new(models.CygxAskListResp)
  1431. page := paging.GetPaging(currentIndex, pageSize, total)
  1432. resp.Paging = page
  1433. resp.List = listActcivity
  1434. br.Msg = "获取成功!"
  1435. br.Ret = 200
  1436. br.Success = true
  1437. br.Data = resp
  1438. }
  1439. // @Title 我的收藏微路演列表
  1440. // @Description 我的收藏微路演列表接口
  1441. // @Param PageSize query int true "每页数据条数"
  1442. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1443. // @Success 200 {object} models.HomeListResp
  1444. // @router /collect/microRoadShow [get]
  1445. func (this *UserController) Mycollect() {
  1446. br := new(models.BaseResponse).Init()
  1447. defer func() {
  1448. this.Data["json"] = br
  1449. this.ServeJSON()
  1450. }()
  1451. user := this.User
  1452. if user == nil {
  1453. br.Msg = "请登录"
  1454. br.ErrMsg = "请登录,用户信息为空"
  1455. br.Ret = 408
  1456. return
  1457. }
  1458. pageSize, _ := this.GetInt("PageSize")
  1459. currentIndex, _ := this.GetInt("CurrentIndex")
  1460. if pageSize <= 0 {
  1461. pageSize = utils.PageSize20
  1462. }
  1463. if currentIndex <= 0 {
  1464. currentIndex = 1
  1465. }
  1466. userId := user.UserId
  1467. listMycollect, err := models.GetUserMicroRoadshowCollectList(userId)
  1468. if err != nil {
  1469. br.Msg = "获取数据失败"
  1470. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1471. return
  1472. }
  1473. listAskserieVideoCollect, err := models.GetUserCygxAskserieVideoCollectList(userId)
  1474. if err != nil {
  1475. br.Msg = "获取数据失败"
  1476. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1477. return
  1478. }
  1479. collectVoiceMap := make(map[int]time.Time, 0)
  1480. collectVideoMap := make(map[int]time.Time, 0)
  1481. collectActivityVideoMap := make(map[int]time.Time, 0)
  1482. var audioIds []string
  1483. var videoIds []string
  1484. var activityVideoIds []string
  1485. var askserieVideoIds []string //问答系列视频
  1486. for _, item := range listMycollect {
  1487. if item.ActivityVoiceId > 0 {
  1488. audioIds = append(audioIds, strconv.Itoa(item.ActivityVoiceId))
  1489. collectVoiceMap[item.ActivityVoiceId] = item.CreateTime
  1490. } else if item.VideoId > 0 {
  1491. videoIds = append(videoIds, strconv.Itoa(item.VideoId))
  1492. collectVideoMap[item.VideoId] = item.CreateTime
  1493. } else if item.ActivityVideoId > 0 {
  1494. activityVideoIds = append(activityVideoIds, strconv.Itoa(item.ActivityVideoId))
  1495. collectActivityVideoMap[item.ActivityVideoId] = item.CreateTime
  1496. }
  1497. }
  1498. for _, item := range listAskserieVideoCollect {
  1499. askserieVideoIds = append(askserieVideoIds, strconv.Itoa(item.AskserieVideoId))
  1500. }
  1501. if len(audioIds) == 0 && len(videoIds) == 0 && len(activityVideoIds) == 0 && len(askserieVideoIds) == 0 {
  1502. resp := new(models.MicroRoadShowListResp)
  1503. page := paging.GetPaging(currentIndex, pageSize, 0)
  1504. resp.List = make([]*models.MicroRoadShowPageList, 0)
  1505. resp.Paging = page
  1506. br.Ret = 200
  1507. br.Success = true
  1508. br.Msg = "获取成功"
  1509. br.Data = resp
  1510. return
  1511. }
  1512. audioIdstr := strings.Join(audioIds, ",")
  1513. ideoIdsStr := strings.Join(videoIds, ",")
  1514. activityVideoIdsStr := strings.Join(activityVideoIds, ",")
  1515. askserieVideoIdsStr := strings.Join(askserieVideoIds, ",")
  1516. // 微路演列表
  1517. list, total, e := services.GetMicroRoadShowMycollectV12(pageSize, currentIndex, audioIdstr, activityVideoIdsStr, ideoIdsStr, askserieVideoIdsStr, user)
  1518. if e != nil {
  1519. br.Msg = "获取失败"
  1520. br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
  1521. return
  1522. }
  1523. for _, item := range list {
  1524. if item.Type == 1 {
  1525. //音频
  1526. count, err := models.GetVoiceCollectCount(user.UserId, item.Id)
  1527. if err != nil {
  1528. br.Msg = "获取数据失败!"
  1529. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1530. return
  1531. }
  1532. if count > 0 {
  1533. item.IsCollect = true
  1534. }
  1535. if v, ok := collectVoiceMap[item.Id]; ok {
  1536. item.CollectTime = v
  1537. }
  1538. } else if item.Type == 2 {
  1539. //活动视频
  1540. count, err := models.GetActivityVideoCollectCount(user.UserId, item.Id)
  1541. if err != nil {
  1542. br.Msg = "获取数据失败!"
  1543. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1544. return
  1545. }
  1546. if count > 0 {
  1547. item.IsCollect = true
  1548. }
  1549. if v, ok := collectActivityVideoMap[item.Id]; ok {
  1550. item.CollectTime = v
  1551. }
  1552. } else if item.Type == 3 {
  1553. //微路演视频
  1554. count, err := models.GetVideoCollectCount(user.UserId, item.Id)
  1555. if err != nil {
  1556. br.Msg = "获取数据失败!"
  1557. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1558. return
  1559. }
  1560. if count > 0 {
  1561. item.IsCollect = true
  1562. }
  1563. if v, ok := collectVideoMap[item.Id]; ok {
  1564. item.CollectTime = v
  1565. }
  1566. }
  1567. }
  1568. // 用户权限
  1569. authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
  1570. if e != nil {
  1571. br.Msg = "获取失败"
  1572. br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
  1573. return
  1574. }
  1575. // 获取默认图配置
  1576. audioMap, videoMap, audioShareMap, videoShareMap, e := services.GetMicroRoadShowDefaultImgConfig()
  1577. if e != nil {
  1578. br.Msg = "获取失败"
  1579. br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
  1580. return
  1581. }
  1582. for i := range list {
  1583. // 权限
  1584. au := new(models.UserPermissionAuthInfo)
  1585. au.SellerName = authInfo.SellerName
  1586. au.SellerMobile = authInfo.SellerMobile
  1587. au.HasPermission = authInfo.HasPermission
  1588. au.OperationMode = authInfo.OperationMode
  1589. if au.HasPermission == 1 {
  1590. // 非宏观权限进一步判断是否有权限
  1591. if list[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, list[i].ChartPermissionName) {
  1592. au.HasPermission = 2
  1593. }
  1594. }
  1595. // 无权限的弹框提示
  1596. if au.HasPermission != 1 {
  1597. if au.OperationMode == services.UserPermissionOperationModeCall {
  1598. if list[i].Type == 1 {
  1599. au.PopupMsg = services.UserPermissionPopupMsgCallActivity
  1600. } else {
  1601. au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
  1602. }
  1603. } else {
  1604. if list[i].Type == 1 {
  1605. au.PopupMsg = services.UserPermissionPopupMsgApplyActivity
  1606. } else {
  1607. au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
  1608. }
  1609. }
  1610. }
  1611. list[i].AuthInfo = au
  1612. list[i].PublishTime = utils.StrTimeToTime(list[i].PublishTime).Format(utils.FormatDate)
  1613. // 默认图
  1614. if list[i].BackgroundImg == "" {
  1615. if list[i].Type == 1 {
  1616. list[i].BackgroundImg = audioMap[list[i].ChartPermissionId]
  1617. } else {
  1618. list[i].BackgroundImg = videoMap[list[i].ChartPermissionId]
  1619. }
  1620. }
  1621. // 分享图
  1622. if list[i].ShareImg == "" {
  1623. if list[i].Type == 1 {
  1624. list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
  1625. } else {
  1626. list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
  1627. }
  1628. }
  1629. }
  1630. var sortList models.MicroList
  1631. sortList = list
  1632. sort.Sort(sortList)
  1633. resp := new(models.MicroRoadShowListResp)
  1634. page := paging.GetPaging(currentIndex, pageSize, total)
  1635. resp.List = sortList
  1636. resp.Paging = page
  1637. br.Ret = 200
  1638. br.Success = true
  1639. br.Msg = "获取成功"
  1640. br.Data = resp
  1641. }