yanxuan_special.go 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "hongze/hongze_cygx/models"
  6. "hongze/hongze_cygx/services"
  7. "hongze/hongze_cygx/utils"
  8. "strconv"
  9. "strings"
  10. "time"
  11. )
  12. type YanxuanSpecialController struct {
  13. BaseAuthController
  14. }
  15. // @Title 专栏列表
  16. // @Description 专栏列表
  17. // @Param UserId query int true "用户ID"
  18. // @Param PageSize query int true "每页数据条数"
  19. // @Param CurrentIndex query int true "当前页页码,从1开始"
  20. // @Param Status query int false "研选专栏装态"
  21. // @Success 200 {object} models.SpecialListResp
  22. // @router /list [get]
  23. func (this *YanxuanSpecialController) List() {
  24. br := new(models.BaseResponse).Init()
  25. defer func() {
  26. this.Data["json"] = br
  27. this.ServeJSON()
  28. }()
  29. sysUser := this.User
  30. if sysUser == nil {
  31. br.Msg = "请登录"
  32. br.ErrMsg = "请登录,SysUser Is Empty"
  33. br.Ret = 408
  34. return
  35. }
  36. userId, _ := this.GetInt("UserId", 0)
  37. pageSize, _ := this.GetInt("PageSize")
  38. currentIndex, _ := this.GetInt("CurrentIndex")
  39. status, _ := this.GetInt("Status")
  40. var startSize int
  41. if pageSize <= 0 {
  42. pageSize = utils.PageSize20
  43. }
  44. if currentIndex <= 0 {
  45. currentIndex = 1
  46. }
  47. startSize = utils.StartIndex(currentIndex, pageSize)
  48. resp := new(models.SpecialListResp)
  49. var condition string
  50. var pars []interface{}
  51. if userId > 0 {
  52. condition += ` AND a.user_id = ? `
  53. pars = append(pars, userId)
  54. }
  55. if status == 2 {
  56. condition += ` AND a.status = 2 `
  57. } else {
  58. condition += ` AND a.status = 3 `
  59. }
  60. total, err := models.GetCygxYanxuanSpecialCount(condition, pars)
  61. if err != nil {
  62. br.Msg = "获取失败"
  63. br.ErrMsg = "获取失败, Err:" + err.Error()
  64. return
  65. }
  66. list, err := models.GetYanxuanSpecialList(sysUser.UserId, condition, pars, startSize, pageSize)
  67. if err != nil {
  68. br.Msg = "获取失败"
  69. br.ErrMsg = "获取失败, Err:" + err.Error()
  70. return
  71. }
  72. for _, v := range list {
  73. hasImg, err := utils.ArticleHasImgUrl(v.Content)
  74. if err != nil {
  75. return
  76. }
  77. if hasImg {
  78. v.ContentHasImg = 1
  79. }
  80. v.Content = utils.ArticleRemoveImgUrl(v.Content)
  81. //v.Content, err = utils.ExtractText(v.Content)
  82. //if err != nil {
  83. // return
  84. //}
  85. //v.Content, _ = services.GetReportContentTextSubNew(v.Content)
  86. v.Content = services.AnnotationHtml(v.Content)
  87. if v.DocUrl != "" {
  88. var docs []models.Doc
  89. err := json.Unmarshal([]byte(v.DocUrl), &docs)
  90. if err != nil {
  91. br.Msg = "参数解析异常!"
  92. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  93. return
  94. }
  95. v.Docs = docs
  96. }
  97. if v.MyCollectNum > 0 {
  98. v.IsCollect = 1
  99. }
  100. if v.CompanyTags != "" {
  101. v.Tags += v.CompanyTags
  102. }
  103. if v.IndustryTags != "" {
  104. if v.Tags != "" {
  105. v.Tags += ","
  106. }
  107. v.Tags += v.IndustryTags
  108. }
  109. }
  110. isAuthor, isImproveInformation := services.GetYanxuanSpecialAuthorInfo(sysUser) //用户是否没开通研选专栏以及,专栏信息是否完善
  111. resp.IsAuthor = isAuthor
  112. resp.IsImproveInformation = isImproveInformation
  113. resp.List = list
  114. page := paging.GetPaging(currentIndex, pageSize, total)
  115. resp.Paging = page
  116. br.Data = resp
  117. br.Ret = 200
  118. br.Success = true
  119. br.Msg = "获取成功"
  120. }
  121. // @Title 专栏详情
  122. // @Description 专栏详情
  123. // @Param IsSendWx query int false "是否是通过微信模版进来的 1是,其它否"
  124. // @Param Id query int true "详情ID"
  125. // @Success 200 {object} models.AddEnglishReportResp
  126. // @router /detail [get]
  127. func (this *YanxuanSpecialController) Detail() {
  128. br := new(models.BaseResponse).Init()
  129. defer func() {
  130. this.Data["json"] = br
  131. this.ServeJSON()
  132. }()
  133. sysUser := this.User
  134. if sysUser == nil {
  135. br.Msg = "请登录"
  136. br.ErrMsg = "请登录,SysUser Is Empty"
  137. br.Ret = 408
  138. return
  139. }
  140. specialId, _ := this.GetInt("Id", 0)
  141. isSendWx, _ := this.GetInt("IsSendWx", 0)
  142. if specialId <= 0 {
  143. br.Msg = "参数错误"
  144. br.ErrMsg = "参数错误"
  145. return
  146. }
  147. item, tmpErr := models.GetYanxuanSpecialById(specialId, sysUser.UserId)
  148. if tmpErr != nil {
  149. br.Msg = "获取失败"
  150. br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
  151. return
  152. }
  153. if item.MyCollectNum > 0 {
  154. item.IsCollect = 1
  155. }
  156. var resp models.CygxYanxuanSpecialResp
  157. resp.HasPermission = 1
  158. resp.CygxYanxuanSpecialItem = *item
  159. if item.DocUrl != "" {
  160. var docs []models.Doc
  161. err := json.Unmarshal([]byte(item.DocUrl), &docs)
  162. if err != nil {
  163. br.Msg = "参数解析异常!"
  164. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  165. return
  166. }
  167. resp.Docs = docs
  168. }
  169. if item.CompanyTags != "" {
  170. resp.Tags += item.CompanyTags
  171. resp.CompanyTags = append(resp.CompanyTags, item.CompanyTags)
  172. }
  173. if item.IndustryTags != "" {
  174. if resp.Tags != "" {
  175. resp.Tags += ","
  176. }
  177. resp.Tags += item.IndustryTags
  178. resp.IndustryTags = strings.Split(item.IndustryTags, ",")
  179. }
  180. //如果状态未审核通过,而且查看的不是本人,不是审核人员,就无法查看详情
  181. var configCode string
  182. configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
  183. cnf, err := models.GetConfigByCode(configCode)
  184. if err != nil {
  185. br.Msg = "获取失败"
  186. br.ErrMsg = "获取失败, Err:" + err.Error()
  187. return
  188. }
  189. if isSendWx == 1 && strings.Contains(cnf.ConfigValue, sysUser.Mobile) {
  190. resp.IsShowExamine = true
  191. resp.ExamineStatus = item.Status
  192. }
  193. resp.ExamineStatus = item.Status
  194. if item.UserId != sysUser.UserId && item.Status != 3 && !strings.Contains(cnf.ConfigValue, sysUser.Mobile) {
  195. resp.CygxYanxuanSpecialItem = *new(models.CygxYanxuanSpecialItem) // 如果内容不可见,就把内容置空
  196. resp.HasPermission = 2
  197. }
  198. //如果在web端有样式或者上传了文件,小程序就禁止编辑修改内容
  199. hasStyle, err := utils.ArticleHasStyle(item.Content)
  200. if err != nil {
  201. return
  202. }
  203. hasImg, err := utils.ArticleHasImgUrl(item.Content)
  204. if err != nil {
  205. return
  206. }
  207. if hasStyle || strings.Contains(item.DocUrl, "http") || hasImg {
  208. resp.ContentHasStyle = true
  209. }
  210. br.Data = resp
  211. br.Ret = 200
  212. br.Success = true
  213. br.Msg = "获取成功"
  214. }
  215. // @Title 新增保存专栏作者详情
  216. // @Description 新增保存专栏作者详情
  217. // @Param request body help_doc.AddHelpDocReq true "type json string"
  218. // @Success 200 {object} models.AddEnglishReportResp
  219. // @router /author/save [post]
  220. func (this *YanxuanSpecialController) AuthorSave() {
  221. br := new(models.BaseResponse).Init()
  222. defer func() {
  223. this.Data["json"] = br
  224. this.ServeJSON()
  225. }()
  226. sysUser := this.User
  227. if sysUser == nil {
  228. br.Msg = "请登录"
  229. br.ErrMsg = "请登录,SysUser Is Empty"
  230. br.Ret = 408
  231. return
  232. }
  233. var req models.SaveCygxYanxuanSpecialAuthorReq
  234. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  235. if err != nil {
  236. br.Msg = "参数解析异常!"
  237. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  238. return
  239. }
  240. if req.UserId <= 0 {
  241. br.Msg = "用户id有误"
  242. return
  243. }
  244. if req.SpecialName == "" {
  245. br.Msg = "请输入专栏名称"
  246. return
  247. }
  248. if req.NickName == "" {
  249. br.Msg = "请输入昵称"
  250. return
  251. }
  252. item := models.CygxYanxuanSpecialAuthor{
  253. UserId: req.UserId,
  254. SpecialName: req.SpecialName,
  255. Introduction: req.Introduction,
  256. Label: req.Label,
  257. NickName: req.NickName,
  258. CreateTime: time.Now(),
  259. ModifyTime: time.Now(),
  260. BgImg: "",
  261. Status: 1,
  262. }
  263. //if req.Id == 0{
  264. // _, err = models.AddCygxYanxuanSpecialAuthor(&item)
  265. // if err != nil {
  266. // br.Msg = "新增失败"
  267. // br.ErrMsg = "新增失败,Err:" + err.Error()
  268. // return
  269. // }
  270. //} else {
  271. // err = models.UpdateYanxuanSpecialAuthor(&item)
  272. // if err != nil {
  273. // br.Msg = "保存失败"
  274. // br.ErrMsg = "保存失败,Err:" + err.Error()
  275. // return
  276. // }
  277. //}
  278. err = models.UpdateYanxuanSpecialAuthor(&item)
  279. if err != nil {
  280. br.Msg = "保存失败"
  281. br.ErrMsg = "保存失败,Err:" + err.Error()
  282. return
  283. }
  284. br.Ret = 200
  285. br.Success = true
  286. br.Msg = "保存成功"
  287. }
  288. // @Title 新增保存专栏
  289. // @Description 新增保存专栏
  290. // @Param request body help_doc.AddHelpDocReq true "type json string"
  291. // @Success 200 {object} models.AddEnglishReportResp
  292. // @router /save [post]
  293. func (this *YanxuanSpecialController) Save() {
  294. br := new(models.BaseResponse).Init()
  295. defer func() {
  296. this.Data["json"] = br
  297. this.ServeJSON()
  298. }()
  299. sysUser := this.User
  300. if sysUser == nil {
  301. br.Msg = "请登录"
  302. br.ErrMsg = "请登录,SysUser Is Empty"
  303. br.Ret = 408
  304. return
  305. }
  306. var req models.CygxYanxuanSpecialReq
  307. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  308. if err != nil {
  309. br.Msg = "参数解析异常!"
  310. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  311. return
  312. }
  313. if req.Content == "" && req.DoType == 2 {
  314. br.Msg = "请输入内容"
  315. return
  316. }
  317. if req.CompanyTags == "" && req.IndustryTags == "" && req.DoType == 2 {
  318. br.Msg = "请至少输入一个标签"
  319. return
  320. }
  321. isApprovalPersonnel := req.IsApprovalPersonnel
  322. item := models.CygxYanxuanSpecial{
  323. Id: req.Id,
  324. UserId: sysUser.UserId,
  325. CreateTime: time.Now(),
  326. ModifyTime: time.Now(),
  327. PublishTime: time.Now(),
  328. Content: req.Content,
  329. ImgUrl: req.ImgUrl,
  330. DocUrl: req.DocUrl,
  331. Title: req.Title,
  332. Type: req.Type,
  333. CompanyTags: req.CompanyTags,
  334. IndustryTags: req.IndustryTags,
  335. }
  336. if req.DoType == 1 {
  337. item.Status = 1
  338. } else {
  339. item.Status = 2
  340. }
  341. var authorUserId int
  342. // 如果是审批人员操作的那么就是修改内容,加审批通过
  343. if isApprovalPersonnel {
  344. item.Status = 3
  345. //校验是否属于审核人员
  346. if !services.CheckYxSpecialIsApprovalPersonnel(sysUser.Mobile) {
  347. br.Msg = "操作失败"
  348. br.ErrMsg = "操作失败,该账号不属于审核人员:" + sysUser.Mobile
  349. return
  350. }
  351. specialItem, err := models.GetYanxuanSpecialItemById(req.Id)
  352. if err != nil {
  353. br.Msg = "保存失败"
  354. br.ErrMsg = "保存失败,Err:" + err.Error()
  355. return
  356. }
  357. item.UserId = specialItem.UserId // 专栏userid还是原有userId
  358. authorUserId = specialItem.UserId
  359. item.AdminName = sysUser.RealName //审核人员姓名
  360. }
  361. specialId := 0
  362. if req.Id == 0 {
  363. id, err := models.AddCygxYanxuanSpecial(&item)
  364. if err != nil {
  365. br.Msg = "新增失败"
  366. br.ErrMsg = "新增失败,Err:" + err.Error()
  367. return
  368. }
  369. specialId = int(id)
  370. } else {
  371. err = models.UpdateYanxuanSpecial(&item)
  372. if err != nil {
  373. br.Msg = "保存失败"
  374. br.ErrMsg = "保存失败,Err:" + err.Error()
  375. return
  376. }
  377. specialId = req.Id
  378. }
  379. if isApprovalPersonnel {
  380. go services.UpdateYanxuanSpecialResourceData(specialId) // 写入首页最新 cygx_resource_data 表
  381. go services.EsAddYanxuanSpecial(specialId) // 写入es 综合搜索
  382. go services.SendWxMsgSpecialFollow(req.Id) //研选专栏有新内容审核通过时,给关注此专栏的客户发送模板消息
  383. go services.SendWxMsgSpecialAuthor(req.Id, 2) //研选专栏审核完成时,给提交人发送模板消息
  384. go services.UdpateYanxuanSpecialauthorArticleNum(authorUserId) // 更新作者发布文章的数量
  385. } else {
  386. if req.DoType == 2 {
  387. go services.SendReviewTemplateMsgAdmin(specialId)
  388. go services.UpdateYanxuanSpecialResourceData(specialId) // 写入首页最新 cygx_resource_data 表
  389. go services.EsAddYanxuanSpecial(specialId) // 写入es 综合搜索
  390. }
  391. }
  392. br.Ret = 200
  393. br.Success = true
  394. br.Msg = "保存成功"
  395. }
  396. // @Title 专栏作者详情
  397. // @Description 专栏作者详情
  398. // @Param request body help_doc.AddHelpDocReq true "type json string"
  399. // @Success 200 {object} models.AddEnglishReportResp
  400. // @router /author/detail [get]
  401. func (this *YanxuanSpecialController) AuthorDetail() {
  402. br := new(models.BaseResponse).Init()
  403. defer func() {
  404. this.Data["json"] = br
  405. this.ServeJSON()
  406. }()
  407. sysUser := this.User
  408. if sysUser == nil {
  409. br.Msg = "请登录"
  410. br.ErrMsg = "请登录,SysUser Is Empty"
  411. br.Ret = 408
  412. return
  413. }
  414. userId, _ := this.GetInt("UserId", 0)
  415. if userId == 0 {
  416. userId = sysUser.UserId
  417. }
  418. item, tmpErr := models.GetYanxuanSpecialAuthor(userId, sysUser.UserId, "")
  419. if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
  420. br.Msg = "获取失败"
  421. br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
  422. return
  423. }
  424. br.Data = item
  425. br.Ret = 200
  426. br.Success = true
  427. br.Msg = "获取成功"
  428. }
  429. // @Title 审批研选专栏
  430. // @Description 审批研选专栏
  431. // @Param request body help_doc.AddHelpDocReq true "type json string"
  432. // @Success 200 {object} models.AddEnglishReportResp
  433. // @router /enable [post]
  434. func (this *YanxuanSpecialController) Enable() {
  435. br := new(models.BaseResponse).Init()
  436. defer func() {
  437. this.Data["json"] = br
  438. this.ServeJSON()
  439. }()
  440. user := this.User
  441. if user == nil {
  442. br.Msg = "请登录"
  443. br.ErrMsg = "请登录,SysUser Is Empty"
  444. br.Ret = 408
  445. return
  446. }
  447. var req models.EnableCygxYanxuanSpecialReq
  448. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  449. if err != nil {
  450. br.Msg = "参数解析异常!"
  451. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  452. return
  453. }
  454. if req.Id <= 0 {
  455. br.Msg = "文章id错误"
  456. return
  457. }
  458. if req.Status <= 0 {
  459. br.Msg = "参数错误"
  460. return
  461. }
  462. status := 0
  463. if req.Status == 1 {
  464. status = 3
  465. } else {
  466. status = 4
  467. }
  468. detail, err := models.GetYanxuanSpecialItemById(req.Id)
  469. if err != nil {
  470. br.Msg = "审批失败"
  471. br.ErrMsg = "审批失败, Err:" + err.Error()
  472. return
  473. }
  474. if tmpErr := models.EnableYanxuanSpecial(req.Id, status, req.Reason, user.RealName); tmpErr != nil {
  475. br.Msg = "审批失败"
  476. br.ErrMsg = "审批失败, Err:" + tmpErr.Error()
  477. return
  478. }
  479. if req.Status == 1 {
  480. go services.SendWxMsgSpecialFollow(req.Id)
  481. }
  482. go services.SendWxMsgSpecialAuthor(req.Id, req.Status)
  483. go services.UpdateYanxuanSpecialResourceData(req.Id) // 写入首页最新 cygx_resource_data 表
  484. go services.EsAddYanxuanSpecial(req.Id) // 写入es 综合搜索
  485. go services.AddAddCygxYanxuanSpecialApprovalLog(user, req.Id, req.Status, req.Reason) // 添加审核记录日志
  486. go services.UdpateYanxuanSpecialauthorArticleNum(detail.UserId) // 更新作者发布文章的数量
  487. br.Msg = "审批成功"
  488. br.Ret = 200
  489. br.Success = true
  490. }
  491. // @Title 研选专栏收藏
  492. // @Description 研选专栏收藏
  493. // @Param request body help_doc.AddHelpDocReq true "type json string"
  494. // @Success 200 {object} models.AddEnglishReportResp
  495. // @router /collect [post]
  496. func (this *YanxuanSpecialController) Collect() {
  497. br := new(models.BaseResponse).Init()
  498. defer func() {
  499. this.Data["json"] = br
  500. this.ServeJSON()
  501. }()
  502. user := this.User
  503. if user == nil {
  504. br.Msg = "请登录"
  505. br.ErrMsg = "请登录,SysUser Is Empty"
  506. br.Ret = 408
  507. return
  508. }
  509. var req models.CollectCygxYanxuanSpecialReq
  510. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  511. if err != nil {
  512. br.Msg = "参数解析异常!"
  513. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  514. return
  515. }
  516. if req.Id <= 0 {
  517. br.Msg = "文章id错误"
  518. return
  519. }
  520. if req.Status <= 0 {
  521. br.Msg = "参数错误"
  522. return
  523. }
  524. var sellerName string
  525. sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  526. if err != nil {
  527. br.Msg = "查询栏目详情失败!"
  528. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  529. return
  530. }
  531. sellerName = sellerItemQy.RealName
  532. if req.Status == 1 {
  533. item := models.CygxYanxuanSpecialCollect{
  534. UserId: user.UserId,
  535. Mobile: user.Mobile,
  536. Email: user.Email,
  537. CompanyId: user.CompanyId,
  538. CompanyName: user.CompanyName,
  539. RealName: user.RealName,
  540. SellerName: sellerName,
  541. CreateTime: time.Now(),
  542. ModifyTime: time.Now(),
  543. RegisterPlatform: utils.REGISTER_PLATFORM,
  544. YanxuanSpecialId: req.Id,
  545. }
  546. _, err = models.AddCygxYanxuanSpecialCollect(&item)
  547. if err != nil {
  548. br.Msg = "新增失败"
  549. br.ErrMsg = "新增失败,Err:" + err.Error()
  550. return
  551. }
  552. br.Msg = "收藏成功"
  553. } else {
  554. err = models.DelCygxYanxuanSpecialCollect(user.UserId, req.Id)
  555. if err != nil {
  556. br.Msg = "删除失败"
  557. br.ErrMsg = "删除失败,Err:" + err.Error()
  558. return
  559. }
  560. br.Msg = "取消收藏成功"
  561. }
  562. go services.UdpateYanxuanSpecialCollect(req.Id)
  563. br.Ret = 200
  564. br.Success = true
  565. }
  566. // @Title 专栏内容中心
  567. // @Description 专栏内容中心
  568. // @Param request body help_doc.AddHelpDocReq true "type json string"
  569. // @Success 200 {object} models.AddEnglishReportResp
  570. // @router /center [get]
  571. func (this *YanxuanSpecialController) Center() {
  572. br := new(models.BaseResponse).Init()
  573. defer func() {
  574. this.Data["json"] = br
  575. this.ServeJSON()
  576. }()
  577. sysUser := this.User
  578. if sysUser == nil {
  579. br.Msg = "请登录"
  580. br.ErrMsg = "请登录,SysUser Is Empty"
  581. br.Ret = 408
  582. return
  583. }
  584. // 1:未发布,2:审核中 3:已发布 4:驳回
  585. status, _ := this.GetInt("Status", 0)
  586. if status <= 0 {
  587. br.Msg = "参数错误"
  588. br.ErrMsg = "参数错误"
  589. return
  590. }
  591. var condition string
  592. var pars []interface{}
  593. condition += ` AND a.user_id = ? `
  594. pars = append(pars, sysUser.UserId)
  595. condition += ` AND a.status = ? `
  596. pars = append(pars, status)
  597. list, tmpErr := models.GetYanxuanSpecialList(sysUser.UserId, condition, pars, 0, 0)
  598. if tmpErr != nil {
  599. br.Msg = "获取失败"
  600. br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
  601. return
  602. }
  603. for _, v := range list {
  604. //如果在web端有样式或者上传了文件,小程序就禁止编辑修改内容
  605. hasStyle, err := utils.ArticleHasStyle(v.Content)
  606. if err != nil {
  607. return
  608. }
  609. hasImg, err := utils.ArticleHasImgUrl(v.Content)
  610. if err != nil {
  611. return
  612. }
  613. if hasStyle || strings.Contains(v.DocUrl, "http") || hasImg {
  614. v.ContentHasStyle = true
  615. }
  616. }
  617. br.Data = list
  618. br.Ret = 200
  619. br.Success = true
  620. br.Msg = "获取成功"
  621. }
  622. // @Title 专栏点击记录
  623. // @Description 专栏点击记录
  624. // @Param request body models.AddCygxYanxuanSpecialRecordReq true "type json string"
  625. // @router /record [post]
  626. func (this *YanxuanSpecialController) Record() {
  627. br := new(models.BaseResponse).Init()
  628. defer func() {
  629. this.Data["json"] = br
  630. this.ServeJSON()
  631. }()
  632. user := this.User
  633. if user == nil {
  634. br.Msg = "请重新登录"
  635. br.Ret = 408
  636. return
  637. }
  638. var req models.AddCygxYanxuanSpecialRecordReq
  639. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  640. if err != nil {
  641. br.Msg = "参数解析异常!"
  642. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  643. return
  644. }
  645. specialId := req.SpecialId
  646. stopTime := req.StopTime
  647. if req.SpecialId <= 0 {
  648. br.Msg = "文章不存在"
  649. br.ErrMsg = "文章不存在,文章ID错误"
  650. return
  651. }
  652. err = services.AddSpecialRecord(this.User, specialId, stopTime)
  653. if err != nil {
  654. br.Msg = "记录失败"
  655. br.ErrMsg = "记录失败,Err:" + err.Error()
  656. return
  657. }
  658. br.Ret = 200
  659. br.Success = true
  660. br.Msg = "记录成功"
  661. }
  662. // @Title 研选专栏关注
  663. // @Description 研选专栏关注
  664. // @Param request body help_doc.AddHelpDocReq true "type json string"
  665. // @Success 200 {object} models.AddEnglishReportResp
  666. // @router /follow [post]
  667. func (this *YanxuanSpecialController) Follow() {
  668. br := new(models.BaseResponse).Init()
  669. defer func() {
  670. this.Data["json"] = br
  671. this.ServeJSON()
  672. }()
  673. user := this.User
  674. if user == nil {
  675. br.Msg = "请登录"
  676. br.ErrMsg = "请登录,SysUser Is Empty"
  677. br.Ret = 408
  678. return
  679. }
  680. var req models.FollowCygxYanxuanSpecialReq
  681. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  682. if err != nil {
  683. br.Msg = "参数解析异常!"
  684. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  685. return
  686. }
  687. if req.FollowUserId <= 0 {
  688. br.Msg = "被关注的用户id"
  689. return
  690. }
  691. if req.Status <= 0 {
  692. br.Msg = "参数错误"
  693. return
  694. }
  695. var sellerName string
  696. sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  697. if err != nil {
  698. br.Msg = "查询栏目详情失败!"
  699. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  700. return
  701. }
  702. sellerName = sellerItemQy.RealName
  703. if req.Status == 1 {
  704. item := models.CygxYanxuanSpecialFollow{
  705. UserId: user.UserId,
  706. FollowUserId: req.FollowUserId,
  707. Mobile: user.Mobile,
  708. Email: user.Email,
  709. CompanyId: user.CompanyId,
  710. CompanyName: user.CompanyName,
  711. RealName: user.RealName,
  712. SellerName: sellerName,
  713. CreateTime: time.Now(),
  714. ModifyTime: time.Now(),
  715. RegisterPlatform: utils.REGISTER_PLATFORM,
  716. YanxuanSpecialId: req.SpecialId,
  717. }
  718. err = models.AddCygxYanxuanSpecialFollow(&item)
  719. if err != nil {
  720. br.Msg = "新增失败"
  721. br.ErrMsg = "新增失败,Err:" + err.Error()
  722. return
  723. }
  724. br.Msg = "关注成功"
  725. } else {
  726. err = models.DelCygxYanxuanSpecialFollow(user.UserId, req.FollowUserId)
  727. if err != nil {
  728. br.Msg = "删除失败"
  729. br.ErrMsg = "删除失败,Err:" + err.Error()
  730. return
  731. }
  732. br.Msg = "取消关注成功"
  733. }
  734. go services.UdpateYanxuanSpecialFansNum(req.FollowUserId)
  735. br.Ret = 200
  736. br.Success = true
  737. }
  738. // @Title 行业标签搜索
  739. // @Description 行业标签搜索
  740. // @Param request body help_doc.AddHelpDocReq true "type json string"
  741. // @Success 200 {object} models.AddEnglishReportResp
  742. // @router /industrySearch [get]
  743. func (this *YanxuanSpecialController) IndustrySearch() {
  744. br := new(models.BaseResponse).Init()
  745. defer func() {
  746. this.Data["json"] = br
  747. this.ServeJSON()
  748. }()
  749. sysUser := this.User
  750. if sysUser == nil {
  751. br.Msg = "请登录"
  752. br.ErrMsg = "请登录,SysUser Is Empty"
  753. br.Ret = 408
  754. return
  755. }
  756. keyword := this.GetString("Keyword")
  757. list, tmpErr := models.GetYanxuanSpecialIndustry(keyword)
  758. if tmpErr != nil {
  759. br.Msg = "获取失败"
  760. br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
  761. return
  762. }
  763. br.Data = list
  764. br.Ret = 200
  765. br.Success = true
  766. br.Msg = "获取成功"
  767. }
  768. // @Title 公司标签搜索
  769. // @Description 公司标签搜索
  770. // @Param request body help_doc.AddHelpDocReq true "type json string"
  771. // @Success 200 {object} models.AddEnglishReportResp
  772. // @router /companySearch [get]
  773. func (this *YanxuanSpecialController) CompanySearch() {
  774. br := new(models.BaseResponse).Init()
  775. defer func() {
  776. this.Data["json"] = br
  777. this.ServeJSON()
  778. }()
  779. sysUser := this.User
  780. if sysUser == nil {
  781. br.Msg = "请登录"
  782. br.ErrMsg = "请登录,SysUser Is Empty"
  783. br.Ret = 408
  784. return
  785. }
  786. keyword := this.GetString("Keyword")
  787. if keyword == "" {
  788. br.Ret = 200
  789. return
  790. }
  791. list, tmpErr := models.GetYanxuanSpecialCompany(keyword)
  792. if tmpErr != nil {
  793. br.Msg = "获取失败"
  794. br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
  795. return
  796. }
  797. br.Data = list
  798. br.Ret = 200
  799. br.Success = true
  800. br.Msg = "获取成功"
  801. }
  802. // @Title 专栏取消发布
  803. // @Description 专栏取消发布
  804. // @Param request body help_doc.AddHelpDocReq true "type json string"
  805. // @Success 200 {object} models.AddEnglishReportResp
  806. // @router /cancel [post]
  807. func (this *YanxuanSpecialController) Cancel() {
  808. br := new(models.BaseResponse).Init()
  809. defer func() {
  810. this.Data["json"] = br
  811. this.ServeJSON()
  812. }()
  813. sysUser := this.User
  814. if sysUser == nil {
  815. br.Msg = "请登录"
  816. br.ErrMsg = "请登录,SysUser Is Empty"
  817. br.Ret = 408
  818. return
  819. }
  820. var req models.CancelPublishCygxYanxuanSpecialReq
  821. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  822. if err != nil {
  823. br.Msg = "参数解析异常!"
  824. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  825. return
  826. }
  827. if req.Id <= 0 {
  828. br.Msg = "文章id错误"
  829. return
  830. }
  831. specialItem, err := models.GetYanxuanSpecialItemById(req.Id)
  832. if err != nil {
  833. br.Msg = "专栏取消发布失败"
  834. br.ErrMsg = "专栏取消发布失败,Err:" + err.Error()
  835. return
  836. }
  837. if tmpErr := models.CancelPublishYanxuanSpecial(req.Id); tmpErr != nil {
  838. br.Msg = "取消发布失败"
  839. br.ErrMsg = "取消发布失败, Err:" + tmpErr.Error()
  840. return
  841. }
  842. go services.UpdateYanxuanSpecialResourceData(req.Id) // 写入首页最新 cygx_resource_data 表
  843. go services.EsAddYanxuanSpecial(req.Id) // 写入es 综合搜索
  844. go services.UdpateYanxuanSpecialauthorArticleNum(specialItem.UserId) // 更新作者发布文章的数量
  845. br.Msg = "取消发布成功"
  846. br.Ret = 200
  847. br.Success = true
  848. }
  849. // @Title 作者列表
  850. // @Description 作者列表
  851. // @Param PageSize query int true "每页数据条数"
  852. // @Param CurrentIndex query int true "当前页页码,从1开始"
  853. // @Success 200 {object} models.AddEnglishReportResp
  854. // @router /author/list [get]
  855. func (this *YanxuanSpecialController) AuthorList() {
  856. br := new(models.BaseResponse).Init()
  857. defer func() {
  858. this.Data["json"] = br
  859. this.ServeJSON()
  860. }()
  861. sysUser := this.User
  862. if sysUser == nil {
  863. br.Msg = "请登录"
  864. br.ErrMsg = "请登录,SysUser Is Empty"
  865. br.Ret = 408
  866. return
  867. }
  868. pageSize, _ := this.GetInt("PageSize")
  869. currentIndex, _ := this.GetInt("CurrentIndex")
  870. var startSize int
  871. if pageSize <= 0 {
  872. pageSize = utils.PageSize20
  873. }
  874. if currentIndex <= 0 {
  875. currentIndex = 1
  876. }
  877. startSize = utils.StartIndex(currentIndex, pageSize)
  878. var condition string
  879. var pars []interface{}
  880. condition += ` AND a.nick_name <> '' `
  881. total, err := models.GetCygxYanxuanSpecialAuthorCount(condition, pars)
  882. if err != nil {
  883. br.Msg = "获取失败"
  884. br.ErrMsg = "获取失败,Err:" + err.Error()
  885. return
  886. }
  887. condition += ` ORDER BY latest_publish_time DESC`
  888. list, tmpErr := models.GetYanxuanSpecialAuthorList(condition, pars, startSize, pageSize)
  889. if tmpErr != nil {
  890. br.Msg = "获取失败"
  891. br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
  892. return
  893. }
  894. var userIds []int
  895. for _, v := range list {
  896. v.LatestPublishDate = v.LatestPublishTime.Format(utils.FormatDate) + "更新"
  897. userIds = append(userIds, v.UserId)
  898. }
  899. bestNew := services.GetBestNewYanxuanSpecialByUserId(userIds)
  900. for _, v := range list {
  901. v.YanxuanSpecialCenter = bestNew[v.UserId]
  902. }
  903. resp := new(models.SpecialAuthorListResp)
  904. isAuthor, _ := services.GetYanxuanSpecialAuthorInfo(sysUser) //用户是否没开通研选专栏以及,专栏信息是否完善
  905. resp.IsAuthor = isAuthor
  906. page := paging.GetPaging(currentIndex, pageSize, total)
  907. resp.List = list
  908. resp.Paging = page
  909. br.Data = resp
  910. br.Ret = 200
  911. br.Success = true
  912. br.Msg = "获取成功"
  913. }
  914. // @Title 更新作者头像
  915. // @Description 更新作者头像
  916. // @Param request body help_doc.AddHelpDocReq true "type json string"
  917. // @Success 200 {object} models.AddEnglishReportResp
  918. // @router /author/head_img [post]
  919. func (this *YanxuanSpecialController) AuthorHeadImg() {
  920. br := new(models.BaseResponse).Init()
  921. defer func() {
  922. this.Data["json"] = br
  923. this.ServeJSON()
  924. }()
  925. sysUser := this.User
  926. if sysUser == nil {
  927. br.Msg = "请登录"
  928. br.ErrMsg = "请登录,SysUser Is Empty"
  929. br.Ret = 408
  930. return
  931. }
  932. var req models.SaveCygxYanxuanSpecialAuthoHeadImgrReq
  933. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  934. if err != nil {
  935. br.Msg = "参数解析异常!"
  936. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  937. return
  938. }
  939. if req.UserId <= 0 {
  940. br.Msg = "用户id有误"
  941. return
  942. }
  943. if req.HeadImg == "" {
  944. br.Msg = "头像图片错误"
  945. return
  946. }
  947. item := models.CygxYanxuanSpecialAuthor{
  948. UserId: req.UserId,
  949. HeadImg: req.HeadImg,
  950. }
  951. err = models.UpdateYanxuanSpecialAuthorHeadImg(&item)
  952. if err != nil {
  953. br.Msg = "保存失败"
  954. br.ErrMsg = "保存失败,Err:" + err.Error()
  955. return
  956. }
  957. br.Ret = 200
  958. br.Success = true
  959. br.Msg = "保存成功"
  960. }
  961. // @Title 删除专栏
  962. // @Description 删除专栏
  963. // @Param request body help_doc.AddHelpDocReq true "type json string"
  964. // @Success 200 {object} models.AddEnglishReportResp
  965. // @router /del [post]
  966. func (this *YanxuanSpecialController) Delete() {
  967. br := new(models.BaseResponse).Init()
  968. defer func() {
  969. this.Data["json"] = br
  970. this.ServeJSON()
  971. }()
  972. sysUser := this.User
  973. if sysUser == nil {
  974. br.Msg = "请登录"
  975. br.ErrMsg = "请登录,SysUser Is Empty"
  976. br.Ret = 408
  977. return
  978. }
  979. var req models.EnableCygxYanxuanSpecialReq
  980. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  981. if err != nil {
  982. br.Msg = "参数解析异常!"
  983. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  984. return
  985. }
  986. if req.Id <= 0 {
  987. br.Msg = "文章id错误"
  988. return
  989. }
  990. if tmpErr := models.DelYanxuanSpecial(req.Id); tmpErr != nil {
  991. br.Msg = "删除失败"
  992. br.ErrMsg = "删除失败, Err:" + tmpErr.Error()
  993. return
  994. }
  995. br.Msg = "删除成功"
  996. br.Ret = 200
  997. br.Success = true
  998. }
  999. // @Title 专栏文章敏感词检测
  1000. // @Description 专栏文章敏感词检测
  1001. // @Param request body help_doc.AddHelpDocReq true "type json string"
  1002. // @Success 200 {object} models.AddEnglishReportResp
  1003. // @router /check [post]
  1004. func (this *YanxuanSpecialController) Check() {
  1005. br := new(models.BaseResponse).Init()
  1006. defer func() {
  1007. this.Data["json"] = br
  1008. this.ServeJSON()
  1009. }()
  1010. sysUser := this.User
  1011. if sysUser == nil {
  1012. br.Msg = "请登录"
  1013. br.ErrMsg = "请登录,SysUser Is Empty"
  1014. br.Ret = 408
  1015. return
  1016. }
  1017. var req models.CygxYanxuanSpecialCheckReq
  1018. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1019. if err != nil {
  1020. br.Msg = "参数解析异常!"
  1021. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1022. return
  1023. }
  1024. if req.Content == "" {
  1025. br.Ret = 200
  1026. br.Success = true
  1027. br.Msg = "校验成功"
  1028. }
  1029. itemToken, err := services.WxGetToken()
  1030. if err != nil {
  1031. br.Msg = "GetWxAccessToken Err:" + err.Error()
  1032. return
  1033. }
  1034. if itemToken.AccessToken == "" {
  1035. br.Msg = "accessToken is empty"
  1036. return
  1037. }
  1038. suggest := models.WxCheckContent(itemToken.AccessToken, sysUser.OpenId, req.Content)
  1039. if suggest == "risky" {
  1040. br.Msg = "文章内容含有违法违规内容"
  1041. br.ErrMsg = "文章内容含有违法违规内容"
  1042. return
  1043. }
  1044. if len(req.ImgUrl) > 0 {
  1045. //for _, imgUrl := range req.ImgUrl {
  1046. // imgBody, err := http.Get(imgUrl)
  1047. // if err != nil {
  1048. // br.Msg = "图片链接有误"
  1049. // br.ErrMsg = "图片链接有误"
  1050. // return
  1051. // }
  1052. // rnStr := utils.GetRandStringNoSpecialChar(5)
  1053. // savePath := time.Now().Format(utils.FormatDateTimeUnSpace) + rnStr + ".jpg"
  1054. // err = file.SaveFile(imgBody, savePath)
  1055. // if err != nil {
  1056. // br.Msg = "保存图片错误"
  1057. // br.ErrMsg = "保存图片错误"
  1058. // return
  1059. // }
  1060. // res, err := weapp.IMGSecCheck(itemToken.AccessToken, savePath)
  1061. // if err != nil {
  1062. // // 处理一般错误信息
  1063. // br.Msg = "图片内容含有违法违规内容"
  1064. // br.ErrMsg = "图片内容含有违法违规内容"
  1065. // return
  1066. // }
  1067. // if err := res.GetResponseError(); err != nil {
  1068. // // 处理微信返回错误信息
  1069. // return
  1070. // }
  1071. // err = os.RemoveAll(savePath)
  1072. // if err != nil {
  1073. // return
  1074. // }
  1075. //}
  1076. }
  1077. br.Ret = 200
  1078. br.Success = true
  1079. br.Msg = "校验成功"
  1080. }
  1081. // @Title 上传文章阅读时间
  1082. // @Description 上传文章阅读时间接口
  1083. // @Param request body models.AddStopTimeRep true "type json string"
  1084. // @Success 200 {object} models.ArticleDetailResp
  1085. // @router /addStopTimedel [post]
  1086. func (this *YanxuanSpecialController) AddStopTime() {
  1087. br := new(models.BaseResponse).Init()
  1088. defer func() {
  1089. this.Data["json"] = br
  1090. this.ServeJSON()
  1091. }()
  1092. user := this.User
  1093. if user == nil {
  1094. br.Msg = "请登录"
  1095. br.ErrMsg = "请登录,用户信息为空"
  1096. br.Ret = 408
  1097. return
  1098. }
  1099. var req models.AddStopTimeRep
  1100. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1101. if err != nil {
  1102. br.Msg = "参数解析异常!"
  1103. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1104. return
  1105. }
  1106. uid := user.UserId
  1107. articleId := req.ArticleId
  1108. stopTime := req.StopTime
  1109. outType := req.OutType
  1110. source := req.Source
  1111. if articleId <= 0 {
  1112. br.Msg = "参数错误"
  1113. br.ErrMsg = "参数错误"
  1114. return
  1115. }
  1116. if stopTime == 0 {
  1117. stopTime = 1
  1118. }
  1119. if outType != 2 {
  1120. outType = 1
  1121. }
  1122. if source != "PC" {
  1123. source = "MOBILE"
  1124. }
  1125. detail := new(models.ArticleDetail)
  1126. hasPermission := 0
  1127. hasFree := 0
  1128. //判断是否已经申请过
  1129. applyCount, err := models.GetApplyRecordCount(uid)
  1130. if err != nil && err.Error() != utils.ErrNoRow() {
  1131. br.Msg = "获取信息失败"
  1132. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  1133. return
  1134. }
  1135. //`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
  1136. if user.CompanyId > 1 {
  1137. companyPermission, err := models.GetCompanyPermission(user.CompanyId)
  1138. if err != nil {
  1139. br.Msg = "获取信息失败"
  1140. br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  1141. return
  1142. }
  1143. detail, err = models.GetArticleDetailById(articleId)
  1144. if err != nil {
  1145. br.Msg = "获取信息失败"
  1146. br.ErrMsg = "获取文章信息失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  1147. return
  1148. }
  1149. if companyPermission == "" {
  1150. if applyCount > 0 {
  1151. hasPermission = 5
  1152. } else {
  1153. hasPermission = 2
  1154. }
  1155. hasFree = 2
  1156. goto Loop
  1157. } else {
  1158. hasFree = 1
  1159. var articlePermissionPermissionName string
  1160. if detail.CategoryId > 0 {
  1161. articlePermission, err := models.GetArticlePermission(detail.CategoryId)
  1162. if err != nil {
  1163. br.Msg = "获取信息失败"
  1164. br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  1165. return
  1166. }
  1167. if articlePermission == nil {
  1168. br.Msg = "获取信息失败"
  1169. br.ErrMsg = "报告权限不存在,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  1170. return
  1171. }
  1172. articlePermissionPermissionName = articlePermission.PermissionName
  1173. } else {
  1174. articlePermissionPermissionName = detail.CategoryName
  1175. }
  1176. var hasPersion bool
  1177. slice := strings.Split(articlePermissionPermissionName, ",")
  1178. for _, v := range slice {
  1179. if strings.Contains(companyPermission, v) {
  1180. hasPersion = true
  1181. }
  1182. }
  1183. if hasPersion {
  1184. go services.ArticleHistoryStopTime(articleId, stopTime, outType, user)
  1185. } else { //无该行业权限
  1186. hasPermission = 3
  1187. }
  1188. }
  1189. } else { //潜在客户
  1190. if applyCount > 0 {
  1191. hasPermission = 5
  1192. } else {
  1193. hasPermission = 4
  1194. }
  1195. }
  1196. Loop:
  1197. resp := new(models.ArticleDetailAddStopTimeRep)
  1198. resp.HasPermission = hasPermission
  1199. resp.HasFree = hasFree
  1200. br.Ret = 200
  1201. br.Success = true
  1202. br.Msg = "操作成功"
  1203. br.Data = resp
  1204. }