report.go 116 KB

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