article.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "hongze/hongze_cygx/models"
  5. "hongze/hongze_cygx/services"
  6. "hongze/hongze_cygx/utils"
  7. "html"
  8. "regexp"
  9. "strconv"
  10. "strings"
  11. "time"
  12. )
  13. type ArticleController struct {
  14. BaseAuthController
  15. }
  16. type ArticleCommonController struct {
  17. BaseCommonController
  18. }
  19. // @Title 获取报告详情
  20. // @Description 获取报告详情接口
  21. // @Param ArticleId query int true "报告ID"
  22. // @Success 200 {object} models.ArticleDetailResp
  23. // @router /detail [get]
  24. func (this *ArticleController) Detail() {
  25. br := new(models.BaseResponse).Init()
  26. defer func() {
  27. this.Data["json"] = br
  28. this.ServeJSON()
  29. }()
  30. user := this.User
  31. if user == nil {
  32. br.Msg = "请登录"
  33. br.ErrMsg = "请登录,用户信息为空"
  34. br.Ret = 408
  35. return
  36. }
  37. uid := user.UserId
  38. articleId, err := this.GetInt("ArticleId")
  39. if articleId <= 0 {
  40. br.Msg = "文章不存在"
  41. br.ErrMsg = "文章不存在,文章ID错误"
  42. return
  43. }
  44. detail := new(models.ArticleDetail)
  45. hasPermission := 0
  46. hasFree := 0
  47. //判断是否已经申请过
  48. applyCount, err := models.GetApplyRecordCount(uid)
  49. if err != nil && err.Error() != utils.ErrNoRow() {
  50. br.Msg = "获取信息失败"
  51. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  52. return
  53. }
  54. //`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
  55. if user.CompanyId > 1 {
  56. companyPermission, err := models.GetCompanyPermission(user.CompanyId)
  57. if err != nil {
  58. br.Msg = "获取信息失败"
  59. br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  60. return
  61. }
  62. detail, err = models.GetArticleDetailById(articleId)
  63. if err != nil {
  64. br.Msg = "获取信息失败"
  65. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  66. return
  67. }
  68. detail.Body = html.UnescapeString(detail.Body)
  69. //detail.Abstract = html.UnescapeString(detail.Abstract)
  70. detail.Abstract, _ = services.GetReportContentTextSub(detail.Abstract)
  71. if companyPermission == "" {
  72. if applyCount > 0 {
  73. hasPermission = 5
  74. } else {
  75. hasPermission = 2
  76. }
  77. hasFree = 2
  78. goto Loop
  79. } else {
  80. hasFree = 1
  81. // 原有的权限校验 更改于 2021-05-18
  82. //articlePermission, err := models.GetArticlePermission(detail.SubCategoryName)
  83. //fmt.Println(articlePermission)
  84. //fmt.Println(detail.SubCategoryName)
  85. //if err != nil {
  86. // br.Msg = "获取信息失败"
  87. // br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  88. // return
  89. //}
  90. //if articlePermission == nil {
  91. // br.Msg = "获取信息失败"
  92. // br.ErrMsg = "报告权限不存在,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  93. // return
  94. //}
  95. //for _, p := range articlePermission {
  96. // if strings.Contains(companyPermission, p.PermissionName) {
  97. // hasPermission = 1
  98. // historyRecord := new(models.CygxArticleHistoryRecord)
  99. // historyRecord.UserId = uid
  100. // historyRecord.ArticleId = articleId
  101. // historyRecord.CreateTime = time.Now()
  102. // historyRecord.Mobile = user.Mobile
  103. // historyRecord.Email = user.Email
  104. // historyRecord.CompanyId = user.CompanyId
  105. // historyRecord.CompanyName = user.CompanyName
  106. // go models.AddCygxArticleHistoryRecord(historyRecord)
  107. // break
  108. // } else { //无该行业权限
  109. // hasPermission = 3
  110. // }
  111. //}
  112. var articlePermissionPermissionName string
  113. if detail.CategoryId > 0 {
  114. articlePermission, err := models.GetArticlePermission(detail.CategoryId)
  115. if err != nil {
  116. br.Msg = "获取信息失败"
  117. br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  118. return
  119. }
  120. if articlePermission == nil {
  121. br.Msg = "获取信息失败"
  122. br.ErrMsg = "报告权限不存在,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  123. return
  124. }
  125. articlePermissionPermissionName = articlePermission.PermissionName
  126. } else {
  127. articlePermissionPermissionName = detail.CategoryName
  128. }
  129. if strings.Contains(companyPermission, articlePermissionPermissionName) {
  130. hasPermission = 1
  131. historyRecord := new(models.CygxArticleHistoryRecord)
  132. historyRecord.UserId = uid
  133. historyRecord.ArticleId = articleId
  134. historyRecord.CreateTime = time.Now()
  135. historyRecord.Mobile = user.Mobile
  136. historyRecord.Email = user.Email
  137. historyRecord.CompanyId = user.CompanyId
  138. historyRecord.CompanyName = user.CompanyName
  139. recordCount, _ := models.GetNoAddStoptimeArticleCount(uid, articleId)
  140. if recordCount == 0 {
  141. go models.AddCygxArticleHistoryRecord(historyRecord)
  142. } else {
  143. detailNew, err := models.GetNewArticleHistoryRecord(uid, articleId)
  144. if err != nil {
  145. br.Msg = "获取信息失败"
  146. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  147. return
  148. }
  149. if detailNew.StopTime > 0 {
  150. go models.AddCygxArticleHistoryRecord(historyRecord)
  151. }
  152. }
  153. } else { //无该行业权限
  154. hasPermission = 3
  155. }
  156. if hasPermission == 1 {
  157. key := "CYGX_ARTICLE_" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
  158. if !utils.Rc.IsExist(key) {
  159. //新增浏览记录
  160. record := new(models.CygxArticleViewRecord)
  161. record.UserId = uid
  162. record.ArticleId = articleId
  163. record.CreateTime = time.Now()
  164. record.Mobile = user.Mobile
  165. record.Email = user.Email
  166. record.CompanyId = user.CompanyId
  167. record.CompanyName = user.CompanyName
  168. go models.AddCygxArticleViewRecord(record)
  169. utils.Rc.Put(key, 1, 5*time.Second)
  170. models.ModifyReportLastViewTime(uid)
  171. }
  172. }
  173. }
  174. collectCount, err := models.GetArticleCollectCount(uid, articleId)
  175. if err != nil && err.Error() != utils.ErrNoRow() {
  176. br.Msg = "获取信息失败"
  177. br.ErrMsg = "判断是否已收藏失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  178. return
  179. }
  180. if collectCount > 0 {
  181. detail.IsCollect = true
  182. }
  183. interviewApplyItem, err := models.GetArticleInterviewApply(uid, articleId)
  184. if err != nil && err.Error() != utils.ErrNoRow() {
  185. br.Msg = "获取信息失败"
  186. br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  187. return
  188. }
  189. if interviewApplyItem != nil && interviewApplyItem.InterviewApplyId > 0 {
  190. detail.IsInterviewApply = true
  191. detail.InterviewApplyStatus = interviewApplyItem.Status
  192. }
  193. //获取销售手机号
  194. sellerItem, err := models.GetSellerByCompanyId(user.CompanyId)
  195. if err != nil {
  196. br.Msg = "获取信息失败"
  197. br.ErrMsg = "获取销售数据失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  198. return
  199. }
  200. if sellerItem != nil {
  201. detail.SellerMobile = sellerItem.Mobile
  202. detail.SellerName = sellerItem.RealName
  203. }
  204. sellerList, err := models.GetSellerList(articleId)
  205. if err != nil {
  206. br.Msg = "获取信息失败"
  207. br.ErrMsg = "获取销售数据失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  208. return
  209. }
  210. if detail.ArticleId > 1000000 {
  211. var hrefRegexp = regexp.MustCompile("[0-9]\\d*")
  212. match := hrefRegexp.FindAllString(detail.SellerAndMobile, -1)
  213. if match != nil {
  214. for _, v := range match {
  215. sellerAndMobile := &models.SellerRep{
  216. SellerMobile: v,
  217. SellerName: strings.Replace(detail.SellerAndMobile, v, "", -1),
  218. }
  219. sellerList = append(sellerList, sellerAndMobile)
  220. }
  221. }
  222. }
  223. detail.SellerList = sellerList
  224. } else { //潜在客户
  225. if applyCount > 0 {
  226. hasPermission = 5
  227. } else {
  228. hasPermission = 4
  229. }
  230. }
  231. Loop:
  232. if hasPermission != 1 {
  233. detail.Body = ""
  234. detail.BodyText = ""
  235. }
  236. resp := new(models.ArticleDetailResp)
  237. resp.HasPermission = hasPermission
  238. resp.HasFree = hasFree
  239. resp.Detail = detail
  240. br.Ret = 200
  241. br.Success = true
  242. br.Msg = "获取成功"
  243. br.Data = resp
  244. }
  245. // @Title 收藏
  246. // @Description 收藏
  247. // @Param request body models.ArticleCollectReq true "type json string"
  248. // @Success 200 {object} models.FontsCollectResp
  249. // @router /collect [post]
  250. func (this *ArticleController) ArticleCollect() {
  251. br := new(models.BaseResponse).Init()
  252. defer func() {
  253. this.Data["json"] = br
  254. this.ServeJSON()
  255. }()
  256. user := this.User
  257. if user == nil {
  258. br.Msg = "请重新登录"
  259. br.Ret = 408
  260. return
  261. }
  262. uid := user.UserId
  263. var req models.ArticleCollectReq
  264. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  265. if err != nil {
  266. br.Msg = "参数解析异常!"
  267. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  268. return
  269. }
  270. count, err := models.GetArticleCollectCount(uid, req.ArticleId)
  271. if err != nil {
  272. br.Msg = "获取数据失败!"
  273. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  274. return
  275. }
  276. resp := new(models.ArticleCollectResp)
  277. if count <= 0 {
  278. item := new(models.CygxArticleCollect)
  279. item.ArticleId = req.ArticleId
  280. item.UserId = uid
  281. item.CreateTime = time.Now()
  282. _, err = models.AddCygxArticleCollect(item)
  283. if err != nil {
  284. br.Msg = "收藏失败"
  285. br.ErrMsg = "收藏失败,Err:" + err.Error()
  286. return
  287. }
  288. br.Msg = "收藏成功"
  289. resp.Status = 1
  290. } else {
  291. err = models.RemoveArticleCollect(uid, req.ArticleId)
  292. if err != nil {
  293. br.Msg = "取消收藏失败"
  294. br.ErrMsg = "取消收藏失败,Err:" + err.Error()
  295. return
  296. }
  297. br.Msg = "已取消收藏"
  298. resp.Status = 2
  299. }
  300. collectTotal, err := models.GetArticleCollectUsersCount(req.ArticleId)
  301. if err != nil {
  302. br.Msg = "获取数据失败"
  303. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  304. return
  305. }
  306. resp.CollectCount = collectTotal
  307. br.Ret = 200
  308. br.Success = true
  309. br.Data = resp
  310. }
  311. // @Title 访谈申请
  312. // @Description 访谈申请
  313. // @Param request body models.ArticleInterviewApplyReq true "type json string"
  314. // @Success 200 {object} models.FontsCollectResp
  315. // @router /interview/apply [post]
  316. func (this *ArticleController) InterviewApply() {
  317. br := new(models.BaseResponse).Init()
  318. defer func() {
  319. this.Data["json"] = br
  320. this.ServeJSON()
  321. }()
  322. user := this.User
  323. if user == nil {
  324. br.Msg = "请重新登录"
  325. br.Ret = 408
  326. return
  327. }
  328. uid := user.UserId
  329. var req models.ArticleInterviewApplyReq
  330. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  331. if err != nil {
  332. br.Msg = "参数解析异常!"
  333. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  334. return
  335. }
  336. article, err := models.GetArticleDetailById(req.ArticleId)
  337. if err != nil {
  338. br.Msg = "获取纪要失败!"
  339. br.ErrMsg = "获取纪要失败,Err:" + err.Error()
  340. return
  341. }
  342. count, err := models.GetArticleInterviewApplyCount(uid, req.ArticleId)
  343. if err != nil {
  344. br.Msg = "获取数据失败!"
  345. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  346. return
  347. }
  348. resp := new(models.ArticleInterviewApplyResp)
  349. if count <= 0 {
  350. item := new(models.CygxInterviewApply)
  351. item.ArticleId = req.ArticleId
  352. item.UserId = uid
  353. item.CompanyId = user.CompanyId
  354. item.Status = "待邀请"
  355. item.Sort = 1
  356. item.ArticleTitle = article.Title
  357. item.CreateTime = time.Now()
  358. item.ModifyTime = time.Now()
  359. item.ArticleIdMd5 = article.ArticleIdMd5
  360. _, err = models.AddCygxInterviewApply(item)
  361. if err != nil {
  362. br.Msg = "申请失败"
  363. br.ErrMsg = "申请失败,Err:" + err.Error()
  364. return
  365. }
  366. br.Msg = "申请成功"
  367. resp.Status = 1
  368. //发送模板消息
  369. if user.CompanyId > 1 {
  370. mobile := user.Mobile
  371. if mobile == "" {
  372. mobile = user.Email
  373. }
  374. sellerItem, _ := models.GetSellerByCompanyId(user.CompanyId)
  375. if sellerItem != nil && sellerItem.AdminId > 0 && user.Mobile != "" {
  376. openIpItem, _ := models.GetUserRecordByUserId(sellerItem.UserId, 1)
  377. if openIpItem != nil && openIpItem.OpenId != "" {
  378. go services.SendInterviewApplyTemplateMsg(user.RealName, sellerItem.CompanyName, mobile, article.Title, openIpItem.OpenId)
  379. }
  380. }
  381. }
  382. } else {
  383. err = models.RemoveArticleInterviewApply(uid, req.ArticleId)
  384. if err != nil {
  385. br.Msg = "取消申请失败"
  386. br.ErrMsg = "取消申请失败,Err:" + err.Error()
  387. return
  388. }
  389. br.Msg = "已取消申请"
  390. resp.Status = 2
  391. if user.CompanyId > 1 {
  392. mobile := user.Mobile
  393. if mobile == "" {
  394. mobile = user.Email
  395. }
  396. sellerItem, _ := models.GetSellerByCompanyId(user.CompanyId)
  397. if sellerItem != nil && sellerItem.AdminId > 0 && user.Mobile != "" {
  398. openIpItem, _ := models.GetUserRecordByUserId(sellerItem.UserId, 1)
  399. if openIpItem != nil && openIpItem.OpenId != "" {
  400. go services.SendInterviewApplyCancelTemplateMsg(user.RealName, sellerItem.CompanyName, mobile, article.Title, openIpItem.OpenId)
  401. }
  402. }
  403. }
  404. }
  405. br.Ret = 200
  406. br.Success = true
  407. br.Data = resp
  408. }
  409. // @Title 获取报告详情
  410. // @Description 获取报告详情接口
  411. // @Param ArticleIdMd5 query int true "报告ID"
  412. // @Success 200 {object} models.ArticleDetailResp
  413. // @router /look/detail [get]
  414. func (this *ArticleCommonController) Detail() {
  415. br := new(models.BaseResponse).Init()
  416. defer func() {
  417. this.Data["json"] = br
  418. this.ServeJSON()
  419. }()
  420. articleIdMd5 := this.GetString("ArticleIdMd5")
  421. if articleIdMd5 == "" {
  422. br.Msg = "参数错误"
  423. br.ErrMsg = "参数错误"
  424. return
  425. }
  426. resp := new(models.ArticleDetailResp)
  427. detail, err := models.GetArticleDetailByIdMd5(articleIdMd5)
  428. if err != nil && err.Error() != utils.ErrNoRow() {
  429. br.Msg = "获取信息失败"
  430. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  431. return
  432. }
  433. if detail == nil {
  434. resp.HasPermission = 2
  435. } else {
  436. resp.HasPermission = 1
  437. }
  438. if detail != nil {
  439. detail.Body = html.UnescapeString(detail.Body)
  440. detail.Abstract = html.UnescapeString(detail.Abstract)
  441. }
  442. sellerList, err := models.GetSellerList(detail.ArticleId)
  443. if err != nil {
  444. br.Msg = "获取信息失败"
  445. br.ErrMsg = "获取销售数据失败,Err:" + err.Error() + ";articleId" + strconv.Itoa(detail.ArticleId)
  446. return
  447. }
  448. if detail.ArticleId > 1000000 {
  449. var hrefRegexp = regexp.MustCompile("[0-9]\\d*")
  450. match := hrefRegexp.FindAllString(detail.SellerAndMobile, -1)
  451. if match != nil {
  452. for _, v := range match {
  453. sellerAndMobile := &models.SellerRep{
  454. SellerMobile: v,
  455. SellerName: strings.Replace(detail.SellerAndMobile, v, "", -1),
  456. }
  457. sellerList = append(sellerList, sellerAndMobile)
  458. }
  459. }
  460. }
  461. detail.SellerList = sellerList
  462. resp.Detail = detail
  463. br.Ret = 200
  464. br.Success = true
  465. br.Msg = "获取成功"
  466. br.Data = resp
  467. }
  468. // @Title 上传文章阅读时间
  469. // @Description 上传文章阅读时间接口
  470. // @Param request body models.AddStopTimeRep true "type json string"
  471. // @Success 200 {object} models.ArticleDetailResp
  472. // @router /addStopTime [post]
  473. func (this *ArticleController) AddStopTime() {
  474. br := new(models.BaseResponse).Init()
  475. defer func() {
  476. this.Data["json"] = br
  477. this.ServeJSON()
  478. }()
  479. user := this.User
  480. if user == nil {
  481. br.Msg = "请登录"
  482. br.ErrMsg = "请登录,用户信息为空"
  483. br.Ret = 408
  484. return
  485. }
  486. var req models.AddStopTimeRep
  487. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  488. if err != nil {
  489. br.Msg = "参数解析异常!"
  490. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  491. return
  492. }
  493. uid := user.UserId
  494. articleId := req.ArticleId
  495. stopTime := req.StopTime
  496. if articleId <= 0 {
  497. br.Msg = "参数错误"
  498. br.ErrMsg = "参数错误"
  499. return
  500. }
  501. if stopTime == 0 {
  502. stopTime = 1
  503. //br.Msg = "时间格式错误"
  504. //br.ErrMsg = "时间错误"
  505. //return
  506. }
  507. detail := new(models.ArticleDetail)
  508. hasPermission := 0
  509. hasFree := 0
  510. //判断是否已经申请过
  511. applyCount, err := models.GetApplyRecordCount(uid)
  512. if err != nil && err.Error() != utils.ErrNoRow() {
  513. br.Msg = "获取信息失败"
  514. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  515. return
  516. }
  517. //`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
  518. if user.CompanyId > 1 {
  519. companyPermission, err := models.GetCompanyPermission(user.CompanyId)
  520. if err != nil {
  521. br.Msg = "获取信息失败"
  522. br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  523. return
  524. }
  525. detail, err = models.GetArticleDetailById(articleId)
  526. if err != nil {
  527. br.Msg = "获取信息失败"
  528. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  529. return
  530. }
  531. if companyPermission == "" {
  532. if applyCount > 0 {
  533. hasPermission = 5
  534. } else {
  535. hasPermission = 2
  536. }
  537. hasFree = 2
  538. goto Loop
  539. } else {
  540. hasFree = 1
  541. var articlePermissionPermissionName string
  542. if detail.CategoryId > 0 {
  543. articlePermission, err := models.GetArticlePermission(detail.CategoryId)
  544. if err != nil {
  545. br.Msg = "获取信息失败"
  546. br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  547. return
  548. }
  549. if articlePermission == nil {
  550. br.Msg = "获取信息失败"
  551. br.ErrMsg = "报告权限不存在,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  552. return
  553. }
  554. articlePermissionPermissionName = articlePermission.PermissionName
  555. } else {
  556. articlePermissionPermissionName = detail.CategoryName
  557. }
  558. if strings.Contains(companyPermission, articlePermissionPermissionName) {
  559. detailNew, err := models.GetNewArticleHistoryRecord(uid, articleId)
  560. if err != nil {
  561. br.Msg = "获取信息失败"
  562. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  563. return
  564. }
  565. hasPermission = 1
  566. historyRecord := new(models.AddStopTimeNewRep)
  567. historyRecord.StopTime = detailNew.StopTime + stopTime
  568. historyRecord.Id = detailNew.Id
  569. go models.AddArticleStopTime(historyRecord)
  570. } else { //无该行业权限
  571. hasPermission = 3
  572. }
  573. }
  574. } else { //潜在客户
  575. if applyCount > 0 {
  576. hasPermission = 5
  577. } else {
  578. hasPermission = 4
  579. }
  580. }
  581. Loop:
  582. resp := new(models.ArticleDetailAddStopTimeRep)
  583. resp.HasPermission = hasPermission
  584. resp.HasFree = hasFree
  585. br.Ret = 200
  586. br.Success = true
  587. br.Msg = "操作成功"
  588. br.Data = resp
  589. }