activity.go 135 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "hongze/hongze_cygx/models"
  6. "hongze/hongze_cygx/services"
  7. "hongze/hongze_cygx/utils"
  8. "sort"
  9. "strconv"
  10. "strings"
  11. "time"
  12. "github.com/medivhzhan/weapp/v2"
  13. "github.com/rdlucklib/rdluck_tools/paging"
  14. )
  15. // 活动
  16. type ActivityCoAntroller struct {
  17. BaseAuthController
  18. }
  19. type ActivityABaseController struct {
  20. BaseCommonController
  21. }
  22. type ActivityNoLoginController struct {
  23. BaseAuthMobileController
  24. }
  25. // @Title 活动类型列表
  26. // @Description活动类型列表接口
  27. // @Param IsResearch query bool true "是否为研选"
  28. // @Success 200 {object} models.ActivityTypeListResp
  29. // @router /activityTypelist [get]
  30. func (this *ActivityCoAntroller) List() {
  31. br := new(models.BaseResponse).Init()
  32. defer func() {
  33. this.Data["json"] = br
  34. this.ServeJSON()
  35. }()
  36. user := this.User
  37. if user == nil {
  38. br.Msg = "请登录"
  39. br.ErrMsg = "请登录,SysUser Is Empty"
  40. br.Ret = 408
  41. return
  42. }
  43. resp := new(models.ActivityTypeListResp)
  44. isResearch, _ := this.GetBool("IsResearch", false)
  45. var condition string
  46. //是否仅展示研选下的活动类型
  47. if isResearch {
  48. condition = " AND source_type IN (0,2) "
  49. }
  50. list, err := models.GetActivityTypeList(condition)
  51. if err != nil {
  52. br.Msg = "获取失败"
  53. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  54. return
  55. }
  56. resp.List = list
  57. br.Ret = 200
  58. br.Success = true
  59. br.Msg = "获取成功"
  60. br.Data = resp
  61. }
  62. // @Title 我的日程
  63. // @Description 我的日程列表接口
  64. // @Param PageSize query int true "每页数据条数"
  65. // @Param CurrentIndex query int true "当前页页码,从1开始"
  66. // @Param Source query int false "来源 0:手机 ,1:Pc 默认0"
  67. // @Success 200 {object} models.GetCygxActivityListRep
  68. // @router /scheduleList [get]
  69. func (this *ActivityCoAntroller) ScheduleList() {
  70. br := new(models.BaseResponse).Init()
  71. defer func() {
  72. this.Data["json"] = br
  73. this.ServeJSON()
  74. }()
  75. user := this.User
  76. if user == nil {
  77. br.Msg = "请登录"
  78. br.ErrMsg = "请登录,SysUser Is Empty"
  79. return
  80. }
  81. uid := user.UserId
  82. pageSize, _ := this.GetInt("PageSize")
  83. currentIndex, _ := this.GetInt("CurrentIndex")
  84. source, _ := this.GetInt("Source")
  85. var startSize int
  86. if pageSize <= 0 {
  87. pageSize = utils.PageSize20
  88. }
  89. if currentIndex <= 0 {
  90. currentIndex = 1
  91. }
  92. startSize = utils.StartIndex(currentIndex, pageSize)
  93. var condition string
  94. var conditionCount string
  95. var pars []interface{}
  96. condition += ` AND art.publish_status = 1 `
  97. if source == 1 {
  98. condition += ` AND art.yidong_activity_id = '' `
  99. conditionCount += ` AND art.yidong_activity_id = '' `
  100. }
  101. total, err := models.GetScheduleCount(conditionCount, uid)
  102. specialtotal, err := models.GetSpecialScheduleCount(uid)
  103. page := paging.GetPaging(currentIndex, pageSize, total+specialtotal)
  104. if err != nil {
  105. br.Msg = "获取失败"
  106. br.ErrMsg = "获取失败,Err:" + err.Error()
  107. return
  108. }
  109. conditionCount = ` AND art.active_state = 2 `
  110. totalCount, err := models.GetScheduleCount(conditionCount, uid) //获取正在进行中的活动数量
  111. if err != nil {
  112. br.Msg = "获取失败"
  113. br.ErrMsg = "获取失败,Err:" + err.Error()
  114. return
  115. }
  116. var list []*models.ActivityDetail
  117. //全部都是进行中的活动
  118. if totalCount > currentIndex*pageSize {
  119. condition += ` AND art.active_state IN(2) `
  120. if source == 1 {
  121. condition += ` AND art.yidong_activity_id = '' `
  122. }
  123. listHave, errList := models.GetScheduleList(condition, pars, uid, startSize, pageSize)
  124. list = listHave
  125. if errList != nil {
  126. br.Msg = "获取失败"
  127. br.ErrMsg = "获取失败,Err:" + errList.Error()
  128. return
  129. }
  130. } else if totalCount > currentIndex-1*pageSize && totalCount < currentIndex*pageSize { //部分是进行中的活动
  131. condition = ` AND art.publish_status = 1 AND art.active_state IN(2) `
  132. if source == 1 {
  133. condition += ` AND art.yidong_activity_id = '' `
  134. }
  135. listHave, errList := models.GetScheduleList(condition, pars, uid, startSize, pageSize)
  136. list = listHave
  137. if errList != nil {
  138. br.Msg = "获取失败"
  139. br.ErrMsg = "获取失败,Err:" + errList.Error()
  140. return
  141. }
  142. pageSize = pageSize - len(listHave)
  143. condition = ` AND art.publish_status = 1 AND art.active_state IN(1,3) `
  144. if source == 1 {
  145. condition += ` AND art.yidong_activity_id = '' `
  146. }
  147. //listOther, errList := models.GetScheduleList(condition, pars, uid, startSize, pageSize)
  148. listOther, errList := services.GetScheduleAndSpecilList(user, condition, startSize, pageSize)
  149. if errList != nil {
  150. br.Msg = "获取失败"
  151. br.ErrMsg = "获取失败,Err:" + errList.Error()
  152. return
  153. }
  154. if len(listOther) > 0 {
  155. for _, v := range listOther {
  156. list = append(list, v)
  157. }
  158. }
  159. } else {
  160. condition += ` AND art.active_state IN(1,3)` //全部都不是进行中的活动
  161. //listOther, errList := models.GetScheduleList(condition, pars, uid, startSize, pageSize)
  162. listOther, errList := services.GetScheduleAndSpecilList(user, condition, startSize, pageSize)
  163. list = listOther
  164. if errList != nil {
  165. br.Msg = "获取失败"
  166. br.ErrMsg = "获取失败,Err:" + errList.Error()
  167. return
  168. }
  169. }
  170. var isShow bool
  171. isShow = services.GetShowSustainable()
  172. detail, err := models.GetConfigByCode("city_img_url")
  173. if err != nil {
  174. br.Msg = "获取数据失败"
  175. br.ErrMsg = "城市配置信息失败,Err:" + err.Error()
  176. return
  177. }
  178. detailChart, err := models.GetConfigByCode("chart_img_url")
  179. if err != nil {
  180. br.Msg = "获取数据失败"
  181. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  182. return
  183. }
  184. addressList := strings.Split(detail.ConfigValue, "{|}")
  185. mapAddress := make(map[string]string)
  186. chartList := strings.Split(detailChart.ConfigValue, "{|}")
  187. mapChart := make(map[string]string)
  188. var cityName string
  189. var chartName string
  190. var imgUrl string
  191. var imgUrlChart string
  192. var mapActivityId []int
  193. for _, v := range addressList {
  194. vslice := strings.Split(v, "_")
  195. cityName = vslice[0]
  196. imgUrl = vslice[len(vslice)-1]
  197. mapAddress[cityName] = imgUrl
  198. }
  199. for _, v := range chartList {
  200. vslice := strings.Split(v, "_")
  201. chartName = vslice[0]
  202. imgUrlChart = vslice[len(vslice)-1]
  203. mapChart[chartName] = imgUrlChart
  204. }
  205. for k, v := range list {
  206. if strings.Contains(v.ActivityName, "【") {
  207. list[k].IsBrackets = 1
  208. }
  209. if v.SignupNum > v.LimitPeopleNum {
  210. list[k].SignupNum = v.LimitPeopleNum
  211. }
  212. //是否展示限免标签
  213. if isShow && strings.Contains(v.ChartPermissionName, "研选") {
  214. list[k].IsShowSustainable = true
  215. }
  216. if strings.Contains(v.ChartPermissionName, "研选") && v.ActivityTypeId == 1 {
  217. //list[k].ActivityTypeName = "买方研选电话会"
  218. list[k].ImgUrlText = utils.YAN_XUAN_IMG
  219. }
  220. if v.ActivityType == 0 {
  221. if mapAddress[v.City] != "" {
  222. list[k].ImgUrl = mapAddress[v.City]
  223. } else {
  224. list[k].ImgUrl = mapAddress["其它"]
  225. }
  226. } else {
  227. if mapChart[v.ChartPermissionName] != "" {
  228. list[k].ImgUrl = mapChart[v.ChartPermissionName]
  229. }
  230. }
  231. expertTxt, _ := services.GetReportContentTextSub(v.Expert)
  232. list[k].Expert = expertTxt
  233. if v.IsHideAppointment == 0 {
  234. list[k].IsShowAppointment = services.IsShowAppointment(v.ActivityTypeId, v.ChartPermissionName)
  235. }
  236. if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
  237. list[k].IsCClassMeeting = true
  238. }
  239. mapActivityId = append(mapActivityId, v.ActivityId)
  240. }
  241. //添加我的日程访问记录
  242. //item := new(models.CygxPageHistoryRecord)
  243. //item.UserId = user.UserId
  244. //item.CreateTime = time.Now()
  245. //item.Mobile = user.Mobile
  246. //item.Email = user.Email
  247. //item.CompanyId = user.CompanyId
  248. //item.CompanyName = user.CompanyName
  249. //item.PageType = "MySchedule"
  250. //go models.AddCygxPageHistoryRecord(item)
  251. resp := new(models.GetCygxActivityListRep)
  252. //处理音频回放
  253. mapActivityVoice, err := services.GetActivityVoiceResp(mapActivityId)
  254. if err != nil {
  255. br.Msg = "获取信息失败"
  256. br.ErrMsg = "GetActivityVoiceResp,Err:" + err.Error()
  257. return
  258. }
  259. //处理视频回放
  260. mapActivityVideo, err := services.GetActivityVideoResp(mapActivityId)
  261. if err != nil {
  262. br.Msg = "获取信息失败"
  263. br.ErrMsg = "GetActivityVideoResp,Err:" + err.Error()
  264. return
  265. }
  266. //处理不同的报名方式按钮回显
  267. mapActivitySignup, err := services.GetActivitySignupResp(mapActivityId, user)
  268. if err != nil {
  269. br.Msg = "获取信息失败"
  270. br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
  271. return
  272. }
  273. for k, v := range list {
  274. if mapActivityVoice[v.ActivityId] != nil {
  275. list[k].FileType = 1
  276. list[k].AudioLink = true
  277. list[k].VoiceList = mapActivityVoice[v.ActivityId]
  278. }
  279. if mapActivityVideo[v.ActivityId] != nil {
  280. list[k].FileType = 2
  281. list[k].AudioLink = true
  282. list[k].VideoDetail = mapActivityVideo[v.ActivityId]
  283. }
  284. v.SignupType = mapActivitySignup[v.ActivityId]
  285. //处理列表的标签是否展示逻辑
  286. resp.List = append(resp.List, services.ActivityButtonShow(v))
  287. }
  288. resp.Paging = page
  289. br.Ret = 200
  290. br.Success = true
  291. br.Msg = "获取成功"
  292. br.Data = resp
  293. }
  294. // @Title 活动详情
  295. // @Description 获取活动详情接口
  296. // @Param ActivityId query int true "活动ID"
  297. // @Param IsSendWx query int false "是否是通过微信模版进来的 1是,其它否"
  298. // @Success Ret=200 {object} models.CygxActivityResp
  299. // @router /detail [get]
  300. func (this *ActivityCoAntroller) Detail() {
  301. br := new(models.BaseResponse).Init()
  302. defer func() {
  303. this.Data["json"] = br
  304. this.ServeJSON()
  305. }()
  306. user := this.User
  307. if user == nil {
  308. br.Msg = "请登录"
  309. br.ErrMsg = "请登录,用户信息为空"
  310. br.Ret = 408
  311. return
  312. }
  313. uid := user.UserId
  314. activityId, _ := this.GetInt("ActivityId")
  315. isSendWx, _ := this.GetInt("IsSendWx")
  316. if activityId < 1 {
  317. br.Msg = "请输入活动ID"
  318. return
  319. }
  320. resp := new(models.CygxActivityResp)
  321. activityInfo, err := models.GetAddActivityInfoByIdShow(uid, activityId)
  322. if err != nil && err.Error() != utils.ErrNoRow() {
  323. br.Msg = "获取信息失败"
  324. br.ErrMsg = "获取活动详情信息失败,Err:" + err.Error()
  325. return
  326. }
  327. if activityInfo == nil {
  328. br.Msg = "活动不存在"
  329. br.ErrMsg = "活动ID错误,Err:" + "activityId:" + strconv.Itoa(activityId)
  330. return
  331. }
  332. // 判断是否属于研选类型的活动
  333. if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  334. resp.IsResearch = true
  335. }
  336. signupCount, err := models.GetActivitySignupSuccessByUserCountNoHz(activityId)
  337. if err != nil {
  338. br.Msg = "获取信息"
  339. br.ErrMsg = "GetActivitySignupSuccessByUserCountNoHz,Err:" + err.Error()
  340. return
  341. }
  342. activityInfo.SignupNum = signupCount
  343. havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
  344. if err != nil {
  345. br.Msg = "获取信息失败"
  346. br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
  347. return
  348. }
  349. resp.IsResearchSpecial = isResearchSpecial
  350. if havePower {
  351. //是否展示限免标签
  352. if services.GetShowSustainable() && strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  353. activityInfo.IsShowSustainable = true
  354. }
  355. resp.HasPermission = 1
  356. configCode := "description_of_research"
  357. detail, err := models.GetConfigByCode(configCode)
  358. if err != nil {
  359. br.Msg = "获取数据失败"
  360. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  361. return
  362. }
  363. activityInfo.Description = detail.ConfigValue
  364. if activityInfo.SignupNum > activityInfo.LimitPeopleNum {
  365. activityInfo.SignupNum = activityInfo.LimitPeopleNum
  366. }
  367. if activityInfo.ChartPermissionNames != "" {
  368. activityInfo.ChartPermissionName = activityInfo.ChartPermissionNames
  369. }
  370. if activityInfo.IsHideAppointment == 0 {
  371. activityInfo.IsShowAppointment = services.IsShowAppointment(activityInfo.ActivityTypeId, activityInfo.ChartPermissionName)
  372. }
  373. activityInfo.ActivityTypeName = strings.Replace(activityInfo.ActivityTypeName, "(C类)", "", -1)
  374. //处理活动关联的产业
  375. industrialList, err := models.GetIndustrialActivityGroupManagementList(activityId)
  376. if err != nil && err.Error() != utils.ErrNoRow() {
  377. br.Msg = "获取信息失败"
  378. br.ErrMsg = "获取活动关联的产业列表信息失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  379. return
  380. }
  381. if activityInfo.TemporaryLabel != "" {
  382. industrialList = make([]*models.IndustrialManagementRep, 0)
  383. item := new(models.IndustrialManagementRep)
  384. item.IndustryName = activityInfo.Label
  385. industrialList = append(industrialList, item)
  386. } else {
  387. industryIds := make([]int, 0)
  388. var industrialManagementId string
  389. for k, v := range industrialList {
  390. if v.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
  391. industrialList[k].IsResearch = true
  392. }
  393. industryIds = append(industryIds, v.IndustrialManagementId)
  394. industrialManagementId += strconv.Itoa(v.IndustrialManagementId) + ","
  395. }
  396. // 查研观向7.4-行业新标签
  397. industryNewMap, e := services.GetIndustryNewLabelMap(industryIds)
  398. if e != nil {
  399. br.Msg = "获取信息失败"
  400. br.ErrMsg = "获取产业新标签失败, Err: " + e.Error()
  401. return
  402. }
  403. //判断产业下是否有关联的报告,并处理是否跳转
  404. industrialManagementId = strings.TrimRight(industrialManagementId, ",")
  405. if industrialManagementId != "" {
  406. var condition string
  407. condition = ` AND m.industrial_management_id IN (` + industrialManagementId + `)`
  408. condition += ` AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId)
  409. listIndustrialGrop, err := models.GetSearchResourceList(user.UserId, condition, 0, 0)
  410. if err != nil && err.Error() != utils.ErrNoRow() {
  411. br.Msg = "获取信息失败"
  412. br.ErrMsg = "GetSearchResourceList,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  413. return
  414. }
  415. mapIndustrial := make(map[int]int)
  416. if len(listIndustrialGrop) > 0 {
  417. for _, v := range listIndustrialGrop {
  418. mapIndustrial[v.IndustrialManagementId] = v.IndustrialManagementId
  419. }
  420. }
  421. for k, v := range industrialList {
  422. if mapIndustrial[v.IndustrialManagementId] > 0 && !industrialList[k].IsResearch {
  423. industrialList[k].IsJump = true
  424. }
  425. //非买方研选下的才展示New标签
  426. if activityInfo.ChartPermissionId != utils.CHART_PERMISSION_ID_YANXUAN {
  427. industrialList[k].IndustryNewLabel = industryNewMap[v.IndustrialManagementId]
  428. }
  429. }
  430. }
  431. }
  432. activityInfo.Listndustrial = industrialList
  433. if activityInfo.YidongActivityId != "" {
  434. ydTgc, _ := services.GetYiDongCreateUserInfo(user)
  435. yidongLongLink, err := services.GetYiDongOriginalLink(activityInfo)
  436. if err != nil {
  437. br.Msg = "获取信息失败"
  438. br.ErrMsg = "GetYiDongOriginalLink,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  439. return
  440. }
  441. //yidongKwy := activityInfo.YidongActivityUrl
  442. //activityInfo.YidongActivityUrl = yidongLongLink + "?source=11&fromHz=true&tgc=" + ydTgc
  443. activityInfo.YidongActivityUrl = yidongLongLink + "%26source=11%26fromHz=true%26tgc=" + ydTgc
  444. }
  445. //处理音频回放
  446. var mapActivityId []int
  447. mapActivityId = append(mapActivityId, activityId)
  448. if activityInfo.ChartPermissionId != utils.CHART_PERMISSION_ID_YANXUAN { // 研选的音视频不在查研展示
  449. mapActivityVoice, err := services.GetActivityVoiceResp(mapActivityId)
  450. if err != nil {
  451. br.Msg = "获取信息失败"
  452. br.ErrMsg = "GetActivityVoiceResp,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  453. return
  454. }
  455. if mapActivityVoice[activityId] != nil {
  456. activityInfo.FileType = 1
  457. activityInfo.AudioLink = true
  458. activityInfo.VoiceList = mapActivityVoice[activityId]
  459. }
  460. //处理视频回放
  461. mapActivityVideo, err := services.GetActivityVideoResp(mapActivityId)
  462. if err != nil {
  463. br.Msg = "获取信息失败"
  464. br.ErrMsg = "GetActivityVideoResp,Err:" + err.Error()
  465. return
  466. }
  467. if mapActivityVideo[activityId] != nil {
  468. activityInfo.FileType = 2
  469. activityInfo.AudioLink = true
  470. activityInfo.VideoDetail = mapActivityVideo[activityId]
  471. }
  472. }
  473. //8.5 小程序活动详情页 除专家电话外 其余属于新产业的活动 ,不显示 new 标签
  474. if activityInfo.ActivityTypeName != "专家电话会" {
  475. for _, rep := range activityInfo.Listndustrial {
  476. rep.IndustryNewLabel = false
  477. }
  478. }
  479. //8.5 买方研选的活动去掉限免标签
  480. if strings.Contains(activityInfo.ChartPermissionName, "研选") {
  481. activityInfo.IsShowSustainable = false
  482. }
  483. //处理不同的报名方式按钮回显
  484. mapActivitySignup, err := services.GetActivitySignupResp(mapActivityId, user)
  485. if err != nil {
  486. br.Msg = "获取信息失败"
  487. br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
  488. return
  489. }
  490. activityInfo.SignupType = mapActivitySignup[activityId]
  491. //处理活动关联的产业
  492. industrialListNew, err := models.GetIndustrialActivityGroupManagementList(activityId)
  493. if err != nil && err.Error() != utils.ErrNoRow() {
  494. br.Msg = "获取信息失败"
  495. br.ErrMsg = "获取活动关联的产业列表信息失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  496. return
  497. }
  498. //判断是不是通过微信模版推送消息进来的
  499. if isSendWx == 1 && len(industrialListNew) > 0 {
  500. industryUserFollowMap, err := services.GetIndustryUserFollowMap(user)
  501. if err != nil {
  502. br.Msg = "获取信息失败"
  503. br.ErrMsg = "GetIndustryUserFollowMap,Err:" + err.Error()
  504. return
  505. }
  506. for _, v := range industrialListNew {
  507. if industryUserFollowMap[v.IndustrialManagementId] {
  508. activityInfo.IsFollowButton = true
  509. }
  510. }
  511. activityInfo.IsShowFollowButton = true
  512. }
  513. if activityInfo.ReportLink != "" {
  514. artList, err := services.GetActivityReportLinkToArticleList(activityInfo)
  515. if err != nil && err.Error() != utils.ErrNoRow() {
  516. br.Msg = "获取信息失败"
  517. br.ErrMsg = "解析文章关联的报告内容失败:" + activityInfo.ReportLink
  518. return
  519. }
  520. activityInfo.ArticleList = artList
  521. } else {
  522. activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
  523. }
  524. if services.GetBelongingRai(user.Mobile) && activityInfo.SigninImg != "" {
  525. activityInfo.IsShowSigninButton = true
  526. activityInfo.IsShowSignUpDetail = true
  527. }
  528. //处理按钮是否展示问题
  529. //resp.Detail = services.ActivityButtonShow(activityInfo)
  530. } else {
  531. //用户未登录(绑定登录信息)的时候也能展示 v12.2.1
  532. if user.UserId == 0 {
  533. resp.HasPermission = 1
  534. //resp.Detail = services.ActivityButtonShow(activityInfo)
  535. } else {
  536. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
  537. if err != nil {
  538. br.Msg = "获取信息失败"
  539. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  540. return
  541. }
  542. resp.PopupMsg = popupMsg
  543. resp.HasPermission = hasPermission
  544. resp.SellerName = sellerName
  545. resp.SellerMobile = sellerMobile
  546. }
  547. }
  548. //处理按钮是否展示问题
  549. resp.Detail = services.ActivityButtonShow(activityInfo)
  550. collectCount1, err := models.GetActivityVoiceCollectCount(uid, activityId)
  551. if err != nil && err.Error() != utils.ErrNoRow() {
  552. br.Msg = "获取信息失败"
  553. br.ErrMsg = "判断是否已收藏失败,Err:" + strconv.Itoa(uid) + ";activityId" + strconv.Itoa(activityId)
  554. return
  555. }
  556. collectCount2, err := models.GetActivityVideoCollectCountByActivityId(uid, activityId)
  557. if err != nil && err.Error() != utils.ErrNoRow() {
  558. br.Msg = "获取信息失败"
  559. br.ErrMsg = "判断是否已收藏失败,Err:" + strconv.Itoa(uid) + ";activityId" + strconv.Itoa(activityId)
  560. return
  561. }
  562. if collectCount1+collectCount2 > 0 {
  563. resp.Detail.IsCollect = true
  564. }
  565. br.Ret = 200
  566. br.Success = true
  567. br.Msg = "获取成功"
  568. br.Data = resp
  569. }
  570. // @Title 活动报名
  571. // @Description 活动报名接口
  572. // @Param request body models.ActivitySingnupRep true "type json string"
  573. // @Success Ret=200 {object} models.SignupStatus
  574. // @router /signup/add [post]
  575. func (this *ActivityCoAntroller) SignupAdd() {
  576. br := new(models.BaseResponse).Init()
  577. defer func() {
  578. this.Data["json"] = br
  579. this.ServeJSON()
  580. }()
  581. user := this.User
  582. if user == nil {
  583. br.Msg = "请登录"
  584. br.ErrMsg = "请登录,用户信息为空"
  585. br.Ret = 408
  586. return
  587. }
  588. uid := user.UserId
  589. signupStatus := ""
  590. var req models.ActivitySingnupRep
  591. resp := new(models.SignupStatus)
  592. //var total int
  593. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  594. if err != nil {
  595. br.Msg = "参数解析异常!"
  596. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  597. return
  598. }
  599. if user.Mobile == "" {
  600. user.Mobile = user.OutboundMobile
  601. }
  602. activityId := req.ActivityId
  603. signupType := req.SignupType
  604. hasPermission := 0
  605. if signupType == 1 && user.Mobile == "" && user.OutboundMobile == "" {
  606. resp.GoBindEmail = true
  607. }
  608. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  609. if activityInfo == nil {
  610. br.Msg = "操作失败"
  611. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  612. return
  613. }
  614. if errInfo != nil {
  615. br.Msg = "操作失败"
  616. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  617. return
  618. }
  619. detailActivityType, err := models.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
  620. if err != nil {
  621. br.Msg = "获取信息失败"
  622. br.ErrMsg = "获取信息失败,GetActivityTypeDetailById Err:" + err.Error()
  623. return
  624. }
  625. // 如果是 易董办会 且没有勾选 可提供外呼 默认为自主入会
  626. if activityInfo.IsYidongConduct && activityInfo.IsCanOutboundCall == 0 {
  627. signupType = 4
  628. }
  629. item := new(models.CygxActivitySignup)
  630. // 判断是否属于研选类型的活动
  631. if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  632. resp.IsResearch = true
  633. }
  634. havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
  635. if err != nil {
  636. br.Msg = "获取信息失败"
  637. br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
  638. return
  639. }
  640. resp.IsResearchSpecial = isResearchSpecial
  641. if havePower {
  642. hasPermission = 1
  643. signupStatus = "Success"
  644. resp.HasPermission = hasPermission
  645. resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
  646. if time.Now().After(resultTime.Add(-time.Minute * 60)) {
  647. signupStatus = "Overtime"
  648. resp.SignupType = signupType
  649. resp.SignupStatus = signupStatus
  650. resp.HasPermission = hasPermission
  651. resp.PopupMsg = "活动开始前1小时内无法预约,请联系对口销售处理"
  652. br.Ret = 200
  653. br.Success = true
  654. br.Msg = ""
  655. br.Data = resp
  656. return
  657. }
  658. //限制人数为1人的专家电话会 用户操作时的消息提示
  659. if activityInfo.LimitPeopleNum == 1 && activityInfo.ActivityTypeId == 1 {
  660. resp.HasPermission = hasPermission
  661. resp.SignupStatus = utils.FULLSTARFFED_MSG
  662. resp.PopupMsg = utils.ACTIVITY_ZJDHH_V1_MSG
  663. br.Ret = 200
  664. br.Success = true
  665. br.Msg = ""
  666. br.Data = resp
  667. return
  668. }
  669. var sellerName string
  670. sellerName, err = models.GetCompanySellerName(user.CompanyId)
  671. if err != nil {
  672. br.Msg = "报名失败!"
  673. br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
  674. return
  675. }
  676. popupMsg, err := services.CheckActivityUserAll(activityInfo, user)
  677. if err != nil {
  678. br.Msg = "报名失败!"
  679. br.ErrMsg = "CheckActivityUserAll,Err:" + err.Error()
  680. return
  681. }
  682. if popupMsg != "" {
  683. br.Msg = popupMsg
  684. br.ErrMsg = fmt.Sprint("userId:", uid, "Activity:id", popupMsg)
  685. return
  686. }
  687. //人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
  688. //如果是下面几种情况则对报名信息做判断限制 (公司调研电话会(限制人数)、公司线下调研、专家/分析师线下沙龙)
  689. //if (activityInfo.ActivityTypeId == 3 && activityInfo.IsLimitPeople == 1) || activityInfo.ActivityTypeId > 3 {
  690. if activityInfo.IsLimitPeople == 1 {
  691. signupStatus, resp.PopupMsg, item.FailType, err = services.CheckActivitySignUpLimit(user, activityInfo)
  692. //判断优先级:总人数限制→单机构2人限制→爽约3次限制
  693. totalRestrict, err := models.GetUserRestrictCount(user.Mobile)
  694. if err != nil {
  695. br.Msg = "获取信息失败"
  696. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  697. return
  698. }
  699. totalUserRestrictCount, err := models.GetActivitySignupByUserRestrictCount(uid, activityId)
  700. if err != nil {
  701. br.Msg = "获取失败"
  702. br.ErrMsg = "获取失败,Err:" + err.Error()
  703. return
  704. }
  705. //解除报名限制之后二次报名相同活动
  706. if totalUserRestrictCount > 0 && totalRestrict == 0 && resp.GoBindEmail != true {
  707. item.UserId = uid
  708. item.RealName = user.RealName
  709. item.SellerName = sellerName
  710. item.ActivityId = activityId
  711. item.CreateTime = time.Now()
  712. item.Mobile = user.Mobile
  713. item.Email = user.Email
  714. item.CompanyId = user.CompanyId
  715. item.CompanyName = user.CompanyName
  716. item.SignupType = signupType
  717. item.FailType = 0
  718. item.DoFailType = 0
  719. _, errSignup := models.AddActivitySignupByRestrict(item)
  720. if errSignup != nil {
  721. br.Msg = "操作失败"
  722. br.ErrMsg = "操作失败,Err:" + errSignup.Error()
  723. return
  724. }
  725. resp.HaqveJurisdiction = true
  726. resp.SignupType = signupType
  727. resp.SignupStatus = "Success"
  728. resp.HasPermission = hasPermission
  729. resp.ActivityId = activityId
  730. br.Ret = 200
  731. br.Success = true
  732. br.Msg = "操作成功"
  733. br.Data = resp
  734. return
  735. }
  736. totalMy, err := models.GetActivitySignupByUserCount(uid, activityId)
  737. if err != nil {
  738. br.Msg = "获取失败"
  739. br.ErrMsg = "获取失败,Err:" + err.Error()
  740. return
  741. }
  742. if signupStatus != "Success" && totalMy == 0 && resp.GoBindEmail != true {
  743. item.UserId = uid
  744. item.RealName = user.RealName
  745. item.SellerName = sellerName
  746. item.ActivityId = activityId
  747. item.CreateTime = time.Now()
  748. item.Mobile = user.Mobile
  749. item.Email = user.Email
  750. item.CompanyId = user.CompanyId
  751. item.CompanyName = user.CompanyName
  752. item.SignupType = signupType
  753. item.DoFailType = item.FailType
  754. if user.OutboundMobile != "" {
  755. item.OutboundMobile = user.OutboundMobile
  756. if user.OutboundCountryCode == "" {
  757. item.CountryCode = "86"
  758. } else {
  759. item.CountryCode = user.OutboundCountryCode
  760. }
  761. } else {
  762. item.OutboundMobile = user.Mobile
  763. if user.CountryCode == "" {
  764. item.CountryCode = "86"
  765. } else {
  766. item.CountryCode = user.CountryCode
  767. }
  768. }
  769. //添加报名信息,但是不加入日程
  770. _, errSignup := models.AddActivitySignupNoSchedule(item)
  771. if errSignup != nil {
  772. br.Msg = "操作失败"
  773. br.ErrMsg = "操作失败,Err:" + errSignup.Error()
  774. return
  775. }
  776. }
  777. }
  778. totalMySuccess, err := models.GetActivitySignupCount(uid, activityId)
  779. if err != nil {
  780. br.Msg = "获取失败"
  781. br.ErrMsg = "获取失败,Err:" + err.Error()
  782. return
  783. }
  784. if totalMySuccess > 0 {
  785. br.Msg = "您已报名这个活动"
  786. return
  787. }
  788. if signupStatus == "Success" && resp.GoBindEmail != true {
  789. item.UserId = uid
  790. item.RealName = user.RealName
  791. item.SellerName = sellerName
  792. item.ActivityId = activityId
  793. item.CreateTime = time.Now()
  794. item.Mobile = user.Mobile
  795. item.Email = user.Email
  796. item.CompanyId = user.CompanyId
  797. item.CompanyName = user.CompanyName
  798. item.SignupType = signupType
  799. item.FailType = 0
  800. item.DoFailType = 0
  801. item.OutboundMobile = user.Mobile
  802. if user.OutboundMobile != "" {
  803. item.OutboundMobile = user.OutboundMobile
  804. if user.OutboundCountryCode == "" {
  805. item.CountryCode = "86"
  806. } else {
  807. item.CountryCode = user.OutboundCountryCode
  808. }
  809. } else {
  810. item.OutboundMobile = user.Mobile
  811. if user.CountryCode == "" {
  812. item.CountryCode = "86"
  813. } else {
  814. item.CountryCode = user.CountryCode
  815. }
  816. }
  817. _, errSignup := models.AddActivitySignup(item)
  818. if errSignup != nil {
  819. br.Msg = "操作失败"
  820. br.ErrMsg = "操作失败,Err:" + errSignup.Error()
  821. return
  822. }
  823. resp.HaqveJurisdiction = true
  824. //1:预约外呼 、2:设置会议提醒 、 3:预约纪要 、4:活动报名
  825. if signupType == 1 {
  826. go services.ActivityUserRemind(user, activityInfo, 1)
  827. //resp.PopupMsg = "<b>预约成功,已加入您的活动日程</b><br/><br/>想要及时获取活动信息变更通知,请关注【查研观向小助手】公众号"
  828. resp.PopupMsg = "<b>预约成功,已加入您的活动日程</b><br/><br/>是否将活动日程加入您的系统日历,\n\n活动开始前获取手机日历提醒?"
  829. } else if signupType == 4 {
  830. go services.ActivityUserRemind(user, activityInfo, 4)
  831. //resp.PopupMsg = "<b>报名成功,请复制腾讯会议号打开腾讯会议app参会</b><br/>想要及时获取活动信息变更通知,请关注【查研观向小助手】公众号"
  832. resp.PopupMsg = "<b>报名成功,请复制腾讯会议号打开腾讯会议app参会</b><br/>是否将活动日程加入您的系统日历,\n\n活动开始前获取手机日历提醒?"
  833. } else {
  834. go services.ActivityUserRemind(user, activityInfo, 4)
  835. //resp.PopupMsg = "<b>报名成功,已加入您的活动日程</b><br/>想要及时获取活动信息变更通知,请关注【查研观向小助手】公众号"
  836. resp.PopupMsg = "<b>报名成功,已加入您的活动日程</b><br/>是否将活动日程加入您的系统日历,\n\n活动开始前获取手机日历提醒?"
  837. }
  838. // 如果是买方研选下的专家沙龙,同时推给内容组四人
  839. if activityInfo.ActivityTypeId == 5 && activityInfo.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
  840. go services.SendNeiRongZuActivitieSignTemplateMsg(user, activityInfo)
  841. go services.SendNeiRongZuActivitieSignCategoryTemplateMsg(user, activityInfo)
  842. }
  843. go services.YanXuanActivityPointsBillSignupAdd(activityId, uid) // 用户报名添加到处理研选扣点
  844. }
  845. } else {
  846. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
  847. if err != nil {
  848. br.Msg = "获取信息失败"
  849. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  850. return
  851. }
  852. resp.PopupMsg = popupMsg
  853. resp.HasPermission = hasPermission
  854. resp.SellerName = sellerName
  855. resp.SellerMobile = sellerMobile
  856. }
  857. // 判断是否属于研选类型的活动
  858. if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  859. resp.IsResearch = true
  860. }
  861. //公司线下调研活动客户报名后给建会人,所属销售推送模板信息
  862. if signupStatus == "Success" {
  863. go services.SendResearchActivitiesTemplateMsg(user, activityInfo, "报名")
  864. }
  865. if signupType == 1 && user.IsMsgOutboundMobile == 0 {
  866. resp.GoOutboundMobile = true
  867. if user.Mobile != "" || user.OutboundMobile != "" {
  868. go models.ModifyWxUserIsMsgOutboundMobile(user.UserId)
  869. }
  870. }
  871. if user.OutboundMobile == "" {
  872. resp.Mobile = user.Mobile
  873. if user.CountryCode == "" && len(user.Mobile) == 11 {
  874. resp.CountryCode = "86"
  875. } else {
  876. resp.CountryCode = user.CountryCode
  877. }
  878. } else {
  879. resp.Mobile = user.OutboundMobile
  880. resp.CountryCode = user.OutboundCountryCode
  881. }
  882. //如果用户有绑定手机号,但是没有绑定外呼手机号
  883. if signupType == 1 && user.Mobile != "" && user.OutboundMobile == "" {
  884. var countryCode string
  885. if len(user.Mobile) == 8 {
  886. countryCode = "852"
  887. } else if len(user.Mobile) == 9 {
  888. countryCode = "886"
  889. } else if len(user.Mobile) == 10 {
  890. countryCode = "1"
  891. } else if len(user.Mobile) >= 11 {
  892. countryCode = "86"
  893. }
  894. models.BindUserOutboundMobileByMobile(user.Mobile, countryCode, uid)
  895. }
  896. resp.SignupType = signupType
  897. resp.SignupStatus = signupStatus
  898. //resp.HasPermission = hasPermission
  899. //if signupStatus == "Success" {
  900. resp.ActivityId = activityId
  901. resp.ActivityTypeName = activityInfo.ActivityName
  902. resp.ActivityTime = activityInfo.ActivityTime
  903. resp.ActivityType = detailActivityType.ActivityType
  904. //}
  905. //去关注12.6小程序添加日历 去关注公众号强制取消关注
  906. //total, err = models.GetUserSignupCount(user.UserId)
  907. //if err != nil {
  908. // br.Msg = "获取信息失败"
  909. // br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
  910. // return
  911. //}
  912. //if total <= 1 {
  913. // resp.GoFollow = true
  914. //}
  915. br.Ret = 200
  916. br.Success = true
  917. br.Msg = "操作成功"
  918. br.Data = resp
  919. }
  920. // @Title 活动取消报名
  921. // @Description 活动取消报名接口
  922. // @Param request body models.ActivitySingnupRep true "type json string"
  923. // @Success Ret=200 {object} models.SignupStatus
  924. // @router /signup/cancel [post]
  925. func (this *ActivityCoAntroller) SignupCancel() {
  926. br := new(models.BaseResponse).Init()
  927. defer func() {
  928. this.Data["json"] = br
  929. this.ServeJSON()
  930. }()
  931. user := this.User
  932. if user == nil {
  933. br.Msg = "请登录"
  934. br.ErrMsg = "请登录,用户信息为空"
  935. br.Ret = 408
  936. return
  937. }
  938. uid := user.UserId
  939. var req models.ActivitySingnupRep
  940. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  941. if err != nil {
  942. br.Msg = "参数解析异常!"
  943. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  944. return
  945. }
  946. activityId := req.ActivityId
  947. signupType := req.SignupType
  948. item := new(models.CygxActivitySignup)
  949. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  950. if activityInfo == nil {
  951. br.Msg = "操作失败"
  952. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  953. return
  954. }
  955. if errInfo != nil {
  956. br.Msg = "操作失败"
  957. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  958. return
  959. }
  960. cancelDeadlineMsg := services.CheckCancelDeadline(activityInfo)
  961. if cancelDeadlineMsg != "" {
  962. br.Msg = cancelDeadlineMsg
  963. br.ErrMsg = cancelDeadlineMsg
  964. return
  965. }
  966. resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
  967. if time.Now().After(resultTime.Add(-time.Minute * 60)) {
  968. if signupType == 1 {
  969. br.Msg = "活动开始前1小时内无法取消预约外呼,请联系对口销售处理"
  970. } else {
  971. br.Msg = "活动开始前1小时内无法取消报名,请联系对口销售处理"
  972. }
  973. return
  974. }
  975. total, err := models.GetActivitySignupCount(uid, activityId)
  976. if err != nil {
  977. br.Msg = "获取失败"
  978. br.ErrMsg = "获取失败,Err:" + err.Error()
  979. return
  980. }
  981. if total == 0 {
  982. br.Msg = "您暂未报名这个活动"
  983. return
  984. }
  985. item.UserId = uid
  986. item.ActivityId = activityId
  987. item.CreateTime = time.Now()
  988. item.Mobile = user.Mobile
  989. item.Email = user.Email
  990. item.CompanyId = user.CompanyId
  991. item.CompanyName = user.CompanyName
  992. resp := new(models.SignupStatus)
  993. resp.ActivityId = activityId
  994. _, errSignup := models.CancelActivitySignup(item)
  995. if errSignup != nil {
  996. br.Msg = "操作失败"
  997. br.ErrMsg = "操作失败,Err:" + errSignup.Error()
  998. return
  999. }
  1000. // 如果是买方研选下的专家沙龙,同时推给内容组四人
  1001. if activityInfo.ActivityTypeId == 5 {
  1002. go services.SendActivitieCancelSignTemplateMsg(user, activityInfo)
  1003. go services.SendActivitieCancelSignCategoryTemplateMsg(user, activityInfo)
  1004. }
  1005. go services.SendResearchActivitiesTemplateMsg(user, activityInfo, "取消报名") //公司线下调研活动客户报名后给建会人,所属销售推送模板信息
  1006. go services.YanXuanActivityPointsBillSignupCancel(activityId, uid) // 用户取消报名添加到处理研选扣点
  1007. br.Ret = 200
  1008. br.Success = true
  1009. br.Msg = "操作成功"
  1010. br.Data = resp
  1011. }
  1012. // @Title 用户搜索详情
  1013. // @Description 获取用户搜索详情接口
  1014. // @Param IsShowJurisdiction query int true "是否仅展示有权限的,默认为0,1是,2否 "
  1015. // @Param IsHideResearch query int true "是否隐藏研选行业 "
  1016. // @Success Ret=200 {object} models.ActivityUserSearchContentList
  1017. // @router /getUserSearchContent [get]
  1018. func (this *ActivityCoAntroller) GetUserSearchContent() {
  1019. br := new(models.BaseResponse).Init()
  1020. defer func() {
  1021. this.Data["json"] = br
  1022. this.ServeJSON()
  1023. }()
  1024. user := this.User
  1025. if user == nil {
  1026. br.Msg = "请登录"
  1027. br.ErrMsg = "请登录,用户信息为空"
  1028. br.Ret = 408
  1029. return
  1030. }
  1031. isHideResearch, _ := this.GetBool("IsHideResearch", false)
  1032. uid := user.UserId
  1033. detailSeearch := new(models.CygxActivityUserSearchContent)
  1034. detailSeearch.IsShowJurisdiction = 0
  1035. detailSeearch.ChartPermissionids = ""
  1036. detailSeearch.ActiveState = ""
  1037. resp := new(models.ActivityUserSearchContentList)
  1038. detail, _ := models.GetUserSearchContentByUid(uid)
  1039. if detail == nil {
  1040. detail = detailSeearch
  1041. }
  1042. isShowJurisdiction, _ := this.GetInt("IsShowJurisdiction")
  1043. listActivityType, errActivityType := models.GetActivityTypeList("")
  1044. if errActivityType != nil {
  1045. br.Msg = "获取失败"
  1046. br.ErrMsg = "获取数据失败,Err:" + errActivityType.Error()
  1047. return
  1048. }
  1049. var listChartPermissionid []*models.ActivityChartPermission
  1050. var errChart error
  1051. if isShowJurisdiction == 1 {
  1052. listChartPermissionidAll, errChartAll := models.GetUserCompanyPermission(user.CompanyId)
  1053. listChartPermissionid = listChartPermissionidAll
  1054. errChart = errChartAll
  1055. } else if isShowJurisdiction == 2 {
  1056. listChartPermissionidAll, errChartAll := models.GetChartPermissionActivity()
  1057. listChartPermissionid = listChartPermissionidAll
  1058. errChart = errChartAll
  1059. } else {
  1060. if detail.IsShowJurisdiction == 1 {
  1061. listChartPermissionidAll, errChartAll := models.GetUserCompanyPermission(user.CompanyId)
  1062. listChartPermissionid = listChartPermissionidAll
  1063. errChart = errChartAll
  1064. } else {
  1065. listChartPermissionidAll, errChartAll := models.GetChartPermissionActivity()
  1066. listChartPermissionid = listChartPermissionidAll
  1067. errChart = errChartAll
  1068. }
  1069. }
  1070. if errChart != nil {
  1071. br.Msg = "获取信息失败"
  1072. br.ErrMsg = "获取品种信息失败,Err:" + errChart.Error()
  1073. return
  1074. }
  1075. if detail.IsShowJurisdiction == 1 {
  1076. resp.IsShowJurisdiction = true
  1077. }
  1078. if isShowJurisdiction == 1 || detail.IsShowJurisdiction == 1 {
  1079. resp.IsShowJurisdiction = true
  1080. for k, _ := range listChartPermissionid {
  1081. listChartPermissionid[k].IsChoose = true
  1082. }
  1083. }
  1084. if isShowJurisdiction == 2 {
  1085. resp.IsShowJurisdiction = false
  1086. }
  1087. activeStateList := []models.ActivityStaus{models.ActivityStaus{Id: 1, StatusName: "未开始", IsChoose: true}, models.ActivityStaus{Id: 2, StatusName: "进行中"}, models.ActivityStaus{Id: 3, StatusName: "已结束"}}
  1088. list2, err := models.GetChartPermissionActivity()
  1089. if err != nil {
  1090. br.Msg = "获取信息失败"
  1091. br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
  1092. return
  1093. }
  1094. if activeStateList[1].IsChoose == activeStateList[2].IsChoose == false {
  1095. activeStateList[0].IsChoose = true
  1096. }
  1097. var userType int
  1098. userType, _, err = services.GetUserType(user.CompanyId)
  1099. if err != nil {
  1100. br.Msg = "获取信息失败!"
  1101. br.ErrMsg = "获取失败,Err:" + err.Error()
  1102. return
  1103. }
  1104. var listChartPermissionidNew2 []*models.ActivityChartPermission
  1105. for _, v := range list2 {
  1106. if v.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
  1107. v.PermissionName = utils.MAI_FANG_YAN_XUAN_NAME
  1108. }
  1109. if userType == 1 || isHideResearch {
  1110. if !strings.Contains(v.PermissionName, "研选") {
  1111. listChartPermissionidNew2 = append(listChartPermissionidNew2, v)
  1112. }
  1113. } else {
  1114. listChartPermissionidNew2 = append(listChartPermissionidNew2, v)
  1115. }
  1116. }
  1117. resp.ListChartPermission2 = listChartPermissionidNew2
  1118. var listChartPermissionidNew []*models.ActivityChartPermission
  1119. for _, v := range listChartPermissionid {
  1120. if v.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
  1121. v.PermissionName = utils.MAI_FANG_YAN_XUAN_NAME
  1122. }
  1123. if userType == 1 || isHideResearch {
  1124. if !strings.Contains(v.PermissionName, "研选") {
  1125. listChartPermissionidNew = append(listChartPermissionidNew, v)
  1126. }
  1127. } else {
  1128. listChartPermissionidNew = append(listChartPermissionidNew, v)
  1129. }
  1130. }
  1131. resp.ListActivityType = listActivityType
  1132. resp.ListChartPermission = listChartPermissionidNew
  1133. resp.ListActivityStaus = activeStateList
  1134. br.Ret = 200
  1135. br.Success = true
  1136. br.Msg = "获取成功"
  1137. br.Data = resp
  1138. }
  1139. // @Title 添加会议提醒
  1140. // @Description 添加会议提醒接口
  1141. // @Param request body models.ActivityIdRep true "type json string"
  1142. // @Success Ret=200 {object} models.SignupStatus
  1143. // @router /meetingReminder/add [post]
  1144. func (this *ActivityCoAntroller) MeetingReminderAdd() {
  1145. br := new(models.BaseResponse).Init()
  1146. defer func() {
  1147. this.Data["json"] = br
  1148. this.ServeJSON()
  1149. }()
  1150. user := this.User
  1151. if user == nil {
  1152. br.Msg = "请登录"
  1153. br.ErrMsg = "请登录,用户信息为空"
  1154. br.Ret = 408
  1155. return
  1156. }
  1157. uid := user.UserId
  1158. //var signupStatus string
  1159. signupStatus := "Success"
  1160. var req models.ActivityIdRep
  1161. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1162. if err != nil {
  1163. br.Msg = "参数解析异常!"
  1164. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1165. return
  1166. }
  1167. activityId := req.ActivityId
  1168. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  1169. if activityInfo == nil {
  1170. br.Msg = "操作失败"
  1171. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  1172. return
  1173. }
  1174. if errInfo != nil {
  1175. br.Msg = "操作失败"
  1176. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1177. return
  1178. }
  1179. //SignupStatus string `description:"报名状态:人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
  1180. item := new(models.CygxActivityMeetingReminder)
  1181. resp := new(models.SignupStatus)
  1182. hasPermission := 0
  1183. resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
  1184. if time.Now().After(resultTime.Add(-time.Minute * 15)) {
  1185. br.Msg = "活动开始前15分钟无法设置会议提醒"
  1186. return
  1187. }
  1188. // 判断是否属于研选类型的活动
  1189. if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  1190. resp.IsResearch = true
  1191. }
  1192. havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
  1193. if err != nil {
  1194. br.Msg = "获取信息失败"
  1195. br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
  1196. return
  1197. }
  1198. resp.IsResearchSpecial = isResearchSpecial
  1199. if havePower {
  1200. hasPermission = 1
  1201. signupStatus = "Success"
  1202. //限制人数为1人的专家电话会 用户操作时的消息提示
  1203. if activityInfo.LimitPeopleNum == 1 && activityInfo.ActivityTypeId == 1 {
  1204. resp.HasPermission = hasPermission
  1205. resp.SignupStatus = utils.FULLSTARFFED_MSG
  1206. resp.PopupMsg = utils.ACTIVITY_ZJDHH_V1_MSG
  1207. br.Ret = 200
  1208. br.Success = true
  1209. br.Msg = ""
  1210. br.Data = resp
  1211. return
  1212. }
  1213. totalMeeting, errMeeting := models.GetActivityMeetingReminderCount(uid, activityId)
  1214. if errMeeting != nil {
  1215. br.Msg = "获取失败"
  1216. br.ErrMsg = "获取失败,Err:" + errMeeting.Error()
  1217. return
  1218. }
  1219. if totalMeeting > 0 {
  1220. br.Msg = "您已预约,请勿重复预约"
  1221. return
  1222. }
  1223. item.UserId = uid
  1224. item.ActivityId = activityId
  1225. item.CreateTime = time.Now()
  1226. item.Mobile = user.Mobile
  1227. item.Email = user.Email
  1228. item.CompanyId = user.CompanyId
  1229. item.CompanyName = user.CompanyName
  1230. resp.HasPermission = hasPermission
  1231. _, errSignup := models.AddActivityMeetingReminder(item)
  1232. if errSignup != nil {
  1233. br.Msg = "操作失败"
  1234. br.ErrMsg = "操作失败,Err:" + errSignup.Error()
  1235. return
  1236. }
  1237. resp.HaqveJurisdiction = true
  1238. //1:预约外呼 、2:设置会议提醒 、 3:预约纪要 、4:活动报名
  1239. go services.ActivityUserRemind(user, activityInfo, 2)
  1240. } else {
  1241. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
  1242. if err != nil {
  1243. br.Msg = "获取信息失败"
  1244. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  1245. return
  1246. }
  1247. resp.PopupMsg = popupMsg
  1248. resp.HasPermission = hasPermission
  1249. resp.SellerName = sellerName
  1250. resp.SellerMobile = sellerMobile
  1251. }
  1252. // 判断是否属于研选类型的活动
  1253. if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  1254. resp.IsResearch = true
  1255. }
  1256. resp.SignupStatus = signupStatus
  1257. resp.ActivityId = activityId
  1258. //var total int
  1259. //total, err = models.GetUserActivityMeetingReminderCount(user.UserId)
  1260. //if err != nil {
  1261. // br.Msg = "获取信息失败"
  1262. // br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
  1263. // return
  1264. //}
  1265. //if total <= 1 {
  1266. // resp.GoFollow = true
  1267. //}
  1268. detailActivityType, err := models.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
  1269. if err != nil {
  1270. br.Msg = "获取信息失败"
  1271. br.ErrMsg = "获取信息失败,GetActivityTypeDetailById Err:" + err.Error()
  1272. return
  1273. }
  1274. resp.ActivityTypeName = activityInfo.ActivityName
  1275. resp.ActivityTime = activityInfo.ActivityTime
  1276. resp.ActivityType = detailActivityType.ActivityType
  1277. br.Ret = 200
  1278. br.Success = true
  1279. if hasPermission == 1 {
  1280. br.Msg = "设置成功,会前15分钟会为您推送微信消息提醒"
  1281. resp.PopupMsg = "设置成功,会前15分钟会为您推送微信消息提醒<br/><br/>是否将活动日程加入您的系统日历,\n\n活动开始前获取手机日历提醒?"
  1282. //resp.PopupMsg = "设置成功,会前15分钟会为您推送微信消息提醒<br/><br/>请关注【查研观向小助手】公众号,以获取微信消息提醒"
  1283. }
  1284. br.Data = resp
  1285. }
  1286. // @Title 取消会议提醒
  1287. // @Description 取消会议提醒接口
  1288. // @Param request body models.ActivityIdRep true "type json string"
  1289. // @Success Ret=200 {object} models.SignupStatus
  1290. // @router /meetingReminder/cancel [post]
  1291. func (this *ActivityCoAntroller) MeetingReminderCancel() {
  1292. br := new(models.BaseResponse).Init()
  1293. defer func() {
  1294. this.Data["json"] = br
  1295. this.ServeJSON()
  1296. }()
  1297. user := this.User
  1298. if user == nil {
  1299. br.Msg = "请登录"
  1300. br.ErrMsg = "请登录,用户信息为空"
  1301. br.Ret = 408
  1302. return
  1303. }
  1304. uid := user.UserId
  1305. var req models.ActivityIdRep
  1306. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1307. if err != nil {
  1308. br.Msg = "参数解析异常!"
  1309. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1310. return
  1311. }
  1312. activityId := req.ActivityId
  1313. signupStatus := "Success"
  1314. item := new(models.CygxActivityMeetingReminder)
  1315. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  1316. if activityInfo == nil {
  1317. br.Msg = "操作失败"
  1318. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  1319. return
  1320. }
  1321. if errInfo != nil {
  1322. br.Msg = "操作失败"
  1323. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1324. return
  1325. }
  1326. //if signupStatus == "Success" {
  1327. total, err := models.GetActivityMeetingReminderCount(uid, activityId)
  1328. if err != nil {
  1329. br.Msg = "获取失败"
  1330. br.ErrMsg = "获取失败,Err:" + err.Error()
  1331. return
  1332. }
  1333. if total == 0 {
  1334. br.Msg = "您暂未添加该活动会议提醒"
  1335. return
  1336. }
  1337. resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
  1338. if time.Now().After(resultTime.Add(-time.Minute * 15)) {
  1339. br.Msg = "活动开始前15分钟无法取消会议提醒"
  1340. return
  1341. }
  1342. item.UserId = uid
  1343. item.ActivityId = activityId
  1344. item.CreateTime = time.Now()
  1345. item.Mobile = user.Mobile
  1346. item.Email = user.Email
  1347. item.CompanyId = user.CompanyId
  1348. item.CompanyName = user.CompanyName
  1349. _, errSignup := models.CancelActivityMeetingReminder(item)
  1350. if errSignup != nil {
  1351. br.Msg = "操作失败"
  1352. br.ErrMsg = "操作失败,Err:" + errSignup.Error()
  1353. return
  1354. }
  1355. //}
  1356. resp := new(models.SignupStatus)
  1357. resp.SignupStatus = signupStatus
  1358. resp.ActivityId = activityId
  1359. br.Ret = 200
  1360. br.Success = true
  1361. br.Msg = "会议提醒已取消"
  1362. br.Data = resp
  1363. }
  1364. // @Title 敏捷搜索关键词的列表
  1365. // @Description 获取敏捷搜索关键词的列表接口
  1366. // @Success 200 {object} models.ActivityFastsearchKeywordsListResp
  1367. // @router /fastSearchKeWord [get]
  1368. func (this *ActivityABaseController) FastSearch() {
  1369. br := new(models.BaseResponse).Init()
  1370. defer func() {
  1371. this.Data["json"] = br
  1372. this.ServeJSON()
  1373. }()
  1374. resp := new(models.ActivityFastsearchKeywordsListResp)
  1375. list, err := models.GetActivityFastsearchKeywordsList()
  1376. if err != nil {
  1377. br.Msg = "获取失败"
  1378. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  1379. return
  1380. }
  1381. resp.List = list
  1382. br.Ret = 200
  1383. br.Success = true
  1384. br.Msg = "获取成功"
  1385. br.Data = resp
  1386. }
  1387. // @Title 活动带问
  1388. // @Description 新增活动带问接口
  1389. // @Param request body models.AddCygxActivityHelpAsk true "type json string"
  1390. // @Success Ret=200 新增成功
  1391. // @router /askAdd [post]
  1392. func (this *ActivityCoAntroller) AskAdd() {
  1393. br := new(models.BaseResponse).Init()
  1394. defer func() {
  1395. this.Data["json"] = br
  1396. this.ServeJSON()
  1397. }()
  1398. user := this.User
  1399. if user == nil {
  1400. br.Msg = "请登录"
  1401. br.ErrMsg = "请登录,SysUser Is Empty"
  1402. br.Ret = 408
  1403. return
  1404. }
  1405. var req models.CygxActivityHelpAsk
  1406. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1407. if err != nil {
  1408. br.Msg = "参数解析异常!"
  1409. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1410. return
  1411. }
  1412. if req.Content == "" {
  1413. br.Msg = "建议内容不可为空"
  1414. return
  1415. }
  1416. content := req.Content
  1417. itemToken, err := services.WxGetToken()
  1418. if err != nil {
  1419. br.Msg = "GetWxAccessToken Err:" + err.Error()
  1420. return
  1421. }
  1422. if itemToken.AccessToken == "" {
  1423. br.Msg = "accessToken is empty"
  1424. return
  1425. }
  1426. commerr, err := weapp.MSGSecCheck(itemToken.AccessToken, content)
  1427. if err != nil {
  1428. br.Msg = "内容校验失败!"
  1429. br.ErrMsg = "内容校验失败,Err:" + err.Error()
  1430. return
  1431. }
  1432. if commerr.ErrCode != 0 {
  1433. br.Msg = "内容违规,请重新提交!"
  1434. br.ErrMsg = "颜文字内容违规,Err:" + commerr.ErrMSG
  1435. return
  1436. }
  1437. activityId := req.ActivityId
  1438. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  1439. if activityInfo == nil {
  1440. br.Msg = "操作失败"
  1441. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  1442. return
  1443. }
  1444. if errInfo != nil {
  1445. br.Msg = "操作失败"
  1446. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1447. return
  1448. }
  1449. //resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
  1450. //if activityInfo.ActivityTypeId == 1 && activityInfo.ChartPermissionId != 31 {
  1451. // if time.Now().After(resultTime.Add(-time.Minute * 15)) {
  1452. // br.Msg = "活动开始前15分钟内无法提交问题"
  1453. // return
  1454. // }
  1455. //} else {
  1456. // if time.Now().After(resultTime.Add(-time.Minute * 60)) {
  1457. // br.Msg = "活动开始前1小时内无法提交问题"
  1458. // return
  1459. // }
  1460. //}
  1461. companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
  1462. if err != nil {
  1463. br.Msg = "提交失败!"
  1464. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  1465. return
  1466. }
  1467. if companyDetail == nil {
  1468. br.Msg = "提交失败!"
  1469. br.ErrMsg = "客户不存在,uid:" + strconv.Itoa(user.UserId)
  1470. return
  1471. }
  1472. item := new(models.CygxActivityHelpAsk)
  1473. item.UserId = user.UserId
  1474. item.ActivityId = req.ActivityId
  1475. item.CompanyId = user.CompanyId
  1476. item.CompanyName = companyDetail.CompanyName
  1477. item.CreateTime = time.Now()
  1478. item.Mobile = user.Mobile
  1479. item.Email = user.Email
  1480. item.Content = content
  1481. msgId, err := models.AddActivityHelpAsk(item)
  1482. if err != nil {
  1483. br.Msg = "提交失败"
  1484. br.ErrMsg = "提交带问失败,Err:" + err.Error()
  1485. return
  1486. }
  1487. var isSendMsg bool
  1488. resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
  1489. if activityInfo.ActivityTypeId == 1 && activityInfo.ChartPermissionId != 31 {
  1490. if time.Now().After(resultTime.Add(-time.Minute * 15)) {
  1491. isSendMsg = true
  1492. }
  1493. } else {
  1494. if time.Now().After(resultTime.Add(-time.Minute * 60)) {
  1495. isSendMsg = true
  1496. }
  1497. }
  1498. if isSendMsg {
  1499. listEmail, err := models.GetAskEmail()
  1500. if err != nil {
  1501. br.Msg = "提交失败"
  1502. br.ErrMsg = "提交带问失败,Err:" + err.Error()
  1503. return
  1504. }
  1505. var sendMobile string
  1506. for _, v := range listEmail {
  1507. if strings.Index(activityInfo.Host, v.Name) > 0 {
  1508. sendMobile = v.Mobile
  1509. }
  1510. }
  1511. //如果是研选的就推送给汪洋
  1512. if activityInfo.ChartPermissionId == 31 {
  1513. sendMobile = utils.ActSendMsgMobile
  1514. }
  1515. //获取销售信息
  1516. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  1517. if err != nil && err.Error() != utils.ErrNoRow() {
  1518. br.Msg = "提交失败"
  1519. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  1520. return
  1521. }
  1522. //给研究员发送消息
  1523. if sendMobile != "" {
  1524. openIpItem, _ := models.GetUserRecordByMobile(4, sendMobile)
  1525. if openIpItem != nil && openIpItem.OpenId != "" {
  1526. if sellerItem != nil {
  1527. services.SendActivityAskApplyTemplateMsgV2(user.RealName+"——"+user.CompanyName+"("+sellerItem.RealName+")", "提问:"+activityInfo.ActivityName, time.Now().Format(utils.FormatDateTime), req.Content, activityInfo.ActivityName, openIpItem, activityInfo, int(msgId))
  1528. }
  1529. }
  1530. }
  1531. // 给所属销售发送消息
  1532. if sellerItem != nil {
  1533. openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
  1534. if openIpItem != nil && openIpItem.OpenId != "" {
  1535. services.SendActivityAskApplyTemplateMsgV2(user.RealName+"——"+user.CompanyName+"("+sellerItem.RealName+")", "提问:"+activityInfo.ActivityName, time.Now().Format(utils.FormatDateTime), req.Content, activityInfo.ActivityName, openIpItem, activityInfo, int(msgId))
  1536. }
  1537. go services.SendWxCategoryMsgWithAsk(user, activityInfo, content, int(msgId))
  1538. }
  1539. }
  1540. br.Ret = 200
  1541. br.Success = true
  1542. br.Msg = "提交成功"
  1543. }
  1544. // @Title 更多主题列表(4.3版本)
  1545. // @Description 获取活动更多主题列表接口(4.3版本)
  1546. // @Success 200 {object} models.GetCygxActivityLabelListRep
  1547. // @router /labelMoreList [get]
  1548. func (this *ActivityCoAntroller) LabelMoreList() {
  1549. br := new(models.BaseResponse).Init()
  1550. defer func() {
  1551. this.Data["json"] = br
  1552. this.ServeJSON()
  1553. }()
  1554. user := this.User
  1555. if user == nil {
  1556. br.Msg = "请登录"
  1557. br.ErrMsg = "请登录,SysUser Is Empty"
  1558. return
  1559. }
  1560. userType, permissionStr, err := services.GetUserType(user.CompanyId)
  1561. if err != nil {
  1562. br.Msg = "获取失败"
  1563. br.ErrMsg = "获取失败,Err:" + err.Error()
  1564. return
  1565. }
  1566. var startSize, pageSize int
  1567. pageSize = 24
  1568. var condition string
  1569. var sortTime string
  1570. //var conditionStatus string
  1571. var pars []interface{}
  1572. //活动可见限制
  1573. var sqlExport string
  1574. resp := new(models.GetCygxActivityLabelListRep)
  1575. slicePer := strings.Split(permissionStr, ",")
  1576. var permissionSqlStr string
  1577. for _, v := range slicePer {
  1578. if userType == 1 {
  1579. //if v != "研选" {
  1580. if !strings.Contains(v, "研选") {
  1581. permissionSqlStr += "'" + v + "',"
  1582. }
  1583. } else {
  1584. permissionSqlStr += "'" + v + "',"
  1585. }
  1586. }
  1587. permissionSqlStr = strings.TrimRight(permissionSqlStr, ",")
  1588. permissionSqlStr = strings.Replace(permissionSqlStr, "(主观)", "", -1)
  1589. permissionSqlStr = strings.Replace(permissionSqlStr, "(客观)", "", -1)
  1590. permissionSqlStr = ` AND art.chart_permission_name IN (` + permissionSqlStr + `)`
  1591. sqlExport = ` AND (art.customer_type_ids LIKE '%` + strconv.Itoa(userType) + `%' `
  1592. if userType == 2 {
  1593. sqlExport += ` OR art.customer_type_ids LIKE '%3%' `
  1594. }
  1595. if (userType == 2 || userType == 3) && strings.Contains(permissionStr, "专家") {
  1596. sqlExport += ` OR art.customer_type_ids LIKE '%4%' `
  1597. }
  1598. sqlExport += `) `
  1599. //进行中的活动
  1600. condition = ` AND art.publish_status = 1 AND art.label != '' AND art.active_state = 2 `
  1601. var conditionOr string
  1602. if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
  1603. conditionOr += ` OR ( art.is_limit_people = 1 AND art.customer_type_ids LIKE '%4%' ` + condition + `) `
  1604. }
  1605. if (userType == 5) && strings.Contains(permissionStr, "专家") {
  1606. conditionOr += ` OR ( art.is_limit_people = 1 AND art.customer_type_ids LIKE '%5%' ` + condition + `) `
  1607. }
  1608. if userType == 1 {
  1609. conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + permissionSqlStr + `) `
  1610. } else {
  1611. conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + `) `
  1612. }
  1613. //判断客户规模是否属于可见范围的活动
  1614. companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
  1615. if err != nil && err.Error() != utils.ErrNoRow() {
  1616. br.Msg = "获取信息失败"
  1617. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  1618. return
  1619. }
  1620. if companyProduct != nil {
  1621. if companyProduct.Scale != "" {
  1622. conditionOr += ` OR ( art.scale LIKE '%` + companyProduct.Scale + `%' ` + condition + `) `
  1623. }
  1624. }
  1625. condition += `AND art.is_limit_people = 1 ` + permissionSqlStr + sqlExport + conditionOr
  1626. //进行中的活动
  1627. sortTime = ` mintimesort ASC `
  1628. list, errList := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
  1629. if errList != nil {
  1630. br.Msg = "获取失败"
  1631. br.ErrMsg = "获取失败,Err:" + errList.Error()
  1632. return
  1633. }
  1634. //已结束的活动
  1635. conditionOr = ""
  1636. condition = ` AND art.publish_status = 1 AND art.label != '' AND art.active_state = 3 `
  1637. if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
  1638. conditionOr += ` OR ( art.is_limit_people = 1 AND art.customer_type_ids LIKE '%4%' ` + condition + `) `
  1639. }
  1640. if (userType == 5) && strings.Contains(permissionStr, "专家") {
  1641. conditionOr += ` OR ( art.is_limit_people = 1 AND art.customer_type_ids LIKE '%5%' ` + condition + `) `
  1642. }
  1643. if userType == 1 {
  1644. conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + permissionSqlStr + `) `
  1645. } else {
  1646. conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + `) `
  1647. }
  1648. condition += `AND art.is_limit_people = 1 ` + permissionSqlStr + sqlExport + conditionOr
  1649. startSize = 0
  1650. pageSize = 24 - len(list)
  1651. //已结束的活动
  1652. sortTime = ` timesort DESC `
  1653. listEnd, err := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
  1654. if err != nil {
  1655. br.Msg = "获取失败"
  1656. br.ErrMsg = "获取失败,Err:" + err.Error()
  1657. return
  1658. }
  1659. for _, v := range listEnd {
  1660. list = append(list, v)
  1661. }
  1662. //标签字段关联的产业与标签处理
  1663. for k, v := range list {
  1664. list[k].KeyWord = services.LabelStr(v.KeyWord)
  1665. }
  1666. //添加更多主题访问记录
  1667. item := new(models.CygxPageHistoryRecord)
  1668. item.UserId = user.UserId
  1669. item.CreateTime = time.Now()
  1670. item.Mobile = user.Mobile
  1671. item.Email = user.Email
  1672. item.CompanyId = user.CompanyId
  1673. item.CompanyName = user.CompanyName
  1674. item.PageType = "LabelMore"
  1675. go models.AddCygxPageHistoryRecord(item)
  1676. resp.List = list
  1677. br.Ret = 200
  1678. br.Success = true
  1679. br.Msg = "获取成功"
  1680. br.Data = resp
  1681. }
  1682. // @Title 活动列表(4.3版本)
  1683. // @Description 获取活动列表接口(4.3版本)
  1684. // @Param PageSize query int true "每页数据条数"
  1685. // @Param CurrentIndex query int true "当前页页码,从1开始"
  1686. // @Param Label query string false "搜索主题 多个用 , 隔开"
  1687. // @Param ChartPermissionIds query string false "行业id 多个用 , 隔开"
  1688. // @Param WhichDay query string false "哪一天 1今天、2明天,3本周,4上周,5本月,6上月 多个用 , 隔开"
  1689. // @Param ActiveState query string false "活动进行状态 未开始:1、进行中2、已结束3"
  1690. // @Param ActivityTypeId query string false "活动类型id 多个用 , 隔开"
  1691. // @Param Source query int false "来源 0手机 ,1Pc 默认0"
  1692. // @Param IsPower query int false "是否选择有权限行业 ,1是 0 否 默认0"
  1693. // @Param PlayBack query int false "是否仅展示回放 1:是、0:否 默认0"
  1694. // @Param KeyWord query string false "搜索关键词 多个用 , 隔开"
  1695. // @Param ActivityId query int false "活动列表传过来的活动ID"
  1696. // @Param Filter query int false "筛选条件 0:全部 1:视频 2:音频"
  1697. // @Param TypeName query string false "电话会类型 ,1专家电话会 2分析师电话会"
  1698. // @Param IsExternalLabel query int false "是否仅展示外部资源 1:是、0:否 默认0"
  1699. // @Param IsResearchPoints query string false "是否仅展示研选扣点 1:展示研选扣点、2:展示外部资源 ,1,2两者都展示" //兼容前端
  1700. // @Param IsResearch query bool true "是否为研选"
  1701. // @Success 200 {object} models.GetCygxActivityListRep
  1702. // @router /listNew [get]
  1703. func (this *ActivityCoAntroller) ActivityListNew() {
  1704. br := new(models.BaseResponse).Init()
  1705. defer func() {
  1706. this.Data["json"] = br
  1707. this.ServeJSON()
  1708. }()
  1709. user := this.User
  1710. if user == nil {
  1711. br.Msg = "请登录"
  1712. br.ErrMsg = "请登录,SysUser Is Empty"
  1713. return
  1714. }
  1715. uid := user.UserId
  1716. pageSize, _ := this.GetInt("PageSize")
  1717. currentIndex, _ := this.GetInt("CurrentIndex")
  1718. //source, _ := this.GetInt("Source")
  1719. label := this.GetString("Label")
  1720. chartPermissionIds := this.GetString("ChartPermissionIds")
  1721. whichDay := this.GetString("WhichDay")
  1722. //whichTime := this.GetString("WhichTime")
  1723. activeState := this.GetString("ActiveState")
  1724. activityTypeId := this.GetString("ActivityTypeId")
  1725. keyWord := this.GetString("KeyWord")
  1726. playBack, _ := this.GetInt("PlayBack")
  1727. filter, _ := this.GetInt("Filter")
  1728. isPower, _ := this.GetInt("IsPower")
  1729. activityId, _ := this.GetInt("ActivityId") // 仅用于判断【新】标签
  1730. //isExternalLabel, _ := this.GetInt("IsExternalLabel") //
  1731. isResearchPoints := this.GetString("IsResearchPoints") //
  1732. isResearch, _ := this.GetBool("IsResearch", false) // 是否为研选 查研观向11.0 (研选活动独立显示)
  1733. if label == "undefined" {
  1734. label = ""
  1735. }
  1736. if chartPermissionIds == "undefined" {
  1737. chartPermissionIds = ""
  1738. }
  1739. // 查研观向7.4-始终查询宏观的活动
  1740. if chartPermissionIds != "" {
  1741. chartPermissionIds += ",1"
  1742. }
  1743. if whichDay == "undefined" {
  1744. whichDay = ""
  1745. }
  1746. if activeState == "undefined" {
  1747. activeState = ""
  1748. }
  1749. if activityTypeId == "undefined" {
  1750. activityTypeId = ""
  1751. }
  1752. if activityTypeId == "5" {
  1753. activityTypeId = "5,8" //专家线下沙龙可以查看买方线下交流
  1754. }
  1755. var startSize int
  1756. if pageSize <= 0 {
  1757. pageSize = utils.PageSize20
  1758. }
  1759. if currentIndex <= 0 {
  1760. currentIndex = 1
  1761. }
  1762. startSize = utils.StartIndex(currentIndex, pageSize)
  1763. //userType, permissionStr, err := services.GetUserType(user.CompanyId)
  1764. var condition string
  1765. var conditioninit string //初始化搜索条件
  1766. var pars []interface{}
  1767. var activityList []*models.ActivityDetail
  1768. mapDingActivityId := make(map[int]int)
  1769. //主题
  1770. if label != "" {
  1771. conditioninit += ` AND art.label LIKE "%` + label + `%" `
  1772. }
  1773. //是否是研选
  1774. if isResearch {
  1775. chartPermissionIds = strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN)
  1776. } else {
  1777. conditioninit += ` AND ( art.chart_permission_id != ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + ` OR ( art.is_show_hz = 1 AND art.chart_permission_id = ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `) )`
  1778. conditioninit += ` AND IF ( art.active_state = 3, art.chart_permission_id != ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `, 1 = 1 ) ` //V 11.0 研选活动结束后就不在已结束页面展示了
  1779. }
  1780. //行业名称 易董过来的会,按照 副行业来筛选
  1781. if len(chartPermissionIds) > 0 {
  1782. //conditioninit += ` AND art.chart_permission_id IN (` + chartPermissionIds + `)`
  1783. conditioninit += ` AND IF ( art.yidong_activity_id != '' , art.chart_permission_id_deputy IN (` + chartPermissionIds + `) ,1=1 ) `
  1784. conditioninit += ` AND IF ( art.yidong_activity_id = '' , art.chart_permission_id IN (` + chartPermissionIds + `) ,1=1 ) `
  1785. }
  1786. //哪一天
  1787. if whichDay != "" {
  1788. var startDate string
  1789. var endDate string
  1790. if whichDay == "1" {
  1791. startDate = time.Now().Format(utils.FormatDate)
  1792. endDate = startDate
  1793. } else if whichDay == "2" {
  1794. startDate = time.Now().AddDate(0, 0, +1).Format(utils.FormatDate)
  1795. endDate = startDate
  1796. } else if whichDay == "3" {
  1797. startDate = utils.GetNowWeekMonday().Format(utils.FormatDate)
  1798. endDate = utils.GetNowWeekSunday().Format(utils.FormatDate)
  1799. } else if whichDay == "4" {
  1800. startDate = utils.GetLastWeekMonday().Format(utils.FormatDate)
  1801. endDate = utils.GetLastWeekSunday().Format(utils.FormatDate)
  1802. } else if whichDay == "5" {
  1803. startDate = utils.GetNowMonthFirstDay().Format(utils.FormatDate)
  1804. endDate = utils.GetNowMonthLastDay().Format(utils.FormatDate)
  1805. } else if whichDay == "6" {
  1806. startDate = utils.GetLastMonthFirstDay().Format(utils.FormatDate)
  1807. endDate = utils.GetLastMonthLastDay().Format(utils.FormatDate)
  1808. } else if whichDay == "1,2" {
  1809. startDate = time.Now().Format(utils.FormatDate)
  1810. endDate = time.Now().AddDate(0, 0, +1).Format(utils.FormatDate)
  1811. } else if whichDay == "3,4" {
  1812. startDate = utils.GetLastWeekMonday().Format(utils.FormatDate)
  1813. endDate = utils.GetNowWeekSunday().Format(utils.FormatDate)
  1814. } else if whichDay == "5,6" {
  1815. startDate = utils.GetLastMonthFirstDay().Format(utils.FormatDate)
  1816. endDate = utils.GetNowMonthLastDay().Format(utils.FormatDate)
  1817. } else {
  1818. startDate = time.Now().Format(utils.FormatDate)
  1819. endDate = time.Now().AddDate(0, 0, +1).Format(utils.FormatDate)
  1820. }
  1821. conditioninit += ` AND art.activity_time >= ` + "'" + startDate + " 00:00:00'"
  1822. conditioninit += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
  1823. }
  1824. //活动状态搜索
  1825. if activeState != "" {
  1826. // 默认查看未开始跟进行中
  1827. if activeState == "1" {
  1828. conditioninit += ` AND art.active_state IN (1,2)`
  1829. } else {
  1830. conditioninit += ` AND art.active_state IN (` + activeState + `)`
  1831. }
  1832. } else {
  1833. conditioninit += ` AND art.active_state IN (1,2)`
  1834. }
  1835. // 如果是分析师电话会,那么可以连同C类一起查看
  1836. if activityTypeId != "" {
  1837. if activityTypeId == strconv.Itoa(utils.ANALYST_TELL_ACTIVITY_TYPE_ID) {
  1838. conditioninit += ` AND art.activity_type_id IN (` + activityTypeId + "," + strconv.Itoa(utils.C_CLASS_ACTIVITY_TYPE_ID) + `)`
  1839. } else {
  1840. conditioninit += ` AND art.activity_type_id IN (` + activityTypeId + `)`
  1841. }
  1842. }
  1843. //关键词搜索
  1844. if keyWord != "" {
  1845. conditioninit += ` AND (art.label REGEXP '` + keyWord + `' OR art.activity_name REGEXP '` + keyWord + `' ) `
  1846. }
  1847. //回放
  1848. if playBack == 1 {
  1849. //获取所有带回放的活动ID
  1850. playBackActivityIds, err := services.GetActivityPlayBackActivityIds()
  1851. if err != nil {
  1852. br.Msg = "获取失败"
  1853. br.ErrMsg = "获取失败,Err:" + err.Error()
  1854. return
  1855. }
  1856. conditioninit += ` AND art.activity_id IN ( ` + playBackActivityIds + `) `
  1857. }
  1858. //音频视频 1:视频 2:音频
  1859. if filter > 0 {
  1860. videoOrVoiceActivityIds, err := services.GetActivityVideoOrVoiceActivityIds(filter)
  1861. if err != nil {
  1862. br.Msg = "获取失败"
  1863. br.ErrMsg = "获取失败,Err:" + err.Error()
  1864. return
  1865. }
  1866. conditioninit += ` AND art.activity_id IN ( ` + videoOrVoiceActivityIds + `) `
  1867. }
  1868. //外部资源,研选扣点的并集搜索
  1869. if isResearchPoints == "1,2" || isResearchPoints == "2,1" {
  1870. conditioninit += ` AND ( art.is_external_label = 1 OR art.is_research_points = 1 )`
  1871. } else {
  1872. // 是否为研选扣点
  1873. if isResearchPoints == "1" {
  1874. conditioninit += ` AND art.is_research_points = 1 `
  1875. }
  1876. //是否为外部资源
  1877. if isResearchPoints == "2" {
  1878. conditioninit += ` AND art.is_external_label = 1 `
  1879. }
  1880. }
  1881. //活动可见限制
  1882. //conditionActivityAll, err := services.GetActivityonditionList(user, activityTypeId, chartPermissionIds, whichDay, activeState, label, 0, source, keyWord, playBack, 3)
  1883. conditionActivity, err := services.ActivityConditioninitSql(user, conditioninit, isPower)
  1884. if err != nil && err.Error() != utils.ErrNoRow() {
  1885. br.Msg = "获取失败"
  1886. br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
  1887. return
  1888. }
  1889. condition += ` AND art.publish_status = 1 ` + conditionActivity
  1890. //var conditionCount string
  1891. //conditionCount = condition + conditionActivityAll
  1892. total, err := models.GetActivityCount(condition, playBack, pars, filter)
  1893. if err != nil {
  1894. br.Msg = "获取失败"
  1895. br.ErrMsg = "获取失败,Err:" + err.Error()
  1896. return
  1897. }
  1898. //搜索关键词初始化
  1899. //conditionActivityKey, err := services.GetActivityonditionList(user, activityTypeId, chartPermissionIds, whichDay, activeState, label, 0, source, keyWord, playBack, 1)
  1900. //if err != nil && err.Error() != utils.ErrNoRow() {
  1901. // br.Msg = "获取失败"
  1902. // br.ErrMsg = "获取失败,Err:" + err.Error()
  1903. // return
  1904. //}
  1905. var conditionOrder string
  1906. if activeState == "2" || activeState == "3" {
  1907. conditionOrder = ` ORDER BY art.activity_time DESC `
  1908. } else if activeState == "2,3" {
  1909. conditionOrder = ` ORDER BY art.active_state ASC, art.activity_time DESC `
  1910. } else {
  1911. conditionOrder = ` ORDER BY art.activity_time DESC , art.active_state ASC `
  1912. }
  1913. if label != "" && activeState == "1" {
  1914. conditionOrder = ` ORDER BY art.activity_time ASC `
  1915. }
  1916. //未开始进行中默认按照时间正序
  1917. if activeState == "1" || activeState == "1,2" || activeState == "" {
  1918. conditionOrder = ` ORDER BY art.top_time DESC , art.activity_time ASC `
  1919. }
  1920. //conditionActivityKey += condition + conditionOrder
  1921. condition += conditionOrder
  1922. //fmt.Println(conditionOrder)
  1923. list, errList := models.GetActivityListNew(condition, pars, uid, startSize, pageSize, playBack, filter, "")
  1924. if errList != nil {
  1925. br.Msg = "获取失败"
  1926. br.ErrMsg = "获取失败,Err:" + errList.Error()
  1927. return
  1928. }
  1929. var isShow bool
  1930. isShow = services.GetShowSustainable()
  1931. detail, err := models.GetConfigByCode("city_img_url")
  1932. if err != nil {
  1933. br.Msg = "获取数据失败"
  1934. br.ErrMsg = "城市配置信息失败,Err:" + err.Error()
  1935. return
  1936. }
  1937. detailChart, err := models.GetConfigByCode("chart_img_url")
  1938. if err != nil {
  1939. br.Msg = "获取数据失败"
  1940. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  1941. return
  1942. }
  1943. addressList := strings.Split(detail.ConfigValue, "{|}")
  1944. mapAddress := make(map[string]string)
  1945. chartList := strings.Split(detailChart.ConfigValue, "{|}")
  1946. mapChart := make(map[string]string)
  1947. var cityName string
  1948. var chartName string
  1949. var imgUrl string
  1950. var imgUrlChart string
  1951. var mapActivityId []int
  1952. for _, v := range addressList {
  1953. vslice := strings.Split(v, "_")
  1954. cityName = vslice[0]
  1955. imgUrl = vslice[len(vslice)-1]
  1956. mapAddress[cityName] = imgUrl
  1957. }
  1958. for _, v := range chartList {
  1959. vslice := strings.Split(v, "_")
  1960. chartName = vslice[0]
  1961. imgUrlChart = vslice[len(vslice)-1]
  1962. mapChart[chartName] = imgUrlChart
  1963. }
  1964. for k, v := range list {
  1965. if strings.Contains(v.ActivityName, "【") {
  1966. list[k].IsBrackets = 1
  1967. }
  1968. if v.SignupNum > v.LimitPeopleNum {
  1969. list[k].SignupNum = v.LimitPeopleNum
  1970. }
  1971. if isShow && strings.Contains(v.ChartPermissionName, "研选") {
  1972. list[k].IsShowSustainable = true
  1973. }
  1974. if strings.Contains(v.ChartPermissionName, "研选") && v.ActivityTypeId == 1 {
  1975. //list[k].ActivityTypeName = "买方研选电话会"
  1976. //list[k].ImgUrlText = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211221/bIdfv8t86xrFRpDOeGGHXOmKEuKl.png"
  1977. list[k].ImgUrlText = utils.YAN_XUAN_IMG
  1978. }
  1979. if v.ActivityType == 0 {
  1980. if mapAddress[v.City] != "" {
  1981. list[k].ImgUrl = mapAddress[v.City]
  1982. } else {
  1983. list[k].ImgUrl = mapAddress["其它"]
  1984. }
  1985. } else {
  1986. if mapChart[v.ChartPermissionName] != "" {
  1987. list[k].ImgUrl = mapChart[v.ChartPermissionName]
  1988. }
  1989. }
  1990. expertTxt, _ := services.GetReportContentTextSub(v.Expert)
  1991. list[k].Expert = expertTxt
  1992. if v.IsHideAppointment == 0 {
  1993. list[k].IsShowAppointment = services.IsShowAppointment(v.ActivityTypeId, v.ChartPermissionName)
  1994. }
  1995. if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
  1996. list[k].IsCClassMeeting = true
  1997. }
  1998. mapActivityId = append(mapActivityId, v.ActivityId)
  1999. }
  2000. page := paging.GetPaging(currentIndex, pageSize, total)
  2001. resp := new(models.GetCygxActivityListRep)
  2002. resp.Label = label
  2003. if activityTypeId != "" {
  2004. activityTypeIdint, err := strconv.Atoi(activityTypeId)
  2005. if err == nil {
  2006. detail, errDetail := models.GetActivityTypeDetailById(activityTypeIdint)
  2007. if errDetail != nil {
  2008. br.Msg = "获取信息失败"
  2009. br.ErrMsg = "获取信息失败,Err:" + errDetail.Error()
  2010. return
  2011. }
  2012. resp.ImgUrl = detail.OnlineIco
  2013. resp.Label = detail.ActivityTypeName
  2014. }
  2015. }
  2016. //处理音频回放
  2017. mapActivityVoice, err := services.GetActivityVoiceResp(mapActivityId)
  2018. if err != nil {
  2019. br.Msg = "获取信息失败"
  2020. br.ErrMsg = "GetActivityVoiceResp,Err:" + err.Error()
  2021. return
  2022. }
  2023. //处理视频回放
  2024. mapActivityVideo, err := services.GetActivityVideoResp(mapActivityId)
  2025. if err != nil {
  2026. br.Msg = "获取信息失败"
  2027. br.ErrMsg = "GetActivityVideoResp,Err:" + err.Error()
  2028. return
  2029. }
  2030. //处理不同的报名方式按钮回显
  2031. mapActivitySignup, err := services.GetActivitySignupResp(mapActivityId, user)
  2032. if err != nil {
  2033. br.Msg = "获取信息失败"
  2034. br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
  2035. return
  2036. }
  2037. for _, v := range list {
  2038. if mapDingActivityId[v.ActivityId] == 0 {
  2039. activityList = append(activityList, v)
  2040. }
  2041. v.SignupType = mapActivitySignup[v.ActivityId]
  2042. }
  2043. for k, v := range activityList {
  2044. if mapActivityVoice[v.ActivityId] != nil {
  2045. list[k].FileType = 1
  2046. list[k].AudioLink = true
  2047. list[k].VoiceList = mapActivityVoice[v.ActivityId]
  2048. }
  2049. if mapActivityVideo[v.ActivityId] != nil {
  2050. list[k].FileType = 2
  2051. list[k].AudioLink = true
  2052. list[k].VideoDetail = mapActivityVideo[v.ActivityId]
  2053. }
  2054. //resp.List = append(resp.List, services.ActivityButtonShow(v))
  2055. }
  2056. resp.List = services.ActivityArrButtonShow(activityList)
  2057. // 查研观向7.4-判断标签是否为产业, 为产业时是否跳转资源包
  2058. if label != "" {
  2059. industry, e := models.GetIndustryByName(label)
  2060. if e != nil && e.Error() != utils.ErrNoRow() {
  2061. br.Msg = "获取信息失败"
  2062. br.ErrMsg = "获取标签产业失败, Err:" + e.Error()
  2063. return
  2064. }
  2065. if industry != nil {
  2066. sourceIndustry, e := models.GetSourceIndustryByName(label)
  2067. if e != nil && e.Error() != utils.ErrNoRow() {
  2068. br.Msg = "获取信息失败"
  2069. br.ErrMsg = "获取标签产业资源包失败, Err:" + e.Error()
  2070. return
  2071. }
  2072. if sourceIndustry != nil {
  2073. resp.IndustrialManagementId = sourceIndustry.IndustrialManagementId
  2074. resp.IsJump = true
  2075. // 研选产业不跳资源包
  2076. if sourceIndustry.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
  2077. resp.IsJump = false
  2078. }
  2079. }
  2080. }
  2081. // 新标签
  2082. if activityId > 0 {
  2083. activityIds := []int{activityId}
  2084. activityNewMap, _, e := services.GetActivityNewLabelMap(activityIds)
  2085. if e != nil {
  2086. br.Msg = "获取信息失败"
  2087. br.ErrMsg = "获取活动新标签失败, Err: " + e.Error()
  2088. return
  2089. }
  2090. resp.IndustryNewLabel = activityNewMap[activityId]
  2091. }
  2092. }
  2093. //添加活动搜索记录
  2094. //if keyWord != "" {
  2095. // go services.AddActivitykeyWordSearch(keyWord, user)
  2096. //}
  2097. if activityTypeId == "3" || activityTypeId == "5" {
  2098. resp.IsShowResearchPoints = true
  2099. }
  2100. resp.Paging = page
  2101. br.Ret = 200
  2102. br.Success = true
  2103. br.Msg = "获取成功"
  2104. br.Data = resp
  2105. }
  2106. // @Title 校验活动带问是否有权限
  2107. // @Description 校验活动带问是否有权限接口
  2108. // @Param request body models.ActivityIdRep true "type json string"
  2109. // @Success Ret=200 {object} models.SignupStatus
  2110. // @router /checkAsk [post]
  2111. func (this *ActivityCoAntroller) CheckAsk() {
  2112. br := new(models.BaseResponse).Init()
  2113. defer func() {
  2114. this.Data["json"] = br
  2115. this.ServeJSON()
  2116. }()
  2117. user := this.User
  2118. if user == nil {
  2119. br.Msg = "请登录"
  2120. br.ErrMsg = "请登录,用户信息为空"
  2121. br.Ret = 408
  2122. return
  2123. }
  2124. var signupStatus string
  2125. var req models.ActivityIdRep
  2126. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  2127. if err != nil {
  2128. br.Msg = "参数解析异常!"
  2129. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  2130. return
  2131. }
  2132. activityId := req.ActivityId
  2133. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  2134. if activityInfo == nil {
  2135. br.Msg = "操作失败"
  2136. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  2137. return
  2138. }
  2139. if errInfo != nil {
  2140. br.Msg = "操作失败"
  2141. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  2142. return
  2143. }
  2144. resp := new(models.SignupStatus)
  2145. hasPermission := 0
  2146. havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
  2147. if err != nil {
  2148. br.Msg = "获取信息失败"
  2149. br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
  2150. return
  2151. }
  2152. resp.IsResearchSpecial = isResearchSpecial
  2153. if havePower {
  2154. hasPermission = 1
  2155. signupStatus = "Success"
  2156. //限制人数为1人的专家电话会 用户操作时的消息提示
  2157. if activityInfo.LimitPeopleNum == 1 && activityInfo.ActivityTypeId == 1 {
  2158. resp.HasPermission = hasPermission
  2159. resp.SignupStatus = utils.FULLSTARFFED_MSG
  2160. resp.PopupMsg = utils.ACTIVITY_ZJDHH_V1_MSG
  2161. br.Ret = 200
  2162. br.Success = true
  2163. br.Msg = ""
  2164. br.Data = resp
  2165. return
  2166. }
  2167. resp.HaqveJurisdiction = true
  2168. resp.HasPermission = hasPermission
  2169. resp.SignupStatus = signupStatus
  2170. } else {
  2171. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
  2172. if err != nil {
  2173. br.Msg = "获取信息失败"
  2174. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  2175. return
  2176. }
  2177. resp.PopupMsg = popupMsg
  2178. resp.HasPermission = hasPermission
  2179. resp.SellerName = sellerName
  2180. resp.SellerMobile = sellerMobile
  2181. }
  2182. // 判断是否属于研选类型的活动
  2183. if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  2184. resp.IsResearch = true
  2185. }
  2186. resp.ActivityId = activityId
  2187. br.Ret = 200
  2188. br.Success = true
  2189. br.Data = resp
  2190. }
  2191. // @Title 活动类型下的主题列表(5.3版本)
  2192. // @Description 获取活动类型下的主题列表接口(5.3版本)
  2193. // @Param ChartPermissionIds query string false "行业id 多个用 , 隔开"
  2194. // @Param ActivityTypeIds query string false "活动类型id 多个用 , 隔开"
  2195. // @Param ActiveState query string false "活动进行状态 未开始:1、进行中2、已结束3"
  2196. // @Param WhichDay query string false "哪一天 今天:1、明天:2,多个用 , 隔开"
  2197. // @Param WhichWeek query string false "哪一周 本周:1 上周:2"
  2198. // @Param WhichMonth query string false "哪一月 本月:1 上月:2"
  2199. // @Param WhichMonth query string false "哪一月 本月:1 上月:2"
  2200. // @Param IsPower query int false "是否选择有权限行业 ,1是 0 否 默认0"
  2201. // @Param IsResearch query bool true "是否为研选"
  2202. // @Success 200 {object} models.ActivityTypeListHomeResp
  2203. // @router /labelTypeListV5 [get]
  2204. func (this *ActivityCoAntroller) LabelTypeListV5() {
  2205. br := new(models.BaseResponse).Init()
  2206. defer func() {
  2207. this.Data["json"] = br
  2208. this.ServeJSON()
  2209. }()
  2210. user := this.User
  2211. if user == nil {
  2212. br.Msg = "请登录"
  2213. br.ErrMsg = "请登录,SysUser Is Empty"
  2214. return
  2215. }
  2216. pageSize, _ := this.GetInt("PageSize")
  2217. isPower, _ := this.GetInt("IsPower")
  2218. chartPermissionIds := this.GetString("ChartPermissionIds")
  2219. whichDay := this.GetString("WhichDay")
  2220. activeState := this.GetString("ActiveState")
  2221. isResearch, _ := this.GetBool("IsResearch", false) // 是否为研选 查研观向11.0 (研选活动独立显示)
  2222. //入参为 undefined 时的处理
  2223. if chartPermissionIds == "undefined" {
  2224. chartPermissionIds = ""
  2225. }
  2226. if whichDay == "undefined" {
  2227. whichDay = ""
  2228. }
  2229. if activeState == "undefined" || activeState == "" {
  2230. activeState = "1"
  2231. }
  2232. // 查研观向7.4-始终查询宏观的活动
  2233. if chartPermissionIds != "" {
  2234. chartPermissionIds += ",1"
  2235. }
  2236. userType, _, err := services.GetUserType(user.CompanyId)
  2237. if err != nil {
  2238. br.Msg = "获取失败"
  2239. br.ErrMsg = "获取失败,Err:" + err.Error()
  2240. return
  2241. }
  2242. var startSize int
  2243. pageSize = 1000
  2244. var sortTime string
  2245. var conditioninit string
  2246. var pars []interface{}
  2247. //活动可见限制
  2248. permissionZhengShiStr, err := models.GetCompanyPermissionByUserZhengShi(user.CompanyId)
  2249. if err != nil {
  2250. br.Msg = "获取失败"
  2251. br.ErrMsg = "获取失败,Err:" + err.Error()
  2252. return
  2253. }
  2254. slicePer := strings.Split(permissionZhengShiStr, ",")
  2255. //var permissionSqlStr string
  2256. var permissionNameStr string
  2257. for _, v := range slicePer {
  2258. if userType == 1 {
  2259. //if v != "研选" {
  2260. if !strings.Contains(v, "研选") {
  2261. permissionNameStr += "'" + v + "',"
  2262. }
  2263. } else {
  2264. permissionNameStr += "'" + v + "',"
  2265. }
  2266. }
  2267. permissionNameStr = strings.Replace(permissionNameStr, "(主观)", "", -1)
  2268. permissionNameStr = strings.Replace(permissionNameStr, "(客观)", "", -1)
  2269. permissionNameStr = strings.TrimRight(permissionNameStr, ",")
  2270. if isResearch {
  2271. chartPermissionIds = strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN)
  2272. } else {
  2273. conditioninit += ` AND ( art.chart_permission_id != '` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `' OR ( art.is_show_hz = 1 AND art.chart_permission_id = '` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `') )`
  2274. conditioninit += ` AND IF ( art.active_state = 3, art.chart_permission_id != ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `, 1 = 1 ) ` //V 11.0 研选活动结束后就不在已结束页面展示了
  2275. }
  2276. //行业名称
  2277. //易董过来的会,按照 副行业来筛选
  2278. if len(chartPermissionIds) > 0 {
  2279. //conditioninit += ` AND art.chart_permission_id IN (` + chartPermissionIds + `)`
  2280. conditioninit += ` AND IF ( art.yidong_activity_id != '' , art.chart_permission_id_deputy IN (` + chartPermissionIds + `) ,1=1 ) `
  2281. conditioninit += ` AND IF ( art.yidong_activity_id = '' , art.chart_permission_id IN (` + chartPermissionIds + `) ,1=1 ) `
  2282. }
  2283. //哪一天
  2284. if whichDay != "" {
  2285. var startDate string
  2286. var endDate string
  2287. if whichDay == "1" {
  2288. startDate = time.Now().Format(utils.FormatDate)
  2289. endDate = startDate
  2290. } else if whichDay == "2" {
  2291. startDate = time.Now().AddDate(0, 0, +1).Format(utils.FormatDate)
  2292. endDate = startDate
  2293. } else if whichDay == "3" {
  2294. startDate = utils.GetNowWeekMonday().Format(utils.FormatDate)
  2295. endDate = utils.GetNowWeekSunday().Format(utils.FormatDate)
  2296. } else if whichDay == "4" {
  2297. startDate = utils.GetLastWeekMonday().Format(utils.FormatDate)
  2298. endDate = utils.GetLastWeekSunday().Format(utils.FormatDate)
  2299. } else if whichDay == "5" {
  2300. startDate = utils.GetNowMonthFirstDay().Format(utils.FormatDate)
  2301. endDate = utils.GetNowMonthLastDay().Format(utils.FormatDate)
  2302. } else if whichDay == "6" {
  2303. startDate = utils.GetLastMonthFirstDay().Format(utils.FormatDate)
  2304. endDate = utils.GetLastMonthLastDay().Format(utils.FormatDate)
  2305. } else if whichDay == "1,2" {
  2306. startDate = time.Now().Format(utils.FormatDate)
  2307. endDate = time.Now().AddDate(0, 0, +1).Format(utils.FormatDate)
  2308. } else if whichDay == "3,4" {
  2309. startDate = utils.GetLastWeekMonday().Format(utils.FormatDate)
  2310. endDate = utils.GetNowWeekSunday().Format(utils.FormatDate)
  2311. } else if whichDay == "5,6" {
  2312. startDate = utils.GetLastMonthFirstDay().Format(utils.FormatDate)
  2313. endDate = utils.GetNowMonthLastDay().Format(utils.FormatDate)
  2314. } else {
  2315. startDate = time.Now().Format(utils.FormatDate)
  2316. endDate = time.Now().AddDate(0, 0, +1).Format(utils.FormatDate)
  2317. }
  2318. conditioninit += ` AND art.activity_time >= ` + "'" + startDate + " 00:00:00'"
  2319. conditioninit += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
  2320. }
  2321. //活动状态搜索
  2322. if activeState != "" {
  2323. // 默认查看未开始跟进行中
  2324. if activeState == "1" {
  2325. conditioninit += ` AND art.active_state IN (1,2)`
  2326. } else {
  2327. conditioninit += ` AND art.active_state IN (` + activeState + `)`
  2328. }
  2329. } else {
  2330. conditioninit += ` AND art.active_state IN (1,2)`
  2331. }
  2332. var condition string
  2333. //conditionActivity, err := services.GetActivityonditionList(user, "", chartPermissionIds, whichDay, activeState, "", isPower, 0, "", 0, 1)
  2334. conditionActivity, err := services.ActivityConditioninitSql(user, conditioninit, isPower)
  2335. if err != nil && err.Error() != utils.ErrNoRow() {
  2336. br.Msg = "获取失败"
  2337. br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
  2338. return
  2339. }
  2340. //condition += `AND art.is_limit_people = 1 ` + conditionActivity
  2341. condition += conditionActivity
  2342. sortTime = ` mintimesort ASC `
  2343. listActivity, err := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
  2344. if err != nil {
  2345. br.Msg = "获取失败"
  2346. br.ErrMsg = "获取失败,Err:" + err.Error()
  2347. return
  2348. }
  2349. mapCity, err := services.GetActivityCityResp()
  2350. if err != nil {
  2351. br.Msg = "获取失败"
  2352. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  2353. return
  2354. }
  2355. mapActivity := make(map[int][]*models.CygxActivityLabelList)
  2356. mapkeyWord := make(map[string]string)
  2357. activityPointsByUserAllMap := services.GetActivityPointsByUserAllMap() // 获取对用户进行研选扣点的活动
  2358. for _, v := range listActivity {
  2359. if v.KeyWord == "" {
  2360. continue
  2361. }
  2362. // 如果是C类电话会就不展示内容,且合并到分析师电话会
  2363. if v.ActivityTypeId == 7 {
  2364. v.ActivityTypeId = 2
  2365. }
  2366. // 如果是买方线下交流的活动,合并到专家线下交流
  2367. if v.ActivityTypeId == 8 {
  2368. v.ActivityTypeId = 5
  2369. }
  2370. item := new(models.CygxActivityLabelList)
  2371. item.IsResearchPoints = activityPointsByUserAllMap[v.ActivityId]
  2372. item.City = mapCity[fmt.Sprint(v.KeyWord, "{|}", v.ActivityTypeId)]
  2373. item.KeyWord = services.LabelStrV5(v.KeyWord, v.IsShowSubjectName, v.TemporaryLabel)
  2374. if _, ok := mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", item.KeyWord)]; ok {
  2375. continue
  2376. }
  2377. item.Resource = 1
  2378. item.ActivityId = v.ActivityId
  2379. if v.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
  2380. item.IsResearch = true
  2381. }
  2382. //易董同步过来的活动只展示外部资源标签
  2383. if v.YidongActivityId != "" {
  2384. item.IsResearchPoints = false
  2385. item.IsResearch = false
  2386. }
  2387. item.IsExternalLabel = v.IsExternalLabel
  2388. mapActivity[v.ActivityTypeId] = append(mapActivity[v.ActivityTypeId], item)
  2389. mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", item.KeyWord)] = item.KeyWord
  2390. }
  2391. //
  2392. var conditionType string
  2393. var parsType []interface{}
  2394. if isResearch {
  2395. conditionType = " AND source_type IN (0,2) "
  2396. } else {
  2397. conditionType = " AND source_type IN (0,1) "
  2398. }
  2399. list, err := models.GetActivityTypeHomeList(conditionType, parsType)
  2400. if err != nil {
  2401. br.Msg = "获取失败"
  2402. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  2403. return
  2404. }
  2405. resp := new(models.ActivityTypeListHomeResp)
  2406. for k, v := range list {
  2407. if len(mapActivity[v.ActivityTypeId]) > 0 {
  2408. for _, v2 := range mapActivity[v.ActivityTypeId] {
  2409. v2.ImgUrlBg = v.ImgUrlBgs
  2410. }
  2411. }
  2412. list[k].List = mapActivity[v.ActivityTypeId]
  2413. list[k].Resource = 1
  2414. }
  2415. //获取对应活动的数量并排序
  2416. activityIds := make([]int, 0) // 用于查询活动【新】标签Map
  2417. intArr := make([]int, 0)
  2418. var items []*models.ActivityTypeHome
  2419. for _, v := range list {
  2420. item := new(models.ActivityTypeHome)
  2421. if len(v.List) > 0 {
  2422. for i := range v.List {
  2423. activityIds = append(activityIds, v.List[i].ActivityId)
  2424. }
  2425. item.List = v.List
  2426. item.ActivityTypeName = v.ActivityTypeName
  2427. item.ActivityTypeId = v.ActivityTypeId
  2428. item.ImgUrlBg = v.ImgUrlBg
  2429. item.ImgUrl = v.ImgUrl
  2430. item.Resource = v.Resource
  2431. items = append(items, item)
  2432. intArr = append(intArr, len(v.List))
  2433. }
  2434. }
  2435. sort.Sort(sort.Reverse(sort.IntSlice(intArr)))
  2436. // 活动【新】标签Map
  2437. newLabelMap, _, e := services.GetActivityNewLabelMap(activityIds)
  2438. if e != nil {
  2439. br.Msg = "获取失败"
  2440. br.ErrMsg = "获取活动【新】标签Map失败, Err: " + e.Error()
  2441. return
  2442. }
  2443. for k, _ := range list {
  2444. for k2 := range list[k].List {
  2445. list[k].List[k2].IsNew = newLabelMap[list[k].List[k2].ActivityId]
  2446. }
  2447. }
  2448. var itemsNew []*models.ActivityTypeHome
  2449. activityMap := make(map[int]int)
  2450. for _, v := range intArr {
  2451. for _, v2 := range items {
  2452. item := new(models.ActivityTypeHome)
  2453. if len(v2.List) > 0 && v == len(v2.List) && activityMap[v2.ActivityTypeId] == 0 {
  2454. item.List = v2.List
  2455. item.ActivityTypeName = v2.ActivityTypeName
  2456. item.ActivityTypeId = v2.ActivityTypeId
  2457. item.ImgUrlBg = v2.ImgUrlBg
  2458. item.ImgUrl = v2.ImgUrl
  2459. item.Resource = v2.Resource
  2460. itemsNew = append(itemsNew, item)
  2461. activityMap[v2.ActivityTypeId] = len(v2.List)
  2462. }
  2463. }
  2464. }
  2465. var lenList int
  2466. //按照像素进行排序
  2467. rowHeight := 83 //每一行的行高
  2468. basicsHeight := 178 // 基础高度
  2469. position := 1 // 初始化位置 ,1,左边, 2 右边
  2470. var leftPx, rightPx int
  2471. for k, v := range itemsNew {
  2472. if leftPx <= rightPx {
  2473. position = 1
  2474. } else {
  2475. position = 2
  2476. }
  2477. itemsNew[k].Position = position
  2478. lenList = len(v.List)
  2479. if lenList > 8 {
  2480. lenList = 8
  2481. }
  2482. if position == 1 {
  2483. leftPx += basicsHeight + rowHeight*lenList
  2484. if lenList > 8 {
  2485. lenList = leftPx - 41
  2486. }
  2487. } else {
  2488. rightPx += basicsHeight + rowHeight*lenList
  2489. if lenList > 8 {
  2490. lenList = leftPx - 41
  2491. }
  2492. }
  2493. }
  2494. //研选互动不展示专项产业调研
  2495. if !isResearch {
  2496. //专项产业调研未开始状态不查询
  2497. if activeState == "1" {
  2498. activeState = ""
  2499. }
  2500. conditionActivitySpecial := services.ActivityLabelSpecialSql(chartPermissionIds, whichDay, activeState)
  2501. //查询专项产业调研展示权限 仅对大套餐客户跟永续客户展示
  2502. //if whichDay == "" {
  2503. //speciaItem, err := services.GetActivityLabelSpecialList(user, isPower, chartPermissionIds, permissionNameStr)
  2504. speciaItem, err := services.GetActivityLabelSpecialList(user, conditionActivitySpecial, activeState)
  2505. if err != nil {
  2506. br.Msg = "获取失败"
  2507. br.ErrMsg = "获取失败,Err:" + err.Error()
  2508. return
  2509. }
  2510. if speciaItem != nil {
  2511. if leftPx > rightPx {
  2512. speciaItem.Position = 2
  2513. } else {
  2514. speciaItem.Position = 1
  2515. }
  2516. if len(speciaItem.List) > 0 {
  2517. itemsNew = append(itemsNew, speciaItem)
  2518. }
  2519. }
  2520. //}
  2521. }
  2522. //记录用户搜索的筛选条件
  2523. item := new(models.CygxActivitySearchHistory)
  2524. item.UserId = user.UserId
  2525. item.Mobile = user.Mobile
  2526. item.CompanyId = user.CompanyId
  2527. item.CompanyName = user.CompanyName
  2528. item.CreateTime = time.Now()
  2529. item.ChartPermissionIds = chartPermissionIds
  2530. item.IsPower = isPower
  2531. item.WhichDay = whichDay
  2532. go models.AddCygxActivitySearchHistory(item)
  2533. resp.List = itemsNew
  2534. br.Ret = 200
  2535. br.Success = true
  2536. br.Msg = "获取成功"
  2537. br.Data = resp
  2538. }
  2539. // @Title 专项产业调研列表
  2540. // @Description 获取专项产业调研列表接口
  2541. // @Param PageSize query int true "每页数据条数"
  2542. // @Param CurrentIndex query int true "当前页页码,从1开始"
  2543. // @Success 200 {object} models.GetCygxActivitySpecialDetailListResp
  2544. // @router /special/del_list [get]
  2545. func (this *ActivityCoAntroller) SpecialList() {
  2546. br := new(models.BaseResponse).Init()
  2547. defer func() {
  2548. this.Data["json"] = br
  2549. this.ServeJSON()
  2550. }()
  2551. user := this.User
  2552. if user == nil {
  2553. br.Msg = "请登录"
  2554. br.ErrMsg = "请登录,SysUser Is Empty"
  2555. return
  2556. }
  2557. uid := user.UserId
  2558. pageSize, _ := this.GetInt("PageSize")
  2559. currentIndex, _ := this.GetInt("CurrentIndex")
  2560. userType, permissionStr, err := services.GetUserType(user.CompanyId)
  2561. var startSize int
  2562. if pageSize <= 0 {
  2563. pageSize = utils.PageSize20
  2564. }
  2565. if currentIndex <= 0 {
  2566. currentIndex = 1
  2567. }
  2568. startSize = utils.StartIndex(currentIndex, pageSize)
  2569. var condition string
  2570. var pars []interface{}
  2571. //活动可见限制
  2572. var sqlExport string
  2573. slicePer := strings.Split(permissionStr, ",")
  2574. var permissionSqlStr string
  2575. for _, v := range slicePer {
  2576. if userType == 1 {
  2577. //if v != "研选" {
  2578. if !strings.Contains(v, "研选") {
  2579. permissionSqlStr += "'" + v + "',"
  2580. }
  2581. } else {
  2582. permissionSqlStr += "'" + v + "',"
  2583. }
  2584. }
  2585. //判断客户规模是否属于可见范围的活动
  2586. companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
  2587. if err != nil && err.Error() != utils.ErrNoRow() {
  2588. br.Msg = "获取信息失败"
  2589. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  2590. return
  2591. }
  2592. permissionSqlStr = strings.TrimRight(permissionSqlStr, ",")
  2593. permissionSqlStr = strings.Replace(permissionSqlStr, "(主观)", "", -1)
  2594. permissionSqlStr = strings.Replace(permissionSqlStr, "(客观)", "", -1)
  2595. permissionSqlStr = ` AND art.chart_permission_name IN (` + permissionSqlStr + `)`
  2596. sqlExport = ` AND (art.customer_type_ids LIKE '%` + strconv.Itoa(userType) + `%' `
  2597. if userType == 2 {
  2598. sqlExport += ` OR art.customer_type_ids LIKE '%3%' `
  2599. }
  2600. if (userType == 2 || userType == 3) && strings.Contains(permissionStr, "专家") {
  2601. sqlExport += ` OR art.customer_type_ids LIKE '%4%' `
  2602. }
  2603. sqlExport += `) `
  2604. condition += ` AND art.publish_status = 1 `
  2605. condition = ` AND art.publish_status = 1 AND art.label != '' `
  2606. var conditionOr string
  2607. if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
  2608. conditionOr += ` OR (1=1 AND art.customer_type_ids LIKE '%4%' ` + condition + `) `
  2609. }
  2610. if (userType == 5) && strings.Contains(permissionStr, "专家") {
  2611. conditionOr += ` OR (1=1 AND art.customer_type_ids LIKE '%5%' ` + condition + `) `
  2612. }
  2613. if userType == 1 {
  2614. conditionOr += ` OR ( 1=1` + condition + permissionSqlStr + `) `
  2615. }
  2616. if companyProduct != nil {
  2617. if companyProduct.Scale != "" {
  2618. conditionOr += ` OR ( art.scale LIKE '%` + companyProduct.Scale + `%' ` + condition + `) `
  2619. }
  2620. }
  2621. if companyProduct != nil {
  2622. if companyProduct.Scale != "" {
  2623. conditionOr += ` OR ( art.scale LIKE '%` + companyProduct.Scale + `%' ` + condition + `) `
  2624. }
  2625. }
  2626. condition += sqlExport + conditionOr
  2627. total, err := models.GetActivitySpecialCount(condition, pars)
  2628. if err != nil {
  2629. br.Msg = "获取失败"
  2630. br.ErrMsg = "获取失败,Err:" + err.Error()
  2631. return
  2632. }
  2633. list, errList := models.GetCygxActivitySpecialDetailList(condition, pars, uid, startSize, pageSize)
  2634. if errList != nil {
  2635. br.Msg = "获取失败"
  2636. br.ErrMsg = "获取失败,Err:" + errList.Error()
  2637. return
  2638. }
  2639. detail, err := models.GetConfigByCode("city_img_url")
  2640. if err != nil {
  2641. br.Msg = "获取数据失败"
  2642. br.ErrMsg = "城市配置信息失败,Err:" + err.Error()
  2643. return
  2644. }
  2645. detailChart, err := models.GetConfigByCode("chart_img_url")
  2646. if err != nil {
  2647. br.Msg = "获取数据失败"
  2648. br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
  2649. return
  2650. }
  2651. addressList := strings.Split(detail.ConfigValue, "{|}")
  2652. mapAddress := make(map[string]string)
  2653. chartList := strings.Split(detailChart.ConfigValue, "{|}")
  2654. mapChart := make(map[string]string)
  2655. var cityName string
  2656. var chartName string
  2657. var imgUrl string
  2658. var imgUrlChart string
  2659. for _, v := range addressList {
  2660. vslice := strings.Split(v, "_")
  2661. cityName = vslice[0]
  2662. imgUrl = vslice[len(vslice)-1]
  2663. mapAddress[cityName] = imgUrl
  2664. }
  2665. for _, v := range chartList {
  2666. vslice := strings.Split(v, "_")
  2667. chartName = vslice[0]
  2668. imgUrlChart = vslice[len(vslice)-1]
  2669. mapChart[chartName] = imgUrlChart
  2670. }
  2671. for k, v := range list {
  2672. list[k].ImgUrlText = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211221/bIdfv8t86xrFRpDOeGGHXOmKEuKl.png"
  2673. if mapChart[v.ChartPermissionName] != "" {
  2674. list[k].ImgUrl = mapChart[v.ChartPermissionName]
  2675. }
  2676. list[k].ActivityTypeName = "专项调研"
  2677. }
  2678. page := paging.GetPaging(currentIndex, pageSize, total)
  2679. resp := new(models.GetCygxActivitySpecialDetailListResp)
  2680. count, err := models.GetCygxUserFollowSpecial(user.UserId)
  2681. if err != nil {
  2682. br.Msg = "获取数据失败!"
  2683. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  2684. return
  2685. }
  2686. if count == 1 && user.UserId > 0 {
  2687. resp.IsFollow = true
  2688. }
  2689. if user.Mobile != "" {
  2690. resp.IsBindingMobile = true
  2691. }
  2692. resp.List = list
  2693. resp.Paging = page
  2694. br.Ret = 200
  2695. br.Success = true
  2696. br.Msg = "获取成功"
  2697. br.Data = resp
  2698. }
  2699. // @Title 专项产业调研详情
  2700. // @Description 获取专项产业调研详情接口
  2701. // @Param ActivityId query int true "活动ID"
  2702. // @Success Ret=200 {object} models.CygxActivitySpecialResp
  2703. // @router /special/detail [get]
  2704. func (this *ActivityCoAntroller) SpecialDetail() {
  2705. br := new(models.BaseResponse).Init()
  2706. defer func() {
  2707. this.Data["json"] = br
  2708. this.ServeJSON()
  2709. }()
  2710. user := this.User
  2711. if user == nil {
  2712. br.Msg = "请登录"
  2713. br.ErrMsg = "请登录,用户信息为空"
  2714. br.Ret = 408
  2715. return
  2716. }
  2717. uid := user.UserId
  2718. activityId, _ := this.GetInt("ActivityId")
  2719. if activityId < 1 {
  2720. br.Msg = "请输入活动ID"
  2721. return
  2722. }
  2723. resp := new(models.CygxActivitySpecialResp)
  2724. hasPermission := 0
  2725. activityInfo, err := models.GetCygxActivitySpecialDetailById(uid, activityId)
  2726. if err != nil && err.Error() != utils.ErrNoRow() {
  2727. br.Msg = "获取信息失败"
  2728. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  2729. return
  2730. }
  2731. if activityInfo == nil {
  2732. br.Msg = "活动不存在"
  2733. br.ErrMsg = "活动ID错误,Err:" + "activityId:" + strconv.Itoa(activityId)
  2734. return
  2735. }
  2736. applyCount, err := models.GetApplyRecordCount(uid)
  2737. if err != nil && err.Error() != utils.ErrNoRow() {
  2738. br.Msg = "获取信息失败"
  2739. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  2740. return
  2741. }
  2742. //获取FICC销售信息 如果是FICC的客户类型,则默认他申请过
  2743. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
  2744. if err != nil && err.Error() != utils.ErrNoRow() {
  2745. br.Msg = "获取信息失败"
  2746. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  2747. return
  2748. }
  2749. if user.CompanyId <= 1 {
  2750. //companyDetailStatus = ""
  2751. } else {
  2752. companyPermission, err := models.GetCompanyPermission(user.CompanyId)
  2753. if err != nil {
  2754. br.Msg = "获取信息失败"
  2755. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  2756. return
  2757. }
  2758. if companyPermission == "" {
  2759. if applyCount > 0 {
  2760. hasPermission = 4
  2761. } else {
  2762. if sellerItem != nil {
  2763. hasPermission = 5
  2764. } else {
  2765. //获取权益销售信息 如果是FICC的客户类型,则默认他申请过
  2766. sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  2767. if err != nil && err.Error() != utils.ErrNoRow() {
  2768. br.Msg = "获取信息失败"
  2769. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  2770. return
  2771. }
  2772. if sellerItemQy != nil {
  2773. hasPermission = 2
  2774. resp.SellerMobile = sellerItemQy.Mobile
  2775. resp.SellerName = sellerItemQy.RealName
  2776. } else {
  2777. hasPermission = 3
  2778. }
  2779. }
  2780. }
  2781. resp.HasPermission = hasPermission
  2782. resp.OperationMode = "Apply"
  2783. resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
  2784. br.Ret = 200
  2785. br.Success = true
  2786. br.Msg = "获取成功"
  2787. br.Data = resp
  2788. return
  2789. }
  2790. companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
  2791. if err != nil {
  2792. br.Msg = "获取信息失败!"
  2793. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  2794. return
  2795. }
  2796. if companyDetail == nil {
  2797. br.Msg = "获取信息失败!"
  2798. br.ErrMsg = "客户不存在,uid:" + strconv.Itoa(user.UserId) + "CompanyId:" + strconv.Itoa(user.CompanyId)
  2799. return
  2800. }
  2801. }
  2802. userType, permissionStr, err := services.GetUserType(user.CompanyId)
  2803. if err != nil {
  2804. br.Msg = "获取信息失败"
  2805. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  2806. return
  2807. }
  2808. itemAct := new(models.ActivityDetail)
  2809. itemAct.CustomerTypeIds = activityInfo.CustomerTypeIds
  2810. noPower, err := services.GetShareNoPowe(itemAct, permissionStr, userType, user)
  2811. if err != nil {
  2812. br.Msg = "获取信息失败"
  2813. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  2814. return
  2815. }
  2816. //获取用户的产业规模,判断是否允许可见
  2817. companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
  2818. if err != nil && err.Error() != utils.ErrNoRow() {
  2819. br.Msg = "获取信息失败"
  2820. br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  2821. return
  2822. }
  2823. if companyProduct != nil {
  2824. if companyProduct.Scale != "" {
  2825. if strings.Count(activityInfo.Scale, companyProduct.Scale) > 0 {
  2826. noPower = false
  2827. }
  2828. }
  2829. }
  2830. if noPower {
  2831. br.Msg = "您暂无查看该活动权限"
  2832. br.ErrMsg = "被分享客户不可见,获取信息失败"
  2833. br.IsSendEmail = false
  2834. return
  2835. }
  2836. if userType == 1 && strings.Contains(activityInfo.ChartPermissionName, "研选") {
  2837. br.Msg = "您暂无查看该活动权限"
  2838. br.ErrMsg = "被分享客户不可见,永续客户无法查看研选行业"
  2839. return
  2840. }
  2841. //判断是否已经申请过
  2842. if user.CompanyId > 1 {
  2843. permissionStr, err := models.GetCompanyPermissionByUser(user.CompanyId)
  2844. if err != nil {
  2845. br.Msg = "获取信息失败"
  2846. br.ErrMsg = "获取客户权限信息失败,Err:" + err.Error()
  2847. return
  2848. }
  2849. companyItem, err := models.GetCompanyDetailById(user.CompanyId)
  2850. //冻结客户
  2851. if err != nil {
  2852. if err.Error() == utils.ErrNoRow() {
  2853. if applyCount > 0 {
  2854. hasPermission = 4
  2855. } else {
  2856. if sellerItem != nil {
  2857. hasPermission = 5
  2858. } else {
  2859. //获取权益销售信息 如果是FICC的客户类型,则默认他申请过
  2860. sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  2861. if err != nil && err.Error() != utils.ErrNoRow() {
  2862. br.Msg = "获取信息失败"
  2863. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  2864. return
  2865. }
  2866. if sellerItemQy != nil {
  2867. hasPermission = 2
  2868. resp.SellerMobile = sellerItemQy.Mobile
  2869. resp.SellerName = sellerItemQy.RealName
  2870. } else {
  2871. hasPermission = 3
  2872. }
  2873. }
  2874. }
  2875. resp.HasPermission = hasPermission
  2876. resp.OperationMode = "Apply"
  2877. resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
  2878. br.Ret = 200
  2879. br.Success = true
  2880. br.Msg = "获取成功"
  2881. br.Data = resp
  2882. return
  2883. } else {
  2884. br.Msg = "获取信息失败"
  2885. br.ErrMsg = "获取客户公司信息失败,Err:" + err.Error()
  2886. return
  2887. }
  2888. }
  2889. var havePower bool
  2890. if strings.Contains(permissionStr, activityInfo.ActivityTypeName) {
  2891. havePower = true
  2892. }
  2893. if havePower {
  2894. hasPermission = 1
  2895. resp.HaqveJurisdiction = true
  2896. } else {
  2897. if permissionStr == "专家" {
  2898. resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
  2899. resp.MsgType = "Type"
  2900. } else {
  2901. resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
  2902. resp.MsgType = "Industry"
  2903. }
  2904. if companyItem.ProductId == 2 {
  2905. resp.SellerMobile = companyItem.Mobile
  2906. resp.SellerName = companyItem.SellerName
  2907. resp.OperationMode = "Call"
  2908. hasPermission = 2
  2909. } else {
  2910. hasPermission = 5
  2911. }
  2912. }
  2913. } else { //潜在客户
  2914. if applyCount > 0 {
  2915. hasPermission = 4
  2916. } else {
  2917. if sellerItem != nil {
  2918. hasPermission = 5
  2919. } else {
  2920. hasPermission = 3
  2921. }
  2922. }
  2923. resp.OperationMode = "Apply"
  2924. resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
  2925. }
  2926. if hasPermission == 1 {
  2927. count, err := models.GetCygxUserFollowSpecial(user.UserId)
  2928. if err != nil {
  2929. br.Msg = "获取数据失败!"
  2930. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  2931. return
  2932. }
  2933. if count == 1 {
  2934. resp.IsFollow = true
  2935. }
  2936. activityInfo.ActivityTypeName = "专项调研"
  2937. resp.Detail = activityInfo
  2938. }
  2939. resp.HasPermission = hasPermission
  2940. br.Ret = 200
  2941. br.Success = true
  2942. br.Msg = "获取成功"
  2943. br.Data = resp
  2944. }
  2945. // @Title 感兴趣、不感兴趣
  2946. // @Description 感兴趣、不感兴趣接口
  2947. // @Param request body models.ActivityIdRep true "type json string"
  2948. // @Success Ret=200 {object} models.SignupSpecialStatus
  2949. // @router /special/signup/add [post]
  2950. func (this *ActivityCoAntroller) SpecialSignupAdd() {
  2951. br := new(models.BaseResponse).Init()
  2952. defer func() {
  2953. this.Data["json"] = br
  2954. this.ServeJSON()
  2955. }()
  2956. user := this.User
  2957. if user == nil {
  2958. br.Msg = "请登录"
  2959. br.ErrMsg = "请登录,用户信息为空"
  2960. br.Ret = 408
  2961. return
  2962. }
  2963. uid := user.UserId
  2964. var req models.ActivityIdRep
  2965. resp := new(models.SignupSpecialStatus)
  2966. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  2967. if err != nil {
  2968. br.Msg = "参数解析异常!"
  2969. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  2970. return
  2971. }
  2972. activityId := req.ActivityId
  2973. activityInfo, errInfo := models.GetCygxActivitySpecialDetail(activityId)
  2974. if activityInfo == nil {
  2975. br.Msg = "操作失败"
  2976. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  2977. return
  2978. }
  2979. if errInfo != nil {
  2980. br.Msg = "操作失败"
  2981. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  2982. return
  2983. }
  2984. //havePower, err := services.GetSpecialDetailUserPower(user, activityInfo)
  2985. //if err != nil {
  2986. // br.Msg = "获取信息失败"
  2987. // br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  2988. // return
  2989. //}
  2990. var havePower bool
  2991. havePower = true
  2992. //判断有没有对应的权限,如果没有则给出对应的状态码
  2993. if havePower {
  2994. resp.HasPermission = 1
  2995. total, err := models.GetUserCygxActivitySpecialSignup(user.UserId, activityId)
  2996. if err != nil {
  2997. br.Msg = "获取信息失败"
  2998. br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
  2999. return
  3000. }
  3001. resp.SignupStatus = 1
  3002. //判断是删除还是添加
  3003. if total == 0 {
  3004. //获取销售信息
  3005. sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  3006. if err != nil {
  3007. br.Msg = "操作失败"
  3008. br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
  3009. return
  3010. }
  3011. item := new(models.CygxActivitySpecialSignup)
  3012. item.UserId = uid
  3013. item.RealName = user.RealName
  3014. item.ActivityId = activityId
  3015. item.CreateTime = time.Now()
  3016. item.Mobile = user.Mobile
  3017. item.Email = user.Email
  3018. item.CompanyId = user.CompanyId
  3019. item.CompanyName = user.CompanyName
  3020. if sellerItem != nil {
  3021. item.SellerName = sellerItem.RealName
  3022. }
  3023. err = models.AddCygxActivitySpecialSignup(item)
  3024. if err != nil {
  3025. br.Msg = "操作失败"
  3026. br.ErrMsg = "操作失败,Err:" + err.Error()
  3027. return
  3028. }
  3029. resp.Status = 1
  3030. resp.PopupMsg = "感谢反馈"
  3031. resp.PopupMsg2 = "此调研具体行程尚未确认,待预报名人数满10人后弘则会确定行程并推送给您活动日期,只有在确认行程中再次报名才完成占位。"
  3032. //给所属销售发送消息
  3033. //if sellerItem.Mobile != "" {
  3034. // openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
  3035. // if openIpItem != nil && openIpItem.OpenId != "" {
  3036. // if sellerItem != nil {
  3037. // go services.SendSpecialTemplateMsg(user.RealName+"【"+user.CompanyName+"】", time.Now().Format(utils.FormatDateTime), user.Mobile, activityInfo.ResearchTheme, "sale", openIpItem)
  3038. // }
  3039. // }
  3040. //}
  3041. // 给芳姐发消息
  3042. //cnf, _ := models.GetConfigByCode("tpl_msg")
  3043. actList, _ := models.GetActivityListSpecialByActivityId(activityId)
  3044. //if cnf != nil {
  3045. // openIpItem, _ := models.GetUserRecordByMobile(4, cnf.ConfigValue)
  3046. // if openIpItem != nil && openIpItem.OpenId != "" {
  3047. // if len(actList) == 5 {
  3048. // var companyName string
  3049. // for _, v := range actList {
  3050. // companyName += "【" + v.CompanyName + "】"
  3051. // }
  3052. // go services.SendSpecialTemplateMsg(companyName, "", "", activityInfo.ResearchTheme, "", openIpItem)
  3053. // }
  3054. // }
  3055. //}
  3056. //感兴趣人数到达10人时,模板消息发送给活动负责人
  3057. if len(actList) == 10 {
  3058. go services.SendWxMsgActivitySpecial10(activityInfo)
  3059. }
  3060. //用户专项调研操作行为,模板消息推送
  3061. //go services.SpecialActivityUserRemind(user, activityInfo, 1)
  3062. //用户相关行为,给对应销售发模板消息
  3063. go services.ActivitySpecialUserRmind(user, activityId, 1)
  3064. } else {
  3065. err = models.DeleteCygxActivitySpecialSignup(user.UserId, activityId)
  3066. if err != nil {
  3067. br.Msg = "操作失败"
  3068. br.ErrMsg = "操作失败,Err:" + err.Error()
  3069. return
  3070. }
  3071. resp.Status = 2
  3072. }
  3073. } else {
  3074. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
  3075. if err != nil {
  3076. br.Msg = "获取信息失败"
  3077. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  3078. return
  3079. }
  3080. resp.PopupMsg = popupMsg
  3081. resp.HasPermission = hasPermission
  3082. resp.SellerName = sellerName
  3083. resp.SellerMobile = sellerMobile
  3084. }
  3085. br.Ret = 200
  3086. br.Success = true
  3087. br.Msg = "操作成功"
  3088. br.Data = resp
  3089. }
  3090. // @Title 新调研通知取消跟添加
  3091. // @Description 新调研通知取消跟添加接口
  3092. // @Param request body models.ArticleCollectResp true "type json string"
  3093. // @Success 200
  3094. // @router /special/follow [post]
  3095. func (this *ActivityCoAntroller) SpecialMsg() {
  3096. br := new(models.BaseResponse).Init()
  3097. defer func() {
  3098. this.Data["json"] = br
  3099. this.ServeJSON()
  3100. }()
  3101. user := this.User
  3102. if user == nil {
  3103. br.Msg = "请重新登录"
  3104. br.Ret = 408
  3105. return
  3106. }
  3107. resp := new(models.ArticleCollectResp)
  3108. count, err := models.GetCygxUserFollowSpecial(user.UserId)
  3109. if err != nil {
  3110. br.Msg = "获取数据失败!"
  3111. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  3112. return
  3113. }
  3114. if count == 0 {
  3115. item := new(models.CygxUserFollowSpecial)
  3116. item.UserId = user.UserId
  3117. item.RealName = user.RealName
  3118. item.CreateTime = time.Now()
  3119. item.Mobile = user.Mobile
  3120. item.Email = user.Email
  3121. item.CompanyId = user.CompanyId
  3122. item.CompanyName = user.CompanyName
  3123. item.CreateTime = time.Now()
  3124. err := models.AddUserFollowSpecial(item)
  3125. if err != nil {
  3126. br.Msg = "操作失败!"
  3127. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  3128. return
  3129. }
  3130. resp.Status = 1
  3131. } else {
  3132. err := models.DeleteCygxUserFollowSpecial(user.UserId)
  3133. if err != nil {
  3134. br.Msg = "操作失败!"
  3135. br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
  3136. return
  3137. }
  3138. resp.Status = 2
  3139. }
  3140. br.Ret = 200
  3141. br.Data = resp
  3142. br.Success = true
  3143. br.Msg = "操作成功!"
  3144. }
  3145. // @Title 活动类型下的主题列表(6.0Pc版本)
  3146. // @Description 获取活动类型下的主题列表接口(6.0Pc版本)
  3147. // @Param ChartPermissionIds query string false "行业id 多个用 , 隔开"
  3148. // @Param ActivityTypeIds query string false "活动类型id 多个用 , 隔开"
  3149. // @Param ActiveState query string false "活动进行状态 未开始:1、进行中2、已结束3"
  3150. // @Param WhichDay query string false "哪一天 今天:1、明天:2,多个用 , 隔开"
  3151. // @Param IsPower query int false "是否选择有权限行业 ,1是 0 否 默认0"
  3152. // @Success 200 {object} models.ActivityTypeListHomeRespPc
  3153. // @router /labelTypeListV6Pc_del [get]
  3154. func (this *ActivityCoAntroller) LabelTypeListV6Pc() {
  3155. br := new(models.BaseResponse).Init()
  3156. defer func() {
  3157. this.Data["json"] = br
  3158. this.ServeJSON()
  3159. }()
  3160. user := this.User
  3161. if user == nil {
  3162. br.Msg = "请登录"
  3163. br.ErrMsg = "请登录,SysUser Is Empty"
  3164. return
  3165. }
  3166. pageSize, _ := this.GetInt("PageSize")
  3167. isPower, _ := this.GetInt("IsPower")
  3168. playBack, _ := this.GetInt("PlayBack")
  3169. //currentIndex, _ := this.GetInt("CurrentIndex")
  3170. chartPermissionIds := this.GetString("ChartPermissionIds")
  3171. //activityTypeIds := this.GetString("ActivityTypeIds")
  3172. whichDay := this.GetString("WhichDay")
  3173. activeState := this.GetString("ActiveState")
  3174. //入参为 undefined 时的处理
  3175. if chartPermissionIds == "undefined" {
  3176. chartPermissionIds = ""
  3177. }
  3178. // 查研观向7.4-始终查询宏观的活动
  3179. if chartPermissionIds != "" {
  3180. chartPermissionIds += ",1"
  3181. }
  3182. if whichDay == "undefined" {
  3183. whichDay = ""
  3184. }
  3185. if activeState == "undefined" || activeState == "" || activeState == "1" {
  3186. activeState = "1,2"
  3187. }
  3188. //adminIds, err := models.GetSelleridWhichGroup(user.CompanyId, 2)
  3189. //if err != nil {
  3190. // br.Msg = "获取失败"
  3191. // br.ErrMsg = "获取本组下的销售失败,Err:" + err.Error()
  3192. // return
  3193. //}
  3194. userType, permissionStr, err := services.GetUserType(user.CompanyId)
  3195. if err != nil {
  3196. br.Msg = "获取失败"
  3197. br.ErrMsg = "获取失败,Err:" + err.Error()
  3198. return
  3199. }
  3200. //isMaker := user.IsMaker
  3201. var startSize int
  3202. pageSize = 8
  3203. var sortTime string
  3204. var pars []interface{}
  3205. //活动可见限制
  3206. slicePer := strings.Split(permissionStr, ",")
  3207. var permissionNameStr string
  3208. for _, v := range slicePer {
  3209. if userType == 1 {
  3210. //if v != "研选" {
  3211. if !strings.Contains(v, "研选") {
  3212. permissionNameStr += "'" + v + "',"
  3213. }
  3214. } else {
  3215. permissionNameStr += "'" + v + "',"
  3216. }
  3217. }
  3218. permissionNameStr = strings.Replace(permissionNameStr, "(主观)", "", -1)
  3219. permissionNameStr = strings.Replace(permissionNameStr, "(客观)", "", -1)
  3220. permissionNameStr = strings.TrimRight(permissionNameStr, ",")
  3221. // 查研观向7.4-始终查询宏观的权限(无论是否有权限)
  3222. if permissionNameStr == `` {
  3223. permissionNameStr = `'宏观'`
  3224. } else {
  3225. permissionNameStr += `, '宏观'`
  3226. }
  3227. list, err := models.GetActivityTypeHomeListPc()
  3228. if err != nil {
  3229. br.Msg = "获取失败"
  3230. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  3231. return
  3232. }
  3233. //判断客户规模是否属于可见范围的活动
  3234. //companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
  3235. //if err != nil && err.Error() != utils.ErrNoRow() {
  3236. // br.Msg = "获取信息失败"
  3237. // br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
  3238. // return
  3239. //}
  3240. var sqlExport string
  3241. //处理专家权限的查询
  3242. sqlExport = ` AND (art.customer_type_ids LIKE '%` + strconv.Itoa(userType) + `%' `
  3243. if userType == 2 {
  3244. sqlExport += ` OR art.customer_type_ids LIKE '%3%' `
  3245. }
  3246. if (userType == 2 || userType == 3) && strings.Contains(permissionStr, "专家") {
  3247. sqlExport += ` OR art.customer_type_ids LIKE '%4%' `
  3248. }
  3249. sqlExport += `) `
  3250. resp := new(models.ActivityTypeListHomeRespPc)
  3251. for k, v := range list {
  3252. // 如果是C类电话会就不展示内容,且合并到分析师电话会
  3253. if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
  3254. continue
  3255. }
  3256. var condition string
  3257. conditionActivity, err := services.GetActivityonditionList(user, strconv.Itoa(v.ActivityTypeId), chartPermissionIds, whichDay, activeState, "", isPower, 1, "", playBack, 1)
  3258. if err != nil && err.Error() != utils.ErrNoRow() {
  3259. br.Msg = "获取失败"
  3260. br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
  3261. return
  3262. }
  3263. //condition += `AND art.is_limit_people = 1 ` + permissionSqlStr + sqlExport + conditionOr
  3264. condition += `AND art.is_limit_people = 1 AND art.yidong_activity_id = '' ` + conditionActivity
  3265. sortTime = ` mintimesort ASC `
  3266. labelList, err := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
  3267. if err != nil {
  3268. br.Msg = "获取失败"
  3269. br.ErrMsg = "获取失败,Err:" + err.Error()
  3270. return
  3271. }
  3272. //标签字段关联的产业与标签处理
  3273. for k2, v2 := range labelList {
  3274. labelList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName, v2.TemporaryLabel)
  3275. labelList[k2].Resource = 1
  3276. }
  3277. list[k].List = labelList
  3278. list[k].Resource = 1
  3279. }
  3280. //if whichDay == "" {
  3281. // //查询专项产业调研展示权限
  3282. // //var scale string
  3283. // //if companyProduct != nil {
  3284. // // scale = companyProduct.Scale
  3285. // //}
  3286. // speciaItem, err := services.GetActivityLabelSpecialList(user, isPower, chartPermissionIds, permissionNameStr)
  3287. // if err != nil {
  3288. // br.Msg = "获取失败"
  3289. // br.ErrMsg = "获取失败,Err:" + err.Error()
  3290. // return
  3291. // }
  3292. // if len(speciaItem.List) > 0 {
  3293. // itemList := new(models.ActivityTypeHomePc)
  3294. // itemList.ActivityTypeName = "专项产业调研"
  3295. // itemList.Resource = 2
  3296. // itemList.List = speciaItem.List
  3297. // itemList.ActivityTypeId = 7
  3298. // itemList.OnlineIco = "https://hzstatic.hzinsights.com/static/temp/20220707202207/20220707/0H4md6VgZMuIttggMUnJxgrlayxC.png"
  3299. // itemList.ImgUrlBgPc = "https://hzstatic.hzinsights.com/static/temp/20220707202207/20220707/rFwAM1c4fIMJM0EGoUkUYl25XH9L.png"
  3300. // list = append(list, itemList)
  3301. // }
  3302. //}
  3303. // 查研观向7.4-活动【新】标签
  3304. activityIds := make([]int, 0)
  3305. for _, v := range list {
  3306. if len(v.List) > 0 {
  3307. for i := range v.List {
  3308. activityIds = append(activityIds, v.List[i].ActivityId)
  3309. }
  3310. }
  3311. }
  3312. newLabelMap, _, e := services.GetActivityNewLabelMap(activityIds)
  3313. if e != nil {
  3314. br.Msg = "获取失败"
  3315. br.ErrMsg = "获取活动【新】标签Map失败, Err: " + e.Error()
  3316. return
  3317. }
  3318. for k := range list {
  3319. for k2 := range list[k].List {
  3320. list[k].List[k2].IsNew = newLabelMap[list[k].List[k2].ActivityId]
  3321. }
  3322. }
  3323. //记录用户搜索的筛选条件
  3324. {
  3325. item := new(models.CygxActivitySearchHistory)
  3326. item.UserId = user.UserId
  3327. item.Mobile = user.Mobile
  3328. item.CompanyId = user.CompanyId
  3329. item.CompanyName = user.CompanyName
  3330. item.CreateTime = time.Now()
  3331. item.ChartPermissionIds = chartPermissionIds
  3332. item.IsPower = isPower
  3333. item.WhichDay = whichDay
  3334. go models.AddCygxActivitySearchHistory(item)
  3335. }
  3336. resp.List = list
  3337. br.Ret = 200
  3338. br.Success = true
  3339. br.Msg = "获取成功"
  3340. br.Data = resp
  3341. }
  3342. // @Title 预约纪要
  3343. // @Description 预约纪要接口
  3344. // @Param request body models.ActivityIdRep true "type json string"
  3345. // @Success Ret=200 {object} models.AppointmentResp
  3346. // @router /appointment/add [post]
  3347. func (this *ActivityCoAntroller) ActivityAppointmentAdd() {
  3348. br := new(models.BaseResponse).Init()
  3349. defer func() {
  3350. this.Data["json"] = br
  3351. this.ServeJSON()
  3352. }()
  3353. user := this.User
  3354. if user == nil {
  3355. br.Msg = "请登录"
  3356. br.ErrMsg = "请登录,用户信息为空"
  3357. br.Ret = 408
  3358. return
  3359. }
  3360. uid := user.UserId
  3361. signupStatus := "Success"
  3362. var req models.ActivityIdRep
  3363. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  3364. if err != nil {
  3365. br.Msg = "参数解析异常!"
  3366. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  3367. return
  3368. }
  3369. activityId := req.ActivityId
  3370. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  3371. if activityInfo == nil {
  3372. br.Msg = "操作失败"
  3373. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  3374. return
  3375. }
  3376. if errInfo != nil {
  3377. br.Msg = "操作失败"
  3378. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  3379. return
  3380. }
  3381. //判断是否已经预约过
  3382. totalAppointment, err := models.GetUserCygxActivityAppointmentCount(uid, activityId)
  3383. if err != nil {
  3384. br.Msg = "获取失败"
  3385. br.ErrMsg = "获取失败,Err:" + err.Error()
  3386. return
  3387. }
  3388. if totalAppointment > 0 {
  3389. br.Msg = "您已预约!"
  3390. return
  3391. }
  3392. //SignupStatus string `description:"报名状态:人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
  3393. item := new(models.CygxActivityAppointment)
  3394. resp := new(models.SignupStatus)
  3395. hasPermission := 0
  3396. havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
  3397. if err != nil {
  3398. br.Msg = "获取信息失败"
  3399. br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
  3400. return
  3401. }
  3402. resp.IsResearchSpecial = isResearchSpecial
  3403. if havePower {
  3404. hasPermission = 1
  3405. signupStatus = "Success"
  3406. //限制人数为1人的专家电话会 用户操作时的消息提示
  3407. if activityInfo.LimitPeopleNum == 1 && activityInfo.ActivityTypeId == 1 {
  3408. resp.HasPermission = hasPermission
  3409. resp.SignupStatus = utils.FULLSTARFFED_MSG
  3410. resp.PopupMsg = utils.ACTIVITY_ZJDHH_V1_MSG
  3411. br.Ret = 200
  3412. br.Success = true
  3413. br.Msg = ""
  3414. br.Data = resp
  3415. return
  3416. }
  3417. totalMeeting, errMeeting := models.GetUserCygxActivityAppointmentCount(uid, activityId)
  3418. if errMeeting != nil {
  3419. br.Msg = "获取失败"
  3420. br.ErrMsg = "获取失败,Err:" + errMeeting.Error()
  3421. return
  3422. }
  3423. if totalMeeting > 0 {
  3424. br.Msg = "您已预约,请勿重复预约"
  3425. return
  3426. }
  3427. var sellerName string
  3428. sellerName, err = models.GetCompanySellerName(user.CompanyId)
  3429. if err != nil {
  3430. br.Msg = "报名失败!"
  3431. br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
  3432. return
  3433. }
  3434. item.UserId = uid
  3435. item.ActivityId = activityId
  3436. item.CreateTime = time.Now()
  3437. item.Mobile = user.Mobile
  3438. item.Email = user.Email
  3439. item.CompanyId = user.CompanyId
  3440. item.CompanyName = user.CompanyName
  3441. item.SellerName = sellerName
  3442. item.RealName = user.RealName
  3443. err = models.AddCygxActivityAppointment(item)
  3444. if err != nil {
  3445. br.Msg = "操作失败"
  3446. br.ErrMsg = "操作失败,Err:" + err.Error()
  3447. return
  3448. }
  3449. resp.HaqveJurisdiction = true
  3450. //1:预约外呼 、2:设置会议提醒 、 3:预约纪要 、4:活动报名
  3451. go services.ActivityUserRemind(user, activityInfo, 3)
  3452. resp.HasPermission = hasPermission
  3453. resp.SignupStatus = signupStatus
  3454. } else {
  3455. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
  3456. if err != nil {
  3457. br.Msg = "获取信息失败"
  3458. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  3459. return
  3460. }
  3461. resp.PopupMsg = popupMsg
  3462. resp.HasPermission = hasPermission
  3463. resp.SellerName = sellerName
  3464. resp.SellerMobile = sellerMobile
  3465. }
  3466. // 判断是否属于研选类型的活动
  3467. if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  3468. resp.IsResearch = true
  3469. }
  3470. resp.ActivityId = activityId
  3471. //var total int
  3472. //total, err = models.GetUserCygxActivityAppointmentCountByUid(user.UserId)
  3473. //if err != nil {
  3474. // br.Msg = "获取信息失败"
  3475. // br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
  3476. // return
  3477. //}
  3478. //if total <= 1 {
  3479. // resp.GoFollow = true
  3480. //}
  3481. detailActivityType, err := models.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
  3482. if err != nil {
  3483. br.Msg = "获取信息失败"
  3484. br.ErrMsg = "获取信息失败,GetActivityTypeDetailById Err:" + err.Error()
  3485. return
  3486. }
  3487. resp.ActivityTypeName = activityInfo.ActivityName
  3488. resp.ActivityTime = activityInfo.ActivityTime
  3489. resp.ActivityType = detailActivityType.ActivityType
  3490. br.Ret = 200
  3491. br.Success = true
  3492. if hasPermission == 1 {
  3493. br.Msg = "请关注【查研观向小助手】公众号,若有调研纪要发布/更新,将及时为您推送微信消息"
  3494. resp.PopupMsg = "会议纪要预约成功<br/><br/>请关注【查研观向小助手】公众号,若有调研纪要发布/更新,将及时为您推送微信消息"
  3495. }
  3496. br.Data = resp
  3497. }
  3498. // @Title 取消预约纪要
  3499. // @Description 取消预约纪要接口
  3500. // @Param request body models.ActivityIdRep true "type json string"
  3501. // @Success Ret=200 {object} models.SignupStatus
  3502. // @router /appointment/cancel [post]
  3503. func (this *ActivityCoAntroller) ActivityAppointmentCancel() {
  3504. br := new(models.BaseResponse).Init()
  3505. defer func() {
  3506. this.Data["json"] = br
  3507. this.ServeJSON()
  3508. }()
  3509. user := this.User
  3510. if user == nil {
  3511. br.Msg = "请登录"
  3512. br.ErrMsg = "请登录,用户信息为空"
  3513. br.Ret = 408
  3514. return
  3515. }
  3516. uid := user.UserId
  3517. var req models.ActivityIdRep
  3518. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  3519. if err != nil {
  3520. br.Msg = "参数解析异常!"
  3521. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  3522. return
  3523. }
  3524. activityId := req.ActivityId
  3525. signupStatus := "Success"
  3526. item := new(models.CygxActivityAppointment)
  3527. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  3528. if activityInfo == nil {
  3529. br.Msg = "操作失败"
  3530. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  3531. return
  3532. }
  3533. if errInfo != nil {
  3534. br.Msg = "操作失败"
  3535. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  3536. return
  3537. }
  3538. total, err := models.GetUserCygxActivityAppointmentCount(uid, activityId)
  3539. if err != nil {
  3540. br.Msg = "获取失败"
  3541. br.ErrMsg = "获取失败,Err:" + err.Error()
  3542. return
  3543. }
  3544. if total == 0 {
  3545. br.Msg = "您暂未预约该纪要"
  3546. return
  3547. }
  3548. item.UserId = uid
  3549. item.ActivityId = activityId
  3550. item.CreateTime = time.Now()
  3551. item.Mobile = user.Mobile
  3552. item.Email = user.Email
  3553. item.CompanyId = user.CompanyId
  3554. item.CompanyName = user.CompanyName
  3555. _, errSignup := models.CancelcygxActivityAppointment(item)
  3556. if errSignup != nil {
  3557. br.Msg = "操作失败"
  3558. br.ErrMsg = "操作失败,Err:" + errSignup.Error()
  3559. return
  3560. }
  3561. resp := new(models.SignupStatus)
  3562. resp.SignupStatus = signupStatus
  3563. resp.ActivityId = activityId
  3564. br.Ret = 200
  3565. br.Success = true
  3566. br.Msg = "已取消"
  3567. br.Data = resp
  3568. }
  3569. // @Title 记录用户浏览音频回放接口
  3570. // @Description 记录用户浏览音频回放接口
  3571. // @Param request body models.ActivityIdRep true "type json string"
  3572. // @Success Ret=200 {object} models.AppointmentResp
  3573. // @router /voiceHistory/add [post]
  3574. func (this *ActivityCoAntroller) ActivityVoiceHistoryAdd() {
  3575. br := new(models.BaseResponse).Init()
  3576. defer func() {
  3577. this.Data["json"] = br
  3578. this.ServeJSON()
  3579. }()
  3580. user := this.User
  3581. if user == nil {
  3582. br.Msg = "请登录"
  3583. br.ErrMsg = "请登录,用户信息为空"
  3584. br.Ret = 408
  3585. return
  3586. }
  3587. var req models.ActivityIdRep
  3588. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  3589. if err != nil {
  3590. br.Msg = "参数解析异常!"
  3591. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  3592. return
  3593. }
  3594. activityId := req.ActivityId
  3595. playSeconds := req.PlaySeconds
  3596. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  3597. if activityInfo == nil {
  3598. br.Msg = "操作失败"
  3599. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  3600. return
  3601. }
  3602. if errInfo != nil {
  3603. br.Msg = "操作失败"
  3604. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  3605. return
  3606. }
  3607. go services.AddActivityVoiceHistory(user, activityId, playSeconds)
  3608. br.Ret = 200
  3609. br.Success = true
  3610. br.Msg = "操作成功"
  3611. return
  3612. }
  3613. // @Title 记录用户浏览视频回放接口
  3614. // @Description 记录用户浏览音频回放接口
  3615. // @Param request body models.ActivityIdRep true "type json string"
  3616. // @Success Ret=200 {object} models.AppointmentResp
  3617. // @router /videoHistory/add [post]
  3618. func (this *ActivityCoAntroller) ActivityVideoHistoryAdd() {
  3619. br := new(models.BaseResponse).Init()
  3620. defer func() {
  3621. this.Data["json"] = br
  3622. this.ServeJSON()
  3623. }()
  3624. user := this.User
  3625. if user == nil {
  3626. br.Msg = "请登录"
  3627. br.ErrMsg = "请登录,用户信息为空"
  3628. br.Ret = 408
  3629. return
  3630. }
  3631. uid := user.UserId
  3632. var req models.ActivityIdRep
  3633. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  3634. if err != nil {
  3635. br.Msg = "参数解析异常!"
  3636. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  3637. return
  3638. }
  3639. activityId := req.ActivityId
  3640. activityInfo, errInfo := models.GetCygxActivityVideoByActivityId(activityId)
  3641. if activityInfo == nil {
  3642. br.Msg = "操作失败"
  3643. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  3644. return
  3645. }
  3646. if errInfo != nil {
  3647. br.Msg = "操作失败"
  3648. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  3649. return
  3650. }
  3651. var sellerName string
  3652. sellerName, err = models.GetCompanySellerName(user.CompanyId)
  3653. if err != nil {
  3654. br.Msg = "报名失败!"
  3655. br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
  3656. return
  3657. }
  3658. item := models.CygxActivityVideoHistory{
  3659. ActivityId: activityId,
  3660. VideoId: activityInfo.VideoId,
  3661. UserId: uid,
  3662. CreateTime: time.Now(),
  3663. Mobile: user.Mobile,
  3664. Email: user.Email,
  3665. CompanyId: user.CompanyId,
  3666. CompanyName: user.CompanyName,
  3667. RealName: user.RealName,
  3668. SellerName: sellerName,
  3669. ModifyTime: time.Now(),
  3670. }
  3671. err = models.AddCygxActivityVideoHistory(&item)
  3672. if err != nil {
  3673. br.Msg = "操作失败"
  3674. br.ErrMsg = "操作失败,Err:" + err.Error()
  3675. return
  3676. }
  3677. err = models.UpdateActivityVideoCounts(activityId)
  3678. if err != nil {
  3679. br.Msg = "更新失败"
  3680. br.ErrMsg = "更新失败,Err:" + err.Error()
  3681. return
  3682. }
  3683. br.Ret = 200
  3684. br.Success = true
  3685. br.Msg = "操作成功"
  3686. return
  3687. }
  3688. // @Title 活动、专项调研搜索
  3689. // @Description 活动、专项调研搜索接口
  3690. // @Param PageSize query int true "每页数据条数"
  3691. // @Param CurrentIndex query int true "当前页页码,从1开始"
  3692. // @Param KeyWord query string false "搜索关键词 多个用 , 隔开"
  3693. // @Param IsResearch query bool true "是否为研选"
  3694. // @Success 200 {object} models.GetCygxActivityListRep
  3695. // @router /listSearch [get]
  3696. func (this *ActivityCoAntroller) ActivityListSearch() {
  3697. br := new(models.BaseResponse).Init()
  3698. defer func() {
  3699. this.Data["json"] = br
  3700. this.ServeJSON()
  3701. }()
  3702. user := this.User
  3703. if user == nil {
  3704. br.Msg = "请登录"
  3705. br.ErrMsg = "请登录,SysUser Is Empty"
  3706. return
  3707. }
  3708. pageSize, _ := this.GetInt("PageSize")
  3709. currentIndex, _ := this.GetInt("CurrentIndex")
  3710. source, _ := this.GetInt("Source")
  3711. keyWord := this.GetString("KeyWord")
  3712. playBack, _ := this.GetInt("PlayBack")
  3713. var startSize int
  3714. if pageSize <= 0 {
  3715. pageSize = utils.PageSize20
  3716. }
  3717. if currentIndex <= 0 {
  3718. currentIndex = 1
  3719. }
  3720. startSize = utils.StartIndex(currentIndex, pageSize)
  3721. var condition string
  3722. //活动可见限制
  3723. conditionActivity, err := services.GetActivityonditionList(user, "", "", "", "", "", 0, 1, keyWord, playBack, 1)
  3724. if err != nil && err.Error() != utils.ErrNoRow() {
  3725. br.Msg = "获取失败"
  3726. br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
  3727. return
  3728. }
  3729. if source == 1 {
  3730. condition += ` AND art.yidong_activity_id = '' `
  3731. }
  3732. condition += ` AND art.publish_status = 1 ` + conditionActivity
  3733. list, total, err := services.GetActivitySpecialSearcheList(user, condition, startSize, pageSize, keyWord)
  3734. if err != nil {
  3735. br.Msg = "获取失败"
  3736. br.ErrMsg = "获取失败,Err:" + err.Error()
  3737. return
  3738. }
  3739. page := paging.GetPaging(currentIndex, pageSize, total)
  3740. resp := new(models.GetCygxActivityListRep)
  3741. //添加活动搜索记录
  3742. if keyWord != "" {
  3743. go services.AddActivitykeyWordSearch(keyWord, user)
  3744. }
  3745. resp.Paging = page
  3746. resp.List = list
  3747. br.Ret = 200
  3748. br.Success = true
  3749. br.Msg = "获取成功"
  3750. br.Data = resp
  3751. }
  3752. // @Title 已结束的活动
  3753. // @Description 获取已结束的活动接口
  3754. // @Param ChartPermissionIds query string false "行业id 多个用 , 隔开"
  3755. // @Param WhichDay query string false "哪一天 3本周、4上周,5本月,6上月 可多选"
  3756. // @Param IsPower query string false "是否选择有权限行业 ,1是 0 否 默认0"
  3757. // @Param TypeName query string false "电话会类型 ,1专家电话会 2分析师电话会"
  3758. // @Success 200 {object} models.GetCygxActivityLabelListRep
  3759. // @router /overActivityList [get]
  3760. func (this *ActivityCoAntroller) OverActivityList() {
  3761. br := new(models.BaseResponse).Init()
  3762. defer func() {
  3763. this.Data["json"] = br
  3764. this.ServeJSON()
  3765. }()
  3766. user := this.User
  3767. if user == nil {
  3768. br.Msg = "请登录"
  3769. br.ErrMsg = "请登录,SysUser Is Empty"
  3770. return
  3771. }
  3772. isPower, _ := this.GetInt("IsPower")
  3773. chartPermissionIds := this.GetString("ChartPermissionIds")
  3774. whichDay := this.GetString("WhichDay")
  3775. typeName := this.GetString("TypeName")
  3776. //入参为 undefined 时的处理
  3777. if chartPermissionIds == "undefined" {
  3778. chartPermissionIds = ""
  3779. }
  3780. if whichDay == "undefined" {
  3781. whichDay = ""
  3782. }
  3783. resp := new(models.GetCygxActivityLabelListRep)
  3784. if user.CompanyId <= 1 && user.UserId > 0 {
  3785. resp.List = make([]*models.CygxActivityLabelList, 0)
  3786. br.Ret = 200
  3787. br.Success = true
  3788. br.Msg = "获取成功"
  3789. br.Data = resp
  3790. return
  3791. }
  3792. var condition string
  3793. var conditionSpecialinit string
  3794. var conditionSpecial string
  3795. var sortTime string
  3796. var pars []interface{}
  3797. //已结束的活动 不展示研选 11.0
  3798. condition = ` AND art.publish_status = 1 AND art.label != '' AND art.active_state = 3 AND art.chart_permission_id != ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN)
  3799. if whichDay != "" {
  3800. var startDate string
  3801. var endDate string
  3802. if whichDay == "3" {
  3803. startDate = utils.GetNowWeekMonday().Format(utils.FormatDate)
  3804. endDate = utils.GetNowWeekSunday().Format(utils.FormatDate)
  3805. } else if whichDay == "4" {
  3806. startDate = utils.GetLastWeekMonday().Format(utils.FormatDate)
  3807. endDate = utils.GetLastWeekSunday().Format(utils.FormatDate)
  3808. } else if whichDay == "5" {
  3809. startDate = utils.GetNowMonthFirstDay().Format(utils.FormatDate)
  3810. endDate = utils.GetNowMonthLastDay().Format(utils.FormatDate)
  3811. } else if whichDay == "6" {
  3812. startDate = utils.GetLastMonthFirstDay().Format(utils.FormatDate)
  3813. endDate = utils.GetLastMonthLastDay().Format(utils.FormatDate)
  3814. } else if whichDay == "3,4" {
  3815. startDate = utils.GetLastWeekMonday().Format(utils.FormatDate)
  3816. endDate = utils.GetNowWeekSunday().Format(utils.FormatDate)
  3817. } else if whichDay == "5,6" {
  3818. startDate = utils.GetLastMonthFirstDay().Format(utils.FormatDate)
  3819. endDate = utils.GetNowMonthLastDay().Format(utils.FormatDate)
  3820. } else {
  3821. startDate = utils.GetNowWeekMonday().Format(utils.FormatDate)
  3822. endDate = utils.GetNowWeekSunday().Format(utils.FormatDate)
  3823. }
  3824. condition += ` AND art.activity_time >= ` + "'" + startDate + " 00:00:00'"
  3825. condition += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
  3826. conditionSpecialinit += ` AND art.activity_time >= ` + "'" + startDate + " 00:00:00'"
  3827. conditionSpecialinit += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
  3828. }
  3829. if len(chartPermissionIds) > 0 {
  3830. condition += ` AND art.chart_permission_id IN (` + chartPermissionIds + `)`
  3831. }
  3832. // 如果是C类电话会就不展示内容,且合并到分析师电话会
  3833. if typeName == "1" || typeName == "2" {
  3834. if typeName == strconv.Itoa(utils.ANALYST_TELL_ACTIVITY_TYPE_ID) {
  3835. condition += ` AND art.publish_status = 1 AND art.label != '' AND art.activity_type_id IN (` + typeName + "," + strconv.Itoa(utils.C_CLASS_ACTIVITY_TYPE_ID) + `)`
  3836. } else {
  3837. condition += ` AND art.publish_status = 1 AND art.label != '' AND art.activity_type_id IN (` + typeName + `)`
  3838. }
  3839. conditionSpecialinit += ` AND art.activity_id = 0 `
  3840. }
  3841. conditionActivity, err := services.ActivityConditioninitSql(user, condition, isPower)
  3842. if err != nil && err.Error() != utils.ErrNoRow() {
  3843. br.Msg = "获取失败"
  3844. br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
  3845. return
  3846. }
  3847. sortTime = ` activity_time DESC `
  3848. //如果是永续的就按照普通的权限逻辑来查,如果不是就按照升级的逻辑来查
  3849. if user.UserId > 0 { // v12.2.1
  3850. companyDetail, err := models.GetCompanyDetailByIdGroupTrip(user.CompanyId)
  3851. if err != nil {
  3852. br.Msg = "获取失败"
  3853. br.ErrMsg = "获取失败,Err:" + err.Error()
  3854. return
  3855. }
  3856. if companyDetail.Status == "永续" {
  3857. conditionSpecial, err = services.HandleActivityLabelSpecialPermission(user)
  3858. } else {
  3859. conditionSpecial, _, err = services.HandleActivityLabelSpecialTripPermission(user)
  3860. }
  3861. }
  3862. if err != nil {
  3863. br.Msg = "获取失败"
  3864. br.ErrMsg = "获取失败,Err:" + err.Error()
  3865. return
  3866. }
  3867. conditionSpecial += ` AND art.days >0 AND art.publish_status =1 AND art.is_offline = 0 `
  3868. conditionSpecial += ` AND art.activity_time_end < ` + "'" + time.Now().Format(utils.FormatDateTime) + "'"
  3869. condition += conditionActivity
  3870. list, err := models.GetActivityLabelListAllNoLimit(condition, sortTime, pars, conditionSpecialinit+conditionSpecial)
  3871. if err != nil {
  3872. br.Msg = "获取失败"
  3873. br.ErrMsg = "获取失败,Err:" + err.Error()
  3874. return
  3875. }
  3876. //标签字段关联的产业与标签处理
  3877. mapKeyWord := make(map[string]string)
  3878. for _, v := range list {
  3879. keyWord := services.LabelStr(v.KeyWord)
  3880. if _, ok := mapKeyWord[keyWord]; ok {
  3881. continue
  3882. }
  3883. if keyWord == "" {
  3884. continue
  3885. }
  3886. v.KeyWord = keyWord
  3887. resp.List = append(resp.List, v)
  3888. mapKeyWord[keyWord] = keyWord
  3889. }
  3890. if len(list) == 0 {
  3891. resp.List = make([]*models.CygxActivityLabelList, 0)
  3892. }
  3893. //添加更多主题访问记录
  3894. //item := new(models.CygxPageHistoryRecord)
  3895. //item.UserId = user.UserId
  3896. //item.CreateTime = time.Now()
  3897. //item.Mobile = user.Mobile
  3898. //item.Email = user.Email
  3899. //item.CompanyId = user.CompanyId
  3900. //item.CompanyName = user.CompanyName
  3901. //item.PageType = "OverActivity"
  3902. //go models.AddCygxPageHistoryRecord(item)
  3903. br.Ret = 200
  3904. br.Success = true
  3905. br.Msg = "获取成功"
  3906. br.Data = resp
  3907. }
  3908. // @Title 活动报名之前的校验(权限、时间、点数、邮箱)
  3909. // @Description 活动报名之前的校验(权限、时间、点数、邮箱)接口
  3910. // @Param request body models.ActivityIdRep true "type json string"
  3911. // @Success Ret=200 {object} models.SignupStatus
  3912. // @router /check [post]
  3913. func (this *ActivityCoAntroller) Check() {
  3914. br := new(models.BaseResponse).Init()
  3915. defer func() {
  3916. this.Data["json"] = br
  3917. this.ServeJSON()
  3918. }()
  3919. user := this.User
  3920. if user == nil {
  3921. br.Msg = "请登录"
  3922. br.ErrMsg = "请登录,用户信息为空"
  3923. br.Ret = 408
  3924. return
  3925. }
  3926. var req models.ActivityIdRep
  3927. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  3928. if err != nil {
  3929. br.Msg = "参数解析异常!"
  3930. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  3931. return
  3932. }
  3933. activityId := req.ActivityId
  3934. activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
  3935. if activityInfo == nil {
  3936. br.Msg = "操作失败"
  3937. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  3938. return
  3939. }
  3940. if errInfo != nil {
  3941. br.Msg = "操作失败"
  3942. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  3943. return
  3944. }
  3945. //这里的文案顺序提示 权限>时间>研选扣点>邮箱绑定。
  3946. resp := new(models.ActivityCheck)
  3947. resp.CancelPopupMsg, err = services.ActivityCancelDeadlineMsg(activityInfo) //处理取消报名截止时间的弹窗文案
  3948. if err != nil {
  3949. br.Msg = "操作失败"
  3950. br.ErrMsg = "操作失败,Err:" + err.Error()
  3951. return
  3952. }
  3953. hasPermission := 0
  3954. havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
  3955. if err != nil {
  3956. br.Msg = "获取信息失败"
  3957. br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
  3958. return
  3959. }
  3960. resp.IsResearchSpecial = isResearchSpecial
  3961. if havePower {
  3962. hasPermission = 1
  3963. resp.CheckPermission = true
  3964. resp.HasPermission = hasPermission
  3965. } else {
  3966. hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
  3967. if err != nil {
  3968. br.Msg = "获取信息失败"
  3969. br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
  3970. return
  3971. }
  3972. resp.PopupMsg = popupMsg
  3973. resp.HasPermission = hasPermission
  3974. resp.SellerName = sellerName
  3975. resp.SellerMobile = sellerMobile
  3976. }
  3977. if resp.CheckPermission {
  3978. //如果权限通过了校验,那么就来校验时间
  3979. resp.CheckTime, resp.PopupMsg = services.CheckSiginupDeadline(activityInfo)
  3980. }
  3981. if resp.CheckTime {
  3982. // 如果时间通过校验就校验点数
  3983. resp.CheckPoints, resp.PopupMsg, resp.CompanyPoints, resp.ActivityPoints, err = services.CheckActivityPoints(activityInfo, user)
  3984. if err != nil {
  3985. br.Msg = "获取信息失败"
  3986. br.ErrMsg = "CheckActivityPoints,Err:" + err.Error()
  3987. return
  3988. }
  3989. }
  3990. if resp.CheckPoints {
  3991. //如果通过点数的校验,就来校验邮箱
  3992. resp.CheckEmail, resp.PopupMsg = services.CheckActivityUserEmail(activityInfo, user)
  3993. }
  3994. // 判断是否属于研选类型的活动
  3995. if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  3996. resp.IsResearch = true
  3997. }
  3998. br.Ret = 200
  3999. br.Success = true
  4000. br.Data = resp
  4001. }