report.go 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "github.com/rdlucklib/rdluck_tools/paging"
  6. "hongze/hongze_cygx/models"
  7. "hongze/hongze_cygx/services"
  8. "hongze/hongze_cygx/utils"
  9. "html"
  10. "strconv"
  11. "strings"
  12. "time"
  13. )
  14. //报告
  15. type ReportController struct {
  16. BaseAuthController
  17. }
  18. type ReportCommonController struct {
  19. BaseCommonController
  20. }
  21. // @Title 行业报告分类列表接口
  22. // @Description 获取行业报告分类列表接口
  23. // @Param ChartPermissionId query int true "分类ID"
  24. // @Success 200 {object} models.IndustrialManagementList
  25. // @router /home/tradeList [get]
  26. func (this *ReportController) TradeList() {
  27. br := new(models.BaseResponse).Init()
  28. defer func() {
  29. this.Data["json"] = br
  30. this.ServeJSON()
  31. }()
  32. user := this.User
  33. if user == nil {
  34. br.Msg = "请重新登录"
  35. br.Ret = 408
  36. return
  37. }
  38. uid := user.UserId
  39. ChartPermissionId, _ := this.GetInt("ChartPermissionId")
  40. if ChartPermissionId < 1 {
  41. br.Msg = "请输入分类ID"
  42. return
  43. }
  44. list, err := models.GetTradeAll(ChartPermissionId)
  45. if err != nil {
  46. br.Msg = "获取信息失败"
  47. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  48. return
  49. }
  50. for k, v := range list {
  51. list[k].UpdateTime = utils.TimeRemoveHms(v.UpdateTime)
  52. count, err := models.CheckThisCategoryNewArticleIsRead(uid, v.CategoryId)
  53. if err != nil {
  54. br.Msg = "获取信息失败"
  55. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  56. return
  57. }
  58. if count == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.UpdateTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.UpdateTime)) {
  59. list[k].IsRed = true
  60. }
  61. }
  62. resp := new(models.TradeReportMappingResp)
  63. resp.List = list
  64. br.Ret = 200
  65. br.Success = true
  66. br.Msg = "获取成功"
  67. br.Data = resp
  68. }
  69. // @Title 产业报告分类列表接口
  70. // @Description 获取产业报告分类列表接口
  71. // @Param ChartPermissionId query int true "分类ID"
  72. // @Param IsNewLabel query string true "是否属于新标签,1是,0否"
  73. // @Param IsDeepLabel query string true "是否属于深标签,1是,0否"
  74. // @Param KeyWord query string true "搜索关键词"
  75. // @Param OrderColumn query int true "排序字段 ,NewTime 最近更新 ,Recommend弘则推荐"
  76. // @Param DeepCover query int false "深度覆盖:0-否;1-是"
  77. // @Param RecommendFocus query int false "推荐关注:0-否;1-是"
  78. // @Param PageSize query int true "每页数据条数"
  79. // @Param CurrentIndex query int true "当前页页码,从1开始"
  80. // @Success 200 {object} models.IndustrialManagementList
  81. // @router /home/industryList [get]
  82. func (this *ReportController) IndustryList() {
  83. br := new(models.BaseResponse).Init()
  84. defer func() {
  85. this.Data["json"] = br
  86. this.ServeJSON()
  87. }()
  88. user := this.User
  89. if user == nil {
  90. br.Msg = "请重新登录"
  91. br.Ret = 408
  92. return
  93. }
  94. uid := user.UserId
  95. fmt.Println(uid)
  96. ChartPermissionId, _ := this.GetInt("ChartPermissionId")
  97. orderColumn := this.GetString("OrderColumn")
  98. orderColumnNew := this.GetString("OrderColumn")
  99. isNewLabel := this.GetString("IsNewLabel")
  100. isDeepLabel := this.GetString("IsDeepLabel")
  101. keyWord := this.GetString("KeyWord")
  102. pageSize, _ := this.GetInt("PageSize")
  103. currentIndex, _ := this.GetInt("CurrentIndex")
  104. deepCover, _ := this.GetInt("DeepCover")
  105. recommendFocus, _ := this.GetInt("RecommendFocus")
  106. var orderSrt string
  107. var condition string
  108. var startSize int
  109. resp := new(models.IndustrialManagementList)
  110. if pageSize <= 0 {
  111. pageSize = utils.PageSize20
  112. }
  113. if currentIndex <= 0 {
  114. currentIndex = 1
  115. }
  116. startSize = paging.StartIndex(currentIndex, pageSize)
  117. if isNewLabel == "1" {
  118. condition += ` AND is_new_label = ` + isNewLabel
  119. }
  120. if isDeepLabel == "1" {
  121. condition += ` AND is_deep_label = ` + isDeepLabel
  122. }
  123. if keyWord != "" {
  124. //keyWordArr, err := services.GetIndustryMapNameSliceV2(keyWord)
  125. //if err != nil {
  126. // br.Msg = "获取信息失败"
  127. // br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  128. // return
  129. //}
  130. //var conditionkeyWord string
  131. //conditionkeyWord += ` subject_names LIKE '%` + keyWord + `%'`
  132. //keyWordArr = services.RemoveDuplicatesAndEmpty(keyWordArr)
  133. //keyWordLen := len(keyWordArr)
  134. //if keyWordLen <= 0 {
  135. // keyWordArr = append(keyWordArr, keyWord)
  136. // keyWordLen = len(keyWordArr)
  137. //}
  138. //for _, v := range keyWordArr {
  139. // conditionkeyWord += ` OR subject_names LIKE '%` + v + `%'`
  140. //}
  141. //industrialManagementIds, err := models.GetIndustrialManagementIdsBykeyWord(conditionkeyWord)
  142. //if err != nil {
  143. // br.Msg = "获取信息失败"
  144. // br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  145. // return
  146. //}
  147. //if industrialManagementIds == "" {
  148. // br.Ret = 200
  149. // br.Success = true
  150. // br.Msg = "获取成功"
  151. // br.Data = resp
  152. // return
  153. //}
  154. //condition += ` AND man.industrial_management_id IN (` + industrialManagementIds + `)`
  155. condition += ` AND subject_names LIKE '%` + keyWord + `%'`
  156. }
  157. var sqlChartPermissionId string
  158. if ChartPermissionId > 0 {
  159. sqlChartPermissionId += ` AND man_g.industrial_management_id IN ( SELECT industrial_management_id FROM cygx_industrial_management WHERE chart_permission_id = ` + strconv.Itoa(ChartPermissionId) + ` ) `
  160. condition += ` AND man.chart_permission_id IN (` + strconv.Itoa(ChartPermissionId) + `)`
  161. }
  162. // 深度覆盖
  163. if deepCover == 1 {
  164. // 查询深标签产业报告数
  165. var deepCondition string
  166. var deepPars []interface{}
  167. deepCondition += ` AND man.is_deep_label = 1`
  168. if ChartPermissionId > 0 {
  169. deepCondition += ` AND man.chart_permission_id = ?`
  170. deepPars = append(deepPars, ChartPermissionId)
  171. }
  172. industryCountList, e := models.GetIndustryArtCountByCondition(deepCondition, deepPars)
  173. if e != nil {
  174. br.Msg = "获取信息失败"
  175. br.ErrMsg = "获取深标签产业报告数失败, Err: " + e.Error()
  176. return
  177. }
  178. deepIdArr := make([]string, 0)
  179. for i := range industryCountList {
  180. if industryCountList[i].ArtNum > 10 {
  181. deepIdArr = append(deepIdArr, strconv.Itoa(industryCountList[i].IndustrialManagementId))
  182. }
  183. }
  184. deepIds := strings.Join(deepIdArr, ",")
  185. if deepIds != "" {
  186. condition = `AND man.industrial_management_id IN (` + deepIds + `)`
  187. }
  188. }
  189. // 推荐关注
  190. if recommendFocus == 1 {
  191. condition += ` AND man.recommended_index >= 50`
  192. }
  193. // 列表总数据量
  194. var list []*models.IndustrialManagement
  195. total, err := models.GetIndustrialManagementAllCount(condition)
  196. if err != nil {
  197. br.Msg = "获取信息失败"
  198. br.ErrMsg = "获取数量失败,Err:" + err.Error()
  199. return
  200. }
  201. page := paging.GetPaging(currentIndex, pageSize, total)
  202. if orderColumn == "" {
  203. orderColumn = "NewTime"
  204. }
  205. if orderColumn == "NewTime" {
  206. orderSrt = "update_time DESC"
  207. } else {
  208. orderSrt = "man.recommended_index DESC,update_time DESC"
  209. }
  210. if ChartPermissionId == 0 {
  211. ChartPermissionId = 20
  212. }
  213. // 阅读第三的产业详情
  214. //detailHot3, err := models.GetIndustrialManagementHot3(ChartPermissionId)
  215. //if err != nil {
  216. // br.Msg = "获取信息失败"
  217. // br.ErrMsg = "获取信息失败,Err:" + err.Error()
  218. // return
  219. //}
  220. list, err = models.GetIndustrialManagementAll(uid, condition, orderSrt, startSize, pageSize)
  221. if err != nil {
  222. br.Msg = "获取信息失败"
  223. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  224. return
  225. }
  226. // 获取近一个月产业报告阅读次数最多的产业
  227. var topCond string
  228. var topPars []interface{}
  229. topReadIndustryId := 0
  230. if ChartPermissionId > 0 {
  231. topCond += ` AND chart_permission_id = ?`
  232. topPars = append(topPars, ChartPermissionId)
  233. }
  234. topReadIndustry, e := models.GetTopOneMonthArtReadNumIndustry(topCond, topPars)
  235. if e != nil && e.Error() != utils.ErrNoRow() {
  236. br.Msg = "获取信息失败"
  237. br.ErrMsg = "获取近一个月报告阅读次数最多的产业失败, Err: " + e.Error()
  238. return
  239. }
  240. if topReadIndustry != nil {
  241. topReadIndustryId = topReadIndustry.IndustrialManagementId
  242. }
  243. nowTime := time.Now().Local()
  244. threeMonBefore := nowTime.AddDate(0, -3, 0)
  245. for k, v := range list {
  246. industrialSubjectList, err := models.GetIndustrialSubjectAll(v.IndustrialManagementId)
  247. if err != nil {
  248. br.Msg = "获取信息失败"
  249. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  250. return
  251. }
  252. list[k].IndustrialSubjectList = industrialSubjectList
  253. list[k].LayoutTime = utils.TimeRemoveHms(v.LayoutTime)
  254. newArtinfo, err := models.GetIndustrialNewArticleDetail(v.IndustrialManagementId)
  255. if err != nil {
  256. br.Msg = "获取信息失败"
  257. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  258. return
  259. }
  260. list[k].UpdateTime = utils.TimeRemoveHms(newArtinfo.PublishDate)
  261. recordCount, err := models.GetUserToArticleCount(uid, newArtinfo.ArticleId)
  262. if err != nil && err.Error() != utils.ErrNoRow() {
  263. br.Msg = "获取信息失败"
  264. br.ErrMsg = "获取信息失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(newArtinfo.ArticleId)
  265. return
  266. }
  267. if recordCount == 0 && user.CreatedTime.Before(utils.StrTimeToTime(newArtinfo.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(newArtinfo.PublishDate)) {
  268. list[k].IsRed = true
  269. }
  270. // 原:关联的报告阅读量大于等于阅读第三的产业,则标记热门
  271. //if v.ArticleReadNum >= detailHot3.ArticleReadNum {
  272. // list[k].IsHot = true
  273. //}
  274. // 近一个月报告阅读次数最多的产业标记Hot
  275. if topReadIndustryId > 0 && list[k].IndustrialManagementId == topReadIndustryId {
  276. list[k].IsHot = true
  277. }
  278. // 关联报告发布时间均在3个月内则标记New
  279. if v.MinReportTime != "" {
  280. t, e := time.Parse(utils.FormatDateTime, v.MinReportTime)
  281. if e != nil {
  282. br.Msg = "获取信息失败"
  283. br.ErrMsg = "报告最早发布时间有误, Err: " + e.Error()
  284. return
  285. }
  286. if t.After(threeMonBefore) {
  287. list[k].IsNew = true
  288. }
  289. }
  290. }
  291. //记录用户搜索的筛选条件
  292. if orderColumnNew != "" {
  293. item := new(models.CygxReportIndustrialSeaarchHistory)
  294. item.UserId = user.UserId
  295. item.Mobile = user.Mobile
  296. item.CompanyId = user.CompanyId
  297. item.CompanyName = user.CompanyName
  298. item.CreateTime = time.Now()
  299. item.IsDeepLabel = isDeepLabel
  300. item.IsNewLabel = isNewLabel
  301. item.ChartPermissionId = ChartPermissionId
  302. if orderColumnNew == "NewTime" {
  303. item.OrderColumn = "0"
  304. } else {
  305. item.OrderColumn = "1"
  306. }
  307. go models.AddCygxReportIndustrialSeaarchHistory(item)
  308. }
  309. resp.List = list
  310. resp.Paging = page
  311. br.Ret = 200
  312. br.Success = true
  313. br.Msg = "获取成功"
  314. br.Data = resp
  315. }
  316. // @Title 产业下所关联的文章分类列表
  317. // @Description 产业下所关联的文章分类列表接口
  318. // @Param IndustrialManagementId query int true "产业ID"
  319. // @Success 200 {object} models.IndustrialToArticleCategoryListRep
  320. // @router /toArticleCategoryList [get]
  321. func (this *ReportController) ArticleCategoryList() {
  322. br := new(models.BaseResponse).Init()
  323. defer func() {
  324. this.Data["json"] = br
  325. this.ServeJSON()
  326. }()
  327. user := this.User
  328. if user == nil {
  329. br.Msg = "请重新登录"
  330. br.Ret = 408
  331. return
  332. }
  333. uid := user.UserId
  334. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  335. if industrialManagementId < 1 {
  336. br.Msg = "请输入分类ID"
  337. return
  338. }
  339. detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
  340. if err != nil {
  341. br.Msg = "获取信息失败"
  342. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  343. return
  344. }
  345. list, err := models.IndustrialToArticleCategory(industrialManagementId, detail.ChartPermissionId)
  346. if err != nil {
  347. br.Msg = "获取信息失败"
  348. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  349. return
  350. }
  351. for k, v := range list {
  352. recordCount, err := models.IndustrialUserRecordArticleCount(uid, industrialManagementId, v.CategoryId)
  353. if err != nil && err.Error() != utils.ErrNoRow() {
  354. br.Msg = "获取信息失败"
  355. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  356. return
  357. }
  358. Newdetail, err := models.GetNewIndustrialUserRecordArticle(industrialManagementId, v.CategoryId)
  359. if err != nil {
  360. br.Msg = "获取信息失败"
  361. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  362. return
  363. }
  364. if recordCount == 0 && user.CreatedTime.Before(utils.StrTimeToTime(Newdetail.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(Newdetail.PublishDate)) {
  365. list[k].IsRed = true
  366. }
  367. }
  368. //detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
  369. //if err != nil {
  370. // br.Msg = "获取信息失败"
  371. // br.ErrMsg = "获取信息失败,Err:" + err.Error()
  372. // return
  373. //}
  374. resp := new(models.IndustrialToArticleCategoryListRep)
  375. resp.List = list
  376. resp.LayoutTime = utils.TimeRemoveHms(detail.LayoutTime)
  377. resp.IndustryName = detail.IndustryName
  378. resp.IndustrialManagementId = industrialManagementId
  379. br.Ret = 200
  380. br.Success = true
  381. br.Msg = "获取成功"
  382. br.Data = resp
  383. }
  384. // @Title 产业文章列表接口
  385. // @Description 获取产业文章列表接口
  386. // @Param PageSize query int true "每页数据条数"
  387. // @Param CurrentIndex query int true "当前页页码,从1开始"
  388. // @Param CategoryId query int true "分类ID"
  389. // @Param IndustrialManagementId query int true "产业ID"
  390. // @Success 200 {object} models.TacticsListResp
  391. // @router /industry/ArticleList [get]
  392. func (this *ReportController) List() {
  393. br := new(models.BaseResponse).Init()
  394. defer func() {
  395. this.Data["json"] = br
  396. this.ServeJSON()
  397. }()
  398. user := this.User
  399. if user == nil {
  400. br.Msg = "请重新登录"
  401. br.Ret = 408
  402. return
  403. }
  404. uid := user.UserId
  405. pageSize, _ := this.GetInt("PageSize")
  406. currentIndex, _ := this.GetInt("CurrentIndex")
  407. categoryId, _ := this.GetInt("CategoryId")
  408. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  409. var startSize int
  410. if pageSize <= 0 {
  411. pageSize = utils.PageSize20
  412. }
  413. if currentIndex <= 0 {
  414. currentIndex = 1
  415. }
  416. startSize = paging.StartIndex(currentIndex, pageSize)
  417. var pars []interface{}
  418. var total int
  419. resp := new(models.TacticsListResp)
  420. page := paging.GetPaging(currentIndex, pageSize, total)
  421. if categoryId < 1 {
  422. br.Msg = "请输入分类ID"
  423. return
  424. }
  425. if industrialManagementId < 1 {
  426. br.Msg = "请输入产业ID"
  427. return
  428. }
  429. //获取该产业下所对应的行业图片
  430. detail, errCategory := models.GetdetailByCategoryIdOne(categoryId)
  431. if errCategory != nil {
  432. br.Msg = "获取信息失败"
  433. br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
  434. return
  435. }
  436. //对应行业的图片
  437. detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
  438. if err != nil {
  439. br.Msg = "获取数据失败"
  440. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  441. return
  442. }
  443. chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
  444. mapChartPermission := make(map[string]string)
  445. var permissionName string
  446. var imgUrlChartPermission string
  447. for _, v := range chartPermissionUrlList {
  448. vslice := strings.Split(v, "_")
  449. permissionName = vslice[0]
  450. imgUrlChartPermission = vslice[len(vslice)-1]
  451. mapChartPermission[permissionName] = imgUrlChartPermission
  452. }
  453. total, err = models.GetReportIndustrialCount(categoryId, industrialManagementId)
  454. if err != nil {
  455. br.Msg = "获取信息失败"
  456. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  457. return
  458. }
  459. page = paging.GetPaging(currentIndex, pageSize, total)
  460. list, err := models.GetReportIndustrialList(pars, categoryId, industrialManagementId, uid, startSize, pageSize)
  461. if err != nil {
  462. br.Msg = "获取信息失败"
  463. br.ErrMsg = "获取帖子数据失败,Err:" + err.Error()
  464. return
  465. }
  466. //对应分类的所图片
  467. detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
  468. if err != nil {
  469. br.Msg = "获取数据失败"
  470. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  471. return
  472. }
  473. categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
  474. mapCategoryUrl := make(map[string]string)
  475. var categoryIdStr string
  476. var imgUrlChart string
  477. for _, v := range categoryUrlList {
  478. vslice := strings.Split(v, "_")
  479. categoryIdStr = vslice[0]
  480. imgUrlChart = vslice[len(vslice)-1]
  481. mapCategoryUrl[categoryIdStr] = imgUrlChart
  482. }
  483. lenList := len(list)
  484. for i := 0; i < lenList; i++ {
  485. item := list[i]
  486. list[i].Body, _ = services.GetReportContentTextSub(item.Body)
  487. //list[i].Abstract = html.UnescapeString(item.Abstract)
  488. list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
  489. //list[i].Annotation = services.GetAnnotationTextSub(item.Annotation)
  490. }
  491. for k, v := range list {
  492. if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
  493. list[k].IsRed = true
  494. }
  495. if v.VideoUrl != "" {
  496. list[k].IsHaveVideo = true
  497. }
  498. list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
  499. if mapCategoryUrl[v.CategoryId] == "" {
  500. if detail.ChartPermissionId == utils.YI_YAO_ID {
  501. list[k].ImgUrlPc = utils.YI_YAO_QI_TA
  502. }
  503. }
  504. }
  505. resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
  506. resp.List = list
  507. resp.Paging = page
  508. br.Ret = 200
  509. br.Success = true
  510. br.Msg = "获取成功"
  511. br.Data = resp
  512. }
  513. // @Title 置顶/取消置顶
  514. // @Description 置顶
  515. // @Param request body models.CygxIndustryTopRep true "type json string"
  516. // @Success 200
  517. // @router /top [post]
  518. func (this *ReportController) ArticleCollect() {
  519. br := new(models.BaseResponse).Init()
  520. defer func() {
  521. this.Data["json"] = br
  522. this.ServeJSON()
  523. }()
  524. user := this.User
  525. if user == nil {
  526. br.Msg = "请重新登录"
  527. br.Ret = 408
  528. return
  529. }
  530. uid := user.UserId
  531. var req models.CygxIndustryTopRep
  532. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  533. if err != nil {
  534. br.Msg = "参数解析异常!"
  535. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  536. return
  537. }
  538. industrialManagementId := req.IndustrialManagementId
  539. countIndustrial, err := models.GetIndustrialManagementCount(industrialManagementId)
  540. if err != nil {
  541. br.Msg = "获取数据失败!"
  542. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  543. return
  544. }
  545. if countIndustrial == 0 {
  546. br.Msg = "产业不存在!"
  547. br.ErrMsg = "产业ID不存在:" + strconv.Itoa(industrialManagementId)
  548. return
  549. }
  550. count, err := models.GetCygxIndustryTop(uid, industrialManagementId)
  551. if err != nil {
  552. br.Msg = "获取数据失败!"
  553. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  554. return
  555. }
  556. resp := new(models.ArticleCollectResp)
  557. if count <= 0 {
  558. item := new(models.CygxIndustryTop)
  559. item.IndustrialManagementId = req.IndustrialManagementId
  560. item.UserId = uid
  561. item.CreateTime = time.Now()
  562. _, err = models.AddCygxIndustryTop(item)
  563. if err != nil {
  564. br.Msg = "置顶失败"
  565. br.ErrMsg = "置顶失败,Err:" + err.Error()
  566. return
  567. }
  568. br.Msg = "置顶成功"
  569. resp.Status = 1
  570. } else {
  571. err = models.RemoveCygxIndustryTop(uid, industrialManagementId)
  572. if err != nil {
  573. br.Msg = "取消置顶失败"
  574. br.ErrMsg = "取消置顶失败,Err:" + err.Error()
  575. return
  576. }
  577. br.Msg = "已取消置顶"
  578. resp.Status = 2
  579. }
  580. br.Ret = 200
  581. br.Success = true
  582. br.Data = resp
  583. }
  584. // @Title 关注/取消关注产业
  585. // @Description 关注/取消关注 接口
  586. // @Param request body models.CygxIndustryFllowRep true "type json string"
  587. // @Success 200
  588. // @router /fllow [post]
  589. func (this *ReportController) Fllow() {
  590. br := new(models.BaseResponse).Init()
  591. defer func() {
  592. this.Data["json"] = br
  593. this.ServeJSON()
  594. }()
  595. user := this.User
  596. if user == nil {
  597. br.Msg = "请重新登录"
  598. br.Ret = 408
  599. return
  600. }
  601. uid := user.UserId
  602. var req models.CygxIndustryFllowRep
  603. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  604. if err != nil {
  605. br.Msg = "参数解析异常!"
  606. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  607. return
  608. }
  609. industrialManagementId := req.IndustrialManagementId
  610. var condition string
  611. countIndustrial, err := models.GetIndustrialManagementCount(industrialManagementId)
  612. if err != nil {
  613. br.Msg = "获取数据失败!"
  614. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  615. return
  616. }
  617. if countIndustrial == 0 {
  618. br.Msg = "产业不存在!"
  619. br.ErrMsg = "产业ID不存在:" + strconv.Itoa(industrialManagementId)
  620. return
  621. }
  622. count, err := models.GetCountCygxIndustryFllow(uid, industrialManagementId, condition)
  623. if err != nil {
  624. br.Msg = "获取数据失败!"
  625. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  626. return
  627. }
  628. resp := new(models.CygxIndustryFllowResp)
  629. countUser, err := models.GetCountCygxIndustryFllowByUid(uid)
  630. if countUser == 0 {
  631. resp.GoFollow = true
  632. }
  633. if count == 0 {
  634. item := new(models.CygxIndustryFllow)
  635. item.IndustrialManagementId = industrialManagementId
  636. item.UserId = uid
  637. item.Email = user.Email
  638. item.Mobile = user.Mobile
  639. item.RealName = user.RealName
  640. item.CompanyId = user.CompanyId
  641. item.CompanyName = user.CompanyName
  642. item.Type = 1
  643. item.CreateTime = time.Now()
  644. item.ModifyTime = time.Now()
  645. _, err = models.AddCygxIndustryFllow(item)
  646. if err != nil {
  647. br.Msg = "操作失败"
  648. br.ErrMsg = "操作失败,Err:" + err.Error()
  649. return
  650. }
  651. resp.Status = 1
  652. } else {
  653. err = models.RemoveCygxIndustryFllow(uid, industrialManagementId)
  654. if err != nil {
  655. br.Msg = "操作失败"
  656. br.ErrMsg = "取消关注失败,Err:" + err.Error()
  657. return
  658. }
  659. }
  660. //处理是否关注全部赛道字段
  661. go services.IndustryFllowWithTrack(industrialManagementId, count, uid)
  662. br.Msg = "操作成功"
  663. br.Ret = 200
  664. br.Success = true
  665. br.Data = resp
  666. }
  667. // @Title 产业报告分类关联作者列表接口
  668. // @Description 获取产业报告分类关联作者列表接口
  669. // @Param ChartPermissionId query int true "分类ID"
  670. // @Param PageSize query int true "每页数据条数"
  671. // @Param CurrentIndex query int true "当前页页码,从1开始"
  672. // @Success 200 {object} models.CygxArticleDepartmentList
  673. // @router /industryListByDepartment [get]
  674. func (this *ReportController) IndustryListByDepartment() {
  675. br := new(models.BaseResponse).Init()
  676. defer func() {
  677. this.Data["json"] = br
  678. this.ServeJSON()
  679. }()
  680. user := this.User
  681. if user == nil {
  682. br.Msg = "请重新登录"
  683. br.Ret = 408
  684. return
  685. }
  686. uid := user.UserId
  687. pageSize, _ := this.GetInt("PageSize")
  688. currentIndex, _ := this.GetInt("CurrentIndex")
  689. //chartPermissionId, _ := this.GetInt("ChartPermissionId")
  690. var startSize int
  691. var condition string
  692. //condition = ` AND a.publish_status=1 AND m.chart_permission_id =` + strconv.Itoa(chartPermissionId)
  693. condition = ` AND a.publish_status=1 `
  694. if pageSize <= 0 {
  695. pageSize = utils.PageSize20
  696. }
  697. if currentIndex <= 0 {
  698. currentIndex = 1
  699. }
  700. startSize = paging.StartIndex(currentIndex, pageSize)
  701. total, err := models.GetArticleDepartmentCount(condition)
  702. page := paging.GetPaging(currentIndex, pageSize, total)
  703. resp := new(models.CygxArticleDepartmentList)
  704. userType, _, err := services.GetUserType(user.CompanyId)
  705. if err != nil {
  706. br.Msg = "获取信息失败"
  707. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  708. return
  709. }
  710. if userType == 1 {
  711. resp.Paging = page
  712. br.Ret = 200
  713. br.Success = true
  714. br.Msg = "获取成功"
  715. br.Data = resp
  716. return
  717. }
  718. resp.HaveResearch = true
  719. //获取作者信息,并排序
  720. list, err := models.GetCygxArticleDepartmentList(startSize, pageSize, condition, uid)
  721. if err != nil {
  722. br.Msg = "获取信息失败"
  723. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  724. return
  725. }
  726. for k, v := range list {
  727. artList, err := models.GetArticleByDepartmentId(v.DepartmentId)
  728. if err != nil {
  729. br.Msg = "获取信息失败"
  730. br.ErrMsg = "获取文章信息失败,Err:" + err.Error()
  731. return
  732. }
  733. for k2, v2 := range artList {
  734. subjectNames, err := models.GetSubjectNames(v2.ArticleId)
  735. if err != nil {
  736. br.Msg = "获取失败" + strconv.Itoa(v2.ArticleId)
  737. br.ErrMsg = "获取失败,Err:" + err.Error()
  738. return
  739. }
  740. var subjectNamesNew string
  741. if len(subjectNames) > 0 {
  742. slice := strings.Split(subjectNames, "/")
  743. for k3, v3 := range slice {
  744. if k3 < 4 {
  745. subjectNamesNew += v3 + "/"
  746. }
  747. }
  748. }
  749. industryName, err := models.GetIndustrialNames(v2.ArticleId)
  750. if err != nil && err.Error() != utils.ErrNoRow() {
  751. br.Msg = "获取失败" + strconv.Itoa(v2.ArticleId)
  752. br.ErrMsg = "获取失败,Err:" + err.Error()
  753. return
  754. }
  755. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  756. artList[k2].SubjectName = subjectNamesNew
  757. artList[k2].DepartmentId = v.DepartmentId
  758. if subjectNamesNew == "" {
  759. artList[k2].IndustryName = industryName
  760. } else {
  761. artList[k2].IndustryName = industryName + "-" + subjectNamesNew
  762. }
  763. if artList[k2].IsReport == "1" {
  764. artList[k2].IndustryName = "【观点】" + artList[k2].IndustryName
  765. } else {
  766. artList[k2].IndustryName = "【纪要】" + artList[k2].IndustryName
  767. }
  768. }
  769. list[k].List = artList
  770. if v.FollowNum > 0 {
  771. list[k].IsMyFollow = true
  772. }
  773. }
  774. listnNew, err := models.GetIndustrialSubjectByDepartmentNew()
  775. if err != nil {
  776. br.Msg = "获取信息失败"
  777. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  778. return
  779. }
  780. if len(listnNew) > 0 {
  781. for _, v := range listnNew {
  782. firstStr := strings.Index(v.IndustrialAndSubjectIds, "—")
  783. Management := new(models.IndustrialManagementIdInt)
  784. if firstStr == 0 {
  785. Management.IndustryName = v.IndustryName
  786. } else {
  787. listSub, err := models.GetIndustrialManagementSubjectList(v.ArticleId)
  788. if err != nil {
  789. br.Msg = "获取信息失败"
  790. br.ErrMsg = "获取关联标的列表失败,Err:" + err.Error()
  791. return
  792. }
  793. var subjectNamesNew string
  794. for _, v1 := range listSub {
  795. subjectNamesNew += v1.SubjectName + "/"
  796. }
  797. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  798. Management.IndustryName = subjectNamesNew
  799. }
  800. Management.IndustrialManagementId = v.IndustrialManagementId
  801. Management.ArticleId = v.ArticleId
  802. resp.ListnNew = append(resp.ListnNew, Management)
  803. }
  804. }
  805. resp.List = list
  806. resp.Paging = page
  807. br.Ret = 200
  808. br.Success = true
  809. br.Msg = "获取成功"
  810. br.Data = resp
  811. }
  812. // @Title 关注作者/取消关注作者
  813. // @Description 关注作者/取消关注作者 接口
  814. // @Param request body models.CygxArticleDepartmentId true "type json string"
  815. // @Success 200
  816. // @router /fllowDepartment [post]
  817. func (this *ReportController) FllowDepartment() {
  818. br := new(models.BaseResponse).Init()
  819. defer func() {
  820. this.Data["json"] = br
  821. this.ServeJSON()
  822. }()
  823. user := this.User
  824. if user == nil {
  825. br.Msg = "请重新登录"
  826. br.Ret = 408
  827. return
  828. }
  829. uid := user.UserId
  830. var req models.CygxArticleDepartmentId
  831. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  832. if err != nil {
  833. br.Msg = "参数解析异常!"
  834. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  835. return
  836. }
  837. departmentId := req.DepartmentId
  838. var condition string
  839. countDepartment, err := models.GetDepartmentCount(departmentId)
  840. if err != nil {
  841. br.Msg = "获取数据失败!"
  842. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  843. return
  844. }
  845. if countDepartment == 0 {
  846. br.Msg = "作者不存在!"
  847. br.ErrMsg = "作者ID不存在:" + strconv.Itoa(departmentId)
  848. return
  849. }
  850. countUser, err := models.GetArticleDepartmentFollowByUid(uid)
  851. count, err := models.GetArticleDepartmentFollow(uid, departmentId, condition)
  852. if err != nil {
  853. br.Msg = "获取数据失败!"
  854. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  855. return
  856. }
  857. resp := new(models.CygxArticleDepartmentFollowResp)
  858. if countUser == 0 {
  859. resp.GoFollow = true
  860. }
  861. if count == 0 {
  862. item := new(models.CygxArticleDepartmentFollow)
  863. item.DepartmentId = departmentId
  864. item.UserId = uid
  865. item.Email = user.Email
  866. item.Mobile = user.Mobile
  867. item.RealName = user.RealName
  868. item.CompanyId = user.CompanyId
  869. item.CompanyName = user.CompanyName
  870. item.Type = 1
  871. item.CreateTime = time.Now()
  872. item.ModifyTime = time.Now()
  873. _, err = models.AddArticleDepartmentFollow(item)
  874. if err != nil {
  875. br.Msg = "操作失败"
  876. br.ErrMsg = "操作失败,Err:" + err.Error()
  877. return
  878. }
  879. resp.Status = 1
  880. } else {
  881. var doType int
  882. condition = ` AND type = 1`
  883. count, err = models.GetArticleDepartmentFollow(uid, departmentId, condition)
  884. if err != nil {
  885. br.Msg = "操作失败!"
  886. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  887. return
  888. }
  889. if count == 1 {
  890. resp.Status = 2
  891. doType = 2
  892. } else {
  893. resp.Status = 1
  894. doType = 1
  895. }
  896. err = models.RemoveArticleDepartmentFollow(uid, departmentId, doType)
  897. if err != nil {
  898. br.Msg = "操作失败"
  899. br.ErrMsg = "取消关注失败,Err:" + err.Error()
  900. return
  901. }
  902. }
  903. br.Msg = "操作成功"
  904. br.Ret = 200
  905. br.Success = true
  906. br.Data = resp
  907. }
  908. // @Title 研选文章列表接口
  909. // @Description 获取研选文章列表接口
  910. // @Param PageSize query int true "每页数据条数"
  911. // @Param CurrentIndex query int true "当前页页码,从1开始"
  912. // @Param ArticleId query int true "文章id"
  913. // @Param DepartmentId query int true "作者ID"
  914. // @Param IndustrialManagementId query int true "产业ID"
  915. // @Success 200 {object} models.ReportArticleWhichIndustrialRepList
  916. // @router /industry/reportList [get]
  917. func (this *ReportController) ReportList() {
  918. br := new(models.BaseResponse).Init()
  919. defer func() {
  920. this.Data["json"] = br
  921. this.ServeJSON()
  922. }()
  923. user := this.User
  924. if user == nil {
  925. br.Msg = "请重新登录"
  926. br.Ret = 408
  927. return
  928. }
  929. uid := user.UserId
  930. pageSize, _ := this.GetInt("PageSize")
  931. currentIndex, _ := this.GetInt("CurrentIndex")
  932. departmentId, _ := this.GetInt("DepartmentId")
  933. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  934. articleId, _ := this.GetInt("ArticleId")
  935. var condition string
  936. var startSize int
  937. if pageSize <= 0 {
  938. pageSize = utils.PageSize20
  939. }
  940. if currentIndex <= 0 {
  941. currentIndex = 1
  942. }
  943. startSize = paging.StartIndex(currentIndex, pageSize)
  944. var pars []interface{}
  945. var total int
  946. resp := new(models.ReportArticleWhichIndustrialRepList)
  947. page := paging.GetPaging(currentIndex, pageSize, total)
  948. userType, _, err := services.GetUserType(user.CompanyId)
  949. if err != nil {
  950. br.Msg = "获取信息失败"
  951. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  952. return
  953. }
  954. if userType == 1 {
  955. resp.Paging = page
  956. br.Ret = 200
  957. br.Success = true
  958. br.Msg = "获取成功"
  959. br.Data = resp
  960. return
  961. }
  962. resp.HaveResearch = true
  963. if departmentId > 0 {
  964. condition += ` AND art.department_id = ` + strconv.Itoa(departmentId)
  965. detail, err := models.GetArticleDepartmentDateilById(departmentId)
  966. if err != nil {
  967. br.Msg = "获取信息失败"
  968. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  969. return
  970. }
  971. resp.NickName = detail.NickName
  972. }
  973. if industrialManagementId > 0 {
  974. condition += ` AND m.industrial_management_id = ` + strconv.Itoa(industrialManagementId)
  975. }
  976. if articleId > 0 {
  977. detail, err := models.GetArticleDetailById(articleId)
  978. if err != nil {
  979. br.Msg = "获取信息失败"
  980. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  981. return
  982. }
  983. condition += ` AND art.subject_ids = '` + detail.SubjectIds + `'`
  984. }
  985. total, err = models.GetWhichDepartmentCount(condition)
  986. if err != nil {
  987. br.Msg = "获取信息失败"
  988. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  989. return
  990. }
  991. page = paging.GetPaging(currentIndex, pageSize, total)
  992. condition += ` GROUP BY art.article_id ORDER BY art.publish_date DESC`
  993. list, err := models.IndustrialToArticleWhichDepartment(condition, pars, uid, startSize, pageSize)
  994. if err != nil {
  995. br.Msg = "获取失败"
  996. br.ErrMsg = "获取失败,Err:" + err.Error()
  997. return
  998. }
  999. for k, v := range list {
  1000. if v.Readnum == 0 {
  1001. list[k].IsRed = true
  1002. }
  1003. list[k].IsResearch = true
  1004. subjectNames, err := models.GetSubjectNames(v.ArticleId)
  1005. if err != nil {
  1006. br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
  1007. br.ErrMsg = "获取失败,Err:" + err.Error()
  1008. return
  1009. }
  1010. var subjectNamesNew string
  1011. if len(subjectNames) > 0 {
  1012. slice := strings.Split(subjectNames, "/")
  1013. for k3, v3 := range slice {
  1014. if k3 < 4 {
  1015. subjectNamesNew += v3 + "/"
  1016. }
  1017. }
  1018. }
  1019. industryName, err := models.GetIndustrialNames(v.ArticleId)
  1020. if err != nil && err.Error() != utils.ErrNoRow() {
  1021. br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
  1022. br.ErrMsg = "获取失败,Err:" + err.Error()
  1023. return
  1024. }
  1025. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  1026. list[k].SubjectName = subjectNamesNew
  1027. if subjectNamesNew != "" {
  1028. list[k].IndustryName = industryName + "-" + subjectNamesNew
  1029. } else {
  1030. list[k].IndustryName = industryName
  1031. }
  1032. resp.IndustryName = industryName
  1033. list[k].ImgUrlPc = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211206/UvMadc63MLZY6rnQZQgGZAFXkqwf.png"
  1034. }
  1035. resp.List = list
  1036. resp.Paging = page
  1037. br.Ret = 200
  1038. br.Success = true
  1039. br.Msg = "获取成功"
  1040. br.Data = resp
  1041. }
  1042. // @Title 研选最新主题关键词文章列表接口
  1043. // @Description 获取研选最新主题关键词文章列表接口
  1044. // @Param PageSize query int true "每页数据条数"
  1045. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1046. // @Param ArticleId query int true "文章id"
  1047. // @Success 200 {object} models.ReportArticleWhichIndustrialRepList
  1048. // @router /industry/reportListNew [get]
  1049. func (this *ReportController) ReportListNew() {
  1050. br := new(models.BaseResponse).Init()
  1051. defer func() {
  1052. this.Data["json"] = br
  1053. this.ServeJSON()
  1054. }()
  1055. user := this.User
  1056. if user == nil {
  1057. br.Msg = "请重新登录"
  1058. br.Ret = 408
  1059. return
  1060. }
  1061. uid := user.UserId
  1062. pageSize, _ := this.GetInt("PageSize")
  1063. currentIndex, _ := this.GetInt("CurrentIndex")
  1064. articleId, _ := this.GetInt("ArticleId")
  1065. var condition string
  1066. var startSize int
  1067. if pageSize <= 0 {
  1068. pageSize = utils.PageSize20
  1069. }
  1070. if currentIndex <= 0 {
  1071. currentIndex = 1
  1072. }
  1073. startSize = paging.StartIndex(currentIndex, pageSize)
  1074. var pars []interface{}
  1075. var total int
  1076. resp := new(models.ReportArticleWhichIndustrialRepList)
  1077. page := paging.GetPaging(currentIndex, pageSize, total)
  1078. userType, _, err := services.GetUserType(user.CompanyId)
  1079. if err != nil {
  1080. br.Msg = "获取信息失败"
  1081. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  1082. return
  1083. }
  1084. if userType == 1 {
  1085. resp.Paging = page
  1086. br.Ret = 200
  1087. br.Success = true
  1088. br.Msg = "获取成功"
  1089. br.Data = resp
  1090. return
  1091. }
  1092. resp.HaveResearch = true
  1093. if articleId > 0 {
  1094. detail, err := models.GetArticleDetailById(articleId)
  1095. if err != nil {
  1096. br.Msg = "获取信息失败"
  1097. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1098. return
  1099. }
  1100. firstStr := strings.Index(detail.IndustrialAndSubjectIds, "—")
  1101. if firstStr == 0 {
  1102. condition += ` AND art.industrial_management_id = '` + strconv.Itoa(detail.IndustrialManagementId) + `'`
  1103. } else {
  1104. condition += ` AND art.industrial_and_subject_ids = '` + detail.IndustrialAndSubjectIds + `'`
  1105. }
  1106. }
  1107. total, err = models.GetWhichDepartmentCount(condition)
  1108. if err != nil {
  1109. br.Msg = "获取信息失败"
  1110. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  1111. return
  1112. }
  1113. page = paging.GetPaging(currentIndex, pageSize, total)
  1114. condition += ` GROUP BY art.article_id ORDER BY art.publish_date DESC`
  1115. list, err := models.IndustrialToArticleWhichDepartment(condition, pars, uid, startSize, pageSize)
  1116. if err != nil {
  1117. br.Msg = "获取失败"
  1118. br.ErrMsg = "获取失败,Err:" + err.Error()
  1119. return
  1120. }
  1121. for k, v := range list {
  1122. if v.Readnum == 0 {
  1123. list[k].IsRed = true
  1124. }
  1125. list[k].IsResearch = true
  1126. list[k].ImgUrlPc = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211206/UvMadc63MLZY6rnQZQgGZAFXkqwf.png"
  1127. subjectNames, err := models.GetSubjectNames(v.ArticleId)
  1128. if err != nil {
  1129. br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
  1130. br.ErrMsg = "获取失败,Err:" + err.Error()
  1131. return
  1132. }
  1133. var subjectNamesNew string
  1134. if len(subjectNames) > 0 {
  1135. slice := strings.Split(subjectNames, "/")
  1136. for k3, v3 := range slice {
  1137. if k3 < 4 {
  1138. subjectNamesNew += v3 + "/"
  1139. }
  1140. }
  1141. }
  1142. industryName, err := models.GetIndustrialNames(v.ArticleId)
  1143. if err != nil && err.Error() != utils.ErrNoRow() {
  1144. br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
  1145. br.ErrMsg = "获取失败,Err:" + err.Error()
  1146. return
  1147. }
  1148. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  1149. list[k].SubjectName = subjectNamesNew
  1150. if subjectNamesNew != "" {
  1151. list[k].IndustryName = industryName + "-" + subjectNamesNew
  1152. } else {
  1153. list[k].IndustryName = industryName
  1154. }
  1155. resp.IndustryName = industryName
  1156. }
  1157. resp.List = list
  1158. resp.Paging = page
  1159. br.Ret = 200
  1160. br.Success = true
  1161. br.Msg = "获取成功"
  1162. br.Data = resp
  1163. }
  1164. // @Title 是否展示绝密内参
  1165. // @Description 获取是否展示绝密内参接口
  1166. // @Param request body models.IsShow true "type json string"
  1167. // @Success 200
  1168. // @router /isShow [get]
  1169. func (this *ReportController) IsShow() {
  1170. br := new(models.BaseResponse).Init()
  1171. defer func() {
  1172. this.Data["json"] = br
  1173. this.ServeJSON()
  1174. }()
  1175. user := this.User
  1176. if user == nil {
  1177. br.Msg = "请重新登录"
  1178. br.Ret = 408
  1179. return
  1180. }
  1181. var resp models.IsShow
  1182. resp.IsShowChart = true
  1183. resp.IsShowResearch = true
  1184. resp.LinkWxExplain = utils.LINK_WX_EXPLAIN
  1185. resp.YanXuan_Explain = true
  1186. mobile := user.Mobile
  1187. if mobile == "" {
  1188. br.Ret = 200
  1189. br.Success = true
  1190. br.Data = resp
  1191. return
  1192. }
  1193. total, _ := models.GetUserIsAdminCount(mobile)
  1194. if total > 0 {
  1195. resp.IsShowList = true
  1196. }
  1197. resp.IsShow = true
  1198. br.Ret = 200
  1199. br.Success = true
  1200. br.Data = resp
  1201. }
  1202. // @Title 报告精选、本周研究汇总、上周纪要汇总列表
  1203. // @Description 获取报告精选、本周研究汇总、上周纪要汇总列表接口
  1204. // @Param PageSize query int true "每页数据条数"
  1205. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1206. // @Param ReportType string query true "报告类型 ,1报告精选、2本周研究汇总、3上周纪要汇总"
  1207. // @Success 200 {object} models.CygxReportSelectionListPublicRep
  1208. // @router /reportList/byType [get]
  1209. func (this *ReportController) ReportListByType() {
  1210. br := new(models.BaseResponse).Init()
  1211. defer func() {
  1212. this.Data["json"] = br
  1213. this.ServeJSON()
  1214. }()
  1215. user := this.User
  1216. if user == nil {
  1217. br.Msg = "请重新登录"
  1218. br.Ret = 408
  1219. return
  1220. }
  1221. uid := user.UserId
  1222. pageSize, _ := this.GetInt("PageSize")
  1223. currentIndex, _ := this.GetInt("CurrentIndex")
  1224. reportType := this.GetString("ReportType")
  1225. var condition string
  1226. var startSize int
  1227. if pageSize <= 0 {
  1228. pageSize = utils.PageSize20
  1229. }
  1230. if currentIndex <= 0 {
  1231. currentIndex = 1
  1232. }
  1233. startSize = paging.StartIndex(currentIndex, pageSize)
  1234. var pars []interface{}
  1235. var total int
  1236. resp := new(models.CygxReportSelectionListPublicRep)
  1237. page := paging.GetPaging(currentIndex, pageSize, total)
  1238. var tbdb string
  1239. var readSql string
  1240. var reportTypeStr string
  1241. if reportType == "1" {
  1242. tbdb = "cygx_report_selection"
  1243. reportTypeStr = "bgjx"
  1244. } else if reportType == "2" {
  1245. tbdb = "cygx_research_summary"
  1246. reportTypeStr = "bzyjhz"
  1247. } else if reportType == "3" {
  1248. tbdb = "cygx_minutes_summary"
  1249. reportTypeStr = "szjyhz"
  1250. } else {
  1251. br.Msg = "请选择报告类型"
  1252. return
  1253. }
  1254. fmt.Println(tbdb)
  1255. condition = ` AND publish_status = 1 `
  1256. if reportType == "1" {
  1257. condition += ` LIMIT 1 `
  1258. }
  1259. total, err := models.GetCygxReportSelectionPublic(condition, tbdb, pars)
  1260. if err != nil {
  1261. br.Msg = "获取信息失败"
  1262. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  1263. return
  1264. }
  1265. readSql = ` (SELECT COUNT(1) AS count FROM cygx_report_history_record AS h WHERE h.article_id = art.article_id AND report_type ='` + reportTypeStr + `' AND h.user_id = ` + strconv.Itoa(uid) + `) as read_num`
  1266. page = paging.GetPaging(currentIndex, pageSize, total)
  1267. list, err := models.GetReportSelectionListPublic(condition, readSql, tbdb, pars, startSize, pageSize)
  1268. if err != nil {
  1269. br.Msg = "获取失败"
  1270. br.ErrMsg = "获取失败,Err:" + err.Error()
  1271. return
  1272. }
  1273. for k, v := range list {
  1274. if reportType == "1" {
  1275. list[k].Abstract = v.UpdateDescription
  1276. }
  1277. list[k].PublishDate = utils.StrTimeToTime(v.PublishDate).Format("2006-01-02")
  1278. if v.ReadNum == 0 {
  1279. list[k].IsRed = true
  1280. }
  1281. }
  1282. resp.List = list
  1283. resp.Paging = page
  1284. br.Ret = 200
  1285. br.Success = true
  1286. br.Msg = "获取成功"
  1287. br.Data = resp
  1288. }
  1289. // @Title 获取报告精选详情
  1290. // @Description 获取报告精选详情接口
  1291. // @Param ArticleId query int true "报告ID"
  1292. // @Success 200 {object} models.ReportSelectionLetailResp
  1293. // @router /reportSelection/detail [get]
  1294. func (this *ReportController) Detail() {
  1295. br := new(models.BaseResponse).Init()
  1296. defer func() {
  1297. this.Data["json"] = br
  1298. this.ServeJSON()
  1299. }()
  1300. user := this.User
  1301. if user == nil {
  1302. br.Msg = "请重新登录"
  1303. br.Ret = 408
  1304. return
  1305. }
  1306. uid := user.UserId
  1307. articleId, _ := this.GetInt("ArticleId")
  1308. if articleId < 0 {
  1309. br.Msg = "参数错误"
  1310. br.ErrMsg = "参数错误"
  1311. return
  1312. }
  1313. resp := new(models.ReportSelectionLetailResp)
  1314. //判断用户权限
  1315. hasPermission, err := services.GetUserhasPermission(user)
  1316. if err != nil {
  1317. br.Msg = "获取信息失败"
  1318. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1319. }
  1320. resp.HasPermission = hasPermission
  1321. if hasPermission != 1 {
  1322. br.Ret = 200
  1323. br.Success = true
  1324. br.Msg = "获取成功"
  1325. br.Data = resp
  1326. return
  1327. }
  1328. detail, err := models.GetCygxReportSelectionInfoById(articleId)
  1329. if err != nil {
  1330. br.Msg = "获取信息失败"
  1331. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1332. return
  1333. }
  1334. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
  1335. existMap := make(map[int]int)
  1336. var items []*models.ReportSelectionChartPermission
  1337. listLog, err := models.GetReportSelectionlogListAll(articleId)
  1338. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1339. if err != nil {
  1340. br.Msg = "获取失败"
  1341. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1342. return
  1343. }
  1344. //var itemLogs []*models.CygxReportSelectionLogDetail
  1345. for _, v := range listLog {
  1346. item := new(models.ReportSelectionChartPermission)
  1347. if existMap[v.ChartPermissionId] == 0 {
  1348. item.PermissionName = v.PermissionName + "领域深度报告和调研"
  1349. item.IcoLink = v.IcoLink
  1350. listSonLog, err := models.GetReportSelectionlogSonListAll(articleId, v.ChartPermissionId)
  1351. if err != nil && err.Error() != utils.ErrNoRow() {
  1352. br.Msg = "获取信息失败"
  1353. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1354. return
  1355. }
  1356. for k2, v2 := range listSonLog {
  1357. if v2.IndustrialManagementId != "" {
  1358. listIndustrial, err := models.GetIndustrialByIds(v2.IndustrialManagementId)
  1359. if err != nil && err.Error() != utils.ErrNoRow() {
  1360. br.Msg = "获取信息失败"
  1361. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1362. return
  1363. }
  1364. listSonLog[k2].List = listIndustrial
  1365. }
  1366. }
  1367. item.List = listSonLog
  1368. items = append(items, item)
  1369. //itemLogs = make([]*models.CygxReportSelectionLogDetail, 0)
  1370. }
  1371. existMap[v.ChartPermissionId] = v.ChartPermissionId
  1372. }
  1373. historyRecord := new(models.CygxReportHistoryRecord)
  1374. historyRecord.UserId = uid
  1375. historyRecord.ArticleId = articleId
  1376. historyRecord.CreateTime = time.Now()
  1377. historyRecord.Mobile = user.Mobile
  1378. historyRecord.Email = user.Email
  1379. historyRecord.CompanyId = user.CompanyId
  1380. historyRecord.CompanyName = user.CompanyName
  1381. historyRecord.ReportType = "bgjx"
  1382. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  1383. if err != nil && err.Error() != utils.ErrNoRow() {
  1384. br.Msg = "获取信息失败"
  1385. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  1386. return
  1387. }
  1388. historyRecord.RealName = user.RealName
  1389. if sellerItem != nil {
  1390. historyRecord.SellerName = sellerItem.RealName
  1391. }
  1392. go models.AddCygxReportHistoryRecord(historyRecord)
  1393. resp.List = items
  1394. resp.Detail = detail
  1395. br.Ret = 200
  1396. br.Success = true
  1397. br.Msg = "获取成功"
  1398. br.Data = resp
  1399. }
  1400. // @Title 获取本周研究汇总详情
  1401. // @Description 获取本周研究汇总详情接口
  1402. // @Param ArticleId query int true "报告ID"
  1403. // @Success 200 {object} models.ResearchSummaryLetailResp
  1404. // @router /researchSummary/detail [get]
  1405. func (this *ReportController) ResearchDetail() {
  1406. br := new(models.BaseResponse).Init()
  1407. defer func() {
  1408. this.Data["json"] = br
  1409. this.ServeJSON()
  1410. }()
  1411. user := this.User
  1412. if user == nil {
  1413. br.Msg = "请重新登录"
  1414. br.Ret = 408
  1415. return
  1416. }
  1417. uid := user.UserId
  1418. articleId, _ := this.GetInt("ArticleId")
  1419. if articleId < 0 {
  1420. br.Msg = "参数错误"
  1421. br.ErrMsg = "参数错误"
  1422. return
  1423. }
  1424. resp := new(models.ResearchSummaryLetailResp)
  1425. //判断用户权限
  1426. hasPermission, err := services.GetUserhasPermission(user)
  1427. if err != nil {
  1428. br.Msg = "获取信息失败"
  1429. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1430. }
  1431. resp.HasPermission = hasPermission
  1432. if hasPermission != 1 {
  1433. br.Ret = 200
  1434. br.Success = true
  1435. br.Msg = "获取成功"
  1436. br.Data = resp
  1437. return
  1438. }
  1439. detail, err := models.GetCygxResearchSummaryInfoById(articleId)
  1440. if err != nil {
  1441. br.Msg = "获取信息失败"
  1442. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1443. return
  1444. }
  1445. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
  1446. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1447. listFirst, err := models.GetResearchSummarylogListFirst(articleId)
  1448. if err != nil {
  1449. br.Msg = "获取失败"
  1450. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1451. return
  1452. }
  1453. listArticleType, err := models.GetCygxArticleTypeList()
  1454. if err != nil {
  1455. br.Msg = "获取失败"
  1456. br.ErrMsg = "获取文章类型数据失败,Err:" + err.Error()
  1457. return
  1458. }
  1459. for k, v := range listFirst {
  1460. listSecond, err := models.GetResearchSummarylogSonListSecond(articleId, v.Type)
  1461. if err != nil && err.Error() != utils.ErrNoRow() {
  1462. br.Msg = "获取信息失败"
  1463. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1464. return
  1465. }
  1466. for k2, v2 := range listSecond {
  1467. listThird, err := models.GetResearchSummarylogSonListThird(articleId, v2.ChartPermissionId, v.Type)
  1468. if err != nil && err.Error() != utils.ErrNoRow() {
  1469. br.Msg = "获取信息失败"
  1470. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1471. return
  1472. }
  1473. for _, vType := range listArticleType {
  1474. if v2.ChartPermissionId == vType.YanxPermissionId {
  1475. listSecond[k2].IcoLink = vType.IcoLinkM
  1476. listSecond[k2].PermissionName = vType.YanxPermissionName
  1477. }
  1478. }
  1479. //if v2.ChartPermissionId == utils.YanxSummaryPermissionId {
  1480. // listSecond[k2].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1481. // listSecond[k2].PermissionName = "买方研选纪要"
  1482. //} else if v2.ChartPermissionId == utils.YanxViewpointPermissionId {
  1483. // listSecond[k2].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1484. // listSecond[k2].PermissionName = "买方研选观点"
  1485. //}
  1486. if len(listThird) > 0 {
  1487. for k3, v3 := range listThird {
  1488. if v3.VideoUrl != "" {
  1489. listThird[k3].IsHaveVideo = true
  1490. }
  1491. if v3.ReportLink == "0" {
  1492. listThird[k3].ReportLink = ""
  1493. }
  1494. }
  1495. listSecond[k2].List = listThird
  1496. }
  1497. }
  1498. if len(listSecond) > 0 {
  1499. listFirst[k].List = listSecond
  1500. }
  1501. //`description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
  1502. if v.Type == "SDBG" {
  1503. listFirst[k].ListName = "深度报告"
  1504. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211027/le8AcRjDz0MhA72bVDiaf3d5ALSe.png"
  1505. } else if v.Type == "BZCHJH" {
  1506. listFirst[k].ListName = "本周晨会精华"
  1507. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/DCfekcxaIKGePBsNVu1ULfmNcJBY.png"
  1508. } else if v.Type == "CYDYJY" {
  1509. listFirst[k].ListName = "产业调研纪要"
  1510. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/UPAdozy96z9ypzY04vi0Y3Ogqzji.png"
  1511. } else if v.Type == "SSGS" {
  1512. listFirst[k].ListName = "上市公司调研纪要篇"
  1513. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
  1514. } else if v.Type == "SJDP" {
  1515. listFirst[k].ListName = "事件点评"
  1516. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/2a5cXafO3Iws4QcFp1bd5WPdYikV.png"
  1517. } else if v.Type == "YANX" {
  1518. listFirst[k].ListName = "买方研选"
  1519. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1520. }
  1521. }
  1522. historyRecord := new(models.CygxReportHistoryRecord)
  1523. historyRecord.UserId = uid
  1524. historyRecord.ArticleId = articleId
  1525. historyRecord.CreateTime = time.Now()
  1526. historyRecord.Mobile = user.Mobile
  1527. historyRecord.Email = user.Email
  1528. historyRecord.CompanyId = user.CompanyId
  1529. historyRecord.CompanyName = user.CompanyName
  1530. historyRecord.ReportType = "bzyjhz"
  1531. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  1532. if err != nil && err.Error() != utils.ErrNoRow() {
  1533. br.Msg = "获取信息失败"
  1534. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  1535. return
  1536. }
  1537. historyRecord.RealName = user.RealName
  1538. if sellerItem != nil {
  1539. historyRecord.SellerName = sellerItem.RealName
  1540. }
  1541. go models.AddCygxReportHistoryRecord(historyRecord)
  1542. resp.List = listFirst
  1543. resp.Detail = detail
  1544. br.Ret = 200
  1545. br.Success = true
  1546. br.Msg = "获取成功"
  1547. br.Data = resp
  1548. }
  1549. // @Title 上周纪要汇总内容详情
  1550. // @Description 获取上周纪要汇总内容详情接口
  1551. // @Param ArticleId query int true "报告ID"
  1552. // @Success 200 {object} models.MinutesSummaryLetailResp
  1553. // @router /minutesSummary/detailv4 [get]
  1554. func (this *ReportController) MinutesDetailV4() {
  1555. br := new(models.BaseResponse).Init()
  1556. defer func() {
  1557. this.Data["json"] = br
  1558. this.ServeJSON()
  1559. }()
  1560. user := this.User
  1561. if user == nil {
  1562. br.Msg = "请重新登录"
  1563. br.Ret = 408
  1564. return
  1565. }
  1566. uid := user.UserId
  1567. articleId, _ := this.GetInt("ArticleId")
  1568. if articleId < 0 {
  1569. br.Msg = "参数错误"
  1570. br.ErrMsg = "参数错误"
  1571. return
  1572. }
  1573. resp := new(models.MinutesSummaryLetailRespV4)
  1574. //判断用户权限
  1575. hasPermission, err := services.GetUserhasPermission(user)
  1576. if err != nil {
  1577. br.Msg = "获取信息失败"
  1578. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1579. }
  1580. resp.HasPermission = hasPermission
  1581. if hasPermission != 1 {
  1582. br.Ret = 200
  1583. br.Success = true
  1584. br.Msg = "获取成功"
  1585. br.Data = resp
  1586. return
  1587. }
  1588. detail, err := models.GetCygxMinutesSummaryInfoById(articleId)
  1589. if err != nil {
  1590. br.Msg = "获取信息失败"
  1591. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1592. return
  1593. }
  1594. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
  1595. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1596. listFirst, err := models.GetMinutesSummarylogListAllV4(articleId)
  1597. if err != nil {
  1598. br.Msg = "获取失败"
  1599. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1600. return
  1601. }
  1602. for k, v := range listFirst {
  1603. listSecond, err := models.GetMinutesSummarylogSonListSecond(articleId, v.Type)
  1604. if err != nil && err.Error() != utils.ErrNoRow() {
  1605. br.Msg = "获取信息失败"
  1606. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1607. return
  1608. }
  1609. for k2, v2 := range listSecond {
  1610. listThird, err := models.GetMinutesSummarylogListThird(articleId, v2.ChartPermissionId, v.Type)
  1611. if err != nil && err.Error() != utils.ErrNoRow() {
  1612. br.Msg = "获取信息失败"
  1613. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1614. return
  1615. }
  1616. if len(listThird) > 0 {
  1617. for k3, v3 := range listThird {
  1618. if v3.VideoUrl != "" {
  1619. listThird[k3].IsHaveVideo = true
  1620. }
  1621. if v3.ReportLink == "0" {
  1622. listThird[k3].ReportLink = ""
  1623. }
  1624. }
  1625. listSecond[k2].List = listThird
  1626. }
  1627. }
  1628. if len(listSecond) > 0 {
  1629. listFirst[k].List = listSecond
  1630. }
  1631. //`description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
  1632. if v.Type == "CYDYJY" {
  1633. listFirst[k].ListName = "产业调研纪要"
  1634. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/UPAdozy96z9ypzY04vi0Y3Ogqzji.png"
  1635. } else if v.Type == "SSGS" {
  1636. listFirst[k].ListName = "上市公司调研纪要篇"
  1637. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
  1638. } else if v.Type == "YANX" {
  1639. listFirst[k].ListName = "买方研选纪要"
  1640. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1641. }
  1642. }
  1643. historyRecord := new(models.CygxReportHistoryRecord)
  1644. historyRecord.UserId = uid
  1645. historyRecord.ArticleId = articleId
  1646. historyRecord.CreateTime = time.Now()
  1647. historyRecord.Mobile = user.Mobile
  1648. historyRecord.Email = user.Email
  1649. historyRecord.CompanyId = user.CompanyId
  1650. historyRecord.CompanyName = user.CompanyName
  1651. historyRecord.ReportType = "szjyhz"
  1652. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  1653. if err != nil && err.Error() != utils.ErrNoRow() {
  1654. br.Msg = "获取信息失败"
  1655. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  1656. return
  1657. }
  1658. historyRecord.RealName = user.RealName
  1659. if sellerItem != nil {
  1660. historyRecord.SellerName = sellerItem.RealName
  1661. }
  1662. go models.AddCygxReportHistoryRecord(historyRecord)
  1663. resp.List = listFirst
  1664. resp.Detail = detail
  1665. br.Ret = 200
  1666. br.Success = true
  1667. br.Msg = "获取成功"
  1668. br.Data = resp
  1669. }
  1670. // @Title 上周纪要汇总内容详情
  1671. // @Description 获取上周纪要汇总内容详情接口
  1672. // @Param ArticleId query int true "报告ID"
  1673. // @Success 200 {object} models.MinutesSummaryLetailResp
  1674. // @router /minutesSummary/detail [get]
  1675. func (this *ReportController) MinutesDetail() {
  1676. br := new(models.BaseResponse).Init()
  1677. defer func() {
  1678. this.Data["json"] = br
  1679. this.ServeJSON()
  1680. }()
  1681. user := this.User
  1682. if user == nil {
  1683. br.Msg = "请重新登录"
  1684. br.Ret = 408
  1685. return
  1686. }
  1687. uid := user.UserId
  1688. articleId, _ := this.GetInt("ArticleId")
  1689. if articleId < 0 {
  1690. br.Msg = "参数错误"
  1691. br.ErrMsg = "参数错误"
  1692. return
  1693. }
  1694. resp := new(models.MinutesSummaryLetailResp)
  1695. //判断用户权限
  1696. hasPermission, err := services.GetUserhasPermission(user)
  1697. if err != nil {
  1698. br.Msg = "获取信息失败"
  1699. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1700. }
  1701. resp.HasPermission = hasPermission
  1702. if hasPermission != 1 {
  1703. br.Ret = 200
  1704. br.Success = true
  1705. br.Msg = "获取成功"
  1706. br.Data = resp
  1707. return
  1708. }
  1709. detail, err := models.GetCygxMinutesSummaryInfoById(articleId)
  1710. if err != nil {
  1711. br.Msg = "获取信息失败"
  1712. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1713. return
  1714. }
  1715. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
  1716. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1717. listLog, err := models.GetMinutesSummarylogListAll(articleId)
  1718. if err != nil {
  1719. br.Msg = "获取失败"
  1720. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1721. return
  1722. }
  1723. for k, v := range listLog {
  1724. listSonLog, err := models.GetMinutesSummarylogSonListAll(articleId, v.ChartPermissionId)
  1725. if err != nil && err.Error() != utils.ErrNoRow() {
  1726. br.Msg = "获取信息失败"
  1727. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1728. return
  1729. }
  1730. if len(listSonLog) > 0 {
  1731. listLog[k].List = listSonLog
  1732. for k2, v2 := range listSonLog {
  1733. if v2.ReportLink == "0" {
  1734. listSonLog[k2].ReportLink = ""
  1735. }
  1736. }
  1737. }
  1738. }
  1739. historyRecord := new(models.CygxReportHistoryRecord)
  1740. historyRecord.UserId = uid
  1741. historyRecord.ArticleId = articleId
  1742. historyRecord.CreateTime = time.Now()
  1743. historyRecord.Mobile = user.Mobile
  1744. historyRecord.Email = user.Email
  1745. historyRecord.CompanyId = user.CompanyId
  1746. historyRecord.CompanyName = user.CompanyName
  1747. historyRecord.ReportType = "szjyhz"
  1748. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  1749. if err != nil && err.Error() != utils.ErrNoRow() {
  1750. br.Msg = "获取信息失败"
  1751. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  1752. return
  1753. }
  1754. historyRecord.RealName = user.RealName
  1755. if sellerItem != nil {
  1756. historyRecord.SellerName = sellerItem.RealName
  1757. }
  1758. go models.AddCygxReportHistoryRecord(historyRecord)
  1759. resp.List = listLog
  1760. resp.Detail = detail
  1761. br.Ret = 200
  1762. br.Success = true
  1763. br.Msg = "获取成功"
  1764. br.Data = resp
  1765. }
  1766. // @Title 获取路演精华详情
  1767. // @Description 获取路演精华详情接口
  1768. // @Param ArticleId query int true "报告ID"
  1769. // @Success 200 {object} models.RoadshowDetailResp
  1770. // @router /roadshowEssence/detail [get]
  1771. func (this *ReportController) RoadshowDetail() {
  1772. br := new(models.BaseResponse).Init()
  1773. defer func() {
  1774. this.Data["json"] = br
  1775. this.ServeJSON()
  1776. }()
  1777. user := this.User
  1778. if user == nil {
  1779. br.Msg = "请登录"
  1780. br.ErrMsg = "请登录,用户信息为空"
  1781. br.Ret = 408
  1782. return
  1783. }
  1784. uid := user.UserId
  1785. articleId, err := this.GetInt("ArticleId")
  1786. if articleId <= 0 {
  1787. br.Msg = "文章不存在"
  1788. br.ErrMsg = "文章不存在,文章ID错误"
  1789. return
  1790. }
  1791. detail := new(models.ReportDetailRoadshow)
  1792. hasPermission := 0
  1793. hasFree := 0
  1794. //判断是否已经申请过
  1795. applyCount, err := models.GetApplyRecordCount(uid)
  1796. if err != nil && err.Error() != utils.ErrNoRow() {
  1797. br.Msg = "获取信息失败"
  1798. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  1799. return
  1800. }
  1801. //`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
  1802. if user.CompanyId > 1 {
  1803. companyPermission, err := models.GetCompanyPermission(user.CompanyId)
  1804. if err != nil {
  1805. br.Msg = "获取信息失败"
  1806. br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  1807. return
  1808. }
  1809. detail, err = models.GetReportRoadshowDetailById(articleId)
  1810. if err != nil {
  1811. br.Msg = "获取信息失败"
  1812. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1813. return
  1814. }
  1815. detail.Body = html.UnescapeString(detail.Body)
  1816. detail.Abstract, _ = services.GetReportContentTextSubNew(detail.Abstract)
  1817. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
  1818. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1819. if detail.ReportLink == "0" {
  1820. detail.ReportLink = ""
  1821. }
  1822. if companyPermission == "" {
  1823. if applyCount > 0 {
  1824. hasPermission = 5
  1825. } else {
  1826. hasPermission = 2
  1827. }
  1828. hasFree = 2
  1829. goto Loop
  1830. } else {
  1831. hasFree = 1
  1832. var articlePermissionPermissionName string
  1833. articlePermissionPermissionName = detail.CategoryName
  1834. var hasPersion bool
  1835. slice := strings.Split(articlePermissionPermissionName, ",")
  1836. for _, v := range slice {
  1837. if strings.Contains(companyPermission, v) {
  1838. hasPersion = true
  1839. }
  1840. }
  1841. if hasPersion {
  1842. hasPermission = 1
  1843. historyRecord := new(models.CygxArticleHistoryRecord)
  1844. historyRecord.UserId = uid
  1845. historyRecord.ArticleId = articleId
  1846. historyRecord.CreateTime = time.Now()
  1847. historyRecord.Mobile = user.Mobile
  1848. historyRecord.Email = user.Email
  1849. historyRecord.CompanyId = user.CompanyId
  1850. historyRecord.CompanyName = user.CompanyName
  1851. go models.AddCygxArticleHistoryRecord(historyRecord)
  1852. } else { //无该行业权限
  1853. hasPermission = 3
  1854. }
  1855. if hasPermission == 1 {
  1856. key := "CYGX_ARTICLE_" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
  1857. if !utils.Rc.IsExist(key) {
  1858. //新增浏览记录
  1859. record := new(models.CygxArticleViewRecord)
  1860. record.UserId = uid
  1861. record.ArticleId = articleId
  1862. record.CreateTime = time.Now()
  1863. record.Mobile = user.Mobile
  1864. record.Email = user.Email
  1865. record.CompanyId = user.CompanyId
  1866. record.CompanyName = user.CompanyName
  1867. go models.AddCygxArticleViewRecord(record)
  1868. utils.Rc.Put(key, 1, 5*time.Second)
  1869. models.ModifyReportLastViewTime(uid)
  1870. }
  1871. }
  1872. }
  1873. } else { //潜在客户
  1874. if applyCount > 0 {
  1875. hasPermission = 5
  1876. } else {
  1877. hasPermission = 4
  1878. }
  1879. }
  1880. Loop:
  1881. if hasPermission != 1 {
  1882. detail.Body = ""
  1883. detail.Abstract = ""
  1884. }
  1885. resp := new(models.RoadshowDetailResp)
  1886. resp.HasPermission = hasPermission
  1887. resp.HasFree = hasFree
  1888. resp.Detail = detail
  1889. br.Ret = 200
  1890. br.Success = true
  1891. br.Msg = "获取成功"
  1892. br.Data = resp
  1893. }
  1894. // @Title 产业文章列表接口
  1895. // @Description 获取产业文章列表接口
  1896. // @Param KeyWord query string true "搜索关键词"
  1897. // @Success 200 {object} models.CygxIndustrySearchList
  1898. // @router /industryAndArticle/list [get]
  1899. func (this *ReportController) IndustryAndArticleList() {
  1900. br := new(models.BaseResponse).Init()
  1901. defer func() {
  1902. this.Data["json"] = br
  1903. this.ServeJSON()
  1904. }()
  1905. user := this.User
  1906. if user == nil {
  1907. br.Msg = "请重新登录"
  1908. br.Ret = 408
  1909. return
  1910. }
  1911. uid := user.UserId
  1912. keyWord := this.GetString("KeyWord")
  1913. orderSrt := "update_time DESC"
  1914. condition := ` AND subject_names LIKE '%` + keyWord + `%'`
  1915. list, err := models.GetIndustrialManagementAll(uid, condition, orderSrt, 0, 100)
  1916. if err != nil {
  1917. br.Msg = "获取信息失败"
  1918. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  1919. return
  1920. }
  1921. for k, v := range list {
  1922. industrialSubjectList, err := models.GetIndustrialSubjectAll(v.IndustrialManagementId)
  1923. if err != nil {
  1924. br.Msg = "获取信息失败"
  1925. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  1926. return
  1927. }
  1928. list[k].IndustrialSubjectList = industrialSubjectList
  1929. //list[k].LayoutTime = utils.TimeRemoveHms(v.LayoutTime)
  1930. newArtinfo, err := models.GetIndustrialNewArticleDetail(v.IndustrialManagementId)
  1931. if err != nil {
  1932. br.Msg = "获取信息失败"
  1933. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  1934. return
  1935. }
  1936. list[k].UpdateTime = utils.TimeRemoveHms(newArtinfo.PublishDate)
  1937. }
  1938. artList, err := models.GetCygxIndustryAndArticleList(keyWord)
  1939. if err != nil {
  1940. br.Msg = "获取失败"
  1941. br.ErrMsg = "获取失败,Err:" + err.Error()
  1942. return
  1943. }
  1944. for k2, v2 := range artList {
  1945. subjectNames, err := models.GetSubjectNames(v2.ArticleId)
  1946. if err != nil {
  1947. br.Msg = "获取失败" + strconv.Itoa(v2.ArticleId)
  1948. br.ErrMsg = "获取失败,Err:" + err.Error()
  1949. return
  1950. }
  1951. var subjectNamesNew string
  1952. if len(subjectNames) > 0 {
  1953. slice := strings.Split(subjectNames, "/")
  1954. for k3, v3 := range slice {
  1955. if k3 < 4 {
  1956. subjectNamesNew += v3 + "/"
  1957. }
  1958. }
  1959. }
  1960. industryName, err := models.GetIndustrialNames(v2.ArticleId)
  1961. if err != nil && err.Error() != utils.ErrNoRow() {
  1962. br.Msg = "获取失败" + strconv.Itoa(v2.ArticleId)
  1963. br.ErrMsg = "获取失败,Err:" + err.Error()
  1964. return
  1965. }
  1966. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  1967. artList[k2].SubjectName = subjectNamesNew
  1968. if subjectNamesNew == "" {
  1969. artList[k2].IndustryName = industryName
  1970. } else {
  1971. artList[k2].IndustryName = industryName + "-" + subjectNamesNew
  1972. }
  1973. }
  1974. if keyWord != "" {
  1975. keyWordItem := new(models.CygxUserSearchKeyWord)
  1976. keyWordItem.UserId = user.UserId
  1977. keyWordItem.KeyWord = keyWord
  1978. keyWordItem.PageType = "ReortSearch"
  1979. keyWordItem.CreateTime = time.Now()
  1980. go models.AddUserSearchKeyWord(keyWordItem)
  1981. }
  1982. resp := new(models.CygxIndustrySearchList)
  1983. resp.ArtList = artList
  1984. resp.IndList = list
  1985. br.Ret = 200
  1986. br.Success = true
  1987. br.Msg = "获取成功"
  1988. br.Data = resp
  1989. }
  1990. // @Title 产业报告分类关联作者列表接口Pc端
  1991. // @Description 获取产业报告分类关联作者列表接口Pc端
  1992. // @Param ChartPermissionId query int true "分类ID"
  1993. // @Param KeyWord query string true "搜索关键词"
  1994. // @Param PageSize query int true "每页数据条数"
  1995. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1996. // @Success 200 {object} models.CygxArticleDepartmentListPc
  1997. // @router /industryListByDepartmentPc [get]
  1998. func (this *ReportController) IndustryListByDepartmentPc() {
  1999. br := new(models.BaseResponse).Init()
  2000. defer func() {
  2001. this.Data["json"] = br
  2002. this.ServeJSON()
  2003. }()
  2004. user := this.User
  2005. if user == nil {
  2006. br.Msg = "请重新登录"
  2007. br.Ret = 408
  2008. return
  2009. }
  2010. uid := user.UserId
  2011. pageSize, _ := this.GetInt("PageSize")
  2012. currentIndex, _ := this.GetInt("CurrentIndex")
  2013. chartPermissionId, _ := this.GetInt("ChartPermissionId")
  2014. keyWord := this.GetString("KeyWord")
  2015. var startSize int
  2016. var condition string
  2017. condition = ` AND a.publish_status=1 AND m.chart_permission_id =` + strconv.Itoa(chartPermissionId)
  2018. if pageSize <= 0 {
  2019. pageSize = utils.PageSize20
  2020. }
  2021. if currentIndex <= 0 {
  2022. currentIndex = 1
  2023. }
  2024. var articleIdGroup string
  2025. if keyWord != "" {
  2026. //获取标的关联的文章ID
  2027. articleIdSub, err := models.GetArticleIdSubjectGroup(keyWord)
  2028. if err != nil {
  2029. br.Msg = "获取信息失败"
  2030. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  2031. return
  2032. }
  2033. //获取产业关联的标的
  2034. articleIdInd, err := models.GetArticleIndustrialIdGroup(keyWord)
  2035. if err != nil {
  2036. br.Msg = "获取信息失败"
  2037. br.ErrMsg = "获取产业信息失败,Err:" + err.Error()
  2038. return
  2039. }
  2040. if articleIdSub != "" && articleIdInd != "" {
  2041. articleIdGroup = articleIdSub + "," + articleIdInd
  2042. } else if articleIdSub != "" && articleIdInd == "" {
  2043. articleIdGroup = articleIdSub
  2044. } else if articleIdSub == "" && articleIdInd != "" {
  2045. articleIdGroup = articleIdInd
  2046. }
  2047. slice := strings.Split(keyWord, "/")
  2048. if len(slice) > 1 {
  2049. var subjectIds string
  2050. for _, v := range slice {
  2051. subjectId, err := models.GetcygxIndustrialSubjectByName(v)
  2052. if err != nil && err.Error() != utils.ErrNoRow() {
  2053. br.Msg = "获取信息失败"
  2054. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  2055. return
  2056. }
  2057. if subjectId != "" {
  2058. subjectIds += subjectId + ","
  2059. }
  2060. }
  2061. subjectIds = strings.TrimRight(subjectIds, ",")
  2062. if len(subjectIds) > 0 {
  2063. articleBySub, err := models.GetArticleIdsBySubId(subjectIds)
  2064. if err != nil {
  2065. br.Msg = "获取信息失败"
  2066. br.ErrMsg = "获取文章关联的标的失败,Err:" + err.Error()
  2067. return
  2068. }
  2069. if articleIdGroup != "" {
  2070. if articleBySub != "" {
  2071. articleIdGroup += "," + articleBySub
  2072. }
  2073. } else {
  2074. articleIdGroup = articleBySub
  2075. }
  2076. }
  2077. }
  2078. }
  2079. if articleIdGroup != "" {
  2080. condition += ` AND a.article_id IN (` + articleIdGroup + `)`
  2081. }
  2082. startSize = paging.StartIndex(currentIndex, pageSize)
  2083. total, err := models.GetArticleDepartmentCount(condition)
  2084. page := paging.GetPaging(currentIndex, pageSize, total)
  2085. resp := new(models.CygxArticleDepartmentListPc)
  2086. userType, _, err := services.GetUserType(user.CompanyId)
  2087. if err != nil {
  2088. br.Msg = "获取信息失败"
  2089. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  2090. return
  2091. }
  2092. if userType == 1 {
  2093. resp.Paging = page
  2094. br.Ret = 200
  2095. br.Success = true
  2096. br.Msg = "获取成功"
  2097. br.Data = resp
  2098. return
  2099. }
  2100. resp.HaveResearch = true
  2101. //获取作者信息,并排序
  2102. list, err := models.GetCygxArticleDepartmentListPc(startSize, pageSize, condition, uid)
  2103. if err != nil {
  2104. br.Msg = "获取信息失败"
  2105. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2106. return
  2107. }
  2108. for k, v := range list {
  2109. artList, err := models.GetArticleByDepartmentIdPc(v.DepartmentId, articleIdGroup)
  2110. if err != nil {
  2111. br.Msg = "获取信息失败"
  2112. br.ErrMsg = "获取文章信息失败,Err:" + err.Error()
  2113. return
  2114. }
  2115. for k2, v2 := range artList {
  2116. if artList[k2].IsReport == "1" {
  2117. artList[k2].Title = v2.Title
  2118. } else {
  2119. artList[k2].Title = v2.Title
  2120. }
  2121. artList[k2].IndustryName = strings.Replace(artList[k2].IndustryName, " ", "", -1)
  2122. }
  2123. list[k].List = artList
  2124. if v.FollowNum > 0 {
  2125. list[k].IsMyFollow = true
  2126. }
  2127. }
  2128. listnNew, err := models.GetIndustrialSubjectByDepartmentNew()
  2129. if err != nil {
  2130. br.Msg = "获取信息失败"
  2131. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2132. return
  2133. }
  2134. if len(listnNew) > 0 {
  2135. for _, v := range listnNew {
  2136. firstStr := strings.Index(v.IndustrialAndSubjectIds, "—")
  2137. Management := new(models.IndustrialManagementIdInt)
  2138. if firstStr == 0 {
  2139. Management.IndustryName = v.IndustryName
  2140. } else {
  2141. listSub, err := models.GetIndustrialManagementSubjectList(v.ArticleId)
  2142. if err != nil {
  2143. br.Msg = "获取信息失败"
  2144. br.ErrMsg = "获取关联标的列表失败,Err:" + err.Error()
  2145. return
  2146. }
  2147. var subjectNamesNew string
  2148. for _, v1 := range listSub {
  2149. subjectNamesNew += v1.SubjectName + "/"
  2150. }
  2151. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  2152. Management.IndustryName = subjectNamesNew
  2153. }
  2154. Management.IndustrialManagementId = v.IndustrialManagementId
  2155. Management.ArticleId = v.ArticleId
  2156. resp.ListnNew = append(resp.ListnNew, Management)
  2157. }
  2158. }
  2159. resp.List = list
  2160. resp.Paging = page
  2161. br.Ret = 200
  2162. br.Success = true
  2163. br.Msg = "获取成功"
  2164. br.Data = resp
  2165. }
  2166. // @Title 产业文章列表接口Pc端
  2167. // @Description 获取产业文章列表接口Pc端
  2168. // @Param KeyWord query string true "搜索关键词"
  2169. // @Success 200 {object} models.CygxIndustrySearchListPc
  2170. // @router /industryAndArticle/listPc [get]
  2171. func (this *ReportController) IndustryAndArticleListPc() {
  2172. br := new(models.BaseResponse).Init()
  2173. defer func() {
  2174. this.Data["json"] = br
  2175. this.ServeJSON()
  2176. }()
  2177. user := this.User
  2178. if user == nil {
  2179. br.Msg = "请重新登录"
  2180. br.Ret = 408
  2181. return
  2182. }
  2183. uid := user.UserId
  2184. keyWord := this.GetString("KeyWord")
  2185. resp := new(models.CygxIndustrySearchListPc)
  2186. orderSrt := "update_time DESC"
  2187. condition := ` AND subject_names LIKE '%` + keyWord + `%'`
  2188. list, err := models.GetIndustrialManagementAll(uid, condition, orderSrt, 0, 100)
  2189. if err != nil {
  2190. br.Msg = "获取信息失败"
  2191. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2192. return
  2193. }
  2194. for k, v := range list {
  2195. industrialSubjectList, err := models.GetIndustrialSubjectAll(v.IndustrialManagementId)
  2196. if err != nil {
  2197. br.Msg = "获取信息失败"
  2198. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2199. return
  2200. }
  2201. list[k].IndustrialSubjectList = industrialSubjectList
  2202. //list[k].LayoutTime = utils.TimeRemoveHms(v.LayoutTime)
  2203. newArtinfo, err := models.GetIndustrialNewArticleDetail(v.IndustrialManagementId)
  2204. if err != nil {
  2205. br.Msg = "获取信息失败"
  2206. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2207. return
  2208. }
  2209. list[k].UpdateTime = utils.TimeRemoveHms(newArtinfo.PublishDate)
  2210. }
  2211. artList, err := models.GetCygxIndustryAndArticleList(keyWord)
  2212. if err != nil {
  2213. br.Msg = "获取失败"
  2214. br.ErrMsg = "获取失败,Err:" + err.Error()
  2215. return
  2216. }
  2217. if len(artList) > 0 {
  2218. var articleIds string
  2219. for _, v := range artList {
  2220. articleIds += strconv.Itoa(v.ArticleId) + ","
  2221. }
  2222. articleIds = strings.TrimRight(articleIds, ",")
  2223. if articleIds != "" {
  2224. condition = ` AND a.article_id IN (` + articleIds + `)`
  2225. DepartmentList, err := models.GetCygxArticleDepartmentListPc(0, 20, condition, uid)
  2226. if err != nil {
  2227. br.Msg = "获取信息失败"
  2228. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2229. return
  2230. }
  2231. for k, v := range DepartmentList {
  2232. artList, err := models.GetArticleByDepartmentIdPc(v.DepartmentId, articleIds)
  2233. if err != nil {
  2234. br.Msg = "获取信息失败"
  2235. br.ErrMsg = "获取文章信息失败,Err:" + err.Error()
  2236. return
  2237. }
  2238. for k2, v2 := range artList {
  2239. if artList[k2].IsReport == "1" {
  2240. artList[k2].Title = v2.Title
  2241. } else {
  2242. artList[k2].Title = v2.Title
  2243. }
  2244. artList[k2].IndustryName = strings.Replace(artList[k2].IndustryName, " ", "", -1)
  2245. }
  2246. DepartmentList[k].List = artList
  2247. if v.FollowNum > 0 {
  2248. DepartmentList[k].IsMyFollow = true
  2249. }
  2250. }
  2251. resp.DepartmentList = DepartmentList
  2252. }
  2253. }
  2254. if keyWord != "" {
  2255. keyWordItem := new(models.CygxUserSearchKeyWord)
  2256. keyWordItem.UserId = user.UserId
  2257. keyWordItem.KeyWord = keyWord
  2258. keyWordItem.PageType = "ReortSearch"
  2259. keyWordItem.CreateTime = time.Now()
  2260. go models.AddUserSearchKeyWord(keyWordItem)
  2261. }
  2262. resp.IndList = list
  2263. br.Ret = 200
  2264. br.Success = true
  2265. br.Msg = "获取成功"
  2266. br.Data = resp
  2267. }
  2268. // @Title 报告搜索
  2269. // @Description 报告搜索接口
  2270. // @Param KeyWord query string true "搜索关键词"
  2271. // @Success 200 {object} models.ReoprtSearchResp
  2272. // @router /searchReport [get]
  2273. func (this *ReportController) SearchReport() {
  2274. br := new(models.BaseResponse).Init()
  2275. defer func() {
  2276. this.Data["json"] = br
  2277. this.ServeJSON()
  2278. }()
  2279. user := this.User
  2280. if user == nil {
  2281. br.Msg = "请重新登录"
  2282. br.Ret = 408
  2283. return
  2284. }
  2285. keyWord := this.GetString("KeyWord")
  2286. var condition string
  2287. var sqlGroup string
  2288. //匹配报告标题、
  2289. condition = `AND ( a.title LIKE '%` + keyWord + `%' OR a.body LIKE '%` + keyWord + `%' OR a.annotation LIKE '%` + keyWord + `%' OR a.abstract LIKE '%` + keyWord + `%') AND a.publish_status = 1 `
  2290. sqlGroup = ` GROUP BY a.article_id ORDER BY a.publish_date DESC `
  2291. //对应产业名称、标的名称。
  2292. listYx, err := models.GetArticleCollectionList(` AND a.article_id >= 1000000 `+condition+sqlGroup, user.UserId)
  2293. if err != nil {
  2294. br.Msg = "获取信息失败"
  2295. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2296. return
  2297. }
  2298. for k, v := range listYx {
  2299. listYx[k].Source = 2
  2300. if v.MyCollectNum > 0 {
  2301. listYx[k].IsCollect = true
  2302. }
  2303. }
  2304. listHz, err := models.GetReoprtSearchList(` AND a.article_id < 1000000 `+condition+` OR ( article_type = 'lyjh' `+condition+` ) `+sqlGroup, user.UserId)
  2305. if err != nil {
  2306. br.Msg = "获取信息失败"
  2307. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2308. return
  2309. }
  2310. for k, v := range listHz {
  2311. listHz[k].Source = 1
  2312. if v.MyCollectNum > 0 {
  2313. listHz[k].IsCollect = true
  2314. }
  2315. }
  2316. if keyWord != "" {
  2317. keyWordItem := new(models.CygxUserSearchKeyWord)
  2318. keyWordItem.UserId = user.UserId
  2319. keyWordItem.KeyWord = keyWord
  2320. keyWordItem.PageType = "ReortSearch"
  2321. keyWordItem.CreateTime = time.Now()
  2322. go models.AddUserSearchKeyWord(keyWordItem)
  2323. go services.AddUserSearchLog(user, keyWord, 5)
  2324. }
  2325. if len(listYx) == 0 {
  2326. listYx = make([]*models.ArticleCollectionResp, 0)
  2327. }
  2328. if len(listHz) == 0 {
  2329. listHz = make([]*models.ArticleCollectionResp, 0)
  2330. }
  2331. resp := new(models.ReoprtSearchResp)
  2332. resp.ListYx = listYx
  2333. resp.ListHz = listHz
  2334. br.Ret = 200
  2335. br.Success = true
  2336. br.Msg = "获取成功"
  2337. br.Data = resp
  2338. }
  2339. // @Title 资源包搜索
  2340. // @Description 资源包搜索接口
  2341. // @Param KeyWord query string true "搜索关键词"
  2342. // @Success 200 {object} models.SearchResourceResp
  2343. // @router /searchResource [get]
  2344. func (this *ReportController) SearchResource() {
  2345. br := new(models.BaseResponse).Init()
  2346. defer func() {
  2347. this.Data["json"] = br
  2348. this.ServeJSON()
  2349. }()
  2350. user := this.User
  2351. if user == nil {
  2352. br.Msg = "请重新登录"
  2353. br.Ret = 408
  2354. return
  2355. }
  2356. uid := user.UserId
  2357. fllowList, err := models.GetUserFllowIndustrialList(uid)
  2358. if err != nil {
  2359. br.Msg = "获取失败"
  2360. br.ErrMsg = "获取失败,GetUserFllowIndustrialList Err:" + err.Error()
  2361. return
  2362. }
  2363. fllowMap := make(map[int]int)
  2364. if len(fllowList) > 0 {
  2365. for _, v := range fllowList {
  2366. fllowMap[v.IndustrialManagementId] = v.IndustrialManagementId
  2367. }
  2368. }
  2369. keyWord := this.GetString("KeyWord")
  2370. var condition string
  2371. var conditionOr string
  2372. //conditionOr = ` OR ( a.title LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2373. conditionOr += ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2374. condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
  2375. listHz, err := models.GetSearchResourceList(condition, 0, 0)
  2376. if err != nil {
  2377. br.Msg = "获取信息失败"
  2378. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2379. return
  2380. }
  2381. //conditionOr = ` OR ( a.title LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2382. conditionOr = ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2383. condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
  2384. listYx, err := models.GetSearchResourceList(condition, 0, 0)
  2385. if err != nil {
  2386. br.Msg = "获取信息失败"
  2387. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2388. return
  2389. }
  2390. //合并产业关联的标的
  2391. listSubjcet, err := models.GetThemeHeatSubjectList("")
  2392. if err != nil {
  2393. br.Msg = "获取信息失败"
  2394. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  2395. return
  2396. }
  2397. industrialIdArr := make([]int, 0)
  2398. for k, v := range listHz {
  2399. listHz[k].Source = 1
  2400. if fllowMap[v.IndustrialManagementId] > 0 {
  2401. listHz[k].IsFollw = true
  2402. }
  2403. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  2404. }
  2405. for k, v := range listYx {
  2406. listYx[k].Source = 2
  2407. if fllowMap[v.IndustrialManagementId] > 0 {
  2408. listYx[k].IsFollw = true
  2409. }
  2410. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  2411. }
  2412. if len(industrialIdArr) > 0 {
  2413. //合并产业关联的标的
  2414. listSubjcet, err = models.GetIndustrialSubjectAllByIndustrialId(industrialIdArr)
  2415. if err != nil {
  2416. br.Msg = "获取信息失败"
  2417. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  2418. return
  2419. }
  2420. mapIndustrial := make(map[string]int)
  2421. for _, v := range listSubjcet {
  2422. for k2, v2 := range listYx {
  2423. if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] == 0 {
  2424. listYx[k2].IndustrialSubjectList = append(listYx[k2].IndustrialSubjectList, v)
  2425. mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] = v2.IndustrialManagementId
  2426. }
  2427. }
  2428. for k2, v2 := range listHz {
  2429. if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] == 0 {
  2430. listHz[k2].IndustrialSubjectList = append(listHz[k2].IndustrialSubjectList, v)
  2431. mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] = v2.IndustrialManagementId
  2432. }
  2433. }
  2434. }
  2435. }
  2436. if keyWord != "" {
  2437. keyWordItem := new(models.CygxUserSearchKeyWord)
  2438. keyWordItem.UserId = user.UserId
  2439. keyWordItem.KeyWord = keyWord
  2440. keyWordItem.PageType = "ReortSearch"
  2441. keyWordItem.CreateTime = time.Now()
  2442. go models.AddUserSearchKeyWord(keyWordItem)
  2443. go services.AddUserSearchLog(user, keyWord, 4)
  2444. }
  2445. resp := new(models.SearchResourceResp)
  2446. if len(listYx) == 0 {
  2447. listYx = make([]*models.IndustrialManagementHotResp, 0)
  2448. }
  2449. if len(listHz) == 0 {
  2450. listHz = make([]*models.IndustrialManagementHotResp, 0)
  2451. }
  2452. resp.ListYx = listYx
  2453. resp.ListHz = listHz
  2454. br.Ret = 200
  2455. br.Success = true
  2456. br.Msg = "获取成功"
  2457. br.Data = resp
  2458. }
  2459. // @Title 报告搜索、资源包搜索接口
  2460. // @Description 报告搜索、资源包搜索接口接口
  2461. // @Param KeyWord query string true "搜索关键词"
  2462. // @Param PageSize query int true "每页数据条数"
  2463. // @Success 200 {object} models.SearchReportAndResourceResp
  2464. // @router /searchReportAndResource [get]
  2465. func (this *ReportController) SearchReportAndResource() {
  2466. br := new(models.BaseResponse).Init()
  2467. defer func() {
  2468. this.Data["json"] = br
  2469. this.ServeJSON()
  2470. }()
  2471. user := this.User
  2472. if user == nil {
  2473. br.Msg = "请重新登录"
  2474. br.Ret = 408
  2475. return
  2476. }
  2477. uid := user.UserId
  2478. keyWord := this.GetString("KeyWord")
  2479. pageSize, _ := this.GetInt("PageSize")
  2480. var condition string
  2481. var sqlGroup string
  2482. //匹配报告标题、
  2483. condition = `AND ( a.title LIKE '%` + keyWord + `%' OR a.body LIKE '%` + keyWord + `%' OR a.annotation LIKE '%` + keyWord + `%' OR a.abstract LIKE '%` + keyWord + `%') AND a.publish_status = 1 `
  2484. sqlGroup = ` GROUP BY a.article_id ORDER BY a.publish_date DESC `
  2485. if pageSize > 0 {
  2486. sqlGroup += ` LIMIT 5 `
  2487. }
  2488. ListYxReport, err := models.GetArticleCollectionList(` AND a.article_id >= 1000000 `+condition+sqlGroup, user.UserId)
  2489. if err != nil {
  2490. br.Msg = "获取信息失败"
  2491. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2492. return
  2493. }
  2494. for k, v := range ListYxReport {
  2495. ListYxReport[k].Source = 2
  2496. if v.MyCollectNum > 0 {
  2497. ListYxReport[k].IsCollect = true
  2498. }
  2499. }
  2500. ListHzReport, err := models.GetReoprtSearchList(` AND a.article_id < 1000000 `+condition+` OR ( article_type = 'lyjh' `+condition+` ) `+sqlGroup, user.UserId)
  2501. if err != nil {
  2502. br.Msg = "获取信息失败"
  2503. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2504. return
  2505. }
  2506. for k, v := range ListHzReport {
  2507. ListHzReport[k].Source = 1
  2508. if v.MyCollectNum > 0 {
  2509. ListHzReport[k].IsCollect = true
  2510. }
  2511. }
  2512. if len(ListYxReport) == 0 {
  2513. ListYxReport = make([]*models.ArticleCollectionResp, 0)
  2514. }
  2515. if len(ListHzReport) == 0 {
  2516. ListHzReport = make([]*models.ArticleCollectionResp, 0)
  2517. }
  2518. fllowList, err := models.GetUserFllowIndustrialList(uid)
  2519. if err != nil {
  2520. br.Msg = "获取失败"
  2521. br.ErrMsg = "获取失败,GetUserFllowIndustrialList Err:" + err.Error()
  2522. return
  2523. }
  2524. fllowMap := make(map[int]int)
  2525. if len(fllowList) > 0 {
  2526. for _, v := range fllowList {
  2527. fllowMap[v.IndustrialManagementId] = v.IndustrialManagementId
  2528. }
  2529. }
  2530. var conditionOr string
  2531. conditionOr += ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2532. condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
  2533. listHzResource, err := models.GetSearchResourceList(condition, 0, pageSize)
  2534. if err != nil {
  2535. br.Msg = "获取信息失败"
  2536. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2537. return
  2538. }
  2539. conditionOr = ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2540. condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
  2541. listYxResource, err := models.GetSearchResourceList(condition, 0, pageSize)
  2542. if err != nil {
  2543. br.Msg = "获取信息失败"
  2544. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2545. return
  2546. }
  2547. //合并产业关联的标的
  2548. listSubjcet, err := models.GetThemeHeatSubjectList("")
  2549. if err != nil {
  2550. br.Msg = "获取信息失败"
  2551. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  2552. return
  2553. }
  2554. industrialIdArr := make([]int, 0)
  2555. for k, v := range listHzResource {
  2556. listHzResource[k].Source = 1
  2557. if fllowMap[v.IndustrialManagementId] > 0 {
  2558. listHzResource[k].IsFollw = true
  2559. }
  2560. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  2561. }
  2562. for k, v := range listYxResource {
  2563. listYxResource[k].Source = 2
  2564. if fllowMap[v.IndustrialManagementId] > 0 {
  2565. listYxResource[k].IsFollw = true
  2566. }
  2567. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  2568. }
  2569. if len(industrialIdArr) > 0 {
  2570. //合并产业关联的标的
  2571. listSubjcet, err = models.GetIndustrialSubjectAllByIndustrialId(industrialIdArr)
  2572. if err != nil {
  2573. br.Msg = "获取信息失败"
  2574. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  2575. return
  2576. }
  2577. mapIndustrial := make(map[string]int)
  2578. for _, v := range listSubjcet {
  2579. for k2, v2 := range listYxResource {
  2580. if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] == 0 {
  2581. listYxResource[k2].IndustrialSubjectList = append(listYxResource[k2].IndustrialSubjectList, v)
  2582. mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] = v2.IndustrialManagementId
  2583. }
  2584. }
  2585. for k2, v2 := range listHzResource {
  2586. if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] == 0 {
  2587. listHzResource[k2].IndustrialSubjectList = append(listHzResource[k2].IndustrialSubjectList, v)
  2588. mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] = v2.IndustrialManagementId
  2589. }
  2590. }
  2591. }
  2592. }
  2593. resp := new(models.SearchReportAndResourceResp)
  2594. if len(listYxResource) == 0 {
  2595. listYxResource = make([]*models.IndustrialManagementHotResp, 0)
  2596. }
  2597. if len(listHzResource) == 0 {
  2598. listHzResource = make([]*models.IndustrialManagementHotResp, 0)
  2599. }
  2600. if keyWord != "" {
  2601. keyWordItem := new(models.CygxUserSearchKeyWord)
  2602. keyWordItem.UserId = user.UserId
  2603. keyWordItem.KeyWord = keyWord
  2604. keyWordItem.PageType = "ReortSearch"
  2605. keyWordItem.CreateTime = time.Now()
  2606. go models.AddUserSearchKeyWord(keyWordItem)
  2607. go services.AddUserSearchLog(user, keyWord, 5)
  2608. }
  2609. resp.ListHzResource = listHzResource
  2610. resp.ListYxResource = listYxResource
  2611. resp.ListYxReport = ListYxReport
  2612. resp.ListHzReport = ListHzReport
  2613. br.Ret = 200
  2614. br.Success = true
  2615. br.Msg = "获取成功"
  2616. br.Data = resp
  2617. }