report.go 83 KB

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