article.go 18 KB

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