report.go 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "hongze/hongze_clpt/models"
  6. "hongze/hongze_clpt/services"
  7. "hongze/hongze_clpt/utils"
  8. "strconv"
  9. "strings"
  10. "time"
  11. )
  12. // 报告
  13. type ReportController struct {
  14. BaseAuthController
  15. }
  16. type ReportCommonController struct {
  17. BaseCommonController
  18. }
  19. type MobileReportController struct {
  20. BaseAuthMobileController
  21. }
  22. // @Title 行业报告分类列表接口
  23. // @Description 获取行业报告分类列表接口
  24. // @Param ChartPermissionId query int true "分类ID"
  25. // @Success 200 {object} models.TradeReportMappingResp
  26. // @router /tradeList [get]
  27. func (this *MobileReportController) TradeList() {
  28. br := new(models.BaseResponse).Init()
  29. defer func() {
  30. this.Data["json"] = br
  31. this.ServeJSON()
  32. }()
  33. user := this.User
  34. if user == nil {
  35. br.Msg = "请重新登录"
  36. br.Ret = 408
  37. return
  38. }
  39. //uid := user.UserId
  40. ChartPermissionId, _ := this.GetInt("ChartPermissionId")
  41. if ChartPermissionId < 1 {
  42. br.Msg = "请输入分类ID"
  43. return
  44. }
  45. //var result []*models.SearchItem
  46. var list []*models.TradeReportMapping
  47. var err error
  48. mapCategory := make(map[int]int)
  49. if ChartPermissionId == utils.CE_LUE_ID || ChartPermissionId == utils.GU_SHOU_ID {
  50. listTrade, errTrade := models.GetReportMappingStrategyHomeAllByCygx(user.UserId, ChartPermissionId)
  51. err = errTrade
  52. if ChartPermissionId == utils.CE_LUE_ID {
  53. cf, err := models.GetConfigByCode(utils.CYGX_TACTICS_TIME_LINE_STATUS)
  54. if err != nil {
  55. br.Msg = "获取失败"
  56. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  57. return
  58. }
  59. if cf.ConfigValue == "1" || user.CompanyId == utils.HZ_COMPANY_ID {
  60. item := new(models.TradeReportMapping)
  61. item.CategoryId = utils.TIME_LINE_ID
  62. item.MatchTypeName = utils.TIME_LINE_NAME
  63. list = append(list, item)
  64. }
  65. }
  66. for _, v := range listTrade {
  67. list = append(list, v)
  68. }
  69. if user.Mobile != "" {
  70. //策略的处理
  71. categoryList, err := models.GetCygxXzsChooseCategoryList(user.Mobile)
  72. if err != nil && err.Error() != utils.ErrNoRow() {
  73. br.Msg = "获取信息失败"
  74. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  75. return
  76. }
  77. for _, v := range categoryList {
  78. mapCategory[v.IdCygx] = v.IdCygx
  79. }
  80. }
  81. } else {
  82. listCategory, err := models.GetTradeArticleAndProductInterior(ChartPermissionId)
  83. if err != nil {
  84. br.Msg = "获取信息失败"
  85. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  86. return
  87. }
  88. categoryMap := make(map[int]int)
  89. for _, v := range listCategory {
  90. if categoryMap[v.CategoryId] > 0 {
  91. continue
  92. }
  93. categoryMap[v.CategoryId] = v.CategoryId
  94. list = append(list, v)
  95. }
  96. //加了一个需求,现有数据结构不支持,手动添加 2023-06-12
  97. //if ChartPermissionId == utils.KE_JI_ID {
  98. // list = append(list, &models.TradeReportMapping{MatchTypeName: "AI前沿", CategoryId: utils.ACTEGORY_ID_AI_QY})
  99. //}
  100. }
  101. if err != nil {
  102. br.Msg = "获取信息失败"
  103. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  104. return
  105. }
  106. for k, v := range list {
  107. if ChartPermissionId != utils.CE_LUE_ID && ChartPermissionId != utils.GU_SHOU_ID {
  108. var pageSize int
  109. var listArticle []*models.HomeArticle
  110. pageSize = 3
  111. if v.CategoryId == utils.ACTEGORY_ID_AI_QY {
  112. //加了一个需求,现有数据结构不支持,手动添加 2023-06-12
  113. listArticle, _, err = services.GetAiQianYanArtilceList(0, pageSize)
  114. } else {
  115. listArticle, _, err = models.GetReportAndproductIndustrylList(v.CategoryId, 0, pageSize)
  116. }
  117. if err != nil {
  118. br.Msg = "获取信息失败"
  119. br.Msg = "GetHomeList,Err:" + err.Error()
  120. return
  121. }
  122. if len(listArticle) > 0 {
  123. list[k].UpdateTime = utils.StrTimeToTime(listArticle[0].PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
  124. }
  125. list[k].ListArticle = listArticle
  126. } else {
  127. if mapCategory[v.CategoryId] > 0 {
  128. list[k].IsFollow = true
  129. }
  130. list[k].ListArticle = make([]*models.HomeArticle, 0)
  131. }
  132. }
  133. resp := new(models.TradeReportMappingResp)
  134. if len(list) == 0 {
  135. list = make([]*models.TradeReportMapping, 0)
  136. }
  137. resp.List = list
  138. br.Ret = 200
  139. br.Success = true
  140. br.Msg = "获取成功"
  141. br.Data = resp
  142. }
  143. // @Title 产业报告分类列表接口
  144. // @Description 获取产业报告分类列表接口
  145. // @Param ChartPermissionId query int true "分类ID"
  146. // @Param DeepCover query int false "是否选择深度覆盖,1是,0否 不填默认为0"
  147. // @Param RecommendFocus query int false "是否选择推荐关注,1是,0否 不填默认为0"
  148. // @Param PageSize query int true "每页数据条数"
  149. // @Param CurrentIndex query int true "当前页页码,从1开始"
  150. // @Param IsBillboard query bool false "是否属于榜单 是true 否 false"
  151. // @Success 200 {object} models.IndustrialManagementList
  152. // @router /industryList [get]
  153. func (this *MobileReportController) IndustryList() {
  154. br := new(models.BaseResponse).Init()
  155. defer func() {
  156. this.Data["json"] = br
  157. this.ServeJSON()
  158. }()
  159. user := this.User
  160. if user == nil {
  161. br.Msg = "请重新登录"
  162. br.Ret = 408
  163. return
  164. }
  165. uid := user.UserId
  166. ChartPermissionId, _ := this.GetInt("ChartPermissionId")
  167. orderColumn := this.GetString("OrderColumn")
  168. orderColumnNew := this.GetString("OrderColumn")
  169. isNewLabel := this.GetString("IsNewLabel")
  170. isDeepLabel := this.GetString("IsDeepLabel")
  171. pageSize, _ := this.GetInt("PageSize")
  172. currentIndex, _ := this.GetInt("CurrentIndex")
  173. deepCover, _ := this.GetInt("DeepCover")
  174. recommendFocus, _ := this.GetInt("RecommendFocus")
  175. isBillboard, _ := this.GetBool("IsBillboard", false)
  176. var orderSrt string
  177. var condition string
  178. var startSize int
  179. resp := new(models.IndustrialManagementList)
  180. if pageSize <= 0 {
  181. pageSize = utils.PageSize20
  182. }
  183. if currentIndex <= 0 {
  184. currentIndex = 1
  185. }
  186. startSize = paging.StartIndex(currentIndex, pageSize)
  187. if ChartPermissionId > 0 {
  188. condition += ` AND man.chart_permission_id IN (` + strconv.Itoa(ChartPermissionId) + `)`
  189. }
  190. // 获取近一个月产业报告阅读次数最多的产业
  191. var topCond string
  192. var topPars []interface{}
  193. topReadIndustryId := 0
  194. if ChartPermissionId > 0 {
  195. topCond += ` AND chart_permission_id = ?`
  196. topPars = append(topPars, ChartPermissionId)
  197. }
  198. topReadIndustry, e := models.GetTopOneMonthArtReadNumIndustry(topCond, topPars)
  199. if e != nil && e.Error() != utils.ErrNoRow() {
  200. br.Msg = "获取信息失败"
  201. br.ErrMsg = "获取近一个月报告阅读次数最多的产业失败, Err: " + e.Error()
  202. return
  203. }
  204. if topReadIndustry != nil {
  205. topReadIndustryId = topReadIndustry.IndustrialManagementId
  206. }
  207. // 深度覆盖
  208. if deepCover == 1 {
  209. // 查询深标签产业报告数
  210. var deepCondition string
  211. var deepPars []interface{}
  212. deepCondition += ` AND man.is_deep_label = 1`
  213. if ChartPermissionId > 0 {
  214. deepCondition += ` AND man.chart_permission_id = ?`
  215. deepPars = append(deepPars, ChartPermissionId)
  216. }
  217. industryCountList, e := models.GetIndustryArtCountByCondition(deepCondition, deepPars)
  218. if e != nil {
  219. br.Msg = "获取信息失败"
  220. br.ErrMsg = "获取深标签产业报告数失败, Err: " + e.Error()
  221. return
  222. }
  223. deepIdArr := make([]string, 0)
  224. for i := range industryCountList {
  225. if industryCountList[i].ArtNum > 10 {
  226. deepIdArr = append(deepIdArr, strconv.Itoa(industryCountList[i].IndustrialManagementId))
  227. }
  228. }
  229. deepIds := strings.Join(deepIdArr, ",")
  230. if deepIds != "" {
  231. condition = `AND man.industrial_management_id IN (` + deepIds + `)`
  232. }
  233. }
  234. // 推荐关注
  235. if recommendFocus == 1 {
  236. condition += ` AND man.recommended_index >= 80`
  237. }
  238. var list []*models.IndustrialManagement
  239. total, err := models.GetIndustrialManagementAllCount(condition)
  240. if err != nil {
  241. br.Msg = "获取信息失败"
  242. br.ErrMsg = "获取数量失败,Err:" + err.Error()
  243. return
  244. }
  245. if orderColumn == "" {
  246. orderColumn = "NewTime"
  247. }
  248. if orderColumn == "NewTime" {
  249. orderSrt = "update_time DESC"
  250. } else {
  251. orderSrt = "man.recommended_index DESC,update_time DESC"
  252. }
  253. if isBillboard {
  254. // 查询有已归类行业报告的行业IDs
  255. activeIndustryIds, e := models.GetActiveArticleIndustryIds()
  256. if e != nil {
  257. br.Msg = "获取失败"
  258. br.ErrMsg = "获取已归类行业失败, Err:" + e.Error()
  259. return
  260. }
  261. activeIndustryLen := len(activeIndustryIds)
  262. //topNum := pageSize
  263. condition = ""
  264. var parsBd []interface{}
  265. if ChartPermissionId > 0 {
  266. condition += ` AND man.chart_permission_id = ? `
  267. parsBd = append(parsBd, ChartPermissionId)
  268. }
  269. if activeIndustryLen > 0 {
  270. condition += ` AND man.industrial_management_id IN (` + utils.GetOrmInReplace(activeIndustryLen) + `)`
  271. parsBd = append(parsBd, activeIndustryIds)
  272. }
  273. nowTime := time.Now().Local()
  274. startTime := nowTime.AddDate(0, -1, 0)
  275. endTime := nowTime.AddDate(0, 0, -1)
  276. condition += ` AND idf.create_time BETWEEN ? AND ?`
  277. parsBd = append(parsBd, startTime, endTime)
  278. list, e = models.GetTopIndustryFollowData(0, pageSize, condition, parsBd)
  279. if e != nil {
  280. br.Msg = "获取失败"
  281. br.ErrMsg = "获取关注度最高的产业数据失败, Err:" + e.Error()
  282. return
  283. }
  284. } else {
  285. list, err = models.GetIndustrialManagementAll(uid, condition, orderSrt, startSize, pageSize, isBillboard)
  286. if err != nil {
  287. br.Msg = "获取信息失败"
  288. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  289. return
  290. }
  291. }
  292. var resource string
  293. if ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
  294. resource = utils.REOURCE_YX
  295. } else {
  296. resource = utils.REOURCE_HZ
  297. }
  298. list, err = services.HandleIndustryList(list, user, resource)
  299. if err != nil {
  300. br.Msg = "获取信息失败"
  301. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  302. return
  303. }
  304. industrialIdArr := make([]int, 0)
  305. for k, v := range list {
  306. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  307. if topReadIndustryId > 0 && list[k].IndustrialManagementId == topReadIndustryId {
  308. list[k].IsHot = true
  309. }
  310. }
  311. if orderColumnNew != "" {
  312. item := new(models.CygxReportIndustrialSeaarchHistory)
  313. item.UserId = user.UserId
  314. item.Mobile = user.Mobile
  315. item.CompanyId = user.CompanyId
  316. item.CompanyName = user.CompanyName
  317. item.CreateTime = time.Now()
  318. item.IsDeepLabel = isDeepLabel
  319. item.IsNewLabel = isNewLabel
  320. item.ChartPermissionId = ChartPermissionId
  321. if orderColumnNew == "NewTime" {
  322. item.OrderColumn = "0"
  323. } else {
  324. item.OrderColumn = "1"
  325. }
  326. go models.AddCygxReportIndustrialSeaarchHistory(item)
  327. }
  328. if len(list) == 0 {
  329. list = make([]*models.IndustrialManagement, 0)
  330. }
  331. page := paging.GetPaging(currentIndex, pageSize, total)
  332. if isBillboard {
  333. total = len(list)
  334. }
  335. resp.List = list
  336. resp.Paging = page
  337. br.Ret = 200
  338. br.Success = true
  339. br.Msg = "获取成功"
  340. br.Data = resp
  341. }
  342. // @Title 产业下所关联的文章分类列表
  343. // @Description 产业下所关联的文章分类列表接口
  344. // @Param IndustrialManagementId query int true "产业ID"
  345. // @Success 200 {object} models.IndustrialToArticleCategoryListRep
  346. // @router /toArticleCategoryList [get]
  347. func (this *MobileReportController) ArticleCategoryList() {
  348. br := new(models.BaseResponse).Init()
  349. defer func() {
  350. this.Data["json"] = br
  351. this.ServeJSON()
  352. }()
  353. user := this.User
  354. if user == nil {
  355. br.Msg = "请重新登录"
  356. br.Ret = 408
  357. return
  358. }
  359. //uid := user.UserId
  360. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  361. if industrialManagementId < 1 {
  362. br.Msg = "请输入分类ID"
  363. return
  364. }
  365. detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
  366. if err != nil {
  367. br.Msg = "获取信息失败"
  368. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  369. return
  370. }
  371. listCategory, err := models.IndustrialToArticleAndProductInteriorCategoryNew(industrialManagementId)
  372. if err != nil {
  373. br.Msg = "获取信息失败"
  374. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  375. return
  376. }
  377. var list []*models.IndustrialToArticleCategoryRep
  378. categoryMap := make(map[int]int)
  379. for _, v := range listCategory {
  380. if categoryMap[v.CategoryId] > 0 {
  381. continue
  382. }
  383. categoryMap[v.CategoryId] = v.CategoryId
  384. list = append(list, v)
  385. }
  386. //标的列表
  387. industrialSubjectList, err := models.GetIndustrialArticleGroupSubjectListByHz(industrialManagementId)
  388. if err != nil {
  389. br.Msg = "获取信息失败"
  390. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  391. return
  392. }
  393. videoSimple, au, err := services.GetindustryVideo(user, industrialManagementId)
  394. if err != nil {
  395. br.Msg = "获取失败"
  396. br.ErrMsg = "获取用户权限失败, Err: " + err.Error()
  397. return
  398. }
  399. timeLineItem := models.IndustrialToArticleCategoryRep{
  400. CategoryId: utils.TIME_CATEGORYID,
  401. MatchTypeName: "时间线",
  402. }
  403. timeLineIsRed, err := services.GetShowTimeLineIsRed(user, industrialManagementId)
  404. if err != nil {
  405. br.Msg = "获取失败"
  406. br.ErrMsg = "获取用户权限失败, Err: " + err.Error()
  407. return
  408. }
  409. timeLineItem.IsRed = timeLineIsRed
  410. list = append([]*models.IndustrialToArticleCategoryRep{&timeLineItem}, list...)
  411. resp := new(models.IndustrialToArticleCategoryListRep)
  412. resp.List = list
  413. resp.ListSubject = industrialSubjectList
  414. resp.LayoutTime = utils.TimeRemoveHms(detail.LayoutTime)
  415. resp.IndustryName = detail.IndustryName
  416. resp.IndustrialManagementId = industrialManagementId
  417. if videoSimple != nil && videoSimple.Id > 0 {
  418. resp.IndustryVideo = videoSimple
  419. }
  420. resp.AuthInfo = au
  421. br.Ret = 200
  422. br.Success = true
  423. br.Msg = "获取成功"
  424. br.Data = resp
  425. }
  426. // @Title 根据行业分类获取文章列表
  427. // @Description根据行业分类获取文章列表接口
  428. // @Param PageSize query int true "每页数据条数"
  429. // @Param CurrentIndex query int true "当前页页码,从1开始"
  430. // @Param CategoryId query int true "分类ID"
  431. // @Param IndustrialManagementId query int false "产业ID"
  432. // @Success 200 {object} models.TacticsListResp
  433. // @router /articleList/byCategoryId [get]
  434. func (this *MobileReportController) List() {
  435. br := new(models.BaseResponse).Init()
  436. defer func() {
  437. this.Data["json"] = br
  438. this.ServeJSON()
  439. }()
  440. user := this.User
  441. if user == nil {
  442. br.Msg = "请重新登录"
  443. br.Ret = 408
  444. return
  445. }
  446. //uid := user.UserId
  447. pageSize, _ := this.GetInt("PageSize")
  448. currentIndex, _ := this.GetInt("CurrentIndex")
  449. categoryId, _ := this.GetInt("CategoryId")
  450. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  451. uid := user.UserId
  452. var startSize int
  453. if pageSize <= 0 {
  454. pageSize = utils.PageSize20
  455. }
  456. if currentIndex <= 0 {
  457. currentIndex = 1
  458. }
  459. startSize = paging.StartIndex(currentIndex, pageSize)
  460. //var condition string
  461. var pars []interface{}
  462. var total int
  463. resp := new(models.TacticsListResp)
  464. page := paging.GetPaging(currentIndex, pageSize, total)
  465. list := make([]*models.ArticleListResp, 0)
  466. if categoryId == utils.TIME_CATEGORYID {
  467. var err error
  468. list, total, err = models.GetTimeLineReportIndustrialList(industrialManagementId, startSize, pageSize)
  469. if err != nil {
  470. br.Msg = "获取信息失败"
  471. br.ErrMsg = "获取产业报告+晨会点评列表,Err:" + err.Error()
  472. return
  473. }
  474. } else {
  475. //获取该产业下所对应的行业图片
  476. //var reportType int
  477. //if industrialManagementId > 0 {
  478. // reportType = 2
  479. //} else {
  480. // reportType = 1
  481. //}
  482. //detail, errCategory := models.GetdetailByCategoryIdOne(categoryId, reportType)
  483. //if errCategory != nil {
  484. // br.Msg = "获取信息失败"
  485. // br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
  486. // return
  487. //}
  488. //对应行业的图片
  489. detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
  490. if err != nil {
  491. br.Msg = "获取数据失败"
  492. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  493. return
  494. }
  495. chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
  496. mapChartPermission := make(map[string]string)
  497. var permissionName string
  498. var imgUrlChartPermission string
  499. for _, v := range chartPermissionUrlList {
  500. vslice := strings.Split(v, "_")
  501. permissionName = vslice[0]
  502. imgUrlChartPermission = vslice[len(vslice)-1]
  503. mapChartPermission[permissionName] = imgUrlChartPermission
  504. }
  505. //对应分类的所图片
  506. detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
  507. if err != nil {
  508. br.Msg = "获取数据失败"
  509. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  510. return
  511. }
  512. categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
  513. mapCategoryUrl := make(map[string]string)
  514. var categoryIdStr string
  515. var imgUrlChart string
  516. for _, v := range categoryUrlList {
  517. vslice := strings.Split(v, "_")
  518. categoryIdStr = vslice[0]
  519. imgUrlChart = vslice[len(vslice)-1]
  520. mapCategoryUrl[categoryIdStr] = imgUrlChart
  521. }
  522. list, total, err = models.GetReportAndproductInteriorIndustrialList(pars, categoryId, industrialManagementId, uid, startSize, pageSize)
  523. if err != nil {
  524. br.Msg = "获取信息失败"
  525. br.ErrMsg = "获取帖子数据失败,Err:" + err.Error()
  526. return
  527. }
  528. articleIdMap, err := services.GetUserArticleHistoryRecord(user)
  529. if err != nil {
  530. br.Msg = "获取信息失败"
  531. br.Msg = "获取帖子数据失败,Err:" + err.Error()
  532. return
  533. }
  534. for k, v := range list {
  535. list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
  536. if !articleIdMap[v.ArticleId] && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
  537. list[k].IsRed = true
  538. }
  539. }
  540. }
  541. listPublic, err := services.HandleArticleCategoryImg(list, user)
  542. if err != nil {
  543. br.Msg = "获取失败"
  544. br.ErrMsg = "获取报告封面图片失败, Err:" + err.Error()
  545. return
  546. }
  547. var articleIds []int
  548. for _, v := range listPublic {
  549. if v.Resource == 1 {
  550. articleIds = append(articleIds, v.ArticleId)
  551. }
  552. }
  553. articleMapPv := services.GetArticleHistoryByArticleId(articleIds) //文章Pv
  554. articleCollectMap, _ := services.GetCygxArticleCollectMap(user.UserId) //用户收藏的文章
  555. articleCollectNumMap, _ := services.GetCygxArticleCollectNumMapByArtcileIds(articleIds) //文章收藏的数量
  556. listResp := make([]*models.HomeArticle, 0)
  557. //listResp :=
  558. for _, v := range listPublic {
  559. listResp = append(listResp, &models.HomeArticle{
  560. ArticleId: v.ArticleId,
  561. Title: v.Title,
  562. Annotation: "核心观点:" + v.Annotation,
  563. Abstract: v.Abstract,
  564. ImgUrlPc: v.ImgUrlPc,
  565. PublishDate: v.PublishDate,
  566. Resource: v.Resource,
  567. Pv: articleMapPv[v.ArticleId],
  568. IsCollect: articleCollectMap[v.ArticleId],
  569. CollectNum: articleCollectNumMap[v.ArticleId],
  570. })
  571. }
  572. //lenList := len(list)
  573. //for i := 0; i < lenList; i++ {
  574. // item := list[i]
  575. // list[i].Body = ""
  576. // list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
  577. // list[i].Annotation, _ = services.GetReportContentTextSub(item.Annotation)
  578. // list[i].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
  579. // //行业比较研究、资金流向,显示报告的摘要
  580. // if resp.MatchTypeName == "行业比较研究" || resp.MatchTypeName == "资金流向" {
  581. // list[i].Annotation = list[i].Abstract
  582. // }
  583. //}
  584. if len(listResp) == 0 {
  585. listResp = make([]*models.HomeArticle, 0)
  586. }
  587. page = paging.GetPaging(currentIndex, pageSize, total)
  588. resp.List = listResp
  589. resp.Paging = page
  590. br.Ret = 200
  591. br.Success = true
  592. br.Msg = "获取成功"
  593. br.Data = resp
  594. }
  595. // @Title 产业关注/取消关注
  596. // @Description 产业关注/取消关注 接口
  597. // @Param request body models.CygxIndustryFllowRep true "type json string"
  598. // @Success 200
  599. // @router /industrial/fllow [post]
  600. func (this *ReportController) IndustrialFllow() {
  601. br := new(models.BaseResponse).Init()
  602. defer func() {
  603. this.Data["json"] = br
  604. this.ServeJSON()
  605. }()
  606. user := this.User
  607. if user == nil {
  608. br.Msg = "请重新登录"
  609. br.Ret = 408
  610. return
  611. }
  612. uid := user.UserId
  613. var req models.CygxIndustryFllowRep
  614. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  615. if err != nil {
  616. br.Msg = "参数解析异常!"
  617. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  618. return
  619. }
  620. industrialManagementId := req.IndustrialManagementId
  621. var condition string
  622. countIndustrial, err := models.GetIndustrialManagementCount(industrialManagementId)
  623. if err != nil {
  624. br.Msg = "获取数据失败!"
  625. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  626. return
  627. }
  628. if countIndustrial == 0 {
  629. br.Msg = "产业不存在!"
  630. br.ErrMsg = "产业ID不存在:" + strconv.Itoa(industrialManagementId)
  631. return
  632. }
  633. count, err := models.GetCountCygxIndustryFllow(industrialManagementId, user.UserId, condition)
  634. if err != nil {
  635. br.Msg = "获取数据失败!"
  636. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  637. return
  638. }
  639. resp := new(models.CygxIndustryFllowResp)
  640. item := new(models.CygxIndustryFllow)
  641. item.IndustrialManagementId = industrialManagementId
  642. item.UserId = uid
  643. item.Email = user.Email
  644. item.Mobile = user.Mobile
  645. item.RealName = user.RealName
  646. item.Source = utils.REGISTER_PLATFORM
  647. item.CompanyId = user.CompanyId
  648. item.CompanyName = user.CompanyName
  649. if count == 0 {
  650. item.Type = 1
  651. item.CreateTime = time.Now()
  652. item.ModifyTime = time.Now()
  653. _, err = models.AddCygxIndustryFllow(item)
  654. if err != nil {
  655. br.Msg = "操作失败"
  656. br.ErrMsg = "操作失败,Err:" + err.Error()
  657. return
  658. }
  659. resp.Status = 1
  660. br.Msg = "关注成功"
  661. } else {
  662. item.Type = 2
  663. err = models.RemoveCygxIndustryFllow(uid, industrialManagementId)
  664. if err != nil {
  665. br.Msg = "操作失败"
  666. br.ErrMsg = "取消关注失败,Err:" + err.Error()
  667. return
  668. }
  669. resp.Status = 2
  670. br.Msg = "已取消关注"
  671. }
  672. //处理是否关注全部赛道字段
  673. go services.IndustryFllowWithTrack(industrialManagementId, count, uid)
  674. go services.IndustryFllowUserLabelLogAdd(industrialManagementId, count, uid) //处理用户标签
  675. go services.AddCygxIndustryFllowLog(item) //添加操作日志记录
  676. br.Ret = 200
  677. br.Success = true
  678. br.Data = resp
  679. }
  680. // @Title 行业关注/取消关注
  681. // @Description 行业关注/取消关注 接口
  682. // @Param request body models.CygxCategoryFllowRep true "type json string"
  683. // @Success 200
  684. // @router /category/fllow [post]
  685. func (this *ReportController) CategoryFllow() {
  686. br := new(models.BaseResponse).Init()
  687. defer func() {
  688. this.Data["json"] = br
  689. this.ServeJSON()
  690. }()
  691. user := this.User
  692. if user == nil {
  693. br.Msg = "请重新登录"
  694. br.Ret = 408
  695. return
  696. }
  697. uid := user.UserId
  698. var req models.CygxCategoryFllowRep
  699. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  700. if err != nil {
  701. br.Msg = "参数解析异常!"
  702. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  703. return
  704. }
  705. categoryId := req.CategoryId
  706. var condition string
  707. //countCategory, err := models.GetCategoryCount(categoryId)
  708. //if err != nil {
  709. // br.Msg = "获取数据失败!"
  710. // br.ErrMsg = "获取数据失败,Err:" + err.Error()
  711. // return
  712. //}
  713. //if countCategory == 0 {
  714. // br.Msg = "产业不存在!"
  715. // br.ErrMsg = "产业ID不存在:" + strconv.Itoa(categoryId)
  716. // return
  717. //}
  718. listMap, err := models.GetCygxXzsChooseCategoryMapList()
  719. if err != nil {
  720. br.Msg = "操作失败!"
  721. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  722. return
  723. }
  724. mapReport := make(map[int]int)
  725. for _, v := range listMap {
  726. mapReport[v.Id] = v.CategoryId
  727. }
  728. if mapReport[categoryId] == 0 {
  729. br.Msg = "操作失败!"
  730. br.ErrMsg = "分类ID不存在,ID:" + strconv.Itoa(categoryId)
  731. return
  732. }
  733. count, err := models.GetCountCategoryFllow(mapReport[categoryId], user.Mobile, condition)
  734. if err != nil {
  735. br.Msg = "获取数据失败!"
  736. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  737. return
  738. }
  739. resp := new(models.CygxIndustryFllowResp)
  740. if count == 0 {
  741. item := new(models.CygxXzsChooseCategory)
  742. item.CategoryId = mapReport[categoryId]
  743. item.IdCygx = categoryId
  744. item.UserId = uid
  745. item.Email = user.Email
  746. item.Mobile = user.Mobile
  747. item.RealName = user.RealName
  748. item.CompanyId = user.CompanyId
  749. item.CompanyName = user.CompanyName
  750. item.CreateTime = time.Now()
  751. item.ModifyTime = time.Now()
  752. _, err = models.AddCygxCategoryFllow(item)
  753. if err != nil {
  754. br.Msg = "操作失败"
  755. br.ErrMsg = "操作失败,Err:" + err.Error()
  756. return
  757. }
  758. resp.Status = 1
  759. br.Msg = "关注成功"
  760. } else {
  761. err = models.RemoveCygxCategoryFllow(user.Mobile, mapReport[categoryId])
  762. if err != nil {
  763. br.Msg = "操作失败"
  764. br.ErrMsg = "取消关注失败,Err:" + err.Error()
  765. return
  766. }
  767. resp.Status = 2
  768. br.Msg = "已取消关注"
  769. }
  770. go services.CategoryFllowUserLabelLogAdd(categoryId, count, uid) //处理用户标签
  771. br.Ret = 200
  772. br.Success = true
  773. br.Data = resp
  774. }
  775. // @Title 报告搜索
  776. // @Description 报告搜索接口
  777. // @Param PageSize query int true "每页数据条数"
  778. // @Param CurrentIndex query int true "当前页页码,从1开始"
  779. // @Param KeyWord query string true "搜索关键词"
  780. // @Param ArticleType query int true "文章类型,1弘则报告、2研选 "
  781. // @Param IsAll query bool true "是否为综合 "
  782. // @Success 200 {object} models.ReoprtSearchResp
  783. // @router /searchReport [get]
  784. func (this *MobileReportController) SearchReport() {
  785. br := new(models.BaseResponse).Init()
  786. defer func() {
  787. this.Data["json"] = br
  788. this.ServeJSON()
  789. }()
  790. user := this.User
  791. if user == nil {
  792. br.Msg = "请重新登录"
  793. br.Ret = 408
  794. return
  795. }
  796. pageSize, _ := this.GetInt("PageSize")
  797. currentIndex, _ := this.GetInt("CurrentIndex")
  798. articleType, _ := this.GetInt("ArticleType", 1)
  799. keyWord := this.GetString("KeyWord")
  800. isAll, _ := this.GetBool("IsAll")
  801. var condition string
  802. var pars []interface{}
  803. //var conditionSql string
  804. var total int
  805. var startSize int
  806. if pageSize <= 0 {
  807. pageSize = utils.PageSize20
  808. }
  809. if isAll {
  810. pageSize = utils.PageSize5
  811. }
  812. if currentIndex <= 0 {
  813. currentIndex = 1
  814. }
  815. startSize = paging.StartIndex(currentIndex, pageSize)
  816. resp := new(models.ReoprtSearchResp)
  817. //匹配报告标题、
  818. articleTypeIds, err := services.GetYanXuanArticleTypeIds()
  819. if err != nil {
  820. br.Msg = "获取信息失败"
  821. br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
  822. return
  823. }
  824. if articleTypeIds == "" {
  825. br.Msg = "获取信息失败"
  826. br.ErrMsg = "研选分类ID不能为空"
  827. return
  828. }
  829. //处理对应的文章类型标签按钮
  830. nameMap, styleMap, err := services.GetArticleTypeMap()
  831. if err != nil {
  832. br.Msg = "获取信息失败"
  833. br.ErrMsg = "GetArticleTypeMap Err:" + err.Error()
  834. return
  835. }
  836. if isAll {
  837. total = utils.PageSize5
  838. conditionHz := ` 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 AND a.article_type_id NOT IN (` + articleTypeIds + `) `
  839. conditionYx := ` 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 AND a.article_type_id IN (` + articleTypeIds + `) `
  840. listHz, err := models.GetArticleResearchListHz(conditionHz, pars, startSize, pageSize, user.UserId)
  841. if err != nil {
  842. br.Msg = "获取信息失败"
  843. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  844. return
  845. }
  846. listYx, err := models.GetArticleResearchList(conditionYx, pars, startSize, pageSize, user.UserId, true)
  847. if err != nil {
  848. br.Msg = "获取信息失败"
  849. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  850. return
  851. }
  852. listHz, err = services.HandleArticleCategoryImg(listHz, user)
  853. if err != nil {
  854. br.Msg = "获取信息失败"
  855. br.ErrMsg = "HandleArticleCategoryImg,Err:" + err.Error()
  856. return
  857. }
  858. listYx, err = services.HandleArticleCategoryImg(listYx, user)
  859. if err != nil {
  860. br.Msg = "获取信息失败"
  861. br.ErrMsg = "HandleArticleCategoryImg,Err:" + err.Error()
  862. return
  863. }
  864. for _, v := range listHz {
  865. item := models.ArticleResearchResp{
  866. ArticleId: v.ArticleId,
  867. ArticleTypeId: v.ArticleTypeId,
  868. Title: v.Title,
  869. PublishDate: v.PublishDate,
  870. DepartmentId: v.DepartmentId,
  871. NickName: v.NickName,
  872. IsCollect: v.IsCollect,
  873. Pv: v.Pv,
  874. CollectNum: v.CollectNum,
  875. Abstract: v.Abstract,
  876. Annotation: v.Annotation,
  877. ImgUrlPc: v.ImgUrlPc,
  878. ArticleTypeName: nameMap[v.ArticleTypeId],
  879. ButtonStyle: styleMap[v.ArticleTypeId],
  880. List: v.List,
  881. }
  882. resp.ListHz = append(resp.ListHz, &item)
  883. }
  884. for _, v := range listYx {
  885. item := models.ArticleResearchResp{
  886. ArticleId: v.ArticleId,
  887. ArticleTypeId: v.ArticleTypeId,
  888. Title: v.Title,
  889. PublishDate: v.PublishDate,
  890. DepartmentId: v.DepartmentId,
  891. NickName: v.NickName,
  892. IsCollect: v.IsCollect,
  893. Pv: v.Pv,
  894. CollectNum: v.CollectNum,
  895. Abstract: v.Abstract,
  896. Annotation: v.Annotation,
  897. ImgUrlPc: v.ImgUrlPc,
  898. ArticleTypeName: nameMap[v.ArticleTypeId],
  899. ButtonStyle: styleMap[v.ArticleTypeId],
  900. List: v.List,
  901. }
  902. resp.ListYx = append(resp.ListYx, &item)
  903. }
  904. } else {
  905. //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 `
  906. if articleType == 1 {
  907. 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 AND a.article_type_id NOT IN (` + articleTypeIds + `) `
  908. total, err = models.GetReoprtSearchCountHz(condition)
  909. } else {
  910. 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 AND a.article_type_id IN (` + articleTypeIds + `) `
  911. total, err = models.GetReoprtSearchCountYx(condition)
  912. }
  913. if err != nil {
  914. br.Msg = "获取信息失败"
  915. br.Msg = "获取总数失败,Err:" + err.Error()
  916. return
  917. }
  918. var list []*models.ArticleListResp
  919. //list := new([]models.ArticleResearchResp)
  920. if articleType == 1 {
  921. list, err = models.GetArticleResearchListHz(condition, pars, startSize, pageSize, user.UserId)
  922. } else {
  923. list, err = models.GetArticleResearchList(condition, pars, startSize, pageSize, user.UserId, true)
  924. }
  925. if err != nil {
  926. br.Msg = "获取信息失败"
  927. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  928. return
  929. }
  930. //return
  931. list, err = services.HandleArticleCategoryImg(list, user)
  932. if err != nil {
  933. br.Msg = "获取信息失败"
  934. br.ErrMsg = "HandleArticleCategoryImg,Err:" + err.Error()
  935. return
  936. }
  937. for _, v := range list {
  938. item := models.ArticleResearchResp{
  939. ArticleId: v.ArticleId,
  940. ArticleTypeId: v.ArticleTypeId,
  941. Title: v.Title,
  942. PublishDate: v.PublishDate,
  943. DepartmentId: v.DepartmentId,
  944. NickName: v.NickName,
  945. IsCollect: v.IsCollect,
  946. Pv: v.Pv,
  947. CollectNum: v.CollectNum,
  948. Abstract: v.Abstract,
  949. Annotation: v.Annotation,
  950. ImgUrlPc: v.ImgUrlPc,
  951. ArticleTypeName: nameMap[v.ArticleTypeId],
  952. ButtonStyle: styleMap[v.ArticleTypeId],
  953. List: v.List,
  954. }
  955. if v.IsSpecial == 1 {
  956. //去除图片标签
  957. item.Annotation = utils.ArticleRemoveImgUrl(item.Annotation)
  958. item.IsSpecial = true
  959. item.ImgUrlPc = utils.CYGX_YANXUAN_SPECIAL_IMG_PC
  960. if v.CompanyTags != "" {
  961. item.CompanyTags = strings.Split(v.CompanyTags, ",")
  962. } else {
  963. item.CompanyTags = []string{}
  964. }
  965. if v.IndustryTags != "" {
  966. item.IndustryTags = strings.Split(v.IndustryTags, ",")
  967. } else {
  968. item.IndustryTags = []string{}
  969. }
  970. item.ArticleTypeName = utils.CYGX_YANXUAN_SPECIAL
  971. if v.SpecialType == 1 {
  972. item.Title = "【笔记】" + item.Title
  973. } else if v.SpecialType == 2 {
  974. item.Title = "【观点】" + item.Title
  975. }
  976. if v.MyCollectNum > 0 {
  977. item.IsCollect = true
  978. }
  979. }
  980. if articleType == 1 {
  981. resp.ListHz = append(resp.ListHz, &item)
  982. } else {
  983. resp.ListYx = append(resp.ListYx, &item)
  984. }
  985. }
  986. }
  987. if keyWord != "" {
  988. //go services.AddUserSearchLog(user, keyWord, 5)
  989. }
  990. if len(resp.ListHz) == 0 {
  991. resp.ListHz = make([]*models.ArticleResearchResp, 0)
  992. }
  993. if len(resp.ListYx) == 0 {
  994. resp.ListYx = make([]*models.ArticleResearchResp, 0)
  995. }
  996. page := paging.GetPaging(currentIndex, pageSize, total)
  997. resp.Paging = page
  998. br.Ret = 200
  999. br.Success = true
  1000. br.Msg = "获取成功"
  1001. br.Data = resp
  1002. }
  1003. // @Title 资源包搜索
  1004. // @Description 资源包搜索接口
  1005. // @Param KeyWord query string true "搜索关键词"
  1006. // @Success 200 {object} models.SearchResourceResp
  1007. // @router /searchResource [get]
  1008. func (this *MobileReportController) SearchResource() {
  1009. br := new(models.BaseResponse).Init()
  1010. defer func() {
  1011. this.Data["json"] = br
  1012. this.ServeJSON()
  1013. }()
  1014. user := this.User
  1015. if user == nil {
  1016. br.Msg = "请重新登录"
  1017. br.Ret = 408
  1018. return
  1019. }
  1020. uid := user.UserId
  1021. fllowList, err := models.GetUserFllowIndustrialList(uid)
  1022. if err != nil {
  1023. br.Msg = "获取失败"
  1024. br.ErrMsg = "获取失败,GetUserFllowIndustrialList Err:" + err.Error()
  1025. return
  1026. }
  1027. fllowMap := make(map[int]int)
  1028. if len(fllowList) > 0 {
  1029. for _, v := range fllowList {
  1030. fllowMap[v.IndustrialManagementId] = v.IndustrialManagementId
  1031. }
  1032. }
  1033. keyWord := this.GetString("KeyWord")
  1034. var condition string
  1035. articleTypeIds, err := services.GetYanXuanArticleTypeIds()
  1036. if err != nil {
  1037. br.Msg = "获取信息失败"
  1038. br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
  1039. return
  1040. }
  1041. if articleTypeIds == "" {
  1042. br.Msg = "获取信息失败"
  1043. br.ErrMsg = "研选分类ID不能为空"
  1044. return
  1045. }
  1046. condition = ` AND a.publish_status = 1 AND a.article_type_id NOT IN (` + articleTypeIds + `) AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%' ) `
  1047. listHz, err := models.GetSearchResourceList(condition)
  1048. if err != nil {
  1049. br.Msg = "获取信息失败"
  1050. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  1051. return
  1052. }
  1053. condition = ` AND a.publish_status = 1 AND a.article_type_id IN (` + articleTypeIds + `) AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%' ) `
  1054. listYx, err := models.GetSearchResourceList(condition)
  1055. if err != nil {
  1056. br.Msg = "获取信息失败"
  1057. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  1058. return
  1059. }
  1060. if len(listYx) > 0 {
  1061. listYx, err = services.HandleIndustryList(listYx, user, "Yx")
  1062. if err != nil {
  1063. br.Msg = "获取信息失败"
  1064. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1065. return
  1066. }
  1067. }
  1068. if len(listHz) > 0 {
  1069. listHz, err = services.HandleIndustryList(listHz, user, "Hz")
  1070. if err != nil {
  1071. br.Msg = "获取信息失败"
  1072. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1073. return
  1074. }
  1075. }
  1076. if keyWord != "" {
  1077. //go services.AddUserSearchLog(user, keyWord, 4)
  1078. }
  1079. resp := new(models.SearchResourceResp)
  1080. if len(listHz) == 0 {
  1081. listHz = make([]*models.IndustrialManagement, 0)
  1082. }
  1083. if len(listYx) == 0 {
  1084. listYx = make([]*models.IndustrialManagement, 0)
  1085. }
  1086. resp.ListHz = listHz
  1087. resp.ListYx = listYx
  1088. br.Ret = 200
  1089. br.Success = true
  1090. br.Msg = "获取成功"
  1091. br.Data = resp
  1092. }
  1093. // @Title 报告搜索、资源包搜索接口
  1094. // @Description 报告搜索、资源包搜索接口接口
  1095. // @Param KeyWord query string true "搜索关键词"
  1096. // @Param PageSize query int true "每页数据条数"
  1097. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1098. // @Param SearchType query int true "1:综合,2:全部"
  1099. // @Success 200 {object} models.SearchReportAndResourceResp
  1100. // @router /searchReportAndResource [get]
  1101. func (this *MobileReportController) SearchReportAndResource() {
  1102. br := new(models.BaseResponse).Init()
  1103. defer func() {
  1104. this.Data["json"] = br
  1105. this.ServeJSON()
  1106. }()
  1107. user := this.User
  1108. if user == nil {
  1109. br.Msg = "请重新登录"
  1110. br.Ret = 408
  1111. return
  1112. }
  1113. //uid := user.UserId
  1114. keyWord := this.GetString("KeyWord")
  1115. pageSize, _ := this.GetInt("PageSize")
  1116. currentIndex, _ := this.GetInt("CurrentIndex")
  1117. searchType, _ := this.GetInt("SearchType")
  1118. var total int
  1119. var startSize int
  1120. if pageSize <= 0 {
  1121. pageSize = utils.PageSize20
  1122. }
  1123. if currentIndex <= 0 {
  1124. currentIndex = 1
  1125. }
  1126. startSize = paging.StartIndex(currentIndex, pageSize)
  1127. page := paging.GetPaging(currentIndex, pageSize, total)
  1128. var condition string
  1129. var conditionSql string
  1130. //匹配报告标题、
  1131. condition = ` AND ( a.title LIKE '%` + keyWord + `%' OR a.body LIKE '%` + keyWord + `%') AND a.publish_status = 1 `
  1132. conditionSql = ` AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + condition + ` OR ( article_type = 'lyjh' ` + condition + ` ) `
  1133. total, err := models.GetReoprtSearchCount(conditionSql)
  1134. if err != nil {
  1135. br.Msg = "获取信息失败"
  1136. br.Msg = "获取总数失败,Err:" + err.Error()
  1137. return
  1138. }
  1139. if searchType == 1 {
  1140. pageSize = utils.PageSize5
  1141. }
  1142. ListHzReport, err := services.GetReoprtSearchListHz(conditionSql, user.UserId, startSize, pageSize)
  1143. if err != nil {
  1144. br.Msg = "获取失败"
  1145. br.ErrMsg = "获取失败,GetReoprtSearchListHz Err:" + err.Error()
  1146. return
  1147. }
  1148. if len(ListHzReport) == 0 {
  1149. ListHzReport = make([]*models.ArticleCollectionResp, 0)
  1150. }
  1151. var conditionOr string
  1152. conditionOr += ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  1153. condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
  1154. listHzResource, err := services.GetSearchResourceListHz(condition, user)
  1155. if err != nil {
  1156. br.Msg = "获取信息失败"
  1157. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  1158. return
  1159. }
  1160. resp := new(models.SearchReportAndResourceResp)
  1161. if len(listHzResource) == 0 {
  1162. listHzResource = make([]*models.IndustrialManagement, 0)
  1163. }
  1164. if keyWord != "" {
  1165. //go services.AddUserSearchLog(user, keyWord, 5)
  1166. }
  1167. page = paging.GetPaging(currentIndex, pageSize, total)
  1168. resp.Paging = page
  1169. resp.ListHzResource = listHzResource
  1170. resp.ListHzReport = ListHzReport
  1171. br.Ret = 200
  1172. br.Success = true
  1173. br.Msg = "获取成功"
  1174. br.Data = resp
  1175. }
  1176. // @Title 公司速览
  1177. // @Description 公司速览接口
  1178. // @Param ChartPermissionId query int false "分类ID"
  1179. // @Success 200 {object} models.ArticleDataLogoListResp
  1180. // @router /companyList [get]
  1181. func (this *ReportCommonController) CompanyList() {
  1182. br := new(models.BaseResponse).Init()
  1183. defer func() {
  1184. this.Data["json"] = br
  1185. this.ServeJSON()
  1186. }()
  1187. var condition string
  1188. var pars []interface{}
  1189. chartPermissionId, _ := this.GetInt("ChartPermissionId")
  1190. if chartPermissionId > 1 {
  1191. categoryId, err := models.GetCategoryId(chartPermissionId)
  1192. if err != nil && err.Error() != utils.ErrNoRow() {
  1193. br.Msg = "获取信息失败"
  1194. br.ErrMsg = "获取分类权限信息失败,Err:" + err.Error()
  1195. return
  1196. }
  1197. if categoryId != "" {
  1198. condition += ` AND a.category_id IN (` + categoryId + `)`
  1199. }
  1200. }
  1201. condition += ` AND a.type_name = '综述报告' ORDER BY a.modify_time_by_cl DESC `
  1202. list, err := models.CygxArticleDataList(condition, pars)
  1203. if err != nil {
  1204. br.Msg = "获取失败"
  1205. br.ErrMsg = "获取报告封面图片失败, Err:" + err.Error()
  1206. return
  1207. }
  1208. listLogo := make([]*models.ArticleDataLogoResp, 0)
  1209. for i := range list {
  1210. v := list[i]
  1211. comapnyList := services.HandleArticleStock(v.Stock)
  1212. if len(comapnyList) > 1 {
  1213. for kC, vC := range comapnyList {
  1214. sliceCovers := strings.Split(v.Cover, "{|}")
  1215. cover := v.Cover
  1216. if len(sliceCovers) == len(comapnyList) {
  1217. cover = sliceCovers[kC]
  1218. }
  1219. listLogo = append(listLogo, &models.ArticleDataLogoResp{
  1220. ArticleId: v.ArticleId,
  1221. Cover: cover,
  1222. ComapnyList: services.HandleArticleStock(vC.ComapnyName),
  1223. })
  1224. }
  1225. } else {
  1226. listLogo = append(listLogo, &models.ArticleDataLogoResp{
  1227. ArticleId: v.ArticleId,
  1228. Cover: v.Cover,
  1229. ComapnyList: services.HandleArticleStock(v.Stock),
  1230. })
  1231. }
  1232. }
  1233. resp := new(models.ArticleDataLogoListResp)
  1234. resp.List = listLogo
  1235. br.Ret = 200
  1236. br.Success = true
  1237. br.Msg = "获取成功"
  1238. br.Data = resp
  1239. }
  1240. // @Title 时间线
  1241. // @Description 时间线接口
  1242. // @Param PageSize query int true "每页数据条数"
  1243. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1244. // @Param IndustrialManagementId query int false "产业ID"
  1245. // @Success 200 {object} models.TacticsListResp
  1246. // @router /timeline [get]
  1247. func (this *MobileReportController) Timeline() {
  1248. br := new(models.BaseResponse).Init()
  1249. defer func() {
  1250. this.Data["json"] = br
  1251. this.ServeJSON()
  1252. }()
  1253. user := this.User
  1254. if user == nil {
  1255. br.Msg = "请重新登录"
  1256. br.Ret = 408
  1257. return
  1258. }
  1259. pageSize, _ := this.GetInt("PageSize")
  1260. currentIndex, _ := this.GetInt("CurrentIndex")
  1261. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  1262. var startSize int
  1263. if pageSize <= 0 {
  1264. pageSize = utils.PageSize20
  1265. }
  1266. if currentIndex <= 0 {
  1267. currentIndex = 1
  1268. }
  1269. startSize = paging.StartIndex(currentIndex, pageSize)
  1270. var total int
  1271. resp := new(models.TacticsListTimeResp)
  1272. page := paging.GetPaging(currentIndex, pageSize, total)
  1273. list := make([]*models.TimeLineReportItem, 0)
  1274. var err error
  1275. list, total, err = models.GetTimeLineReportIndustrialListTime(user.UserId, industrialManagementId, startSize, pageSize)
  1276. if err != nil {
  1277. br.Msg = "获取信息失败"
  1278. br.ErrMsg = "获取产业报告+晨会点评列表,Err:" + err.Error()
  1279. return
  1280. }
  1281. //查询用户今天是否看过时间线
  1282. count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
  1283. if err != nil {
  1284. br.Msg = "查询浏览记录数量失败"
  1285. br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
  1286. return
  1287. }
  1288. var recordItem *models.CygxPageHistoryRecord
  1289. if count > 1 {
  1290. recordItem, err = models.GetTimeLineRecordItem(user.UserId, industrialManagementId)
  1291. if err != nil {
  1292. br.Msg = "查询浏览记录失败"
  1293. br.ErrMsg = "查询浏览记录失败,Err:" + err.Error()
  1294. return
  1295. }
  1296. }
  1297. for k, v := range list {
  1298. if v.SubCategoryName != "时间线" && v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
  1299. list[k].IsRed = true
  1300. }
  1301. timeLineRed := false
  1302. if count < 2 && v.SubCategoryName == "时间线" {
  1303. timeLineRed = true
  1304. } else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishDate)) {
  1305. timeLineRed = true
  1306. }
  1307. if v.SubCategoryName == "时间线" && timeLineRed {
  1308. list[k].IsRed = true
  1309. }
  1310. if v.VideoUrl != "" {
  1311. list[k].IsHaveVideo = true
  1312. }
  1313. v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
  1314. }
  1315. //添加我的日程访问记录
  1316. item := new(models.CygxPageHistoryRecord)
  1317. item.UserId = user.UserId
  1318. item.CreateTime = time.Now()
  1319. item.CompanyId = user.CompanyId
  1320. item.CompanyName = user.CompanyName
  1321. item.Router = utils.TIME_LINE_ROUTE + strconv.Itoa(industrialManagementId)
  1322. go models.AddCygxPageHistoryRecord(item)
  1323. if len(list) == 0 {
  1324. list = make([]*models.TimeLineReportItem, 0)
  1325. }
  1326. page = paging.GetPaging(currentIndex, pageSize, total)
  1327. resp.List = list
  1328. resp.Paging = page
  1329. br.Ret = 200
  1330. br.Success = true
  1331. br.Msg = "获取成功"
  1332. br.Data = resp
  1333. }
  1334. // @Title 文章留言接口
  1335. // @Description 文章留言接口
  1336. // @Param request body models.AddCygxActivityHelpAsk true "type json string"
  1337. // @Success 200 {object} models.TacticsListResp
  1338. // @router /commentAdd [post]
  1339. func (this *ReportController) CommentAdd() {
  1340. br := new(models.BaseResponse).Init()
  1341. defer func() {
  1342. this.Data["json"] = br
  1343. this.ServeJSON()
  1344. }()
  1345. user := this.User
  1346. if user == nil {
  1347. br.Msg = "请重新登录"
  1348. br.Ret = 408
  1349. return
  1350. }
  1351. var req models.AddCygxArticleCommentReq
  1352. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1353. if err != nil {
  1354. br.Msg = "参数解析异常!"
  1355. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1356. return
  1357. }
  1358. if req.ArticleId <= 0 {
  1359. br.Msg = "文章不存在"
  1360. br.ErrMsg = "文章不存在,文章ID错误"
  1361. return
  1362. }
  1363. if req.Content == "" {
  1364. br.Msg = "建议内容不可为空"
  1365. return
  1366. }
  1367. content := req.Content
  1368. if content == "" {
  1369. br.Msg = "留言内容不能为空!"
  1370. return
  1371. }
  1372. //itemToken, err := services.WxGetToken()
  1373. //if err != nil {
  1374. // br.Msg = "GetWxAccessToken Err:" + err.Error()
  1375. // return
  1376. //}
  1377. //if itemToken.AccessToken == "" {
  1378. // br.Msg = "accessToken is empty"
  1379. // return
  1380. //}
  1381. //commerr, err := weapp.MSGSecCheck(itemToken.AccessToken, content)
  1382. //if err != nil {
  1383. // br.Msg = "内容校验失败!"
  1384. // br.ErrMsg = "内容校验失败,Err:" + err.Error()
  1385. // return
  1386. //}
  1387. //if commerr.ErrCode != 0 {
  1388. // br.Msg = "内容违规,请重新提交!"
  1389. // br.ErrMsg = "内容违规,Err:" + commerr.ErrMSG
  1390. // return
  1391. //}
  1392. articleId := req.ArticleId
  1393. articleInfo, errInfo := models.GetArticleDetailById(articleId)
  1394. if articleInfo == nil {
  1395. br.Msg = "操作失败"
  1396. br.ErrMsg = "文章ID错误,不存在articleId:" + strconv.Itoa(articleId)
  1397. return
  1398. }
  1399. if errInfo != nil {
  1400. br.Msg = "操作失败"
  1401. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1402. return
  1403. }
  1404. companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
  1405. if err != nil {
  1406. br.Msg = "提交失败!"
  1407. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  1408. return
  1409. }
  1410. if companyDetail == nil {
  1411. br.Msg = "提交失败!"
  1412. br.ErrMsg = "客户不存在,uid:" + strconv.Itoa(user.UserId)
  1413. return
  1414. }
  1415. item := models.CygxArticleComment{
  1416. UserId: user.UserId,
  1417. ArticleId: req.ArticleId,
  1418. CreateTime: time.Now(),
  1419. Mobile: user.Mobile,
  1420. Email: user.Email,
  1421. CompanyId: user.CompanyId,
  1422. CompanyName: companyDetail.CompanyName,
  1423. Content: content,
  1424. Title: articleInfo.Title,
  1425. }
  1426. msgId, err := models.AddArticleComment(&item)
  1427. if err != nil {
  1428. br.Msg = "提交失败"
  1429. br.ErrMsg = "提交留言失败,Err:" + err.Error()
  1430. return
  1431. }
  1432. go services.SendCommentWxTemplateMsg(req, user, articleInfo, int(msgId))
  1433. br.Ret = 200
  1434. br.Success = true
  1435. br.Msg = "提交成功"
  1436. }
  1437. // @Title 报告精选、本周研究汇总、上周纪要汇总列表
  1438. // @Description 获取报告精选、本周研究汇总、上周纪要汇总列表接口
  1439. // @Param PageSize query int true "每页数据条数"
  1440. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1441. // @Param ReportType string query true "报告类型 ,1报告精选、2本周研究汇总、3上周纪要汇总"
  1442. // @Success 200 {object} models.CygxReportSelectionListPublicRep
  1443. // @router /reportList/byType [get]
  1444. func (this *ReportController) ReportListByType() {
  1445. br := new(models.BaseResponse).Init()
  1446. defer func() {
  1447. this.Data["json"] = br
  1448. this.ServeJSON()
  1449. }()
  1450. user := this.User
  1451. if user == nil {
  1452. br.Msg = "请重新登录"
  1453. br.Ret = 408
  1454. return
  1455. }
  1456. uid := user.UserId
  1457. pageSize, _ := this.GetInt("PageSize")
  1458. currentIndex, _ := this.GetInt("CurrentIndex")
  1459. reportType := this.GetString("ReportType")
  1460. var condition string
  1461. var startSize int
  1462. if pageSize <= 0 {
  1463. pageSize = utils.PageSize20
  1464. }
  1465. if currentIndex <= 0 {
  1466. currentIndex = 1
  1467. }
  1468. startSize = paging.StartIndex(currentIndex, pageSize)
  1469. var pars []interface{}
  1470. var total int
  1471. resp := new(models.CygxReportSelectionListPublicRep)
  1472. page := paging.GetPaging(currentIndex, pageSize, total)
  1473. var tbdb string
  1474. var readSql string
  1475. var reportTypeStr string
  1476. if reportType == "1" {
  1477. tbdb = "cygx_report_selection"
  1478. reportTypeStr = "bgjx"
  1479. } else if reportType == "2" {
  1480. tbdb = "cygx_research_summary"
  1481. reportTypeStr = "bzyjhz"
  1482. } else if reportType == "3" {
  1483. tbdb = "cygx_minutes_summary"
  1484. reportTypeStr = "szjyhz"
  1485. } else {
  1486. br.Msg = "请选择报告类型"
  1487. return
  1488. }
  1489. condition = ` AND publish_status = 1 `
  1490. if user.CompanyId != utils.HZ_COMPANY_ID {
  1491. condition += ` AND visible_range = 1 `
  1492. }
  1493. total, err := models.GetCygxReportSelectionPublic(condition, tbdb, pars)
  1494. if err != nil {
  1495. br.Msg = "获取信息失败"
  1496. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  1497. return
  1498. }
  1499. //研究汇总--报告精选 只显示最新一期,往期都隐藏
  1500. if reportType == "1" {
  1501. startSize = 0
  1502. pageSize = 1
  1503. total = 1
  1504. }
  1505. 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`
  1506. page = paging.GetPaging(currentIndex, pageSize, total)
  1507. list, err := models.GetReportSelectionListPublic(condition, readSql, tbdb, pars, startSize, pageSize)
  1508. if err != nil {
  1509. br.Msg = "获取失败"
  1510. br.ErrMsg = "获取失败,Err:" + err.Error()
  1511. return
  1512. }
  1513. for k, v := range list {
  1514. if reportType == "1" {
  1515. list[k].Abstract = v.UpdateDescription
  1516. }
  1517. list[k].PublishDate = utils.StrTimeToTime(v.PublishDate).Format("2006-01-02")
  1518. if v.ReadNum == 0 {
  1519. list[k].IsRed = true
  1520. }
  1521. }
  1522. resp.List = list
  1523. resp.Paging = page
  1524. br.Ret = 200
  1525. br.Success = true
  1526. br.Msg = "获取成功"
  1527. br.Data = resp
  1528. }
  1529. // @Title 获取本周研究汇总详情
  1530. // @Description 获取本周研究汇总详情接口
  1531. // @Param ArticleId query int true "报告ID"
  1532. // @Success 200 {object} models.ResearchSummaryLetailResp
  1533. // @router /researchSummary/detail [get]
  1534. func (this *ReportController) ResearchDetail() {
  1535. br := new(models.BaseResponse).Init()
  1536. defer func() {
  1537. this.Data["json"] = br
  1538. this.ServeJSON()
  1539. }()
  1540. user := this.User
  1541. if user == nil {
  1542. br.Msg = "请重新登录"
  1543. br.Ret = 408
  1544. return
  1545. }
  1546. //uid := user.UserId
  1547. articleId, _ := this.GetInt("ArticleId")
  1548. if articleId < 0 {
  1549. br.Msg = "参数错误"
  1550. br.ErrMsg = "参数错误"
  1551. return
  1552. }
  1553. resp := new(models.ResearchSummaryLetailResp)
  1554. //判断用户权限
  1555. hasPermission, err := services.GetUserhasPermission(user)
  1556. if err != nil {
  1557. br.Msg = "获取信息失败"
  1558. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1559. }
  1560. detail, err := models.GetCygxResearchSummaryInfoById(articleId)
  1561. if err != nil {
  1562. br.Msg = "获取信息失败"
  1563. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1564. return
  1565. }
  1566. PermissionNameMap, err := services.GetPermissionNameMap()
  1567. if err != nil {
  1568. br.Msg = "获取失败"
  1569. br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
  1570. return
  1571. }
  1572. PermissionIcoMap, err := services.GetPermissionNameIcoMap()
  1573. if err != nil {
  1574. br.Msg = "获取失败"
  1575. br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
  1576. return
  1577. }
  1578. //未设置全部可见的只能给弘则内部查看
  1579. if detail.VisibleRange == 1 || user.CompanyId == utils.HZ_COMPANY_ID {
  1580. resp.IsShow = true
  1581. }
  1582. resp.HasPermission = hasPermission
  1583. if hasPermission != 1 || !resp.IsShow {
  1584. br.Ret = 200
  1585. br.Success = true
  1586. br.Msg = "获取成功"
  1587. br.Data = resp
  1588. return
  1589. }
  1590. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
  1591. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1592. listFirst, err := models.GetResearchSummarylogListFirst(articleId)
  1593. if err != nil {
  1594. br.Msg = "获取失败"
  1595. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1596. return
  1597. }
  1598. listArticleType, err := models.GetCygxArticleTypeList()
  1599. if err != nil {
  1600. br.Msg = "获取失败"
  1601. br.ErrMsg = "获取文章类型数据失败,Err:" + err.Error()
  1602. return
  1603. }
  1604. for k, v := range listFirst {
  1605. listSecond, err := models.GetResearchSummarylogSonListSecond(articleId, v.Type)
  1606. if err != nil && err.Error() != utils.ErrNoRow() {
  1607. br.Msg = "获取信息失败"
  1608. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1609. return
  1610. }
  1611. for k2, v2 := range listSecond {
  1612. v2.PermissionName = PermissionNameMap[v2.ChartPermissionId]
  1613. v2.IcoLink = PermissionIcoMap[v2.ChartPermissionId]
  1614. listThird, err := models.GetResearchSummarylogSonListThird(articleId, v2.ChartPermissionId, v.Type)
  1615. if err != nil && err.Error() != utils.ErrNoRow() {
  1616. br.Msg = "获取信息失败"
  1617. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1618. return
  1619. }
  1620. for _, vType := range listArticleType {
  1621. if v2.ChartPermissionId == vType.YanxPermissionId {
  1622. listSecond[k2].IcoLink = vType.IcoLinkM
  1623. listSecond[k2].PermissionName = vType.YanxPermissionName
  1624. }
  1625. }
  1626. if len(listThird) > 0 {
  1627. for k3, v3 := range listThird {
  1628. if v3.VideoUrl != "" {
  1629. listThird[k3].IsHaveVideo = true
  1630. }
  1631. if v3.ReportLink == "0" {
  1632. listThird[k3].ReportLink = ""
  1633. }
  1634. }
  1635. listSecond[k2].List = listThird
  1636. }
  1637. }
  1638. if len(listSecond) > 0 {
  1639. listFirst[k].List = listSecond
  1640. }
  1641. //`description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
  1642. if v.Type == "SDBG" {
  1643. listFirst[k].ListName = "深度报告"
  1644. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211027/le8AcRjDz0MhA72bVDiaf3d5ALSe.png"
  1645. } else if v.Type == "BZCHJH" {
  1646. listFirst[k].ListName = "本周晨会精华"
  1647. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/DCfekcxaIKGePBsNVu1ULfmNcJBY.png"
  1648. } else if v.Type == "CYDYJY" {
  1649. listFirst[k].ListName = "产业调研纪要"
  1650. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/UPAdozy96z9ypzY04vi0Y3Ogqzji.png"
  1651. } else if v.Type == "SSGS" {
  1652. listFirst[k].ListName = "上市公司调研纪要篇"
  1653. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
  1654. } else if v.Type == "SJDP" {
  1655. listFirst[k].ListName = "市场QA汇总"
  1656. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/2a5cXafO3Iws4QcFp1bd5WPdYikV.png"
  1657. } else if v.Type == "YANX" {
  1658. listFirst[k].ListName = "买方研选"
  1659. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1660. }
  1661. }
  1662. //go services.AddCygxReportHistoryRecord(user, articleId, "bzyjhz")
  1663. go services.ResearchSummaryHistoryUserRmind(user, articleId) // 本周研究汇总用户阅读操作操作行为,模板消息推送
  1664. resp.List = listFirst
  1665. resp.Detail = detail
  1666. br.Ret = 200
  1667. br.Success = true
  1668. br.Msg = "获取成功"
  1669. br.Data = resp
  1670. }
  1671. // @Title 上周纪要汇总内容详情
  1672. // @Description 获取上周纪要汇总内容详情接口
  1673. // @Param ArticleId query int true "报告ID"
  1674. // @Success 200 {object} models.MinutesSummaryLetailResp
  1675. // @router /minutesSummary/detail [get]
  1676. func (this *ReportController) MinutesDetail() {
  1677. br := new(models.BaseResponse).Init()
  1678. defer func() {
  1679. this.Data["json"] = br
  1680. this.ServeJSON()
  1681. }()
  1682. user := this.User
  1683. if user == nil {
  1684. br.Msg = "请重新登录"
  1685. br.Ret = 408
  1686. return
  1687. }
  1688. articleId, _ := this.GetInt("ArticleId")
  1689. if articleId < 0 {
  1690. br.Msg = "参数错误"
  1691. br.ErrMsg = "参数错误"
  1692. return
  1693. }
  1694. resp := new(models.MinutesSummaryLetailRespV4)
  1695. //判断用户权限
  1696. hasPermission, err := services.GetUserhasPermission(user)
  1697. if err != nil {
  1698. br.Msg = "获取信息失败"
  1699. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1700. }
  1701. detail, err := models.GetCygxMinutesSummaryInfoById(articleId)
  1702. if err != nil {
  1703. br.Msg = "获取信息失败"
  1704. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1705. return
  1706. }
  1707. PermissionNameMap, err := services.GetPermissionNameMap()
  1708. if err != nil {
  1709. br.Msg = "获取失败"
  1710. br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
  1711. return
  1712. }
  1713. PermissionIcoMap, err := services.GetPermissionNameIcoMap()
  1714. if err != nil {
  1715. br.Msg = "获取失败"
  1716. br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
  1717. return
  1718. }
  1719. //未设置全部可见的只能给弘则内部查看
  1720. if detail.VisibleRange == 1 || user.CompanyId == utils.HZ_COMPANY_ID {
  1721. resp.IsShow = true
  1722. }
  1723. resp.HasPermission = hasPermission
  1724. if hasPermission != 1 || !resp.IsShow {
  1725. br.Ret = 200
  1726. br.Success = true
  1727. br.Msg = "获取成功"
  1728. br.Data = resp
  1729. return
  1730. }
  1731. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
  1732. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1733. listFirst, err := models.GetMinutesSummarylogListAllV4(articleId)
  1734. if err != nil {
  1735. br.Msg = "获取失败"
  1736. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1737. return
  1738. }
  1739. for k, v := range listFirst {
  1740. listSecond, err := models.GetMinutesSummarylogSonListSecond(articleId, v.Type)
  1741. if err != nil && err.Error() != utils.ErrNoRow() {
  1742. br.Msg = "获取信息失败"
  1743. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1744. return
  1745. }
  1746. for k2, v2 := range listSecond {
  1747. v2.PermissionName = PermissionNameMap[v2.ChartPermissionId]
  1748. v2.IcoLink = PermissionIcoMap[v2.ChartPermissionId]
  1749. listThird, err := models.GetMinutesSummarylogListThird(articleId, v2.ChartPermissionId, v.Type)
  1750. if err != nil && err.Error() != utils.ErrNoRow() {
  1751. br.Msg = "获取信息失败"
  1752. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1753. return
  1754. }
  1755. if len(listThird) > 0 {
  1756. for k3, v3 := range listThird {
  1757. if v3.VideoUrl != "" {
  1758. listThird[k3].IsHaveVideo = true
  1759. }
  1760. if v3.ReportLink == "0" {
  1761. listThird[k3].ReportLink = ""
  1762. }
  1763. }
  1764. listSecond[k2].List = listThird
  1765. }
  1766. }
  1767. if len(listSecond) > 0 {
  1768. listFirst[k].List = listSecond
  1769. }
  1770. //`description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
  1771. if v.Type == "CYDYJY" {
  1772. listFirst[k].ListName = "产业调研纪要"
  1773. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/UPAdozy96z9ypzY04vi0Y3Ogqzji.png"
  1774. } else if v.Type == "SSGS" {
  1775. listFirst[k].ListName = "上市公司调研纪要篇"
  1776. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
  1777. } else if v.Type == "YANX" {
  1778. listFirst[k].ListName = "买方研选纪要"
  1779. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1780. }
  1781. }
  1782. //go services.AddCygxReportHistoryRecord(user, articleId, "szjyhz")
  1783. go services.MinutesSummaryHistoryUserRmind(user, articleId) // 上周纪要汇总用户阅读,给销售发消息提醒
  1784. resp.List = listFirst
  1785. resp.Detail = detail
  1786. br.Ret = 200
  1787. br.Success = true
  1788. br.Msg = "获取成功"
  1789. br.Data = resp
  1790. }
  1791. // @Title 记录用户浏览音频回放接口
  1792. // @Description 记录用户浏览音频回放接口
  1793. // @Param request body models.ArticleIdReq true "type json string"
  1794. // @Success Ret=200 操作成功
  1795. // @router /voiceHistory/add [post]
  1796. func (this *ReportController) ResearchSummaryVoiceHistoryAdd() {
  1797. br := new(models.BaseResponse).Init()
  1798. defer func() {
  1799. this.Data["json"] = br
  1800. this.ServeJSON()
  1801. }()
  1802. user := this.User
  1803. if user == nil {
  1804. br.Msg = "请登录"
  1805. br.ErrMsg = "请登录,用户信息为空"
  1806. br.Ret = 408
  1807. return
  1808. }
  1809. uid := user.UserId
  1810. var req models.ArticleIdReq
  1811. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1812. if err != nil {
  1813. br.Msg = "参数解析异常!"
  1814. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1815. return
  1816. }
  1817. articleId := req.ArticleId
  1818. playSeconds := req.PlaySeconds
  1819. reportType := req.ReportType
  1820. //本周研究汇总
  1821. if reportType == 2 {
  1822. articleInfo, errInfo := models.GetCygxResearchSummaryInfoById(articleId)
  1823. if articleInfo == nil {
  1824. br.Msg = "操作失败"
  1825. br.ErrMsg = "文章ID错误,不存在articleId:" + strconv.Itoa(articleId)
  1826. return
  1827. }
  1828. if errInfo != nil {
  1829. br.Msg = "操作失败"
  1830. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1831. return
  1832. }
  1833. var sellerName string
  1834. sellerName, err = models.GetCompanySellerName(user.CompanyId)
  1835. if err != nil {
  1836. br.Msg = "报名失败!"
  1837. br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
  1838. return
  1839. }
  1840. item := models.CygxResearchSummaryVoiceHistory{
  1841. ArticleId: articleId,
  1842. UserId: uid,
  1843. CreateTime: time.Now(),
  1844. Mobile: user.Mobile,
  1845. Email: user.Email,
  1846. CompanyId: user.CompanyId,
  1847. CompanyName: user.CompanyName,
  1848. RealName: user.RealName,
  1849. SellerName: sellerName,
  1850. PlaySeconds: strconv.Itoa(req.PlaySeconds),
  1851. ModifyTime: time.Now(),
  1852. RegisterPlatform: utils.REGISTER_PLATFORM,
  1853. }
  1854. if playSeconds != 0 {
  1855. lastItem, err := models.GetLastCygxResearchSummaryVoiceHistory(articleId, user.UserId)
  1856. if err != nil {
  1857. br.Msg = "操作失败"
  1858. br.ErrMsg = "操作失败,GetLastCygxResearchSummaryVoiceHistory Err:" + err.Error()
  1859. return
  1860. }
  1861. err = models.UpdateLastCygxResearchSummaryVoiceHistory(strconv.Itoa(req.PlaySeconds), lastItem.Id)
  1862. if err != nil {
  1863. br.Msg = "更新失败"
  1864. br.ErrMsg = "更新失败,UpdateLastCygxResearchSummaryVoiceHistory Err:" + err.Error()
  1865. return
  1866. }
  1867. } else {
  1868. err = models.AddCygxResearchSummaryVoiceHistory(&item)
  1869. if err != nil {
  1870. br.Msg = "操作失败"
  1871. br.ErrMsg = "操作失败,Err:" + err.Error()
  1872. return
  1873. }
  1874. err = models.UpdateResearchSummaryVoiceCounts(articleId)
  1875. if err != nil {
  1876. br.Msg = "更新失败"
  1877. br.ErrMsg = "更新失败,Err:" + err.Error()
  1878. return
  1879. }
  1880. }
  1881. } else if reportType == 3 {
  1882. articleInfo, errInfo := models.GetCygxMinutesSummaryInfoById(articleId)
  1883. if articleInfo == nil {
  1884. br.Msg = "操作失败"
  1885. br.ErrMsg = "文章ID错误,不存在articleId:" + strconv.Itoa(articleId)
  1886. return
  1887. }
  1888. if errInfo != nil {
  1889. br.Msg = "操作失败"
  1890. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1891. return
  1892. }
  1893. var sellerName string
  1894. sellerName, err = models.GetCompanySellerName(user.CompanyId)
  1895. if err != nil {
  1896. br.Msg = "报名失败!"
  1897. br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
  1898. return
  1899. }
  1900. item := models.CygxMinutesSummaryVoiceHistory{
  1901. ArticleId: articleId,
  1902. UserId: uid,
  1903. CreateTime: time.Now(),
  1904. Mobile: user.Mobile,
  1905. Email: user.Email,
  1906. CompanyId: user.CompanyId,
  1907. CompanyName: user.CompanyName,
  1908. RealName: user.RealName,
  1909. SellerName: sellerName,
  1910. PlaySeconds: strconv.Itoa(req.PlaySeconds),
  1911. ModifyTime: time.Now(),
  1912. RegisterPlatform: utils.REGISTER_PLATFORM,
  1913. }
  1914. if playSeconds != 0 {
  1915. lastItem, err := models.GetLastCygxMinutesSummaryVoiceHistory(articleId, user.UserId)
  1916. if err != nil {
  1917. br.Msg = "操作失败"
  1918. br.ErrMsg = "操作失败,GetLastCygxSummaryVoiceHistory Err:" + err.Error()
  1919. return
  1920. }
  1921. err = models.UpdateLastCygxMinutesSummaryVoiceHistory(strconv.Itoa(req.PlaySeconds), lastItem.Id)
  1922. if err != nil {
  1923. br.Msg = "更新失败"
  1924. br.ErrMsg = "更新失败,UpdateLastCygxSummaryVoiceHistory Err:" + err.Error()
  1925. return
  1926. }
  1927. } else {
  1928. err = models.AddCygxMinutesSummaryVoiceHistory(&item)
  1929. if err != nil {
  1930. br.Msg = "操作失败"
  1931. br.ErrMsg = "操作失败,Err:" + err.Error()
  1932. return
  1933. }
  1934. err = models.UpdateMinutesSummaryVoiceCounts(articleId)
  1935. if err != nil {
  1936. br.Msg = "更新失败"
  1937. br.ErrMsg = "更新失败,Err:" + err.Error()
  1938. return
  1939. }
  1940. }
  1941. }
  1942. br.Ret = 200
  1943. br.Success = true
  1944. br.Msg = "操作成功"
  1945. return
  1946. }
  1947. // @Title 根据行业分类获取行业文章列表
  1948. // @Description 根据行业分类获取行业文章列表接口
  1949. // @Param PageSize query int true "每页数据条数"
  1950. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1951. // @Param CategoryId query int true "分类ID"
  1952. // @Param IndustrialManagementId query int false "产业ID"
  1953. // @Success 200 {object} models.TacticsListResp
  1954. // @router /tactics/list [get]
  1955. func (this *MobileReportController) TacticsList() {
  1956. br := new(models.BaseResponse).Init()
  1957. defer func() {
  1958. this.Data["json"] = br
  1959. this.ServeJSON()
  1960. }()
  1961. user := this.User
  1962. if user == nil {
  1963. br.Msg = "请重新登录"
  1964. br.Ret = 408
  1965. return
  1966. }
  1967. //uid := user.UserId
  1968. pageSize, _ := this.GetInt("PageSize")
  1969. currentIndex, _ := this.GetInt("CurrentIndex")
  1970. categoryId, _ := this.GetInt("CategoryId")
  1971. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  1972. var startSize int
  1973. if pageSize <= 0 {
  1974. pageSize = utils.PageSize20
  1975. }
  1976. if currentIndex <= 0 {
  1977. currentIndex = 1
  1978. }
  1979. startSize = paging.StartIndex(currentIndex, pageSize)
  1980. //var condition string
  1981. //var pars []interface{}
  1982. var total int
  1983. var err error
  1984. resp := new(models.TacticsListResp)
  1985. page := paging.GetPaging(currentIndex, pageSize, total)
  1986. list := make([]*models.ArticleListResp, 0)
  1987. if categoryId == utils.TIME_CATEGORYID {
  1988. list, total, err = models.GetTimeLineReportIndustrialList(industrialManagementId, startSize, pageSize)
  1989. if err != nil {
  1990. br.Msg = "获取信息失败"
  1991. br.ErrMsg = "获取产业报告+晨会点评列表,Err:" + err.Error()
  1992. return
  1993. }
  1994. } else {
  1995. if categoryId == utils.ACTEGORY_ID_AI_QY {
  1996. listArticle := make([]*models.HomeArticle, 0)
  1997. listArticle, total, err = services.GetAiQianYanArtilceList(startSize, pageSize)
  1998. if err != nil {
  1999. br.Msg = "获取信息失败"
  2000. br.Msg = "GetAiQianYanArtilceList,Err:" + err.Error()
  2001. return
  2002. }
  2003. for _, v := range listArticle {
  2004. list = append(list, &models.ArticleListResp{
  2005. ArticleId: v.ArticleId,
  2006. Title: v.Title,
  2007. CategoryId: v.CategoryId,
  2008. Annotation: v.Annotation,
  2009. Abstract: v.Abstract,
  2010. Body: v.Body,
  2011. PublishDate: v.PublishDate,
  2012. Resource: 1,
  2013. })
  2014. }
  2015. } else {
  2016. list, total, err = models.GetReportAndproductIndustrylListimg(categoryId, user.UserId, startSize, pageSize)
  2017. if err != nil {
  2018. br.Msg = "获取信息失败"
  2019. br.Msg = "GetHomeList,Err:" + err.Error()
  2020. return
  2021. }
  2022. }
  2023. articleIdMap, err := services.GetUserArticleHistoryRecord(user)
  2024. if err != nil {
  2025. br.Msg = "获取信息失败"
  2026. br.Msg = "获取帖子数据失败,Err:" + err.Error()
  2027. return
  2028. }
  2029. for k, v := range list {
  2030. //list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
  2031. if !articleIdMap[v.ArticleId] && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
  2032. list[k].IsRed = true
  2033. }
  2034. }
  2035. if categoryId > 0 {
  2036. detail, errCategory := models.GetCygxReportMappingCygxByCategoryId(categoryId)
  2037. if errCategory != nil {
  2038. br.Msg = "获取信息失败"
  2039. br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
  2040. return
  2041. }
  2042. resp.MatchTypeName = detail.MatchTypeName
  2043. }
  2044. //resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
  2045. }
  2046. listPublic, err := services.HandleArticleCategoryImg(list, user)
  2047. if err != nil {
  2048. br.Msg = "获取失败"
  2049. br.ErrMsg = "获取报告封面图片失败, Err:" + err.Error()
  2050. return
  2051. }
  2052. var articleIds []int
  2053. var productInteriorIs []int
  2054. for _, v := range listPublic {
  2055. if v.Resource == 1 {
  2056. articleIds = append(articleIds, v.ArticleId)
  2057. }
  2058. if v.Resource == 2 {
  2059. productInteriorIs = append(productInteriorIs, v.ArticleId)
  2060. }
  2061. }
  2062. articleMapPv := services.GetArticleHistoryByArticleId(articleIds) //文章Pv
  2063. articleCollectMap, _ := services.GetCygxArticleCollectMap(user.UserId) //用户收藏的文章
  2064. articleCollectNumMap, _ := services.GetCygxArticleCollectNumMapByArtcileIds(articleIds) //文章收藏的数量
  2065. productInteriorMapPv := services.GetCygxProductInteriorHistoryListPvMap(productInteriorIs) //产品内测Pv
  2066. listResp := make([]*models.HomeArticle, 0)
  2067. for _, v := range listPublic {
  2068. item := new(models.HomeArticle)
  2069. item.ArticleId = v.ArticleId
  2070. item.Title = v.Title
  2071. item.Annotation = v.Annotation
  2072. item.Abstract = v.Abstract
  2073. item.ImgUrlPc = v.ImgUrlPc
  2074. item.PublishDate = v.PublishDate
  2075. item.Resource = v.Resource
  2076. if v.Resource == 1 {
  2077. item.Pv = articleMapPv[v.ArticleId]
  2078. item.IsCollect = articleCollectMap[v.ArticleId]
  2079. item.CollectNum = articleCollectNumMap[v.ArticleId]
  2080. }
  2081. if v.Resource == 2 {
  2082. item.Pv = productInteriorMapPv[v.ArticleId]
  2083. }
  2084. //listResp = append(listResp, &models.HomeArticle{
  2085. // ArticleId: v.ArticleId,
  2086. // Title: v.Title,
  2087. // Annotation: "核心观点:" + v.Annotation,
  2088. // Abstract: v.Abstract,
  2089. // ImgUrlPc: v.ImgUrlPc,
  2090. // PublishDate: v.PublishDate,
  2091. // Resource: v.Resource,
  2092. // Pv: articleMapPv[v.ArticleId],
  2093. // IsCollect: articleCollectMap[v.ArticleId],
  2094. // CollectNum: articleCollectNumMap[v.ArticleId],
  2095. //})
  2096. listResp = append(listResp, item)
  2097. }
  2098. if len(listResp) == 0 {
  2099. listResp = make([]*models.HomeArticle, 0)
  2100. }
  2101. page = paging.GetPaging(currentIndex, pageSize, total)
  2102. resp.List = listResp
  2103. resp.Paging = page
  2104. br.Ret = 200
  2105. br.Success = true
  2106. br.Msg = "获取成功"
  2107. br.Data = resp
  2108. }