report.go 116 KB

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