yanxuan_special.go 33 KB

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