report.go 116 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "errors"
  5. "fmt"
  6. "github.com/medivhzhan/weapp/v2"
  7. "github.com/rdlucklib/rdluck_tools/paging"
  8. "hongze/hongze_cygx/models"
  9. "hongze/hongze_cygx/services"
  10. "hongze/hongze_cygx/utils"
  11. "html"
  12. "strconv"
  13. "strings"
  14. "time"
  15. )
  16. // 报告
  17. type ReportController struct {
  18. BaseAuthController
  19. }
  20. type ReportCommonController struct {
  21. BaseCommonController
  22. }
  23. // @Title 行业报告分类列表接口
  24. // @Description 获取行业报告分类列表接口
  25. // @Param ChartPermissionId query int true "分类ID"
  26. // @Success 200 {object} models.IndustrialManagementList
  27. // @router /home/tradeList [get]
  28. func (this *ReportController) TradeList() {
  29. br := new(models.BaseResponse).Init()
  30. defer func() {
  31. this.Data["json"] = br
  32. this.ServeJSON()
  33. }()
  34. user := this.User
  35. if user == nil {
  36. br.Msg = "请重新登录"
  37. br.Ret = 408
  38. return
  39. }
  40. uid := user.UserId
  41. ChartPermissionId, _ := this.GetInt("ChartPermissionId")
  42. if ChartPermissionId < 1 {
  43. br.Msg = "请输入分类ID"
  44. return
  45. }
  46. list, err := models.GetTradeAll(ChartPermissionId)
  47. if err != nil {
  48. br.Msg = "获取信息失败"
  49. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  50. return
  51. }
  52. var condition string
  53. var pars []interface{}
  54. for k, v := range list {
  55. if v.PolymerizationId != "" {
  56. condition = ` AND a.category_id IN(` + v.PolymerizationId + `)`
  57. } else {
  58. condition = ` AND a.category_id IN(` + strconv.Itoa(v.CategoryId) + `)`
  59. }
  60. listArticle, err := models.GetHomeList(condition, pars, 0, 1)
  61. if err != nil && err.Error() != utils.ErrNoRow() {
  62. br.Msg = "获取信息失败"
  63. br.Msg = "GetHomeList,Err:" + err.Error()
  64. return
  65. }
  66. if len(listArticle) > 0 {
  67. list[k].UpdateTime = utils.StrTimeToTime(listArticle[0].PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
  68. count, err := models.CheckThisCategoryNewArticleIsRead(uid, v.CategoryId)
  69. if err != nil {
  70. br.Msg = "获取信息失败"
  71. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  72. return
  73. }
  74. if count == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.UpdateTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.UpdateTime)) {
  75. list[k].IsRed = true
  76. }
  77. }
  78. }
  79. resp := new(models.TradeReportMappingResp)
  80. resp.List = list
  81. br.Ret = 200
  82. br.Success = true
  83. br.Msg = "获取成功"
  84. br.Data = resp
  85. }
  86. // @Title 产业报告分类列表接口
  87. // @Description 获取产业报告分类列表接口
  88. // @Param ChartPermissionId query int true "分类ID"
  89. // @Param IsNewLabel query string true "是否属于新标签,1是,0否"
  90. // @Param IsDeepLabel query string true "是否属于深标签,1是,0否"
  91. // @Param KeyWord query string true "搜索关键词"
  92. // @Param OrderColumn query int true "排序字段 ,NewTime 最近更新 ,Recommend弘则推荐"
  93. // @Param DeepCover query int false "深度覆盖:0-否;1-是"
  94. // @Param RecommendFocus query int false "推荐关注:0-否;1-是"
  95. // @Param PageSize query int true "每页数据条数"
  96. // @Param CurrentIndex query int true "当前页页码,从1开始"
  97. // @Success 200 {object} models.IndustrialManagementList
  98. // @router /home/industryList [get]
  99. func (this *ReportController) IndustryList() {
  100. br := new(models.BaseResponse).Init()
  101. defer func() {
  102. this.Data["json"] = br
  103. this.ServeJSON()
  104. }()
  105. user := this.User
  106. if user == nil {
  107. br.Msg = "请重新登录"
  108. br.Ret = 408
  109. return
  110. }
  111. uid := user.UserId
  112. fmt.Println(uid)
  113. ChartPermissionId, _ := this.GetInt("ChartPermissionId")
  114. orderColumn := this.GetString("OrderColumn")
  115. orderColumnNew := this.GetString("OrderColumn")
  116. isNewLabel := this.GetString("IsNewLabel")
  117. isDeepLabel := this.GetString("IsDeepLabel")
  118. keyWord := this.GetString("KeyWord")
  119. pageSize, _ := this.GetInt("PageSize")
  120. currentIndex, _ := this.GetInt("CurrentIndex")
  121. deepCover, _ := this.GetInt("DeepCover")
  122. recommendFocus, _ := this.GetInt("RecommendFocus")
  123. var orderSrt string
  124. var condition string
  125. var startSize int
  126. resp := new(models.IndustrialManagementList)
  127. if pageSize <= 0 {
  128. pageSize = utils.PageSize20
  129. }
  130. if currentIndex <= 0 {
  131. currentIndex = 1
  132. }
  133. startSize = paging.StartIndex(currentIndex, pageSize)
  134. if isNewLabel == "1" {
  135. condition += ` AND is_new_label = ` + isNewLabel
  136. }
  137. if isDeepLabel == "1" {
  138. condition += ` AND is_deep_label = ` + isDeepLabel
  139. }
  140. if keyWord != "" {
  141. condition += ` AND subject_names LIKE '%` + keyWord + `%'`
  142. }
  143. var sqlChartPermissionId string
  144. if ChartPermissionId > 0 {
  145. sqlChartPermissionId += ` AND man_g.industrial_management_id IN ( SELECT industrial_management_id FROM cygx_industrial_management WHERE chart_permission_id = ` + strconv.Itoa(ChartPermissionId) + ` ) `
  146. condition += ` AND man.chart_permission_id IN (` + strconv.Itoa(ChartPermissionId) + `)`
  147. }
  148. // 深度覆盖
  149. if deepCover == 1 {
  150. // 查询深标签产业报告数
  151. var deepCondition string
  152. var deepPars []interface{}
  153. deepCondition += ` AND man.is_deep_label = 1`
  154. if ChartPermissionId > 0 {
  155. deepCondition += ` AND man.chart_permission_id = ?`
  156. deepPars = append(deepPars, ChartPermissionId)
  157. }
  158. industryCountList, e := models.GetIndustryArtCountByCondition(deepCondition, deepPars)
  159. if e != nil {
  160. br.Msg = "获取信息失败"
  161. br.ErrMsg = "获取深标签产业报告数失败, Err: " + e.Error()
  162. return
  163. }
  164. deepIdArr := make([]string, 0)
  165. for i := range industryCountList {
  166. if industryCountList[i].ArtNum > 10 {
  167. deepIdArr = append(deepIdArr, strconv.Itoa(industryCountList[i].IndustrialManagementId))
  168. }
  169. }
  170. deepIds := strings.Join(deepIdArr, ",")
  171. if deepIds != "" {
  172. condition = `AND man.industrial_management_id IN (` + deepIds + `)`
  173. }
  174. }
  175. // 推荐关注
  176. if recommendFocus == 1 {
  177. condition += ` AND man.recommended_index >= 80`
  178. }
  179. // 列表总数据量
  180. var list []*models.IndustrialManagement
  181. total, err := models.GetIndustrialManagementAllCount(condition)
  182. if err != nil {
  183. br.Msg = "获取信息失败"
  184. br.ErrMsg = "获取数量失败,Err:" + err.Error()
  185. return
  186. }
  187. page := paging.GetPaging(currentIndex, pageSize, total)
  188. if orderColumn == "" {
  189. orderColumn = "NewTime"
  190. }
  191. if orderColumn == "NewTime" {
  192. orderSrt = "update_time DESC"
  193. } else {
  194. orderSrt = "man.recommended_index DESC,update_time DESC"
  195. }
  196. if ChartPermissionId == 0 {
  197. ChartPermissionId = 20
  198. }
  199. // 阅读第三的产业详情
  200. //detailHot3, err := models.GetIndustrialManagementHot3(ChartPermissionId)
  201. //if err != nil {
  202. // br.Msg = "获取信息失败"
  203. // br.ErrMsg = "获取信息失败,Err:" + err.Error()
  204. // return
  205. //}
  206. list, err = models.GetIndustrialManagementAll(uid, condition, orderSrt, startSize, pageSize)
  207. if err != nil {
  208. br.Msg = "获取信息失败"
  209. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  210. return
  211. }
  212. // 获取近一个月产业报告阅读次数最多的产业
  213. var topCond string
  214. var topPars []interface{}
  215. //topReadIndustryId := 0
  216. if ChartPermissionId > 0 {
  217. topCond += ` AND chart_permission_id = ?`
  218. topPars = append(topPars, ChartPermissionId)
  219. }
  220. list, err = services.HandleIndustryList(list, user)
  221. if orderColumnNew != "" {
  222. item := new(models.CygxReportIndustrialSeaarchHistory)
  223. item.UserId = user.UserId
  224. item.Mobile = user.Mobile
  225. item.CompanyId = user.CompanyId
  226. item.CompanyName = user.CompanyName
  227. item.CreateTime = time.Now()
  228. item.IsDeepLabel = isDeepLabel
  229. item.IsNewLabel = isNewLabel
  230. item.ChartPermissionId = ChartPermissionId
  231. if orderColumnNew == "NewTime" {
  232. item.OrderColumn = "0"
  233. } else {
  234. item.OrderColumn = "1"
  235. }
  236. go models.AddCygxReportIndustrialSeaarchHistory(item)
  237. }
  238. resp.List = list
  239. resp.Paging = page
  240. br.Ret = 200
  241. br.Success = true
  242. br.Msg = "获取成功"
  243. br.Data = resp
  244. }
  245. // @Title 产业下所关联的文章分类列表
  246. // @Description 产业下所关联的文章分类列表接口
  247. // @Param IndustrialManagementId query int true "产业ID"
  248. // @Param ShowTimeLine query int true "是否展示时间线 0不展示,1展示"
  249. // @Param IsSendWx query int false "是否是通过微信模版进来的 1是,其它否"
  250. // @Success 200 {object} models.IndustrialToArticleCategoryListRep
  251. // @router /toArticleCategoryList [get]
  252. func (this *ReportController) ArticleCategoryList() {
  253. br := new(models.BaseResponse).Init()
  254. defer func() {
  255. this.Data["json"] = br
  256. this.ServeJSON()
  257. }()
  258. user := this.User
  259. if user == nil {
  260. br.Msg = "请重新登录"
  261. br.Ret = 408
  262. return
  263. }
  264. uid := user.UserId
  265. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  266. if industrialManagementId < 1 {
  267. br.Msg = "请输入分类ID"
  268. return
  269. }
  270. showTimeLine, _ := this.GetInt("ShowTimeLine", 0)
  271. isSendWx, _ := this.GetInt("IsSendWx")
  272. detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
  273. if err != nil {
  274. br.Msg = "获取信息失败"
  275. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  276. return
  277. }
  278. list, err := models.IndustrialToArticleCategoryNew(industrialManagementId)
  279. if err != nil {
  280. br.Msg = "获取信息失败"
  281. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  282. return
  283. }
  284. for k, v := range list {
  285. recordCount, err := models.IndustrialUserRecordArticleCount(uid, industrialManagementId, v.CategoryId)
  286. if err != nil && err.Error() != utils.ErrNoRow() {
  287. br.Msg = "获取信息失败"
  288. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  289. return
  290. }
  291. Newdetail, err := models.GetNewIndustrialUserRecordArticle(industrialManagementId, v.CategoryId)
  292. if err != nil && err.Error() != utils.ErrNoRow() {
  293. br.Msg = "获取信息失败"
  294. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  295. return
  296. }
  297. if Newdetail != nil {
  298. if recordCount == 0 && user.CreatedTime.Before(utils.StrTimeToTime(Newdetail.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(Newdetail.PublishDate)) {
  299. list[k].IsRed = true
  300. }
  301. }
  302. }
  303. // 用户权限
  304. authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
  305. if e != nil {
  306. br.Msg = "获取失败"
  307. br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
  308. return
  309. }
  310. videoSimple := new(models.MicroVideoSimpleInfo)
  311. // 权限
  312. var au *models.UserPermissionAuthInfo
  313. video, err := models.GetMicroRoadshowVideoByIndustryId(industrialManagementId)
  314. if err != nil {
  315. if err.Error() != utils.ErrNoRow() {
  316. br.Msg = "获取产业视频失败"
  317. br.ErrMsg = "获取产业视频失败,Err:" + err.Error()
  318. return
  319. }
  320. } else {
  321. videoSimple.Id = video.VideoId
  322. videoSimple.Title = "5min逻辑【" + video.IndustryName + "】解析"
  323. videoSimple.BackgroundImg = video.ImgUrl
  324. videoSimple.DetailImgUrl = video.DetailImgUrl
  325. if videoSimple.BackgroundImg == "" {
  326. // 获取默认图配置
  327. _, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
  328. if e != nil {
  329. br.Msg = "获取视频默认配置图失败"
  330. br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
  331. return
  332. }
  333. videoSimple.BackgroundImg = videoMap[video.ChartPermissionId]
  334. }
  335. videoSimple.PlaySeconds = video.VideoDuration
  336. videoSimple.ResourceUrl = video.VideoUrl
  337. au = new(models.UserPermissionAuthInfo)
  338. au.SellerName = authInfo.SellerName
  339. au.SellerMobile = authInfo.SellerMobile
  340. au.HasPermission = authInfo.HasPermission
  341. au.OperationMode = authInfo.OperationMode
  342. if au.HasPermission == 1 {
  343. // 非宏观权限进一步判断是否有权限
  344. if video.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, video.ChartPermissionName) {
  345. au.HasPermission = 2
  346. }
  347. }
  348. // 无权限的弹框提示
  349. if au.HasPermission != 1 {
  350. if au.OperationMode == services.UserPermissionOperationModeCall {
  351. au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
  352. } else {
  353. au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
  354. }
  355. videoSimple.ResourceUrl = ""
  356. }
  357. }
  358. //detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
  359. //if err != nil {
  360. // br.Msg = "获取信息失败"
  361. // br.ErrMsg = "获取信息失败,Err:" + err.Error()
  362. // return
  363. //}
  364. //时间线
  365. if showTimeLine == 1 {
  366. timeLineItem := models.IndustrialToArticleCategoryRep{
  367. CategoryId: 99999,
  368. MatchTypeName: "时间线",
  369. }
  370. timeLineList, err := models.GetTimeLineReportIndustrialList(user.UserId, industrialManagementId, 0, 30)
  371. if err != nil {
  372. br.Msg = "获取信息失败"
  373. br.ErrMsg = "获取帖子数据失败,Err:" + err.Error()
  374. return
  375. }
  376. //查询用户今天是否看过时间线
  377. haveMorningMeeting := false
  378. var morningMeetingTime string
  379. count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
  380. if err != nil {
  381. br.Msg = "查询浏览记录数量失败"
  382. br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
  383. return
  384. }
  385. var recordItem *models.CygxPageHistoryRecord
  386. if count > 1 {
  387. recordItem, err = models.GetTimeLineRecordItem(user.UserId, industrialManagementId)
  388. if err != nil {
  389. br.Msg = "查询浏览记录失败"
  390. br.ErrMsg = "查询浏览记录失败,Err:" + err.Error()
  391. return
  392. }
  393. }
  394. for _, v := range timeLineList {
  395. if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishTime)) {
  396. if v.SubCategoryName == "时间线" {
  397. haveMorningMeeting = true
  398. morningMeetingTime = v.PublishTime
  399. continue
  400. }
  401. timeLineItem.IsRed = true
  402. }
  403. }
  404. //因为无法记录用户是否看过晨会点评,所以用用户今天是否看过时间线来判断是否显示小红点,这里是判断分类的小红点
  405. timeLineRed := false
  406. if count < 2 {
  407. timeLineRed = true
  408. } else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(morningMeetingTime)) {
  409. timeLineRed = true
  410. }
  411. if !timeLineItem.IsRed && timeLineRed && haveMorningMeeting {
  412. timeLineItem.IsRed = true
  413. }
  414. list = append([]*models.IndustrialToArticleCategoryRep{&timeLineItem}, list...)
  415. }
  416. resp := new(models.IndustrialToArticleCategoryListRep)
  417. resp.List = list
  418. resp.LayoutTime = utils.TimeRemoveHms(detail.LayoutTime)
  419. resp.IndustryName = detail.IndustryName
  420. resp.IndustrialManagementId = industrialManagementId
  421. resp.AuthInfo = au
  422. if videoSimple.Id > 0 {
  423. resp.IndustryVideo = videoSimple
  424. }
  425. if isSendWx == 1 {
  426. industryUserFollowMap, err := services.GetIndustryUserFollowMap(user)
  427. if err != nil {
  428. br.Msg = "获取信息失败"
  429. br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
  430. return
  431. }
  432. resp.IsFollowButton = industryUserFollowMap[industrialManagementId]
  433. resp.IsShowFollowButton = true
  434. }
  435. resp.IsShowFollowButton = true
  436. br.Ret = 200
  437. br.Success = true
  438. br.Msg = "获取成功"
  439. br.Data = resp
  440. }
  441. // @Title 产业文章列表接口
  442. // @Description 获取产业文章列表接口
  443. // @Param PageSize query int true "每页数据条数"
  444. // @Param CurrentIndex query int true "当前页页码,从1开始"
  445. // @Param CategoryId query int true "分类ID"
  446. // @Param IndustrialManagementId query int true "产业ID"
  447. // @Success 200 {object} models.TacticsListResp
  448. // @router /industry/ArticleList [get]
  449. func (this *ReportController) List() {
  450. br := new(models.BaseResponse).Init()
  451. defer func() {
  452. this.Data["json"] = br
  453. this.ServeJSON()
  454. }()
  455. user := this.User
  456. if user == nil {
  457. br.Msg = "请重新登录"
  458. br.Ret = 408
  459. return
  460. }
  461. uid := user.UserId
  462. pageSize, _ := this.GetInt("PageSize")
  463. currentIndex, _ := this.GetInt("CurrentIndex")
  464. categoryId, _ := this.GetInt("CategoryId")
  465. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  466. var startSize int
  467. if pageSize <= 0 {
  468. pageSize = utils.PageSize20
  469. }
  470. if currentIndex <= 0 {
  471. currentIndex = 1
  472. }
  473. startSize = paging.StartIndex(currentIndex, pageSize)
  474. var pars []interface{}
  475. var total int
  476. page := paging.GetPaging(currentIndex, pageSize, total)
  477. if categoryId < 1 {
  478. br.Msg = "请输入分类ID"
  479. return
  480. }
  481. if industrialManagementId < 1 {
  482. br.Msg = "请输入产业ID"
  483. return
  484. }
  485. if categoryId != 99999 {
  486. resp := new(models.TacticsListResp)
  487. //获取该产业下所对应的行业图片
  488. detail, errCategory := models.GetdetailByCategoryIdOne(categoryId)
  489. if errCategory != nil {
  490. br.Msg = "获取信息失败"
  491. br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
  492. return
  493. }
  494. //对应行业的图片
  495. detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
  496. if err != nil {
  497. br.Msg = "获取数据失败"
  498. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  499. return
  500. }
  501. chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
  502. mapChartPermission := make(map[string]string)
  503. var permissionName string
  504. var imgUrlChartPermission string
  505. for _, v := range chartPermissionUrlList {
  506. vslice := strings.Split(v, "_")
  507. permissionName = vslice[0]
  508. imgUrlChartPermission = vslice[len(vslice)-1]
  509. mapChartPermission[permissionName] = imgUrlChartPermission
  510. }
  511. total, err = models.GetReportIndustrialCount(categoryId, industrialManagementId)
  512. if err != nil {
  513. br.Msg = "获取信息失败"
  514. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  515. return
  516. }
  517. page = paging.GetPaging(currentIndex, pageSize, total)
  518. list, err := models.GetReportIndustrialList(pars, categoryId, industrialManagementId, uid, startSize, pageSize)
  519. if err != nil {
  520. br.Msg = "获取信息失败"
  521. br.ErrMsg = "获取帖子数据失败,Err:" + err.Error()
  522. return
  523. }
  524. //对应分类的所图片
  525. detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
  526. if err != nil {
  527. br.Msg = "获取数据失败"
  528. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  529. return
  530. }
  531. categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
  532. mapCategoryUrl := make(map[string]string)
  533. var categoryIdStr string
  534. var imgUrlChart string
  535. for _, v := range categoryUrlList {
  536. vslice := strings.Split(v, "_")
  537. categoryIdStr = vslice[0]
  538. imgUrlChart = vslice[len(vslice)-1]
  539. mapCategoryUrl[categoryIdStr] = imgUrlChart
  540. }
  541. lenList := len(list)
  542. for i := 0; i < lenList; i++ {
  543. item := list[i]
  544. list[i].Body, _ = services.GetReportContentTextSub(item.Body)
  545. //list[i].Abstract = html.UnescapeString(item.Abstract)
  546. list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
  547. }
  548. for k, v := range list {
  549. if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
  550. list[k].IsRed = true
  551. }
  552. if v.VideoUrl != "" {
  553. list[k].IsHaveVideo = true
  554. }
  555. list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
  556. if mapCategoryUrl[v.CategoryId] == "" {
  557. if detail.ChartPermissionId == utils.YI_YAO_ID {
  558. list[k].ImgUrlPc = utils.YI_YAO_QI_TA
  559. }
  560. }
  561. }
  562. resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
  563. resp.ChartPermissionId = detail.ChartPermissionId
  564. resp.List = list
  565. resp.Paging = page
  566. br.Ret = 200
  567. br.Success = true
  568. br.Msg = "获取成功"
  569. br.Data = resp
  570. } else {
  571. //获取该产业下所对应的行业图片
  572. //因为时间线不属于数据表里的二级分类,所以图片Id用产业id查到的list中的任意一个categoryId取到的图片替代
  573. categoryList, err := models.IndustrialToArticleCategoryNew(industrialManagementId)
  574. if err != nil {
  575. br.Msg = "获取信息失败"
  576. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  577. return
  578. }
  579. var timeLineCategoryId int
  580. if len(categoryList) > 0 {
  581. timeLineCategoryId = categoryList[0].CategoryId
  582. }
  583. var detail *models.ReportMapping
  584. var errCategory error
  585. if timeLineCategoryId > 0 {
  586. detail, errCategory = models.GetdetailByCategoryIdOne(timeLineCategoryId)
  587. if errCategory != nil {
  588. br.Msg = "获取信息失败"
  589. br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
  590. return
  591. }
  592. }
  593. //对应行业的图片
  594. detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
  595. if err != nil {
  596. br.Msg = "获取数据失败"
  597. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  598. return
  599. }
  600. chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
  601. mapChartPermission := make(map[string]string)
  602. var permissionName string
  603. var imgUrlChartPermission string
  604. for _, v := range chartPermissionUrlList {
  605. vslice := strings.Split(v, "_")
  606. permissionName = vslice[0]
  607. imgUrlChartPermission = vslice[len(vslice)-1]
  608. mapChartPermission[permissionName] = imgUrlChartPermission
  609. }
  610. total, err := models.GetTimeLineReportIndustrialCount(industrialManagementId)
  611. if err != nil {
  612. br.Msg = "获取信息失败"
  613. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  614. return
  615. }
  616. page = paging.GetPaging(currentIndex, pageSize, total)
  617. list, err := models.GetTimeLineReportIndustrialList(user.UserId, industrialManagementId, startSize, pageSize)
  618. if err != nil {
  619. br.Msg = "获取信息失败"
  620. br.ErrMsg = "获取帖子数据失败,Err:" + err.Error()
  621. return
  622. }
  623. //对应分类的所图片
  624. detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
  625. if err != nil {
  626. br.Msg = "获取数据失败"
  627. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  628. return
  629. }
  630. categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
  631. mapCategoryUrl := make(map[string]string)
  632. var categoryIdStr string
  633. var imgUrlChart string
  634. for _, v := range categoryUrlList {
  635. vslice := strings.Split(v, "_")
  636. categoryIdStr = vslice[0]
  637. imgUrlChart = vslice[len(vslice)-1]
  638. mapCategoryUrl[categoryIdStr] = imgUrlChart
  639. }
  640. //lenList := len(list)
  641. //for i := 0; i < lenList; i++ {
  642. // item := list[i]
  643. // list[i].Content, _ = services.GetReportContentTextSub(item.Content)
  644. // //list[i].Abstract = html.UnescapeString(item.Abstract)
  645. // //list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
  646. //}
  647. //查询用户今天是否看过时间线
  648. count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
  649. if err != nil {
  650. br.Msg = "查询浏览记录数量失败"
  651. br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
  652. return
  653. }
  654. var recordItem *models.CygxPageHistoryRecord
  655. if count > 1 {
  656. recordItem, err = models.GetTimeLineRecordItem(user.UserId, industrialManagementId)
  657. if err != nil {
  658. br.Msg = "查询浏览记录失败"
  659. br.ErrMsg = "查询浏览记录失败,Err:" + err.Error()
  660. return
  661. }
  662. }
  663. for k, v := range list {
  664. if v.SubCategoryName != "时间线" && v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishTime)) {
  665. list[k].IsRed = true
  666. }
  667. timeLineRed := false
  668. if count < 2 && v.SubCategoryName == "时间线" {
  669. timeLineRed = true
  670. } else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishTime)) {
  671. timeLineRed = true
  672. }
  673. if v.SubCategoryName == "时间线" && timeLineRed {
  674. list[k].IsRed = true
  675. }
  676. if v.VideoUrl != "" {
  677. list[k].IsHaveVideo = true
  678. }
  679. id := strconv.Itoa(timeLineCategoryId)
  680. list[k].ImgUrlPc = mapCategoryUrl[id]
  681. if mapCategoryUrl[id] == "" {
  682. if detail.ChartPermissionId == utils.YI_YAO_ID {
  683. list[k].ImgUrlPc = utils.YI_YAO_QI_TA
  684. }
  685. }
  686. }
  687. resp := new(models.TimeLineReportListResp)
  688. resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
  689. resp.List = list
  690. resp.Paging = page
  691. br.Ret = 200
  692. br.Success = true
  693. br.Msg = "获取成功"
  694. br.Data = resp
  695. }
  696. }
  697. // @Title 置顶/取消置顶
  698. // @Description 置顶
  699. // @Param request body models.CygxIndustryTopRep true "type json string"
  700. // @Success 200
  701. // @router /top [post]
  702. func (this *ReportController) ArticleCollect() {
  703. br := new(models.BaseResponse).Init()
  704. defer func() {
  705. this.Data["json"] = br
  706. this.ServeJSON()
  707. }()
  708. user := this.User
  709. if user == nil {
  710. br.Msg = "请重新登录"
  711. br.Ret = 408
  712. return
  713. }
  714. uid := user.UserId
  715. var req models.CygxIndustryTopRep
  716. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  717. if err != nil {
  718. br.Msg = "参数解析异常!"
  719. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  720. return
  721. }
  722. industrialManagementId := req.IndustrialManagementId
  723. countIndustrial, err := models.GetIndustrialManagementCount(industrialManagementId)
  724. if err != nil {
  725. br.Msg = "获取数据失败!"
  726. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  727. return
  728. }
  729. if countIndustrial == 0 {
  730. br.Msg = "产业不存在!"
  731. br.ErrMsg = "产业ID不存在:" + strconv.Itoa(industrialManagementId)
  732. return
  733. }
  734. count, err := models.GetCygxIndustryTop(uid, industrialManagementId)
  735. if err != nil {
  736. br.Msg = "获取数据失败!"
  737. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  738. return
  739. }
  740. resp := new(models.ArticleCollectResp)
  741. if count <= 0 {
  742. item := new(models.CygxIndustryTop)
  743. item.IndustrialManagementId = req.IndustrialManagementId
  744. item.UserId = uid
  745. item.CreateTime = time.Now()
  746. _, err = models.AddCygxIndustryTop(item)
  747. if err != nil {
  748. br.Msg = "置顶失败"
  749. br.ErrMsg = "置顶失败,Err:" + err.Error()
  750. return
  751. }
  752. br.Msg = "置顶成功"
  753. resp.Status = 1
  754. } else {
  755. err = models.RemoveCygxIndustryTop(uid, industrialManagementId)
  756. if err != nil {
  757. br.Msg = "取消置顶失败"
  758. br.ErrMsg = "取消置顶失败,Err:" + err.Error()
  759. return
  760. }
  761. br.Msg = "已取消置顶"
  762. resp.Status = 2
  763. }
  764. br.Ret = 200
  765. br.Success = true
  766. br.Data = resp
  767. }
  768. // @Title 关注/取消关注产业
  769. // @Description 关注/取消关注 接口
  770. // @Param request body models.CygxIndustryFllowRep true "type json string"
  771. // @Success 200
  772. // @router /fllow [post]
  773. func (this *ReportController) Fllow() {
  774. br := new(models.BaseResponse).Init()
  775. defer func() {
  776. this.Data["json"] = br
  777. this.ServeJSON()
  778. }()
  779. user := this.User
  780. if user == nil {
  781. br.Msg = "请重新登录"
  782. br.Ret = 408
  783. return
  784. }
  785. uid := user.UserId
  786. var req models.CygxIndustryFllowRep
  787. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  788. if err != nil {
  789. br.Msg = "参数解析异常!"
  790. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  791. return
  792. }
  793. industrialManagementId := req.IndustrialManagementId
  794. var condition string
  795. countIndustrial, err := models.GetIndustrialManagementCount(industrialManagementId)
  796. if err != nil {
  797. br.Msg = "获取数据失败!"
  798. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  799. return
  800. }
  801. if countIndustrial == 0 {
  802. br.Msg = "产业不存在!"
  803. br.ErrMsg = "产业ID不存在:" + strconv.Itoa(industrialManagementId)
  804. return
  805. }
  806. count, err := models.GetCountCygxIndustryFllow(uid, industrialManagementId, condition)
  807. if err != nil {
  808. br.Msg = "获取数据失败!"
  809. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  810. return
  811. }
  812. resp := new(models.CygxIndustryFllowResp)
  813. countUser, err := models.GetCountCygxIndustryFllowByUid(uid)
  814. if countUser == 0 {
  815. resp.GoFollow = true
  816. }
  817. if count == 0 {
  818. item := new(models.CygxIndustryFllow)
  819. item.IndustrialManagementId = industrialManagementId
  820. item.UserId = uid
  821. item.Email = user.Email
  822. item.Mobile = user.Mobile
  823. item.RealName = user.RealName
  824. item.CompanyId = user.CompanyId
  825. item.CompanyName = user.CompanyName
  826. item.Type = 1
  827. item.CreateTime = time.Now()
  828. item.ModifyTime = time.Now()
  829. _, err = models.AddCygxIndustryFllow(item)
  830. if err != nil {
  831. br.Msg = "操作失败"
  832. br.ErrMsg = "操作失败,Err:" + err.Error()
  833. return
  834. }
  835. resp.Status = 1
  836. } else {
  837. err = models.RemoveCygxIndustryFllow(uid, industrialManagementId)
  838. if err != nil {
  839. br.Msg = "操作失败"
  840. br.ErrMsg = "取消关注失败,Err:" + err.Error()
  841. return
  842. }
  843. }
  844. //处理是否关注全部赛道字段
  845. go services.IndustryFllowWithTrack(industrialManagementId, count, uid)
  846. br.Msg = "操作成功"
  847. br.Ret = 200
  848. br.Success = true
  849. br.Data = resp
  850. }
  851. // @Title 产业报告分类关联作者列表接口
  852. // @Description 获取产业报告分类关联作者列表接口
  853. // @Param ChartPermissionId query int true "分类ID"
  854. // @Param PageSize query int true "每页数据条数"
  855. // @Param CurrentIndex query int true "当前页页码,从1开始"
  856. // @Success 200 {object} models.CygxArticleDepartmentList
  857. // @router /industryListByDepartment [get]
  858. func (this *ReportController) IndustryListByDepartment() {
  859. br := new(models.BaseResponse).Init()
  860. defer func() {
  861. this.Data["json"] = br
  862. this.ServeJSON()
  863. }()
  864. user := this.User
  865. if user == nil {
  866. br.Msg = "请重新登录"
  867. br.Ret = 408
  868. return
  869. }
  870. uid := user.UserId
  871. pageSize, _ := this.GetInt("PageSize")
  872. currentIndex, _ := this.GetInt("CurrentIndex")
  873. //chartPermissionId, _ := this.GetInt("ChartPermissionId")
  874. var startSize int
  875. var condition string
  876. //condition = ` AND a.publish_status=1 AND m.chart_permission_id =` + strconv.Itoa(chartPermissionId)
  877. condition = ` AND a.publish_status=1 `
  878. if pageSize <= 0 {
  879. pageSize = utils.PageSize20
  880. }
  881. if currentIndex <= 0 {
  882. currentIndex = 1
  883. }
  884. startSize = paging.StartIndex(currentIndex, pageSize)
  885. total, err := models.GetArticleDepartmentCount(condition)
  886. page := paging.GetPaging(currentIndex, pageSize, total)
  887. resp := new(models.CygxArticleDepartmentList)
  888. userType, _, err := services.GetUserType(user.CompanyId)
  889. if err != nil {
  890. br.Msg = "获取信息失败"
  891. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  892. return
  893. }
  894. if userType == 1 {
  895. resp.Paging = page
  896. br.Ret = 200
  897. br.Success = true
  898. br.Msg = "获取成功"
  899. br.Data = resp
  900. return
  901. }
  902. resp.HaveResearch = true
  903. //获取作者信息,并排序
  904. list, err := models.GetCygxArticleDepartmentList(startSize, pageSize, condition, uid)
  905. if err != nil {
  906. br.Msg = "获取信息失败"
  907. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  908. return
  909. }
  910. for k, v := range list {
  911. artList, err := models.GetArticleByDepartmentId(v.DepartmentId)
  912. if err != nil {
  913. br.Msg = "获取信息失败"
  914. br.ErrMsg = "获取文章信息失败,Err:" + err.Error()
  915. return
  916. }
  917. for k2, v2 := range artList {
  918. subjectNames, err := models.GetSubjectNames(v2.ArticleId)
  919. if err != nil {
  920. br.Msg = "获取失败" + strconv.Itoa(v2.ArticleId)
  921. br.ErrMsg = "获取失败,Err:" + err.Error()
  922. return
  923. }
  924. var subjectNamesNew string
  925. if len(subjectNames) > 0 {
  926. slice := strings.Split(subjectNames, "/")
  927. for k3, v3 := range slice {
  928. if k3 < 4 {
  929. subjectNamesNew += v3 + "/"
  930. }
  931. }
  932. }
  933. industryName, err := models.GetIndustrialNames(v2.ArticleId)
  934. if err != nil && err.Error() != utils.ErrNoRow() {
  935. br.Msg = "获取失败" + strconv.Itoa(v2.ArticleId)
  936. br.ErrMsg = "获取失败,Err:" + err.Error()
  937. return
  938. }
  939. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  940. artList[k2].SubjectName = subjectNamesNew
  941. artList[k2].DepartmentId = v.DepartmentId
  942. if subjectNamesNew == "" {
  943. artList[k2].IndustryName = industryName
  944. } else {
  945. artList[k2].IndustryName = industryName + "-" + subjectNamesNew
  946. }
  947. if artList[k2].IsReport == "1" {
  948. artList[k2].IndustryName = "【观点】" + artList[k2].IndustryName
  949. } else {
  950. artList[k2].IndustryName = "【纪要】" + artList[k2].IndustryName
  951. }
  952. }
  953. list[k].List = artList
  954. if v.FollowNum > 0 {
  955. list[k].IsMyFollow = true
  956. }
  957. }
  958. listnNew, err := models.GetIndustrialSubjectByDepartmentNew()
  959. if err != nil {
  960. br.Msg = "获取信息失败"
  961. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  962. return
  963. }
  964. if len(listnNew) > 0 {
  965. for _, v := range listnNew {
  966. firstStr := strings.Index(v.IndustrialAndSubjectIds, "—")
  967. Management := new(models.IndustrialManagementIdInt)
  968. if firstStr == 0 {
  969. Management.IndustryName = v.IndustryName
  970. } else {
  971. listSub, err := models.GetIndustrialManagementSubjectList(v.ArticleId)
  972. if err != nil {
  973. br.Msg = "获取信息失败"
  974. br.ErrMsg = "获取关联标的列表失败,Err:" + err.Error()
  975. return
  976. }
  977. var subjectNamesNew string
  978. for _, v1 := range listSub {
  979. subjectNamesNew += v1.SubjectName + "/"
  980. }
  981. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  982. Management.IndustryName = subjectNamesNew
  983. }
  984. Management.IndustrialManagementId = v.IndustrialManagementId
  985. Management.ArticleId = v.ArticleId
  986. resp.ListnNew = append(resp.ListnNew, Management)
  987. }
  988. }
  989. resp.List = list
  990. resp.Paging = page
  991. br.Ret = 200
  992. br.Success = true
  993. br.Msg = "获取成功"
  994. br.Data = resp
  995. }
  996. // @Title 关注作者/取消关注作者
  997. // @Description 关注作者/取消关注作者 接口
  998. // @Param request body models.CygxArticleDepartmentId true "type json string"
  999. // @Success 200
  1000. // @router /fllowDepartment [post]
  1001. func (this *ReportController) FllowDepartment() {
  1002. br := new(models.BaseResponse).Init()
  1003. defer func() {
  1004. this.Data["json"] = br
  1005. this.ServeJSON()
  1006. }()
  1007. user := this.User
  1008. if user == nil {
  1009. br.Msg = "请重新登录"
  1010. br.Ret = 408
  1011. return
  1012. }
  1013. uid := user.UserId
  1014. var req models.CygxArticleDepartmentId
  1015. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1016. if err != nil {
  1017. br.Msg = "参数解析异常!"
  1018. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1019. return
  1020. }
  1021. departmentId := req.DepartmentId
  1022. var condition string
  1023. countDepartment, err := models.GetDepartmentCount(departmentId)
  1024. if err != nil {
  1025. br.Msg = "获取数据失败!"
  1026. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1027. return
  1028. }
  1029. if countDepartment == 0 {
  1030. br.Msg = "作者不存在!"
  1031. br.ErrMsg = "作者ID不存在:" + strconv.Itoa(departmentId)
  1032. return
  1033. }
  1034. countUser, err := models.GetArticleDepartmentFollowByUid(uid)
  1035. count, err := models.GetArticleDepartmentFollow(uid, departmentId, condition)
  1036. if err != nil {
  1037. br.Msg = "获取数据失败!"
  1038. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1039. return
  1040. }
  1041. resp := new(models.CygxArticleDepartmentFollowResp)
  1042. if countUser == 0 {
  1043. resp.GoFollow = true
  1044. }
  1045. if count == 0 {
  1046. item := new(models.CygxArticleDepartmentFollow)
  1047. item.DepartmentId = departmentId
  1048. item.UserId = uid
  1049. item.Email = user.Email
  1050. item.Mobile = user.Mobile
  1051. item.RealName = user.RealName
  1052. item.CompanyId = user.CompanyId
  1053. item.CompanyName = user.CompanyName
  1054. item.Type = 1
  1055. item.CreateTime = time.Now()
  1056. item.ModifyTime = time.Now()
  1057. _, err = models.AddArticleDepartmentFollow(item)
  1058. if err != nil {
  1059. br.Msg = "操作失败"
  1060. br.ErrMsg = "操作失败,Err:" + err.Error()
  1061. return
  1062. }
  1063. resp.Status = 1
  1064. } else {
  1065. var doType int
  1066. condition = ` AND type = 1`
  1067. count, err = models.GetArticleDepartmentFollow(uid, departmentId, condition)
  1068. if err != nil {
  1069. br.Msg = "操作失败!"
  1070. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1071. return
  1072. }
  1073. if count == 1 {
  1074. resp.Status = 2
  1075. doType = 2
  1076. } else {
  1077. resp.Status = 1
  1078. doType = 1
  1079. }
  1080. err = models.RemoveArticleDepartmentFollow(uid, departmentId, doType)
  1081. if err != nil {
  1082. br.Msg = "操作失败"
  1083. br.ErrMsg = "取消关注失败,Err:" + err.Error()
  1084. return
  1085. }
  1086. }
  1087. br.Msg = "操作成功"
  1088. br.Ret = 200
  1089. br.Success = true
  1090. br.Data = resp
  1091. }
  1092. // @Title 研选文章列表接口
  1093. // @Description 获取研选文章列表接口
  1094. // @Param PageSize query int true "每页数据条数"
  1095. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1096. // @Param ArticleId query int true "文章id"
  1097. // @Param DepartmentId query int true "作者ID"
  1098. // @Param IndustrialManagementId query int true "产业ID"
  1099. // @Success 200 {object} models.ReportArticleWhichIndustrialRepList
  1100. // @router /industry/reportList [get]
  1101. func (this *ReportController) ReportList() {
  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. pageSize, _ := this.GetInt("PageSize")
  1115. currentIndex, _ := this.GetInt("CurrentIndex")
  1116. departmentId, _ := this.GetInt("DepartmentId")
  1117. industrialManagementId, _ := this.GetInt("IndustrialManagementId")
  1118. articleId, _ := this.GetInt("ArticleId")
  1119. var condition string
  1120. var startSize int
  1121. if pageSize <= 0 {
  1122. pageSize = utils.PageSize20
  1123. }
  1124. if currentIndex <= 0 {
  1125. currentIndex = 1
  1126. }
  1127. startSize = paging.StartIndex(currentIndex, pageSize)
  1128. var pars []interface{}
  1129. var total int
  1130. resp := new(models.ReportArticleWhichIndustrialRepList)
  1131. page := paging.GetPaging(currentIndex, pageSize, total)
  1132. userType, _, err := services.GetUserType(user.CompanyId)
  1133. if err != nil {
  1134. br.Msg = "获取信息失败"
  1135. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  1136. return
  1137. }
  1138. if userType == 1 {
  1139. resp.Paging = page
  1140. br.Ret = 200
  1141. br.Success = true
  1142. br.Msg = "获取成功"
  1143. br.Data = resp
  1144. return
  1145. }
  1146. resp.HaveResearch = true
  1147. if departmentId > 0 {
  1148. condition += ` AND art.department_id = ` + strconv.Itoa(departmentId)
  1149. detail, err := models.GetArticleDepartmentDateilById(departmentId)
  1150. if err != nil {
  1151. br.Msg = "获取信息失败"
  1152. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1153. return
  1154. }
  1155. resp.NickName = detail.NickName
  1156. }
  1157. if industrialManagementId > 0 {
  1158. condition += ` AND m.industrial_management_id = ` + strconv.Itoa(industrialManagementId)
  1159. }
  1160. if articleId > 0 {
  1161. detail, err := models.GetArticleDetailById(articleId)
  1162. if err != nil {
  1163. br.Msg = "获取信息失败"
  1164. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1165. return
  1166. }
  1167. condition += ` AND art.subject_ids = '` + detail.SubjectIds + `'`
  1168. }
  1169. total, err = models.GetWhichDepartmentCount(condition)
  1170. if err != nil {
  1171. br.Msg = "获取信息失败"
  1172. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  1173. return
  1174. }
  1175. page = paging.GetPaging(currentIndex, pageSize, total)
  1176. condition += ` GROUP BY art.article_id ORDER BY art.publish_date DESC`
  1177. list, err := models.IndustrialToArticleWhichDepartment(condition, pars, uid, startSize, pageSize)
  1178. if err != nil {
  1179. br.Msg = "获取失败"
  1180. br.ErrMsg = "获取失败,Err:" + err.Error()
  1181. return
  1182. }
  1183. for k, v := range list {
  1184. if v.Readnum == 0 {
  1185. list[k].IsRed = true
  1186. }
  1187. list[k].IsResearch = true
  1188. subjectNames, err := models.GetSubjectNames(v.ArticleId)
  1189. if err != nil {
  1190. br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
  1191. br.ErrMsg = "获取失败,Err:" + err.Error()
  1192. return
  1193. }
  1194. var subjectNamesNew string
  1195. if len(subjectNames) > 0 {
  1196. slice := strings.Split(subjectNames, "/")
  1197. for k3, v3 := range slice {
  1198. if k3 < 4 {
  1199. subjectNamesNew += v3 + "/"
  1200. }
  1201. }
  1202. }
  1203. industryName, err := models.GetIndustrialNames(v.ArticleId)
  1204. if err != nil && err.Error() != utils.ErrNoRow() {
  1205. br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
  1206. br.ErrMsg = "获取失败,Err:" + err.Error()
  1207. return
  1208. }
  1209. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  1210. list[k].SubjectName = subjectNamesNew
  1211. if subjectNamesNew != "" {
  1212. list[k].IndustryName = industryName + "-" + subjectNamesNew
  1213. } else {
  1214. list[k].IndustryName = industryName
  1215. }
  1216. resp.IndustryName = industryName
  1217. list[k].ImgUrlPc = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211206/UvMadc63MLZY6rnQZQgGZAFXkqwf.png"
  1218. }
  1219. resp.List = list
  1220. resp.Paging = page
  1221. br.Ret = 200
  1222. br.Success = true
  1223. br.Msg = "获取成功"
  1224. br.Data = resp
  1225. }
  1226. // @Title 研选最新主题关键词文章列表接口
  1227. // @Description 获取研选最新主题关键词文章列表接口
  1228. // @Param PageSize query int true "每页数据条数"
  1229. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1230. // @Param ArticleId query int true "文章id"
  1231. // @Success 200 {object} models.ReportArticleWhichIndustrialRepList
  1232. // @router /industry/reportListNew [get]
  1233. func (this *ReportController) ReportListNew() {
  1234. br := new(models.BaseResponse).Init()
  1235. defer func() {
  1236. this.Data["json"] = br
  1237. this.ServeJSON()
  1238. }()
  1239. user := this.User
  1240. if user == nil {
  1241. br.Msg = "请重新登录"
  1242. br.Ret = 408
  1243. return
  1244. }
  1245. uid := user.UserId
  1246. pageSize, _ := this.GetInt("PageSize")
  1247. currentIndex, _ := this.GetInt("CurrentIndex")
  1248. articleId, _ := this.GetInt("ArticleId")
  1249. var condition string
  1250. var startSize int
  1251. if pageSize <= 0 {
  1252. pageSize = utils.PageSize20
  1253. }
  1254. if currentIndex <= 0 {
  1255. currentIndex = 1
  1256. }
  1257. startSize = paging.StartIndex(currentIndex, pageSize)
  1258. var pars []interface{}
  1259. var total int
  1260. resp := new(models.ReportArticleWhichIndustrialRepList)
  1261. page := paging.GetPaging(currentIndex, pageSize, total)
  1262. userType, _, err := services.GetUserType(user.CompanyId)
  1263. if err != nil {
  1264. br.Msg = "获取信息失败"
  1265. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  1266. return
  1267. }
  1268. if userType == 1 {
  1269. resp.Paging = page
  1270. br.Ret = 200
  1271. br.Success = true
  1272. br.Msg = "获取成功"
  1273. br.Data = resp
  1274. return
  1275. }
  1276. resp.HaveResearch = true
  1277. if articleId > 0 {
  1278. detail, err := models.GetArticleDetailById(articleId)
  1279. if err != nil {
  1280. br.Msg = "获取信息失败"
  1281. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1282. return
  1283. }
  1284. firstStr := strings.Index(detail.IndustrialAndSubjectIds, "—")
  1285. if firstStr == 0 {
  1286. condition += ` AND art.industrial_management_id = '` + strconv.Itoa(detail.IndustrialManagementId) + `'`
  1287. } else {
  1288. condition += ` AND art.industrial_and_subject_ids = '` + detail.IndustrialAndSubjectIds + `'`
  1289. }
  1290. }
  1291. total, err = models.GetWhichDepartmentCount(condition)
  1292. if err != nil {
  1293. br.Msg = "获取信息失败"
  1294. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  1295. return
  1296. }
  1297. page = paging.GetPaging(currentIndex, pageSize, total)
  1298. condition += ` GROUP BY art.article_id ORDER BY art.publish_date DESC`
  1299. list, err := models.IndustrialToArticleWhichDepartment(condition, pars, uid, startSize, pageSize)
  1300. if err != nil {
  1301. br.Msg = "获取失败"
  1302. br.ErrMsg = "获取失败,Err:" + err.Error()
  1303. return
  1304. }
  1305. for k, v := range list {
  1306. if v.Readnum == 0 {
  1307. list[k].IsRed = true
  1308. }
  1309. list[k].IsResearch = true
  1310. list[k].ImgUrlPc = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211206/UvMadc63MLZY6rnQZQgGZAFXkqwf.png"
  1311. subjectNames, err := models.GetSubjectNames(v.ArticleId)
  1312. if err != nil {
  1313. br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
  1314. br.ErrMsg = "获取失败,Err:" + err.Error()
  1315. return
  1316. }
  1317. var subjectNamesNew string
  1318. if len(subjectNames) > 0 {
  1319. slice := strings.Split(subjectNames, "/")
  1320. for k3, v3 := range slice {
  1321. if k3 < 4 {
  1322. subjectNamesNew += v3 + "/"
  1323. }
  1324. }
  1325. }
  1326. industryName, err := models.GetIndustrialNames(v.ArticleId)
  1327. if err != nil && err.Error() != utils.ErrNoRow() {
  1328. br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
  1329. br.ErrMsg = "获取失败,Err:" + err.Error()
  1330. return
  1331. }
  1332. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  1333. list[k].SubjectName = subjectNamesNew
  1334. if subjectNamesNew != "" {
  1335. list[k].IndustryName = industryName + "-" + subjectNamesNew
  1336. } else {
  1337. list[k].IndustryName = industryName
  1338. }
  1339. resp.IndustryName = industryName
  1340. }
  1341. resp.List = list
  1342. resp.Paging = page
  1343. br.Ret = 200
  1344. br.Success = true
  1345. br.Msg = "获取成功"
  1346. br.Data = resp
  1347. }
  1348. // @Title 是否展示绝密内参
  1349. // @Description 获取是否展示绝密内参接口
  1350. // @Param request body models.IsShow true "type json string"
  1351. // @Success 200
  1352. // @router /isShow [get]
  1353. func (this *ReportController) IsShow() {
  1354. br := new(models.BaseResponse).Init()
  1355. defer func() {
  1356. this.Data["json"] = br
  1357. this.ServeJSON()
  1358. }()
  1359. user := this.User
  1360. if user == nil {
  1361. br.Msg = "请重新登录"
  1362. br.Ret = 408
  1363. return
  1364. }
  1365. var resp models.IsShow
  1366. IsShowFreeButton, err := services.GetfreeButtonIsShow(user)
  1367. if err != nil {
  1368. br.Msg = "获取失败"
  1369. br.ErrMsg = "获取失败,GetfreeButtonIsShow Err:" + err.Error()
  1370. return
  1371. }
  1372. resp.IsShowChart = true
  1373. //resp.IsShowResearch = true
  1374. resp.LinkWxExplain = utils.LINK_WX_EXPLAIN
  1375. resp.ActivitySpecialExplain = utils.ACTIVITY_SPECIAL_EXPLAIN
  1376. //resp.YanXuan_Explain = true
  1377. resp.IsShowFreeButton = IsShowFreeButton
  1378. //mobile := user.Mobile
  1379. //if mobile == "" {
  1380. // br.Ret = 200
  1381. // br.Success = true
  1382. // br.Data = resp
  1383. // return
  1384. //}
  1385. //total, _ := models.GetUserIsAdminCount(mobile)
  1386. //if total > 0 {
  1387. // resp.IsShowList = true
  1388. //}
  1389. resp.IsShowList = true
  1390. resp.SearchTxtList.SummarySearch = "全局搜索"
  1391. resp.SearchTxtList.ReportSearch = "全局搜索"
  1392. resp.SearchTxtList.YanXuanSearch = "全局搜索"
  1393. resp.SearchTxtList.ActivitySearch = "全局搜索"
  1394. resp.SearchTxtList.TabSearch = "请输入关键词"
  1395. resp.IsShow = true
  1396. br.Ret = 200
  1397. br.Success = true
  1398. br.Data = resp
  1399. }
  1400. // @Title 报告精选、本周研究汇总、上周纪要汇总列表
  1401. // @Description 获取报告精选、本周研究汇总、上周纪要汇总列表接口
  1402. // @Param PageSize query int true "每页数据条数"
  1403. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1404. // @Param ReportType string query true "报告类型 ,1报告精选、2本周研究汇总、3上周纪要汇总"
  1405. // @Success 200 {object} models.CygxReportSelectionListPublicRep
  1406. // @router /reportList/byType [get]
  1407. func (this *ReportController) ReportListByType() {
  1408. br := new(models.BaseResponse).Init()
  1409. defer func() {
  1410. this.Data["json"] = br
  1411. this.ServeJSON()
  1412. }()
  1413. user := this.User
  1414. if user == nil {
  1415. br.Msg = "请重新登录"
  1416. br.Ret = 408
  1417. return
  1418. }
  1419. uid := user.UserId
  1420. pageSize, _ := this.GetInt("PageSize")
  1421. currentIndex, _ := this.GetInt("CurrentIndex")
  1422. reportType := this.GetString("ReportType")
  1423. var condition string
  1424. var startSize int
  1425. if pageSize <= 0 {
  1426. pageSize = utils.PageSize20
  1427. }
  1428. if currentIndex <= 0 {
  1429. currentIndex = 1
  1430. }
  1431. startSize = paging.StartIndex(currentIndex, pageSize)
  1432. var pars []interface{}
  1433. var total int
  1434. resp := new(models.CygxReportSelectionListPublicRep)
  1435. page := paging.GetPaging(currentIndex, pageSize, total)
  1436. var tbdb string
  1437. var readSql string
  1438. var reportTypeStr string
  1439. if reportType == "1" {
  1440. tbdb = "cygx_report_selection"
  1441. reportTypeStr = "bgjx"
  1442. } else if reportType == "2" {
  1443. tbdb = "cygx_research_summary"
  1444. reportTypeStr = "bzyjhz"
  1445. } else if reportType == "3" {
  1446. tbdb = "cygx_minutes_summary"
  1447. reportTypeStr = "szjyhz"
  1448. } else {
  1449. br.Msg = "请选择报告类型"
  1450. return
  1451. }
  1452. fmt.Println(tbdb)
  1453. condition = ` AND publish_status = 1 `
  1454. total, err := models.GetCygxReportSelectionPublic(condition, tbdb, pars)
  1455. if err != nil {
  1456. br.Msg = "获取信息失败"
  1457. br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
  1458. return
  1459. }
  1460. //研究汇总--报告精选 只显示最新一期,往期都隐藏
  1461. if reportType == "1" {
  1462. startSize = 0
  1463. pageSize = 1
  1464. total = 1
  1465. }
  1466. 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`
  1467. page = paging.GetPaging(currentIndex, pageSize, total)
  1468. list, err := models.GetReportSelectionListPublic(condition, readSql, tbdb, pars, startSize, pageSize)
  1469. if err != nil {
  1470. br.Msg = "获取失败"
  1471. br.ErrMsg = "获取失败,Err:" + err.Error()
  1472. return
  1473. }
  1474. for k, v := range list {
  1475. if reportType == "1" {
  1476. list[k].Abstract = v.UpdateDescription
  1477. }
  1478. list[k].PublishDate = utils.StrTimeToTime(v.PublishDate).Format("2006-01-02")
  1479. if v.ReadNum == 0 {
  1480. list[k].IsRed = true
  1481. }
  1482. }
  1483. resp.List = list
  1484. resp.Paging = page
  1485. br.Ret = 200
  1486. br.Success = true
  1487. br.Msg = "获取成功"
  1488. br.Data = resp
  1489. }
  1490. // @Title 获取报告精选详情
  1491. // @Description 获取报告精选详情接口
  1492. // @Param ArticleId query int true "报告ID"
  1493. // @Success 200 {object} models.ReportSelectionLetailResp
  1494. // @router /reportSelection/detail [get]
  1495. func (this *ReportController) Detail() {
  1496. br := new(models.BaseResponse).Init()
  1497. defer func() {
  1498. this.Data["json"] = br
  1499. this.ServeJSON()
  1500. }()
  1501. user := this.User
  1502. if user == nil {
  1503. br.Msg = "请重新登录"
  1504. br.Ret = 408
  1505. return
  1506. }
  1507. uid := user.UserId
  1508. articleId, _ := this.GetInt("ArticleId")
  1509. if articleId < 0 {
  1510. br.Msg = "参数错误"
  1511. br.ErrMsg = "参数错误"
  1512. return
  1513. }
  1514. resp := new(models.ReportSelectionLetailResp)
  1515. //判断用户权限
  1516. hasPermission, err := services.GetUserhasPermission(user)
  1517. if err != nil {
  1518. br.Msg = "获取信息失败"
  1519. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1520. }
  1521. resp.HasPermission = hasPermission
  1522. if hasPermission != 1 {
  1523. br.Ret = 200
  1524. br.Success = true
  1525. br.Msg = "获取成功"
  1526. br.Data = resp
  1527. return
  1528. }
  1529. detail, err := models.GetCygxReportSelectionInfoById(articleId)
  1530. if err != nil {
  1531. br.Msg = "获取信息失败"
  1532. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1533. return
  1534. }
  1535. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
  1536. existMap := make(map[int]int)
  1537. var items []*models.ReportSelectionChartPermission
  1538. listLog, err := models.GetReportSelectionlogListAll(articleId)
  1539. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1540. if err != nil {
  1541. br.Msg = "获取失败"
  1542. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1543. return
  1544. }
  1545. //var itemLogs []*models.CygxReportSelectionLogDetail
  1546. for _, v := range listLog {
  1547. item := new(models.ReportSelectionChartPermission)
  1548. if existMap[v.ChartPermissionId] == 0 {
  1549. item.PermissionName = v.PermissionName + "领域深度报告和调研"
  1550. item.IcoLink = v.IcoLink
  1551. listSonLog, err := models.GetReportSelectionlogSonListAll(articleId, v.ChartPermissionId)
  1552. if err != nil && err.Error() != utils.ErrNoRow() {
  1553. br.Msg = "获取信息失败"
  1554. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1555. return
  1556. }
  1557. for k2, v2 := range listSonLog {
  1558. if v2.IndustrialManagementId != "" {
  1559. listIndustrial, err := models.GetIndustrialByIds(v2.IndustrialManagementId)
  1560. if err != nil && err.Error() != utils.ErrNoRow() {
  1561. br.Msg = "获取信息失败"
  1562. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1563. return
  1564. }
  1565. listSonLog[k2].List = listIndustrial
  1566. }
  1567. }
  1568. item.List = listSonLog
  1569. items = append(items, item)
  1570. //itemLogs = make([]*models.CygxReportSelectionLogDetail, 0)
  1571. }
  1572. existMap[v.ChartPermissionId] = v.ChartPermissionId
  1573. }
  1574. historyRecord := new(models.CygxReportHistoryRecord)
  1575. historyRecord.UserId = uid
  1576. historyRecord.ArticleId = articleId
  1577. historyRecord.CreateTime = time.Now()
  1578. historyRecord.Mobile = user.Mobile
  1579. historyRecord.Email = user.Email
  1580. historyRecord.CompanyId = user.CompanyId
  1581. historyRecord.CompanyName = user.CompanyName
  1582. historyRecord.ReportType = "bgjx"
  1583. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  1584. if err != nil && err.Error() != utils.ErrNoRow() {
  1585. br.Msg = "获取信息失败"
  1586. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  1587. return
  1588. }
  1589. historyRecord.RealName = user.RealName
  1590. if sellerItem != nil {
  1591. historyRecord.SellerName = sellerItem.RealName
  1592. }
  1593. go models.AddCygxReportHistoryRecord(historyRecord)
  1594. resp.List = items
  1595. resp.Detail = detail
  1596. br.Ret = 200
  1597. br.Success = true
  1598. br.Msg = "获取成功"
  1599. br.Data = resp
  1600. }
  1601. // @Title 获取本周研究汇总详情
  1602. // @Description 获取本周研究汇总详情接口
  1603. // @Param ArticleId query int true "报告ID"
  1604. // @Success 200 {object} models.ResearchSummaryLetailResp
  1605. // @router /researchSummary/detail [get]
  1606. func (this *ReportController) ResearchDetail() {
  1607. br := new(models.BaseResponse).Init()
  1608. defer func() {
  1609. this.Data["json"] = br
  1610. this.ServeJSON()
  1611. }()
  1612. user := this.User
  1613. if user == nil {
  1614. br.Msg = "请重新登录"
  1615. br.Ret = 408
  1616. return
  1617. }
  1618. uid := user.UserId
  1619. articleId, _ := this.GetInt("ArticleId")
  1620. if articleId < 0 {
  1621. br.Msg = "参数错误"
  1622. br.ErrMsg = "参数错误"
  1623. return
  1624. }
  1625. resp := new(models.ResearchSummaryLetailResp)
  1626. //判断用户权限
  1627. hasPermission, err := services.GetUserhasPermission(user)
  1628. if err != nil {
  1629. br.Msg = "获取信息失败"
  1630. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1631. }
  1632. resp.HasPermission = hasPermission
  1633. if hasPermission != 1 {
  1634. br.Ret = 200
  1635. br.Success = true
  1636. br.Msg = "获取成功"
  1637. br.Data = resp
  1638. return
  1639. }
  1640. detail, err := models.GetCygxResearchSummaryInfoById(articleId)
  1641. if err != nil {
  1642. br.Msg = "获取信息失败"
  1643. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1644. return
  1645. }
  1646. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
  1647. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1648. listFirst, err := models.GetResearchSummarylogListFirst(articleId)
  1649. if err != nil {
  1650. br.Msg = "获取失败"
  1651. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1652. return
  1653. }
  1654. listArticleType, err := models.GetCygxArticleTypeList()
  1655. if err != nil {
  1656. br.Msg = "获取失败"
  1657. br.ErrMsg = "获取文章类型数据失败,Err:" + err.Error()
  1658. return
  1659. }
  1660. for k, v := range listFirst {
  1661. listSecond, err := models.GetResearchSummarylogSonListSecond(articleId, v.Type)
  1662. if err != nil && err.Error() != utils.ErrNoRow() {
  1663. br.Msg = "获取信息失败"
  1664. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1665. return
  1666. }
  1667. for k2, v2 := range listSecond {
  1668. listThird, err := models.GetResearchSummarylogSonListThird(articleId, v2.ChartPermissionId, v.Type)
  1669. if err != nil && err.Error() != utils.ErrNoRow() {
  1670. br.Msg = "获取信息失败"
  1671. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1672. return
  1673. }
  1674. for _, vType := range listArticleType {
  1675. if v2.ChartPermissionId == vType.YanxPermissionId {
  1676. listSecond[k2].IcoLink = vType.IcoLinkM
  1677. listSecond[k2].PermissionName = vType.YanxPermissionName
  1678. }
  1679. }
  1680. //if v2.ChartPermissionId == utils.YanxSummaryPermissionId {
  1681. // listSecond[k2].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1682. // listSecond[k2].PermissionName = "买方研选纪要"
  1683. //} else if v2.ChartPermissionId == utils.YanxViewpointPermissionId {
  1684. // listSecond[k2].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1685. // listSecond[k2].PermissionName = "买方研选观点"
  1686. //}
  1687. if len(listThird) > 0 {
  1688. for k3, v3 := range listThird {
  1689. if v3.VideoUrl != "" {
  1690. listThird[k3].IsHaveVideo = true
  1691. }
  1692. if v3.ReportLink == "0" {
  1693. listThird[k3].ReportLink = ""
  1694. }
  1695. }
  1696. listSecond[k2].List = listThird
  1697. }
  1698. }
  1699. if len(listSecond) > 0 {
  1700. listFirst[k].List = listSecond
  1701. }
  1702. //`description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
  1703. if v.Type == "SDBG" {
  1704. listFirst[k].ListName = "深度报告"
  1705. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211027/le8AcRjDz0MhA72bVDiaf3d5ALSe.png"
  1706. } else if v.Type == "BZCHJH" {
  1707. listFirst[k].ListName = "本周晨会精华"
  1708. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/DCfekcxaIKGePBsNVu1ULfmNcJBY.png"
  1709. } else if v.Type == "CYDYJY" {
  1710. listFirst[k].ListName = "产业调研纪要"
  1711. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/UPAdozy96z9ypzY04vi0Y3Ogqzji.png"
  1712. } else if v.Type == "SSGS" {
  1713. listFirst[k].ListName = "上市公司调研纪要篇"
  1714. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
  1715. } else if v.Type == "SJDP" {
  1716. listFirst[k].ListName = "事件点评"
  1717. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/2a5cXafO3Iws4QcFp1bd5WPdYikV.png"
  1718. } else if v.Type == "YANX" {
  1719. listFirst[k].ListName = "买方研选"
  1720. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1721. }
  1722. }
  1723. historyRecord := new(models.CygxReportHistoryRecord)
  1724. historyRecord.UserId = uid
  1725. historyRecord.ArticleId = articleId
  1726. historyRecord.CreateTime = time.Now()
  1727. historyRecord.Mobile = user.Mobile
  1728. historyRecord.Email = user.Email
  1729. historyRecord.CompanyId = user.CompanyId
  1730. historyRecord.CompanyName = user.CompanyName
  1731. historyRecord.ReportType = "bzyjhz"
  1732. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  1733. if err != nil && err.Error() != utils.ErrNoRow() {
  1734. br.Msg = "获取信息失败"
  1735. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  1736. return
  1737. }
  1738. historyRecord.RealName = user.RealName
  1739. if sellerItem != nil {
  1740. historyRecord.SellerName = sellerItem.RealName
  1741. }
  1742. go models.AddCygxReportHistoryRecord(historyRecord)
  1743. resp.List = listFirst
  1744. resp.Detail = detail
  1745. br.Ret = 200
  1746. br.Success = true
  1747. br.Msg = "获取成功"
  1748. br.Data = resp
  1749. }
  1750. // @Title 上周纪要汇总内容详情
  1751. // @Description 获取上周纪要汇总内容详情接口
  1752. // @Param ArticleId query int true "报告ID"
  1753. // @Success 200 {object} models.MinutesSummaryLetailResp
  1754. // @router /minutesSummary/detailv4 [get]
  1755. func (this *ReportController) MinutesDetailV4() {
  1756. br := new(models.BaseResponse).Init()
  1757. defer func() {
  1758. this.Data["json"] = br
  1759. this.ServeJSON()
  1760. }()
  1761. user := this.User
  1762. if user == nil {
  1763. br.Msg = "请重新登录"
  1764. br.Ret = 408
  1765. return
  1766. }
  1767. uid := user.UserId
  1768. articleId, _ := this.GetInt("ArticleId")
  1769. if articleId < 0 {
  1770. br.Msg = "参数错误"
  1771. br.ErrMsg = "参数错误"
  1772. return
  1773. }
  1774. resp := new(models.MinutesSummaryLetailRespV4)
  1775. //判断用户权限
  1776. hasPermission, err := services.GetUserhasPermission(user)
  1777. if err != nil {
  1778. br.Msg = "获取信息失败"
  1779. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1780. }
  1781. resp.HasPermission = hasPermission
  1782. if hasPermission != 1 {
  1783. br.Ret = 200
  1784. br.Success = true
  1785. br.Msg = "获取成功"
  1786. br.Data = resp
  1787. return
  1788. }
  1789. detail, err := models.GetCygxMinutesSummaryInfoById(articleId)
  1790. if err != nil {
  1791. br.Msg = "获取信息失败"
  1792. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1793. return
  1794. }
  1795. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
  1796. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1797. listFirst, err := models.GetMinutesSummarylogListAllV4(articleId)
  1798. if err != nil {
  1799. br.Msg = "获取失败"
  1800. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1801. return
  1802. }
  1803. for k, v := range listFirst {
  1804. listSecond, err := models.GetMinutesSummarylogSonListSecond(articleId, v.Type)
  1805. if err != nil && err.Error() != utils.ErrNoRow() {
  1806. br.Msg = "获取信息失败"
  1807. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1808. return
  1809. }
  1810. for k2, v2 := range listSecond {
  1811. listThird, err := models.GetMinutesSummarylogListThird(articleId, v2.ChartPermissionId, v.Type)
  1812. if err != nil && err.Error() != utils.ErrNoRow() {
  1813. br.Msg = "获取信息失败"
  1814. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1815. return
  1816. }
  1817. if len(listThird) > 0 {
  1818. for k3, v3 := range listThird {
  1819. if v3.VideoUrl != "" {
  1820. listThird[k3].IsHaveVideo = true
  1821. }
  1822. if v3.ReportLink == "0" {
  1823. listThird[k3].ReportLink = ""
  1824. }
  1825. }
  1826. listSecond[k2].List = listThird
  1827. }
  1828. }
  1829. if len(listSecond) > 0 {
  1830. listFirst[k].List = listSecond
  1831. }
  1832. //`description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
  1833. if v.Type == "CYDYJY" {
  1834. listFirst[k].ListName = "产业调研纪要"
  1835. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/UPAdozy96z9ypzY04vi0Y3Ogqzji.png"
  1836. } else if v.Type == "SSGS" {
  1837. listFirst[k].ListName = "上市公司调研纪要篇"
  1838. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
  1839. } else if v.Type == "YANX" {
  1840. listFirst[k].ListName = "买方研选纪要"
  1841. listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
  1842. }
  1843. }
  1844. historyRecord := new(models.CygxReportHistoryRecord)
  1845. historyRecord.UserId = uid
  1846. historyRecord.ArticleId = articleId
  1847. historyRecord.CreateTime = time.Now()
  1848. historyRecord.Mobile = user.Mobile
  1849. historyRecord.Email = user.Email
  1850. historyRecord.CompanyId = user.CompanyId
  1851. historyRecord.CompanyName = user.CompanyName
  1852. historyRecord.ReportType = "szjyhz"
  1853. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  1854. if err != nil && err.Error() != utils.ErrNoRow() {
  1855. br.Msg = "获取信息失败"
  1856. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  1857. return
  1858. }
  1859. historyRecord.RealName = user.RealName
  1860. if sellerItem != nil {
  1861. historyRecord.SellerName = sellerItem.RealName
  1862. }
  1863. go models.AddCygxReportHistoryRecord(historyRecord)
  1864. resp.List = listFirst
  1865. resp.Detail = detail
  1866. br.Ret = 200
  1867. br.Success = true
  1868. br.Msg = "获取成功"
  1869. br.Data = resp
  1870. }
  1871. // @Title 上周纪要汇总内容详情
  1872. // @Description 获取上周纪要汇总内容详情接口
  1873. // @Param ArticleId query int true "报告ID"
  1874. // @Success 200 {object} models.MinutesSummaryLetailResp
  1875. // @router /minutesSummary/detail [get]
  1876. func (this *ReportController) MinutesDetail() {
  1877. br := new(models.BaseResponse).Init()
  1878. defer func() {
  1879. this.Data["json"] = br
  1880. this.ServeJSON()
  1881. }()
  1882. user := this.User
  1883. if user == nil {
  1884. br.Msg = "请重新登录"
  1885. br.Ret = 408
  1886. return
  1887. }
  1888. uid := user.UserId
  1889. articleId, _ := this.GetInt("ArticleId")
  1890. if articleId < 0 {
  1891. br.Msg = "参数错误"
  1892. br.ErrMsg = "参数错误"
  1893. return
  1894. }
  1895. resp := new(models.MinutesSummaryLetailResp)
  1896. //判断用户权限
  1897. hasPermission, err := services.GetUserhasPermission(user)
  1898. if err != nil {
  1899. br.Msg = "获取信息失败"
  1900. br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
  1901. }
  1902. resp.HasPermission = hasPermission
  1903. if hasPermission != 1 {
  1904. br.Ret = 200
  1905. br.Success = true
  1906. br.Msg = "获取成功"
  1907. br.Data = resp
  1908. return
  1909. }
  1910. detail, err := models.GetCygxMinutesSummaryInfoById(articleId)
  1911. if err != nil {
  1912. br.Msg = "获取信息失败"
  1913. br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
  1914. return
  1915. }
  1916. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
  1917. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  1918. listLog, err := models.GetMinutesSummarylogListAll(articleId)
  1919. if err != nil {
  1920. br.Msg = "获取失败"
  1921. br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
  1922. return
  1923. }
  1924. for k, v := range listLog {
  1925. listSonLog, err := models.GetMinutesSummarylogSonListAll(articleId, v.ChartPermissionId)
  1926. if err != nil && err.Error() != utils.ErrNoRow() {
  1927. br.Msg = "获取信息失败"
  1928. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  1929. return
  1930. }
  1931. if len(listSonLog) > 0 {
  1932. listLog[k].List = listSonLog
  1933. for k2, v2 := range listSonLog {
  1934. if v2.ReportLink == "0" {
  1935. listSonLog[k2].ReportLink = ""
  1936. }
  1937. }
  1938. }
  1939. }
  1940. historyRecord := new(models.CygxReportHistoryRecord)
  1941. historyRecord.UserId = uid
  1942. historyRecord.ArticleId = articleId
  1943. historyRecord.CreateTime = time.Now()
  1944. historyRecord.Mobile = user.Mobile
  1945. historyRecord.Email = user.Email
  1946. historyRecord.CompanyId = user.CompanyId
  1947. historyRecord.CompanyName = user.CompanyName
  1948. historyRecord.ReportType = "szjyhz"
  1949. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  1950. if err != nil && err.Error() != utils.ErrNoRow() {
  1951. br.Msg = "获取信息失败"
  1952. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  1953. return
  1954. }
  1955. historyRecord.RealName = user.RealName
  1956. if sellerItem != nil {
  1957. historyRecord.SellerName = sellerItem.RealName
  1958. }
  1959. go models.AddCygxReportHistoryRecord(historyRecord)
  1960. resp.List = listLog
  1961. resp.Detail = detail
  1962. br.Ret = 200
  1963. br.Success = true
  1964. br.Msg = "获取成功"
  1965. br.Data = resp
  1966. }
  1967. // @Title 获取路演精华详情
  1968. // @Description 获取路演精华详情接口
  1969. // @Param ArticleId query int true "报告ID"
  1970. // @Success 200 {object} models.RoadshowDetailResp
  1971. // @router /roadshowEssence/detail [get]
  1972. func (this *ReportController) RoadshowDetail() {
  1973. br := new(models.BaseResponse).Init()
  1974. defer func() {
  1975. this.Data["json"] = br
  1976. this.ServeJSON()
  1977. }()
  1978. user := this.User
  1979. if user == nil {
  1980. br.Msg = "请登录"
  1981. br.ErrMsg = "请登录,用户信息为空"
  1982. br.Ret = 408
  1983. return
  1984. }
  1985. uid := user.UserId
  1986. articleId, err := this.GetInt("ArticleId")
  1987. if articleId <= 0 {
  1988. br.Msg = "文章不存在"
  1989. br.ErrMsg = "文章不存在,文章ID错误"
  1990. return
  1991. }
  1992. detail := new(models.ReportDetailRoadshow)
  1993. hasPermission := 0
  1994. hasFree := 0
  1995. //判断是否已经申请过
  1996. applyCount, err := models.GetApplyRecordCount(uid)
  1997. if err != nil && err.Error() != utils.ErrNoRow() {
  1998. br.Msg = "获取信息失败"
  1999. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  2000. return
  2001. }
  2002. //`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
  2003. if user.CompanyId > 1 {
  2004. companyPermission, err := models.GetCompanyPermission(user.CompanyId)
  2005. if err != nil {
  2006. br.Msg = "获取信息失败"
  2007. br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
  2008. return
  2009. }
  2010. detail, err = models.GetReportRoadshowDetailById(articleId)
  2011. if err != nil {
  2012. br.Msg = "获取信息失败"
  2013. br.ErrMsg = "获取信息失败,Err:" + err.Error()
  2014. return
  2015. }
  2016. detail.Body = html.UnescapeString(detail.Body)
  2017. detail.Abstract, _ = services.GetReportContentTextSubNew(detail.Abstract)
  2018. detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
  2019. detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
  2020. if detail.ReportLink == "0" {
  2021. detail.ReportLink = ""
  2022. }
  2023. if companyPermission == "" {
  2024. if applyCount > 0 {
  2025. hasPermission = 5
  2026. } else {
  2027. hasPermission = 2
  2028. }
  2029. hasFree = 2
  2030. goto Loop
  2031. } else {
  2032. hasFree = 1
  2033. var articlePermissionPermissionName string
  2034. articlePermissionPermissionName = detail.CategoryName
  2035. var hasPersion bool
  2036. slice := strings.Split(articlePermissionPermissionName, ",")
  2037. for _, v := range slice {
  2038. if strings.Contains(companyPermission, v) {
  2039. hasPersion = true
  2040. }
  2041. }
  2042. if hasPersion {
  2043. hasPermission = 1
  2044. historyRecord := new(models.CygxArticleHistoryRecord)
  2045. historyRecord.UserId = uid
  2046. historyRecord.ArticleId = articleId
  2047. historyRecord.CreateTime = time.Now()
  2048. historyRecord.Mobile = user.Mobile
  2049. historyRecord.Email = user.Email
  2050. historyRecord.CompanyId = user.CompanyId
  2051. historyRecord.CompanyName = user.CompanyName
  2052. go models.AddCygxArticleHistoryRecord(historyRecord)
  2053. } else { //无该行业权限
  2054. hasPermission = 3
  2055. }
  2056. if hasPermission == 1 {
  2057. key := "CYGX_ARTICLE_" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
  2058. if !utils.Rc.IsExist(key) {
  2059. //新增浏览记录
  2060. record := new(models.CygxArticleViewRecord)
  2061. record.UserId = uid
  2062. record.ArticleId = articleId
  2063. record.CreateTime = time.Now()
  2064. record.Mobile = user.Mobile
  2065. record.Email = user.Email
  2066. record.CompanyId = user.CompanyId
  2067. record.CompanyName = user.CompanyName
  2068. go models.AddCygxArticleViewRecord(record)
  2069. utils.Rc.Put(key, 1, 5*time.Second)
  2070. models.ModifyReportLastViewTime(uid)
  2071. }
  2072. }
  2073. }
  2074. } else { //潜在客户
  2075. if applyCount > 0 {
  2076. hasPermission = 5
  2077. } else {
  2078. hasPermission = 4
  2079. }
  2080. }
  2081. Loop:
  2082. if hasPermission != 1 {
  2083. detail.Body = ""
  2084. detail.Abstract = ""
  2085. }
  2086. resp := new(models.RoadshowDetailResp)
  2087. resp.HasPermission = hasPermission
  2088. resp.HasFree = hasFree
  2089. resp.Detail = detail
  2090. br.Ret = 200
  2091. br.Success = true
  2092. br.Msg = "获取成功"
  2093. br.Data = resp
  2094. }
  2095. // @Title 产业文章列表接口
  2096. // @Description 获取产业文章列表接口
  2097. // @Param KeyWord query string true "搜索关键词"
  2098. // @Success 200 {object} models.CygxIndustrySearchList
  2099. // @router /industryAndArticle/list [get]
  2100. func (this *ReportController) IndustryAndArticleList() {
  2101. br := new(models.BaseResponse).Init()
  2102. defer func() {
  2103. this.Data["json"] = br
  2104. this.ServeJSON()
  2105. }()
  2106. user := this.User
  2107. if user == nil {
  2108. br.Msg = "请重新登录"
  2109. br.Ret = 408
  2110. return
  2111. }
  2112. uid := user.UserId
  2113. keyWord := this.GetString("KeyWord")
  2114. orderSrt := "update_time DESC"
  2115. condition := ` AND subject_names LIKE '%` + keyWord + `%'`
  2116. list, err := models.GetIndustrialManagementAll(uid, condition, orderSrt, 0, 100)
  2117. if err != nil {
  2118. br.Msg = "获取信息失败"
  2119. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2120. return
  2121. }
  2122. for k, v := range list {
  2123. industrialSubjectList, err := models.GetIndustrialSubjectAll(v.IndustrialManagementId)
  2124. if err != nil {
  2125. br.Msg = "获取信息失败"
  2126. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2127. return
  2128. }
  2129. list[k].IndustrialSubjectList = industrialSubjectList
  2130. //list[k].LayoutTime = utils.TimeRemoveHms(v.LayoutTime)
  2131. newArtinfo, err := models.GetIndustrialNewArticleDetail(v.IndustrialManagementId)
  2132. if err != nil {
  2133. br.Msg = "获取信息失败"
  2134. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2135. return
  2136. }
  2137. list[k].UpdateTime = utils.TimeRemoveHms(newArtinfo.PublishDate)
  2138. }
  2139. artList, err := models.GetCygxIndustryAndArticleList(keyWord)
  2140. if err != nil {
  2141. br.Msg = "获取失败"
  2142. br.ErrMsg = "获取失败,Err:" + err.Error()
  2143. return
  2144. }
  2145. for k2, v2 := range artList {
  2146. subjectNames, err := models.GetSubjectNames(v2.ArticleId)
  2147. if err != nil {
  2148. br.Msg = "获取失败" + strconv.Itoa(v2.ArticleId)
  2149. br.ErrMsg = "获取失败,Err:" + err.Error()
  2150. return
  2151. }
  2152. var subjectNamesNew string
  2153. if len(subjectNames) > 0 {
  2154. slice := strings.Split(subjectNames, "/")
  2155. for k3, v3 := range slice {
  2156. if k3 < 4 {
  2157. subjectNamesNew += v3 + "/"
  2158. }
  2159. }
  2160. }
  2161. industryName, err := models.GetIndustrialNames(v2.ArticleId)
  2162. if err != nil && err.Error() != utils.ErrNoRow() {
  2163. br.Msg = "获取失败" + strconv.Itoa(v2.ArticleId)
  2164. br.ErrMsg = "获取失败,Err:" + err.Error()
  2165. return
  2166. }
  2167. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  2168. artList[k2].SubjectName = subjectNamesNew
  2169. if subjectNamesNew == "" {
  2170. artList[k2].IndustryName = industryName
  2171. } else {
  2172. artList[k2].IndustryName = industryName + "-" + subjectNamesNew
  2173. }
  2174. }
  2175. if keyWord != "" {
  2176. keyWordItem := new(models.CygxUserSearchKeyWord)
  2177. keyWordItem.UserId = user.UserId
  2178. keyWordItem.KeyWord = keyWord
  2179. keyWordItem.PageType = "ReortSearch"
  2180. keyWordItem.CreateTime = time.Now()
  2181. go models.AddUserSearchKeyWord(keyWordItem)
  2182. }
  2183. resp := new(models.CygxIndustrySearchList)
  2184. resp.ArtList = artList
  2185. resp.IndList = list
  2186. br.Ret = 200
  2187. br.Success = true
  2188. br.Msg = "获取成功"
  2189. br.Data = resp
  2190. }
  2191. // @Title 产业报告分类关联作者列表接口Pc端
  2192. // @Description 获取产业报告分类关联作者列表接口Pc端
  2193. // @Param ChartPermissionId query int true "分类ID"
  2194. // @Param KeyWord query string true "搜索关键词"
  2195. // @Param PageSize query int true "每页数据条数"
  2196. // @Param CurrentIndex query int true "当前页页码,从1开始"
  2197. // @Success 200 {object} models.CygxArticleDepartmentListPc
  2198. // @router /industryListByDepartmentPc [get]
  2199. func (this *ReportController) IndustryListByDepartmentPc() {
  2200. br := new(models.BaseResponse).Init()
  2201. defer func() {
  2202. this.Data["json"] = br
  2203. this.ServeJSON()
  2204. }()
  2205. user := this.User
  2206. if user == nil {
  2207. br.Msg = "请重新登录"
  2208. br.Ret = 408
  2209. return
  2210. }
  2211. uid := user.UserId
  2212. pageSize, _ := this.GetInt("PageSize")
  2213. currentIndex, _ := this.GetInt("CurrentIndex")
  2214. chartPermissionId, _ := this.GetInt("ChartPermissionId")
  2215. keyWord := this.GetString("KeyWord")
  2216. var startSize int
  2217. var condition string
  2218. condition = ` AND a.publish_status=1 AND m.chart_permission_id =` + strconv.Itoa(chartPermissionId)
  2219. if pageSize <= 0 {
  2220. pageSize = utils.PageSize20
  2221. }
  2222. if currentIndex <= 0 {
  2223. currentIndex = 1
  2224. }
  2225. var articleIdGroup string
  2226. if keyWord != "" {
  2227. //获取标的关联的文章ID
  2228. articleIdSub, err := models.GetArticleIdSubjectGroup(keyWord)
  2229. if err != nil {
  2230. br.Msg = "获取信息失败"
  2231. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  2232. return
  2233. }
  2234. //获取产业关联的标的
  2235. articleIdInd, err := models.GetArticleIndustrialIdGroup(keyWord)
  2236. if err != nil {
  2237. br.Msg = "获取信息失败"
  2238. br.ErrMsg = "获取产业信息失败,Err:" + err.Error()
  2239. return
  2240. }
  2241. if articleIdSub != "" && articleIdInd != "" {
  2242. articleIdGroup = articleIdSub + "," + articleIdInd
  2243. } else if articleIdSub != "" && articleIdInd == "" {
  2244. articleIdGroup = articleIdSub
  2245. } else if articleIdSub == "" && articleIdInd != "" {
  2246. articleIdGroup = articleIdInd
  2247. }
  2248. slice := strings.Split(keyWord, "/")
  2249. if len(slice) > 1 {
  2250. var subjectIds string
  2251. for _, v := range slice {
  2252. subjectId, err := models.GetcygxIndustrialSubjectByName(v)
  2253. if err != nil && err.Error() != utils.ErrNoRow() {
  2254. br.Msg = "获取信息失败"
  2255. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  2256. return
  2257. }
  2258. if subjectId != "" {
  2259. subjectIds += subjectId + ","
  2260. }
  2261. }
  2262. subjectIds = strings.TrimRight(subjectIds, ",")
  2263. if len(subjectIds) > 0 {
  2264. articleBySub, err := models.GetArticleIdsBySubId(subjectIds)
  2265. if err != nil {
  2266. br.Msg = "获取信息失败"
  2267. br.ErrMsg = "获取文章关联的标的失败,Err:" + err.Error()
  2268. return
  2269. }
  2270. if articleIdGroup != "" {
  2271. if articleBySub != "" {
  2272. articleIdGroup += "," + articleBySub
  2273. }
  2274. } else {
  2275. articleIdGroup = articleBySub
  2276. }
  2277. }
  2278. }
  2279. }
  2280. if articleIdGroup != "" {
  2281. condition += ` AND a.article_id IN (` + articleIdGroup + `)`
  2282. }
  2283. startSize = paging.StartIndex(currentIndex, pageSize)
  2284. total, err := models.GetArticleDepartmentCount(condition)
  2285. page := paging.GetPaging(currentIndex, pageSize, total)
  2286. resp := new(models.CygxArticleDepartmentListPc)
  2287. userType, _, err := services.GetUserType(user.CompanyId)
  2288. if err != nil {
  2289. br.Msg = "获取信息失败"
  2290. br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
  2291. return
  2292. }
  2293. if userType == 1 {
  2294. resp.Paging = page
  2295. br.Ret = 200
  2296. br.Success = true
  2297. br.Msg = "获取成功"
  2298. br.Data = resp
  2299. return
  2300. }
  2301. resp.HaveResearch = true
  2302. //获取作者信息,并排序
  2303. list, err := models.GetCygxArticleDepartmentListPc(startSize, pageSize, condition, uid)
  2304. if err != nil {
  2305. br.Msg = "获取信息失败"
  2306. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2307. return
  2308. }
  2309. for k, v := range list {
  2310. artList, err := models.GetArticleByDepartmentIdPc(v.DepartmentId, articleIdGroup)
  2311. if err != nil {
  2312. br.Msg = "获取信息失败"
  2313. br.ErrMsg = "获取文章信息失败,Err:" + err.Error()
  2314. return
  2315. }
  2316. for k2, v2 := range artList {
  2317. if artList[k2].IsReport == "1" {
  2318. artList[k2].Title = v2.Title
  2319. } else {
  2320. artList[k2].Title = v2.Title
  2321. }
  2322. artList[k2].IndustryName = strings.Replace(artList[k2].IndustryName, " ", "", -1)
  2323. }
  2324. list[k].List = artList
  2325. if v.FollowNum > 0 {
  2326. list[k].IsMyFollow = true
  2327. }
  2328. }
  2329. listnNew, err := models.GetIndustrialSubjectByDepartmentNew()
  2330. if err != nil {
  2331. br.Msg = "获取信息失败"
  2332. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2333. return
  2334. }
  2335. if len(listnNew) > 0 {
  2336. for _, v := range listnNew {
  2337. firstStr := strings.Index(v.IndustrialAndSubjectIds, "—")
  2338. Management := new(models.IndustrialManagementIdInt)
  2339. if firstStr == 0 {
  2340. Management.IndustryName = v.IndustryName
  2341. } else {
  2342. listSub, err := models.GetIndustrialManagementSubjectList(v.ArticleId)
  2343. if err != nil {
  2344. br.Msg = "获取信息失败"
  2345. br.ErrMsg = "获取关联标的列表失败,Err:" + err.Error()
  2346. return
  2347. }
  2348. var subjectNamesNew string
  2349. for _, v1 := range listSub {
  2350. subjectNamesNew += v1.SubjectName + "/"
  2351. }
  2352. subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
  2353. Management.IndustryName = subjectNamesNew
  2354. }
  2355. Management.IndustrialManagementId = v.IndustrialManagementId
  2356. Management.ArticleId = v.ArticleId
  2357. resp.ListnNew = append(resp.ListnNew, Management)
  2358. }
  2359. }
  2360. resp.List = list
  2361. resp.Paging = page
  2362. br.Ret = 200
  2363. br.Success = true
  2364. br.Msg = "获取成功"
  2365. br.Data = resp
  2366. }
  2367. // @Title 产业文章列表接口Pc端
  2368. // @Description 获取产业文章列表接口Pc端
  2369. // @Param KeyWord query string true "搜索关键词"
  2370. // @Success 200 {object} models.CygxIndustrySearchListPc
  2371. // @router /industryAndArticle/listPc [get]
  2372. func (this *ReportController) IndustryAndArticleListPc() {
  2373. br := new(models.BaseResponse).Init()
  2374. defer func() {
  2375. this.Data["json"] = br
  2376. this.ServeJSON()
  2377. }()
  2378. user := this.User
  2379. if user == nil {
  2380. br.Msg = "请重新登录"
  2381. br.Ret = 408
  2382. return
  2383. }
  2384. uid := user.UserId
  2385. keyWord := this.GetString("KeyWord")
  2386. resp := new(models.CygxIndustrySearchListPc)
  2387. orderSrt := "update_time DESC"
  2388. condition := ` AND subject_names LIKE '%` + keyWord + `%'`
  2389. list, err := models.GetIndustrialManagementAll(uid, condition, orderSrt, 0, 100)
  2390. if err != nil {
  2391. br.Msg = "获取信息失败"
  2392. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2393. return
  2394. }
  2395. for k, v := range list {
  2396. industrialSubjectList, err := models.GetIndustrialSubjectAll(v.IndustrialManagementId)
  2397. if err != nil {
  2398. br.Msg = "获取信息失败"
  2399. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2400. return
  2401. }
  2402. list[k].IndustrialSubjectList = industrialSubjectList
  2403. //list[k].LayoutTime = utils.TimeRemoveHms(v.LayoutTime)
  2404. newArtinfo, err := models.GetIndustrialNewArticleDetail(v.IndustrialManagementId)
  2405. if err != nil {
  2406. br.Msg = "获取信息失败"
  2407. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2408. return
  2409. }
  2410. list[k].UpdateTime = utils.TimeRemoveHms(newArtinfo.PublishDate)
  2411. }
  2412. artList, err := models.GetCygxIndustryAndArticleList(keyWord)
  2413. if err != nil {
  2414. br.Msg = "获取失败"
  2415. br.ErrMsg = "获取失败,Err:" + err.Error()
  2416. return
  2417. }
  2418. if len(artList) > 0 {
  2419. var articleIds string
  2420. for _, v := range artList {
  2421. articleIds += strconv.Itoa(v.ArticleId) + ","
  2422. }
  2423. articleIds = strings.TrimRight(articleIds, ",")
  2424. if articleIds != "" {
  2425. condition = ` AND a.article_id IN (` + articleIds + `)`
  2426. DepartmentList, err := models.GetCygxArticleDepartmentListPc(0, 20, condition, uid)
  2427. if err != nil {
  2428. br.Msg = "获取信息失败"
  2429. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2430. return
  2431. }
  2432. for k, v := range DepartmentList {
  2433. artList, err := models.GetArticleByDepartmentIdPc(v.DepartmentId, articleIds)
  2434. if err != nil {
  2435. br.Msg = "获取信息失败"
  2436. br.ErrMsg = "获取文章信息失败,Err:" + err.Error()
  2437. return
  2438. }
  2439. for k2, v2 := range artList {
  2440. if artList[k2].IsReport == "1" {
  2441. artList[k2].Title = v2.Title
  2442. } else {
  2443. artList[k2].Title = v2.Title
  2444. }
  2445. artList[k2].IndustryName = strings.Replace(artList[k2].IndustryName, " ", "", -1)
  2446. }
  2447. DepartmentList[k].List = artList
  2448. if v.FollowNum > 0 {
  2449. DepartmentList[k].IsMyFollow = true
  2450. }
  2451. }
  2452. resp.DepartmentList = DepartmentList
  2453. }
  2454. }
  2455. if keyWord != "" {
  2456. keyWordItem := new(models.CygxUserSearchKeyWord)
  2457. keyWordItem.UserId = user.UserId
  2458. keyWordItem.KeyWord = keyWord
  2459. keyWordItem.PageType = "ReortSearch"
  2460. keyWordItem.CreateTime = time.Now()
  2461. go models.AddUserSearchKeyWord(keyWordItem)
  2462. }
  2463. resp.IndList = list
  2464. br.Ret = 200
  2465. br.Success = true
  2466. br.Msg = "获取成功"
  2467. br.Data = resp
  2468. }
  2469. // @Title 报告搜索
  2470. // @Description 报告搜索接口
  2471. // @Param KeyWord query string true "搜索关键词"
  2472. // @Success 200 {object} models.ReoprtSearchResp
  2473. // @router /searchReport [get]
  2474. func (this *ReportController) SearchReport() {
  2475. br := new(models.BaseResponse).Init()
  2476. defer func() {
  2477. this.Data["json"] = br
  2478. this.ServeJSON()
  2479. }()
  2480. user := this.User
  2481. if user == nil {
  2482. br.Msg = "请重新登录"
  2483. br.Ret = 408
  2484. return
  2485. }
  2486. keyWord := this.GetString("KeyWord")
  2487. var condition string
  2488. var sqlGroup string
  2489. //匹配报告标题、
  2490. 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 `
  2491. sqlGroup = ` GROUP BY a.article_id ORDER BY a.publish_date DESC `
  2492. //对应产业名称、标的名称。
  2493. listYx, err := models.GetArticleCollectionList(` AND a.article_id >= 1000000 `+condition+sqlGroup, user.UserId)
  2494. if err != nil {
  2495. br.Msg = "获取信息失败"
  2496. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2497. return
  2498. }
  2499. for k, v := range listYx {
  2500. listYx[k].Source = 2
  2501. if v.MyCollectNum > 0 {
  2502. listYx[k].IsCollect = true
  2503. }
  2504. }
  2505. listHz, err := models.GetReoprtSearchList(` AND a.article_id < 1000000 `+condition+` OR ( article_type = 'lyjh' `+condition+` ) `+sqlGroup, user.UserId)
  2506. if err != nil {
  2507. br.Msg = "获取信息失败"
  2508. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2509. return
  2510. }
  2511. for k, v := range listHz {
  2512. listHz[k].Source = 1
  2513. if v.MyCollectNum > 0 {
  2514. listHz[k].IsCollect = true
  2515. }
  2516. }
  2517. if keyWord != "" {
  2518. keyWordItem := new(models.CygxUserSearchKeyWord)
  2519. keyWordItem.UserId = user.UserId
  2520. keyWordItem.KeyWord = keyWord
  2521. keyWordItem.PageType = "ReortSearch"
  2522. keyWordItem.CreateTime = time.Now()
  2523. go models.AddUserSearchKeyWord(keyWordItem)
  2524. //go services.AddUserSearchLog(user, keyWord, 5)
  2525. }
  2526. if len(listYx) == 0 {
  2527. listYx = make([]*models.ArticleCollectionResp, 0)
  2528. }
  2529. if len(listHz) == 0 {
  2530. listHz = make([]*models.ArticleCollectionResp, 0)
  2531. }
  2532. resp := new(models.ReoprtSearchResp)
  2533. resp.ListYx = listYx
  2534. resp.ListHz = listHz
  2535. br.Ret = 200
  2536. br.Success = true
  2537. br.Msg = "获取成功"
  2538. br.Data = resp
  2539. }
  2540. // @Title 资源包搜索
  2541. // @Description 资源包搜索接口
  2542. // @Param KeyWord query string true "搜索关键词"
  2543. // @Success 200 {object} models.SearchResourceResp
  2544. // @router /searchResource [get]
  2545. func (this *ReportController) SearchResource() {
  2546. br := new(models.BaseResponse).Init()
  2547. defer func() {
  2548. this.Data["json"] = br
  2549. this.ServeJSON()
  2550. }()
  2551. user := this.User
  2552. if user == nil {
  2553. br.Msg = "请重新登录"
  2554. br.Ret = 408
  2555. return
  2556. }
  2557. uid := user.UserId
  2558. fllowList, err := models.GetUserFllowIndustrialList(uid)
  2559. if err != nil {
  2560. br.Msg = "获取失败"
  2561. br.ErrMsg = "获取失败,GetUserFllowIndustrialList Err:" + err.Error()
  2562. return
  2563. }
  2564. fllowMap := make(map[int]int)
  2565. if len(fllowList) > 0 {
  2566. for _, v := range fllowList {
  2567. fllowMap[v.IndustrialManagementId] = v.IndustrialManagementId
  2568. }
  2569. }
  2570. keyWord := this.GetString("KeyWord")
  2571. var condition string
  2572. var conditionOr string
  2573. //conditionOr = ` OR ( a.title LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2574. conditionOr += ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2575. condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
  2576. listHz, err := models.GetSearchResourceList(user.UserId, condition, 0, 0)
  2577. if err != nil {
  2578. br.Msg = "获取信息失败"
  2579. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2580. return
  2581. }
  2582. //conditionOr = ` OR ( a.title LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2583. conditionOr = ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
  2584. condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
  2585. listYx, err := models.GetSearchResourceList(user.UserId, condition, 0, 0)
  2586. if err != nil {
  2587. br.Msg = "获取信息失败"
  2588. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2589. return
  2590. }
  2591. //合并产业关联的标的
  2592. listSubjcet, err := models.GetThemeHeatSubjectList("")
  2593. if err != nil {
  2594. br.Msg = "获取信息失败"
  2595. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  2596. return
  2597. }
  2598. industrialIdArr := make([]int, 0)
  2599. for k, v := range listHz {
  2600. listHz[k].Source = 1
  2601. if fllowMap[v.IndustrialManagementId] > 0 {
  2602. listHz[k].IsFollw = true
  2603. }
  2604. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  2605. }
  2606. for k, v := range listYx {
  2607. listYx[k].Source = 2
  2608. if fllowMap[v.IndustrialManagementId] > 0 {
  2609. listYx[k].IsFollw = true
  2610. }
  2611. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  2612. }
  2613. if len(industrialIdArr) > 0 {
  2614. //合并产业关联的标的
  2615. listSubjcet, err = models.GetIndustrialSubjectAllByIndustrialId(industrialIdArr)
  2616. if err != nil {
  2617. br.Msg = "获取信息失败"
  2618. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  2619. return
  2620. }
  2621. mapIndustrial := make(map[string]int)
  2622. for _, v := range listSubjcet {
  2623. for k2, v2 := range listYx {
  2624. if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] == 0 {
  2625. listYx[k2].IndustrialSubjectList = append(listYx[k2].IndustrialSubjectList, v)
  2626. mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] = v2.IndustrialManagementId
  2627. }
  2628. }
  2629. for k2, v2 := range listHz {
  2630. if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] == 0 {
  2631. listHz[k2].IndustrialSubjectList = append(listHz[k2].IndustrialSubjectList, v)
  2632. mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] = v2.IndustrialManagementId
  2633. }
  2634. }
  2635. }
  2636. }
  2637. if keyWord != "" {
  2638. keyWordItem := new(models.CygxUserSearchKeyWord)
  2639. keyWordItem.UserId = user.UserId
  2640. keyWordItem.KeyWord = keyWord
  2641. keyWordItem.PageType = "ReortSearch"
  2642. keyWordItem.CreateTime = time.Now()
  2643. go models.AddUserSearchKeyWord(keyWordItem)
  2644. }
  2645. resp := new(models.SearchResourceResp)
  2646. if len(listYx) == 0 {
  2647. listYx = make([]*models.IndustrialManagementHotResp, 0)
  2648. }
  2649. if len(listHz) == 0 {
  2650. listHz = make([]*models.IndustrialManagementHotResp, 0)
  2651. }
  2652. resp.ListYx = listYx
  2653. resp.ListHz = listHz
  2654. br.Ret = 200
  2655. br.Success = true
  2656. br.Msg = "获取成功"
  2657. br.Data = resp
  2658. }
  2659. // @Title 报告搜索、资源包搜索接口
  2660. // @Description 报告搜索、资源包搜索接口接口
  2661. // @Param KeyWord query string true "搜索关键词"
  2662. // @Param PageSize query int true "每页数据条数"
  2663. // @Success 200 {object} models.SearchReportAndResourceResp
  2664. // @router /searchReportAndResource [get]
  2665. func (this *ReportController) SearchReportAndResource() {
  2666. br := new(models.BaseResponse).Init()
  2667. defer func() {
  2668. this.Data["json"] = br
  2669. this.ServeJSON()
  2670. }()
  2671. user := this.User
  2672. if user == nil {
  2673. br.Msg = "请重新登录"
  2674. br.Ret = 408
  2675. return
  2676. }
  2677. uid := user.UserId
  2678. keyWord := this.GetString("KeyWord")
  2679. pageSize, _ := this.GetInt("PageSize")
  2680. var condition string
  2681. var sqlGroup string
  2682. //匹配报告标题、
  2683. 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 `
  2684. sqlGroup = ` GROUP BY a.article_id ORDER BY a.publish_date DESC `
  2685. if pageSize > 0 {
  2686. sqlGroup += ` LIMIT 5 `
  2687. } else {
  2688. sqlGroup += ` LIMIT 100 `
  2689. }
  2690. ListYxReport, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+condition+sqlGroup, user.UserId)
  2691. if err != nil {
  2692. br.Msg = "获取信息失败"
  2693. br.ErrMsg = "获取研选文章列表失败,Err:" + err.Error()
  2694. return
  2695. }
  2696. ListHzReport, err := models.GetReoprtSearchList(` AND a.article_type_id NOT IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+condition+sqlGroup, user.UserId)
  2697. if err != nil {
  2698. br.Msg = "获取信息失败"
  2699. br.ErrMsg = "获取弘则报告文章列表失败,Err:" + err.Error()
  2700. return
  2701. }
  2702. keyWordArr, err := services.GetIndustryMapNameSliceV3(keyWord)
  2703. if err != nil {
  2704. br.Msg = "获取失败"
  2705. br.ErrMsg = "获取分词失败,GetIndustryMapNameSliceV3 Err: " + err.Error()
  2706. return
  2707. }
  2708. keyWordArr = services.RemoveDuplicatesAndEmpty(keyWordArr)
  2709. var keyWordIk string
  2710. if len(keyWordArr) > 1 {
  2711. keyWordIk = services.KeyWordArrSqlRegexp(keyWordArr)
  2712. var conditionIk string
  2713. var sqlGroupIk string
  2714. conditionIk = `AND ( a.title REGEXP '` + keyWordIk + `' OR a.annotation REGEXP '` + keyWordIk + `' OR a.abstract REGEXP '` + keyWordIk + `') AND a.publish_status = 1 `
  2715. sqlGroupIk = ` GROUP BY a.article_id ORDER BY a.publish_date DESC `
  2716. if pageSize > 0 {
  2717. sqlGroupIk += ` LIMIT 5 `
  2718. } else {
  2719. sqlGroupIk += ` LIMIT 20 `
  2720. }
  2721. //研选的联想词列表
  2722. ListYxReportIk, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+conditionIk+sqlGroupIk, user.UserId)
  2723. if err != nil && err.Error() != utils.ErrNoRow() {
  2724. br.Msg = "获取信息失败"
  2725. br.ErrMsg = "获取研选IK文章列表失败,Err:" + err.Error()
  2726. return
  2727. }
  2728. if len(ListYxReportIk) > 0 {
  2729. for _, v := range ListYxReportIk {
  2730. ListYxReport = append(ListYxReport, v)
  2731. }
  2732. }
  2733. //弘则的联想词列表
  2734. ListHzReportIk, err := models.GetReoprtSearchList(` AND a.article_type_id NOT IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+conditionIk+sqlGroupIk, user.UserId)
  2735. if err != nil && err.Error() != utils.ErrNoRow() {
  2736. br.Msg = "获取信息失败"
  2737. br.ErrMsg = "获取研选IK文章列表失败,Err:" + err.Error()
  2738. return
  2739. }
  2740. if len(ListHzReportIk) > 0 {
  2741. for _, v := range ListHzReportIk {
  2742. ListHzReport = append(ListHzReport, v)
  2743. }
  2744. }
  2745. }
  2746. for k, v := range ListHzReport {
  2747. ListHzReport[k].Source = 1
  2748. if v.MyCollectNum > 0 {
  2749. ListHzReport[k].IsCollect = true
  2750. }
  2751. }
  2752. for k, v := range ListYxReport {
  2753. ListYxReport[k].Source = 2
  2754. if v.MyCollectNum > 0 {
  2755. ListYxReport[k].IsCollect = true
  2756. }
  2757. }
  2758. var articleIds string
  2759. for _, v := range ListHzReport {
  2760. articleIds += strconv.Itoa(v.ArticleId) + ","
  2761. }
  2762. for _, v := range ListYxReport {
  2763. articleIds += strconv.Itoa(v.ArticleId) + ","
  2764. }
  2765. articleIds = strings.TrimRight(articleIds, ",")
  2766. silcearticleIds := strings.Split(articleIds, ",")
  2767. var parsindustrial []interface{}
  2768. parsindustrial = make([]interface{}, 0)
  2769. articleIdList := make([]string, 0)
  2770. for _, v := range silcearticleIds {
  2771. articleIdList = append(articleIdList, v)
  2772. }
  2773. conditionindustrial := ` AND mg.article_id IN ( ` + utils.GetOrmInReplace(len(silcearticleIds)) + ` ) `
  2774. parsindustrial = append(parsindustrial, articleIdList)
  2775. industrialList, err := models.GetIndustrialListByarticleId(parsindustrial, conditionindustrial)
  2776. if err != nil {
  2777. return
  2778. }
  2779. industrialMap := make(map[int][]*models.IndustrialManagementResp)
  2780. if len(industrialList) > 0 {
  2781. for _, v := range industrialList {
  2782. item := new(models.IndustrialManagementResp)
  2783. //item.ArticleId = v.ArticleId
  2784. item.IndustrialManagementId = v.IndustrialManagementId
  2785. item.IndustryName = v.IndustryName
  2786. item.ChartPermissionId = v.ChartPermissionId
  2787. industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
  2788. }
  2789. }
  2790. for k, v := range ListHzReport {
  2791. if len(industrialMap[v.ArticleId]) > 0 {
  2792. ListHzReport[k].List = industrialMap[v.ArticleId]
  2793. } else {
  2794. ListHzReport[k].List = make([]*models.IndustrialManagementResp, 0)
  2795. }
  2796. }
  2797. for k, v := range ListYxReport {
  2798. if len(industrialMap[v.ArticleId]) > 0 {
  2799. ListYxReport[k].List = industrialMap[v.ArticleId]
  2800. } else {
  2801. ListYxReport[k].List = make([]*models.IndustrialManagementResp, 0)
  2802. }
  2803. }
  2804. //获取文章关联的产业
  2805. if len(ListYxReport) == 0 {
  2806. ListYxReport = make([]*models.ArticleCollectionResp, 0)
  2807. }
  2808. if len(ListHzReport) == 0 {
  2809. ListHzReport = make([]*models.ArticleCollectionResp, 0)
  2810. }
  2811. fllowList, err := models.GetUserFllowIndustrialList(uid)
  2812. if err != nil {
  2813. br.Msg = "获取失败"
  2814. br.ErrMsg = "获取失败,GetUserFllowIndustrialList Err:" + err.Error()
  2815. return
  2816. }
  2817. fllowMap := make(map[int]int)
  2818. if len(fllowList) > 0 {
  2819. for _, v := range fllowList {
  2820. fllowMap[v.IndustrialManagementId] = v.IndustrialManagementId
  2821. }
  2822. }
  2823. condition = ` AND a.publish_status = 1 AND a.article_type_id NOT IN (` + utils.YAN_XUAN_ARTICLE_TYPE_IDS + `) AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%' ) `
  2824. listHzResource, err := models.GetSearchResourceList(user.UserId, condition, 0, pageSize)
  2825. if err != nil {
  2826. br.Msg = "获取信息失败"
  2827. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2828. return
  2829. }
  2830. condition = ` AND a.publish_status = 1 AND a.article_type_id IN (` + utils.YAN_XUAN_ARTICLE_TYPE_IDS + `) AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%' ) `
  2831. listYxResource, err := models.GetSearchResourceList(user.UserId, condition, 0, pageSize)
  2832. if err != nil {
  2833. br.Msg = "获取信息失败"
  2834. br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
  2835. return
  2836. }
  2837. //合并产业关联的标的
  2838. listSubjcet, err := models.GetThemeHeatSubjectList("")
  2839. if err != nil {
  2840. br.Msg = "获取信息失败"
  2841. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  2842. return
  2843. }
  2844. industrialIdArr := make([]int, 0)
  2845. nowTime := time.Now().Local()
  2846. threeMonBefore := nowTime.AddDate(0, -3, 0)
  2847. mapHot := make(map[string]int)
  2848. hotCondition := ` ORDER BY sum_num DESC `
  2849. listHot, err := models.GetThemeHeatList(user.UserId, hotCondition, 0, 3)
  2850. if err != nil {
  2851. br.Msg = "获取信息失败"
  2852. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2853. return
  2854. }
  2855. for _, v := range listHot {
  2856. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  2857. mapHot[v.IndustryName] = v.IndustrialManagementId
  2858. }
  2859. orderSrt := "man.recommended_index DESC,update_time DESC"
  2860. for k, v := range listHzResource {
  2861. // 关联报告发布时间均在3个月内则标记New
  2862. if v.MinReportTime != "" {
  2863. t, e := time.Parse(utils.FormatDateTime, v.MinReportTime)
  2864. if e != nil {
  2865. err = errors.New("报告最早发布时间有误,GetindustryVideo " + e.Error())
  2866. return
  2867. }
  2868. if t.After(threeMonBefore) {
  2869. listHzResource[k].IsNew = true
  2870. }
  2871. }
  2872. //弘则资源包不展示hot标签
  2873. //if mapHot[v.IndustryName] > 0 {
  2874. // listHzResource[k].IsHot = true
  2875. //}
  2876. listHzResource[k].Source = 1
  2877. if fllowMap[v.IndustrialManagementId] > 0 {
  2878. listHzResource[k].IsFollw = true
  2879. }
  2880. industrialIdSlice := make([]int, 0)
  2881. articleIdArr := make([]int, 0)
  2882. industrialIdSlice = append(industrialIdSlice, v.IndustrialManagementId)
  2883. listUpdateTime, err := models.GetNewArticleDetailByIndustrialIds(industrialIdSlice)
  2884. if err != nil && err.Error() != utils.ErrNoRow() {
  2885. return
  2886. }
  2887. for _, v := range listUpdateTime {
  2888. articleIdArr = append(articleIdArr, v.ArticleId)
  2889. }
  2890. if err != nil {
  2891. return
  2892. }
  2893. mapHistroyArticleId := make(map[int]int)
  2894. if user.UserId > 0 {
  2895. listArticleHistory, e := models.GetUserToArticleHistory(user.UserId, articleIdArr)
  2896. if e != nil && e.Error() != utils.ErrNoRow() {
  2897. err = errors.New("获取产业关联的视频失败,GetindustryVideo " + e.Error())
  2898. return
  2899. }
  2900. for _, v := range listArticleHistory {
  2901. mapHistroyArticleId[v.ArticleId] = v.ArticleId
  2902. }
  2903. }
  2904. condition2 := ` AND man.industry_name LIKE '%` + keyWord + `%' `
  2905. list, err := models.GetIndustrialManagementAll(uid, condition2, orderSrt, 0, 20)
  2906. if err != nil {
  2907. br.Msg = "获取信息失败"
  2908. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  2909. return
  2910. }
  2911. mapUPdateTime := make(map[int]string)
  2912. //获取这些产业下最新更新的文章
  2913. //时间线的更新时间
  2914. // maptimelineUPdateTime := make(map[int]string)
  2915. listtimelinePublishdate, err := models.GetTimeLineReportIndustrialPublishdateList(industrialIdArr)
  2916. if err != nil && err.Error() != utils.ErrNoRow() {
  2917. return
  2918. }
  2919. for _, v := range listtimelinePublishdate {
  2920. if mapUPdateTime[v.IndustrialManagementId] != "" {
  2921. if utils.StrTimeToTime(v.PublishDate).After(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
  2922. mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
  2923. }
  2924. }
  2925. }
  2926. //mapHistroyArticleId := make(map[int]int)
  2927. //if userId > 0 {
  2928. // listArticleHistory, e := models.GetUserToArticleHistory(userId, articleIdArr)
  2929. // if e != nil && e.Error() != utils.ErrNoRow() {
  2930. // err = errors.New("获取产业关联的视频失败,GetindustryVideo " + e.Error())
  2931. // return
  2932. // }
  2933. // for _, v := range listArticleHistory {
  2934. // mapHistroyArticleId[v.ArticleId] = v.ArticleId
  2935. // }
  2936. //}
  2937. var industrialIds string
  2938. for _, id := range industrialIdArr {
  2939. industrialIds += strconv.Itoa(id) + ","
  2940. }
  2941. industrialIds = strings.TrimRight(industrialIds, ",")
  2942. articleList, err := models.GetReportIndustrialReadNumList(user.UserId, industrialIds, user.CreatedTime)
  2943. mapHistroyindustrialId := make(map[int]int)
  2944. for _, v := range articleList {
  2945. mapHistroyindustrialId[v.IndustrialManagementId] = v.Readnum
  2946. }
  2947. //nowTime := time.Now().Local()
  2948. //threeMonBefore := nowTime.AddDate(0, -3, 0)
  2949. //查询用户今天是否看过时间线
  2950. //haveMorningMeeting := false
  2951. //var morningMeetingTime string
  2952. recrodList, err := models.GetTimeLineRecordAllCount(user.UserId, time.Now().Format(utils.FormatDate))
  2953. if err != nil {
  2954. return
  2955. }
  2956. var industrialManagementIdstr string
  2957. industrialIdMap := make(map[string]time.Time)
  2958. for _, v := range recrodList {
  2959. industrialManagementIdstr = strings.TrimLeft(v.Parameter, "PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=")
  2960. if createTime, ok := industrialIdMap[industrialManagementIdstr]; ok {
  2961. if createTime.Before(v.CreateTime) {
  2962. industrialIdMap[industrialManagementIdstr] = v.CreateTime
  2963. }
  2964. } else {
  2965. industrialIdMap[industrialManagementIdstr] = v.CreateTime
  2966. }
  2967. }
  2968. mmList, err := models.GetCygxMorningMeetingReviewsListByIndustrialIds(industrialIds)
  2969. if err != nil {
  2970. return
  2971. }
  2972. morningMeetingTimeMap := make(map[int]time.Time)
  2973. for _, v := range mmList {
  2974. morningMeetingTimeMap[v.IndustryId] = v.CreateTime
  2975. }
  2976. timeLineRedMap := make(map[int]bool, 0)
  2977. for _, industrialId := range industrialIdArr {
  2978. if createTime, ok := industrialIdMap[strconv.Itoa(industrialId)]; ok {
  2979. if createTime.Before(morningMeetingTimeMap[industrialId]) {
  2980. timeLineRedMap[industrialId] = true
  2981. }
  2982. }
  2983. }
  2984. for k, v := range list {
  2985. list[k].UpdateTime = utils.TimeRemoveHms(mapUPdateTime[v.IndustrialManagementId])
  2986. if user.UserId > 0 {
  2987. //如果文章没有阅读,而且,文章的发布时间晚于项目的上线时间,而且文章的发布时间晚于用户的注册时间,就进行标红处理
  2988. if mapHistroyindustrialId[v.IndustrialManagementId] == 0 || timeLineRedMap[v.IndustrialManagementId] {
  2989. if user.CreatedTime.Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
  2990. list[k].IsRed = true
  2991. }
  2992. }
  2993. } else {
  2994. if utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
  2995. list[k].IsRed = true
  2996. }
  2997. list[k].IsFollow = 0
  2998. }
  2999. list[k].UpdateTime = utils.TimeRemoveHms(mapUPdateTime[v.IndustrialManagementId])
  3000. if user.UserId > 0 {
  3001. //如果文章没有阅读,而且,文章的发布时间晚于项目的上线时间,而且文章的发布时间晚于用户的注册时间,就进行标红处理
  3002. if mapHistroyindustrialId[v.IndustrialManagementId] == 0 || timeLineRedMap[v.IndustrialManagementId] {
  3003. if user.CreatedTime.Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
  3004. list[k].IsRed = true
  3005. }
  3006. }
  3007. } else {
  3008. if utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
  3009. list[k].IsRed = true
  3010. }
  3011. list[k].IsFollow = 0
  3012. }
  3013. }
  3014. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  3015. }
  3016. for k, v := range listYxResource {
  3017. // 关联报告发布时间均在3个月内则标记New
  3018. if v.MinReportTime != "" {
  3019. t, e := time.Parse(utils.FormatDateTime, v.MinReportTime)
  3020. if e != nil {
  3021. err = errors.New("报告最早发布时间有误,GetindustryVideo " + e.Error())
  3022. return
  3023. }
  3024. if t.After(threeMonBefore) {
  3025. listYxResource[k].IsNew = true
  3026. }
  3027. }
  3028. if mapHot[v.IndustryName] > 0 {
  3029. listYxResource[k].IsHot = true
  3030. }
  3031. listYxResource[k].Source = 2
  3032. if fllowMap[v.IndustrialManagementId] > 0 {
  3033. listYxResource[k].IsFollw = true
  3034. }
  3035. industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
  3036. }
  3037. if len(industrialIdArr) > 0 {
  3038. //查询产业视频
  3039. industrialVideoMap := make(map[int]*models.MicroVideoSimpleInfo)
  3040. // 获取默认图配置
  3041. _, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
  3042. if e != nil {
  3043. br.Msg = "获取视频默认配置图失败"
  3044. br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
  3045. return
  3046. }
  3047. videoList, err := models.GetMicroRoadshowVideoByIndustryIds(industrialIdArr)
  3048. if err != nil {
  3049. br.Msg = "产业视频列表失败"
  3050. br.ErrMsg = "产业视频列表失败, Err: " + err.Error()
  3051. return
  3052. }
  3053. for _, v := range videoList {
  3054. tmp := &models.MicroVideoSimpleInfo{
  3055. Id: v.VideoId,
  3056. Title: "5min逻辑【" + v.IndustryName + "】解析",
  3057. ResourceUrl: v.VideoUrl,
  3058. BackgroundImg: v.ImgUrl,
  3059. PlaySeconds: v.VideoDuration,
  3060. DetailImgUrl: v.DetailImgUrl,
  3061. ChartPermissionName: v.ChartPermissionName,
  3062. ChartPermissionId: v.ChartPermissionId,
  3063. }
  3064. if tmp.BackgroundImg == "" {
  3065. tmp.BackgroundImg = videoMap[v.ChartPermissionId]
  3066. }
  3067. industrialVideoMap[v.IndustryId] = tmp
  3068. }
  3069. //查询权限
  3070. // 用户权限
  3071. authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
  3072. if e != nil {
  3073. br.Msg = "获取失败"
  3074. br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
  3075. return
  3076. }
  3077. for k, v := range listHzResource {
  3078. //展示产业视频
  3079. if video, ok := industrialVideoMap[v.IndustrialManagementId]; ok {
  3080. au := new(models.UserPermissionAuthInfo)
  3081. au.SellerName = authInfo.SellerName
  3082. au.SellerMobile = authInfo.SellerMobile
  3083. au.HasPermission = authInfo.HasPermission
  3084. au.OperationMode = authInfo.OperationMode
  3085. if au.HasPermission == 1 {
  3086. // 非宏观权限进一步判断是否有权限
  3087. if video.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, video.ChartPermissionName) {
  3088. au.HasPermission = 2
  3089. }
  3090. }
  3091. // 无权限的弹框提示
  3092. if au.HasPermission != 1 {
  3093. if au.OperationMode == services.UserPermissionOperationModeCall {
  3094. au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
  3095. } else {
  3096. au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
  3097. }
  3098. video.ResourceUrl = ""
  3099. }
  3100. listHzResource[k].AuthInfo = au
  3101. listHzResource[k].IndustryVideo = video
  3102. }
  3103. }
  3104. //合并产业关联的标的
  3105. listSubjcet, err = models.GetIndustrialSubjectAllByIndustrialId(industrialIdArr)
  3106. if err != nil {
  3107. br.Msg = "获取信息失败"
  3108. br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
  3109. return
  3110. }
  3111. //严选的产业只关联研选下面的标的
  3112. var yxcondition string
  3113. var yxPer []interface{}
  3114. yxcondition = ` AND ag.article_id >= ?`
  3115. yxPer = append(yxPer, utils.SummaryArticleId)
  3116. listYxAticleSubject, err := models.GetSubjectArticleGroupManagementList(yxcondition, yxPer)
  3117. if err != nil && err.Error() != utils.ErrNoRow() {
  3118. br.Msg = "获取信息失败"
  3119. br.ErrMsg = "获取研选报告关联的标的信息失败,GetSubjectArticleGroupManagementListErr:" + err.Error()
  3120. return
  3121. }
  3122. mapYxSubject := make(map[int]int)
  3123. for _, v := range listYxAticleSubject {
  3124. mapYxSubject[v.IndustrialSubjectId] = v.IndustrialSubjectId
  3125. }
  3126. mapIndustrial := make(map[string]int)
  3127. for _, v := range listSubjcet {
  3128. for k2, v2 := range listYxResource {
  3129. if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] == 0 && mapYxSubject[v.IndustrialSubjectId] > 0 {
  3130. listYxResource[k2].IndustrialSubjectList = append(listYxResource[k2].IndustrialSubjectList, v)
  3131. mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] = v2.IndustrialManagementId
  3132. }
  3133. }
  3134. for k2, v2 := range listHzResource {
  3135. if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] == 0 {
  3136. listHzResource[k2].IndustrialSubjectList = append(listHzResource[k2].IndustrialSubjectList, v)
  3137. mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] = v2.IndustrialManagementId
  3138. }
  3139. }
  3140. }
  3141. }
  3142. resp := new(models.SearchReportAndResourceResp)
  3143. if len(listYxResource) == 0 {
  3144. listYxResource = make([]*models.IndustrialManagementHotResp, 0)
  3145. }
  3146. if len(listHzResource) == 0 {
  3147. listHzResource = make([]*models.IndustrialManagementHotResp, 0)
  3148. }
  3149. if keyWord != "" {
  3150. keyWordItem := new(models.CygxUserSearchKeyWord)
  3151. keyWordItem.UserId = user.UserId
  3152. keyWordItem.KeyWord = keyWord
  3153. keyWordItem.PageType = "ReortSearch"
  3154. keyWordItem.CreateTime = time.Now()
  3155. go models.AddUserSearchKeyWord(keyWordItem)
  3156. //go services.AddUserSearchLog(user, keyWord, 5)
  3157. }
  3158. resp.ListHzResource = listHzResource
  3159. resp.ListYxResource = listYxResource
  3160. resp.ListYxReport = ListYxReport
  3161. resp.ListHzReport = ListHzReport
  3162. br.Ret = 200
  3163. br.Success = true
  3164. br.Msg = "获取成功"
  3165. br.Data = resp
  3166. }
  3167. // @Title 产业报告公司列表
  3168. // @Description 获取产业报告公司列表接口
  3169. // @Param ChartPermissionId query int true "行业id"
  3170. // @Success 200 {object} models.IndustrialManagementList
  3171. // @router /home/stockName [get]
  3172. func (this *ReportController) StockNameList() {
  3173. br := new(models.BaseResponse).Init()
  3174. defer func() {
  3175. this.Data["json"] = br
  3176. this.ServeJSON()
  3177. }()
  3178. user := this.User
  3179. if user == nil {
  3180. br.Msg = "请重新登录"
  3181. br.Ret = 408
  3182. return
  3183. }
  3184. //uid := user.UserId
  3185. chartPermissionId, _ := this.GetInt("ChartPermissionId")
  3186. list, err := models.GetSummaryArticle(chartPermissionId)
  3187. if err != nil {
  3188. br.Msg = "获取综述报告公司名称失败"
  3189. br.ErrMsg = "获取综述报告公司名称失败,Err:" + err.Error()
  3190. return
  3191. }
  3192. var respList []*models.SummaryArticleStock
  3193. for _, item := range list {
  3194. sliceSubjects := strings.Split(item.Stock, "/")
  3195. if len(sliceSubjects) > 0 {
  3196. for i, vSubject := range sliceSubjects {
  3197. sliceKuohao := strings.Split(vSubject, "(") //过滤括号
  3198. sliceXiahuaxian := strings.Split(sliceKuohao[0], "-") //过滤下划线
  3199. subject := sliceXiahuaxian[0]
  3200. if i > 0 {
  3201. newItem := models.SummaryArticleStock{
  3202. Id: item.Id,
  3203. ArticleId: item.ArticleId,
  3204. Stock: subject,
  3205. }
  3206. respList = append(respList, &newItem)
  3207. } else {
  3208. item.Stock = subject
  3209. respList = append(respList, item)
  3210. }
  3211. }
  3212. }
  3213. //index := strings.Index(item.Stock, "(")
  3214. //item.Stock = item.Stock[:index]
  3215. //if strings.Contains(item.Stock, "-B"){
  3216. // item.Stock = strings.Replace(item.Stock, "-B", "", -1)
  3217. //}
  3218. //if strings.Contains(item.Stock, "-W"){
  3219. // item.Stock = strings.Replace(item.Stock, "-W", "", -1)
  3220. //}
  3221. }
  3222. resp := new(models.SummaryArticleStockResp)
  3223. resp.List = respList
  3224. br.Ret = 200
  3225. br.Success = true
  3226. br.Msg = "获取成功"
  3227. br.Data = resp
  3228. }
  3229. // @Title 文章留言接口
  3230. // @Description 文章留言接口
  3231. // @Param request body models.AddCygxActivityHelpAsk true "type json string"
  3232. // @Success 200 {object} models.TacticsListResp
  3233. // @router /commentAdd [post]
  3234. func (this *ReportController) CommentAdd() {
  3235. br := new(models.BaseResponse).Init()
  3236. defer func() {
  3237. this.Data["json"] = br
  3238. this.ServeJSON()
  3239. }()
  3240. user := this.User
  3241. if user == nil {
  3242. br.Msg = "请重新登录"
  3243. br.Ret = 408
  3244. return
  3245. }
  3246. var req models.AddCygxArticleCommentReq
  3247. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  3248. if err != nil {
  3249. br.Msg = "参数解析异常!"
  3250. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  3251. return
  3252. }
  3253. if req.ArticleId <= 0 {
  3254. br.Msg = "文章不存在"
  3255. br.ErrMsg = "文章不存在,文章ID错误"
  3256. return
  3257. }
  3258. if req.Content == "" {
  3259. br.Msg = "建议内容不可为空"
  3260. return
  3261. }
  3262. content := req.Content
  3263. itemToken, err := services.WxGetToken()
  3264. if err != nil {
  3265. br.Msg = "GetWxAccessToken Err:" + err.Error()
  3266. return
  3267. }
  3268. if itemToken.AccessToken == "" {
  3269. br.Msg = "accessToken is empty"
  3270. return
  3271. }
  3272. commerr, err := weapp.MSGSecCheck(itemToken.AccessToken, content)
  3273. if err != nil {
  3274. br.Msg = "内容校验失败!"
  3275. br.ErrMsg = "内容校验失败,Err:" + err.Error()
  3276. return
  3277. }
  3278. if commerr.ErrCode != 0 {
  3279. br.Msg = "内容违规,请重新提交!"
  3280. br.ErrMsg = "内容违规,Err:" + commerr.ErrMSG
  3281. return
  3282. }
  3283. articleId := req.ArticleId
  3284. articleInfo, errInfo := models.GetArticleDetailById(articleId)
  3285. if articleInfo == nil {
  3286. br.Msg = "操作失败"
  3287. br.ErrMsg = "文章ID错误,不存在articleId:" + strconv.Itoa(articleId)
  3288. return
  3289. }
  3290. if errInfo != nil {
  3291. br.Msg = "操作失败"
  3292. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  3293. return
  3294. }
  3295. companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
  3296. if err != nil {
  3297. br.Msg = "提交失败!"
  3298. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  3299. return
  3300. }
  3301. if companyDetail == nil {
  3302. br.Msg = "提交失败!"
  3303. br.ErrMsg = "客户不存在,uid:" + strconv.Itoa(user.UserId)
  3304. return
  3305. }
  3306. item := models.CygxArticleComment{
  3307. UserId: user.UserId,
  3308. ArticleId: req.ArticleId,
  3309. CreateTime: time.Now(),
  3310. Mobile: user.Mobile,
  3311. Email: user.Email,
  3312. CompanyId: user.CompanyId,
  3313. CompanyName: companyDetail.CompanyName,
  3314. Content: content,
  3315. Title: articleInfo.Title,
  3316. }
  3317. _, err = models.AddArticleComment(&item)
  3318. if err != nil {
  3319. br.Msg = "提交失败"
  3320. br.ErrMsg = "提交留言失败,Err:" + err.Error()
  3321. return
  3322. }
  3323. //获取销售信息
  3324. //sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  3325. //if err != nil && err.Error() != utils.ErrNoRow() {
  3326. // br.Msg = "提交失败"
  3327. // br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  3328. // return
  3329. //}
  3330. //// 给所属销售发送消息
  3331. //var openIdList []*models.OpenIdList
  3332. //if sellerItem != nil {
  3333. // list, _ := models.GetWxOpenIdByMobileList(sellerItem.Mobile)
  3334. // for _, idList := range list {
  3335. // openIdList = append(openIdList, idList)
  3336. // }
  3337. // if openIdList != nil {
  3338. // // 给芳姐发消息
  3339. // cnf, _ := models.GetConfigByCode("tpl_msg")
  3340. // if cnf != nil {
  3341. // list, _ := models.GetWxOpenIdByMobileList(cnf.ConfigValue)
  3342. // for _, idList := range list {
  3343. // openIdList = append(openIdList, idList)
  3344. // }
  3345. // }
  3346. // if articleId > 1000000 {
  3347. // //发给汪洋
  3348. // list, _ := models.GetWxOpenIdByMobileList(utils.ActSendMsgMobile)
  3349. // for _, idList := range list {
  3350. // openIdList = append(openIdList, idList)
  3351. // }
  3352. // }
  3353. // services.SendCommentWxTemplateMsg(articleInfo.Title, user.CompanyName, user.RealName, sellerItem.RealName, item.CreateTime.Format(utils.FormatDateTime), req.Content, openIdList, req.ArticleId)
  3354. // }
  3355. //}
  3356. services.SendCommentWxTemplateMsg(req, user, articleInfo)
  3357. br.Ret = 200
  3358. br.Success = true
  3359. br.Msg = "提交成功"
  3360. }
  3361. // @Title 记录用户浏览音频回放接口
  3362. // @Description 记录用户浏览音频回放接口
  3363. // @Param request body models.ArticleIdReq true "type json string"
  3364. // @Success Ret=200 操作成功
  3365. // @router /voiceHistory/add [post]
  3366. func (this *ReportController) ResearchSummaryVoiceHistoryAdd() {
  3367. br := new(models.BaseResponse).Init()
  3368. defer func() {
  3369. this.Data["json"] = br
  3370. this.ServeJSON()
  3371. }()
  3372. user := this.User
  3373. if user == nil {
  3374. br.Msg = "请登录"
  3375. br.ErrMsg = "请登录,用户信息为空"
  3376. br.Ret = 408
  3377. return
  3378. }
  3379. uid := user.UserId
  3380. var req models.ArticleIdReq
  3381. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  3382. if err != nil {
  3383. br.Msg = "参数解析异常!"
  3384. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  3385. return
  3386. }
  3387. articleId := req.ArticleId
  3388. playSeconds := req.PlaySeconds
  3389. pageRouter := req.PageRouter
  3390. if pageRouter == "本周研究汇总" {
  3391. articleInfo, errInfo := models.GetCygxResearchSummaryInfoById(articleId)
  3392. if articleInfo == nil {
  3393. br.Msg = "操作失败"
  3394. br.ErrMsg = "文章ID错误,不存在articleId:" + strconv.Itoa(articleId)
  3395. return
  3396. }
  3397. if errInfo != nil {
  3398. br.Msg = "操作失败"
  3399. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  3400. return
  3401. }
  3402. var sellerName string
  3403. sellerName, err = models.GetCompanySellerName(user.CompanyId)
  3404. if err != nil {
  3405. br.Msg = "报名失败!"
  3406. br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
  3407. return
  3408. }
  3409. item := models.CygxResearchSummaryVoiceHistory{
  3410. ArticleId: articleId,
  3411. UserId: uid,
  3412. CreateTime: time.Now(),
  3413. Mobile: user.Mobile,
  3414. Email: user.Email,
  3415. CompanyId: user.CompanyId,
  3416. CompanyName: user.CompanyName,
  3417. RealName: user.RealName,
  3418. SellerName: sellerName,
  3419. PlaySeconds: strconv.Itoa(req.PlaySeconds),
  3420. ModifyTime: time.Now(),
  3421. }
  3422. if playSeconds != 0 {
  3423. lastItem, err := models.GetLastCygxResearchSummaryVoiceHistory(articleId, user.UserId)
  3424. if err != nil {
  3425. br.Msg = "操作失败"
  3426. br.ErrMsg = "操作失败,GetLastCygxResearchSummaryVoiceHistory Err:" + err.Error()
  3427. return
  3428. }
  3429. err = models.UpdateLastCygxResearchSummaryVoiceHistory(strconv.Itoa(req.PlaySeconds), lastItem.Id)
  3430. if err != nil {
  3431. br.Msg = "更新失败"
  3432. br.ErrMsg = "更新失败,UpdateLastCygxResearchSummaryVoiceHistory Err:" + err.Error()
  3433. return
  3434. }
  3435. } else {
  3436. err = models.AddCygxResearchSummaryVoiceHistory(&item)
  3437. if err != nil {
  3438. br.Msg = "操作失败"
  3439. br.ErrMsg = "操作失败,Err:" + err.Error()
  3440. return
  3441. }
  3442. err = models.UpdateResearchSummaryVoiceCounts(articleId)
  3443. if err != nil {
  3444. br.Msg = "更新失败"
  3445. br.ErrMsg = "更新失败,Err:" + err.Error()
  3446. return
  3447. }
  3448. }
  3449. } else if pageRouter == "上周纪要汇总" {
  3450. articleInfo, errInfo := models.GetCygxMinutesSummaryInfoById(articleId)
  3451. if articleInfo == nil {
  3452. br.Msg = "操作失败"
  3453. br.ErrMsg = "文章ID错误,不存在articleId:" + strconv.Itoa(articleId)
  3454. return
  3455. }
  3456. if errInfo != nil {
  3457. br.Msg = "操作失败"
  3458. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  3459. return
  3460. }
  3461. var sellerName string
  3462. sellerName, err = models.GetCompanySellerName(user.CompanyId)
  3463. if err != nil {
  3464. br.Msg = "报名失败!"
  3465. br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
  3466. return
  3467. }
  3468. item := models.CygxMinutesSummaryVoiceHistory{
  3469. ArticleId: articleId,
  3470. UserId: uid,
  3471. CreateTime: time.Now(),
  3472. Mobile: user.Mobile,
  3473. Email: user.Email,
  3474. CompanyId: user.CompanyId,
  3475. CompanyName: user.CompanyName,
  3476. RealName: user.RealName,
  3477. SellerName: sellerName,
  3478. PlaySeconds: strconv.Itoa(req.PlaySeconds),
  3479. ModifyTime: time.Now(),
  3480. }
  3481. if playSeconds != 0 {
  3482. lastItem, err := models.GetLastCygxMinutesSummaryVoiceHistory(articleId, user.UserId)
  3483. if err != nil {
  3484. br.Msg = "操作失败"
  3485. br.ErrMsg = "操作失败,GetLastCygxSummaryVoiceHistory Err:" + err.Error()
  3486. return
  3487. }
  3488. err = models.UpdateLastCygxMinutesSummaryVoiceHistory(strconv.Itoa(req.PlaySeconds), lastItem.Id)
  3489. if err != nil {
  3490. br.Msg = "更新失败"
  3491. br.ErrMsg = "更新失败,UpdateLastCygxSummaryVoiceHistory Err:" + err.Error()
  3492. return
  3493. }
  3494. } else {
  3495. err = models.AddCygxMinutesSummaryVoiceHistory(&item)
  3496. if err != nil {
  3497. br.Msg = "操作失败"
  3498. br.ErrMsg = "操作失败,Err:" + err.Error()
  3499. return
  3500. }
  3501. err = models.UpdateMinutesSummaryVoiceCounts(articleId)
  3502. if err != nil {
  3503. br.Msg = "更新失败"
  3504. br.ErrMsg = "更新失败,Err:" + err.Error()
  3505. return
  3506. }
  3507. }
  3508. } else if pageRouter == "报告精选" {
  3509. articleInfo, errInfo := models.GetCygxReportSelectionInfoById(articleId)
  3510. if articleInfo == nil {
  3511. br.Msg = "操作失败"
  3512. br.ErrMsg = "文章ID错误,不存在articleId:" + strconv.Itoa(articleId)
  3513. return
  3514. }
  3515. if errInfo != nil {
  3516. br.Msg = "操作失败"
  3517. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  3518. return
  3519. }
  3520. var sellerName string
  3521. sellerName, err = models.GetCompanySellerName(user.CompanyId)
  3522. if err != nil {
  3523. br.Msg = "报名失败!"
  3524. br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
  3525. return
  3526. }
  3527. item := models.CygxReportSelectionVoiceHistory{
  3528. ArticleId: articleId,
  3529. UserId: uid,
  3530. CreateTime: time.Now(),
  3531. Mobile: user.Mobile,
  3532. Email: user.Email,
  3533. CompanyId: user.CompanyId,
  3534. CompanyName: user.CompanyName,
  3535. RealName: user.RealName,
  3536. SellerName: sellerName,
  3537. PlaySeconds: strconv.Itoa(req.PlaySeconds),
  3538. ModifyTime: time.Now(),
  3539. }
  3540. if playSeconds != 0 {
  3541. lastItem, err := models.GetLastCygxReportSelectionVoiceHistory(articleId, user.UserId)
  3542. if err != nil {
  3543. br.Msg = "操作失败"
  3544. br.ErrMsg = "操作失败,GetLastCygxSummaryVoiceHistory Err:" + err.Error()
  3545. return
  3546. }
  3547. err = models.UpdateLastCygxReportSelectionVoiceHistory(strconv.Itoa(req.PlaySeconds), lastItem.Id)
  3548. if err != nil {
  3549. br.Msg = "更新失败"
  3550. br.ErrMsg = "更新失败,UpdateLastCygxSummaryVoiceHistory Err:" + err.Error()
  3551. return
  3552. }
  3553. } else {
  3554. err = models.AddCygxReportSelectionVoiceHistory(&item)
  3555. if err != nil {
  3556. br.Msg = "操作失败"
  3557. br.ErrMsg = "操作失败,Err:" + err.Error()
  3558. return
  3559. }
  3560. err = models.UpdateReportSelectionVoiceCounts(articleId)
  3561. if err != nil {
  3562. br.Msg = "更新失败"
  3563. br.ErrMsg = "更新失败,Err:" + err.Error()
  3564. return
  3565. }
  3566. }
  3567. }
  3568. br.Ret = 200
  3569. br.Success = true
  3570. br.Msg = "操作成功"
  3571. return
  3572. }