activity.go 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604
  1. package cygx
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "github.com/rdlucklib/rdluck_tools/paging"
  6. "hongze/hz_crm_api/controllers"
  7. "hongze/hz_crm_api/models"
  8. "hongze/hz_crm_api/models/cygx"
  9. "hongze/hz_crm_api/services"
  10. cygxService "hongze/hz_crm_api/services/cygx"
  11. "hongze/hz_crm_api/services/elastic"
  12. "hongze/hz_crm_api/utils"
  13. "strconv"
  14. "strings"
  15. "time"
  16. )
  17. // 活动
  18. type ActivityCoAntroller struct {
  19. controllers.BaseAuthController
  20. }
  21. // @Title 活动客户列表
  22. // @Description 活动客户列表接口
  23. // @Param IsZxdy query bool false "是否展示专项调研类型"
  24. // @Success 200 {object} cygx.ActivityCcustomerTypeList
  25. // @router /activity/customerTypelist [get]
  26. func (this *ActivityCoAntroller) List() {
  27. br := new(models.BaseResponse).Init()
  28. defer func() {
  29. this.Data["json"] = br
  30. this.ServeJSON()
  31. }()
  32. isZxdy, _ := this.GetBool("IsZxdy", false)
  33. sysUser := this.SysUser
  34. if sysUser == nil {
  35. br.Msg = "请登录"
  36. br.ErrMsg = "请登录,SysUser Is Empty"
  37. br.Ret = 408
  38. return
  39. }
  40. resp := new(cygx.ActivityCcustomerTypeList)
  41. var condition string
  42. if !isZxdy {
  43. condition += ` AND is_activity = 1 `
  44. } else {
  45. condition += ` AND is_apecial = 1 `
  46. }
  47. list, err := cygx.GetActivityCcustomerTypeList(condition)
  48. if err != nil {
  49. br.Msg = "获取失败"
  50. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  51. return
  52. }
  53. resp.List = list
  54. br.Ret = 200
  55. br.Success = true
  56. br.Msg = "获取成功"
  57. br.Data = resp
  58. }
  59. // @Title 活动内容的保存与发布
  60. // @Description 活动内容的保存与发布接口
  61. // @Param request body cygx.ActivityRep true "type json string"
  62. // @Success 200 操作成功
  63. // @router /activity/PreserveAndPublish [post]
  64. func (this *ActivityCoAntroller) PreserveAndPublish() {
  65. br := new(models.BaseResponse).Init()
  66. defer func() {
  67. this.Data["json"] = br
  68. this.ServeJSON()
  69. }()
  70. AdminUser := this.SysUser
  71. if AdminUser == nil {
  72. br.Msg = "请登录"
  73. br.ErrMsg = "请登录,用户信息为空"
  74. br.Ret = 408
  75. return
  76. }
  77. var req cygx.ActivityRep
  78. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  79. if err != nil {
  80. br.Msg = "参数解析异常!"
  81. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  82. return
  83. }
  84. //处理识图建会的会议信息列表 因为活动发布处理的业务逻辑过多,方便后期统一维护这里 根据 list 数据类型自己拼接 活动的 body 查研观向 11.12
  85. listImgToText := req.ListImgToText
  86. if len(listImgToText) > 0 {
  87. var errmsg string
  88. req, err, errmsg = cygxService.MakeActivityReqText(listImgToText)
  89. if err != nil {
  90. br.Msg = "识图建会失败!"
  91. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  92. return
  93. }
  94. if errmsg != "" {
  95. br.Msg = "识图建会失败," + errmsg
  96. br.ErrMsg = "识图建会失败," + errmsg
  97. return
  98. }
  99. }
  100. if req.Body == "" {
  101. br.Msg = "内容不可为空"
  102. return
  103. }
  104. //return
  105. //不限制人数的,强制改为全部客户可见
  106. if req.LimitPeopleNum == 0 {
  107. req.VisibleRange = 2
  108. req.IsMakerShow = 0
  109. req.Scale = ""
  110. req.CustomerTypeIds = ""
  111. }
  112. if req.IsResearchPoints == 0 {
  113. req.SiginupDeadline = ""
  114. }
  115. activityId := req.ActivityId
  116. labelType := req.LabelType
  117. labelList := req.List
  118. activityTypeId := req.ActivityTypeId
  119. scale := req.Scale
  120. voiceList := req.VoiceList
  121. videoDetail := req.VideoDetail
  122. isBClass := req.IsBClass
  123. isResearchPoints := req.IsResearchPoints
  124. isShowHz := req.IsShowHz
  125. isResearch := req.IsResearch //是否是研选类型的活动
  126. if isResearch {
  127. req.PermissionName = utils.CHART_PERMISSION_NAME_MF_YANXUAN
  128. }
  129. var items []*cygx.CygxActivity
  130. //temporaryLabel := req.TemporaryLabel
  131. industrialManagementIdS := req.IndustrialManagementIdS
  132. industrialSubjectIdS := req.IndustrialSubjectIdS
  133. body := req.Body
  134. customerTypeIds := req.CustomerTypeIds
  135. if req.VisibleRange != 1 {
  136. req.VisibleRange = 2
  137. }
  138. //公司调研电话会,增加【外部资源】勾选项,其他的强制过滤
  139. if req.ActivityTypeId != 3 {
  140. req.IsExternalLabel = 0
  141. }
  142. isExternalLabel := req.IsExternalLabel
  143. pointsSet := req.PointsSet
  144. isNeedEmail := req.IsNeedEmail
  145. siginupDeadline := req.SiginupDeadline
  146. if customerTypeIds != "" {
  147. condition := ` AND customer_type_id IN (` + customerTypeIds + `)`
  148. listValue, err := cygx.GetActivityCcustomerTypeList(condition)
  149. if err != nil {
  150. br.Msg = "活动可见套餐类型错误,请核实"
  151. return
  152. }
  153. req.CustomerTypeIds = ""
  154. for _, v := range listValue {
  155. req.CustomerTypeIds += v.PermissionValue + ","
  156. }
  157. req.CustomerTypeIds = strings.TrimRight(req.CustomerTypeIds, ",")
  158. }
  159. if len(voiceList) > 0 && videoDetail != nil {
  160. br.Msg = "音频与视频只能上传一个"
  161. return
  162. }
  163. body = strings.Replace(body, "  ", "", -1)
  164. body = strings.Replace(body, " ", "", -1)
  165. slice := strings.Split(body, "<hr>")
  166. if activityId == 0 {
  167. if activityTypeId == 1 {
  168. if labelType != 1 && labelType != 2 {
  169. br.Msg = "请选择主题标签"
  170. return
  171. }
  172. }
  173. }
  174. var industrialActivityItemsList [][]*cygx.CygxIndustrialActivityGroupManagement
  175. var subjectActivityItemsList [][]*cygx.CygxIndustrialActivityGroupSubject
  176. var industryAndSubjectNameItems []*cygx.IndustryAndSubjectName
  177. var industrialNames string
  178. var industrialSubjectNames string
  179. industryIds := make([]int, 0)
  180. for _, vLabel := range labelList {
  181. var industrialActivityItems []*cygx.CygxIndustrialActivityGroupManagement
  182. var subjectActivityItems []*cygx.CygxIndustrialActivityGroupSubject
  183. if vLabel.IndustrialManagementIdS != "" {
  184. industrialManagementIdS = vLabel.IndustrialManagementIdS
  185. industrialSubjectIdS = vLabel.IndustrialSubjectIdS
  186. if industrialManagementIdS == "" {
  187. br.Msg = "请选择产业"
  188. return
  189. }
  190. industrialManagementIdS = strings.Replace(industrialManagementIdS, " ", "", -1)
  191. industrialManagementList := strings.Split(industrialManagementIdS, ",")
  192. for _, v := range industrialManagementList {
  193. industrialActivityItem := new(cygx.CygxIndustrialActivityGroupManagement)
  194. industrialManagementId, err := strconv.Atoi(v)
  195. if err != nil {
  196. br.Msg = "参数解析异常!"
  197. br.ErrMsg = "产业ID不规范,Err:" + err.Error() + industrialManagementIdS
  198. return
  199. }
  200. industryIds = append(industryIds, industrialManagementId)
  201. industrialActivityItem.CreateTime = time.Now()
  202. industrialActivityItem.IndustrialManagementId = industrialManagementId
  203. industrialActivityItem.ActivityId = activityId
  204. industrialActivityItem.Source = 1
  205. industrialActivityItems = append(industrialActivityItems, industrialActivityItem)
  206. }
  207. if industrialSubjectIdS != "" {
  208. industrialSubjectIdList := strings.Split(industrialSubjectIdS, ",")
  209. for _, v := range industrialSubjectIdList {
  210. subjectActivityItem := new(cygx.CygxIndustrialActivityGroupSubject)
  211. industrialSubjectId, err := strconv.Atoi(v)
  212. if err != nil {
  213. br.Msg = "参数解析异常!"
  214. br.ErrMsg = "标的ID不规范,Err:" + err.Error() + industrialManagementIdS
  215. return
  216. }
  217. subjectActivityItem.CreateTime = time.Now()
  218. subjectActivityItem.IndustrialSubjectId = industrialSubjectId
  219. subjectActivityItem.ActivityId = activityId
  220. subjectActivityItem.Source = 1
  221. subjectActivityItems = append(subjectActivityItems, subjectActivityItem)
  222. }
  223. }
  224. //产业名称
  225. if industrialManagementIdS != "" {
  226. industrialNames, err = cygx.GetindustrialManagementNames(industrialManagementIdS)
  227. if err != nil {
  228. br.Msg = "参数解析异常!"
  229. br.ErrMsg = "产业ID不规范,Err:" + err.Error() + industrialManagementIdS
  230. return
  231. }
  232. }
  233. //标的名称
  234. if industrialSubjectIdS != "" {
  235. industrialSubjectNames, err = cygx.GetindustrialSubjectNames(industrialSubjectIdS)
  236. if err != nil {
  237. br.Msg = "参数解析异常!"
  238. br.ErrMsg = "标的ID不规范,Err:" + err.Error() + industrialSubjectIdS
  239. return
  240. }
  241. } else {
  242. industrialSubjectNames = ""
  243. }
  244. }
  245. if len(industrialActivityItems) == 0 {
  246. industrialActivityItems = make([]*cygx.CygxIndustrialActivityGroupManagement, 0)
  247. }
  248. if len(subjectActivityItems) == 0 {
  249. subjectActivityItems = make([]*cygx.CygxIndustrialActivityGroupSubject, 0)
  250. }
  251. industrialActivityItemsList = append(industrialActivityItemsList, industrialActivityItems)
  252. subjectActivityItemsList = append(subjectActivityItemsList, subjectActivityItems)
  253. //合并产业以及标的的名称
  254. industryAndSubjectNameItem := new(cygx.IndustryAndSubjectName)
  255. industryAndSubjectNameItem.IndustryNames = industrialNames
  256. industryAndSubjectNameItem.SubjectNames = industrialSubjectNames
  257. industryAndSubjectNameItem.TemporaryLabel = vLabel.TemporaryLabel
  258. industrialNames = ""
  259. industrialSubjectNames = ""
  260. industryAndSubjectNameItems = append(industryAndSubjectNameItems, industryAndSubjectNameItem)
  261. }
  262. if labelType == 1 || labelType == 0 {
  263. if len(slice) > len(industrialActivityItemsList) {
  264. for k := range slice {
  265. if k > 0 {
  266. if len(industrialActivityItemsList) > 0 {
  267. industrialActivityItemsList = append(industrialActivityItemsList, industrialActivityItemsList[0])
  268. }
  269. if len(subjectActivityItemsList) > 0 {
  270. subjectActivityItemsList = append(subjectActivityItemsList, subjectActivityItemsList[0])
  271. }
  272. if len(industryAndSubjectNameItems) > 0 {
  273. industryAndSubjectNameItems = append(industryAndSubjectNameItems, industryAndSubjectNameItems[0])
  274. }
  275. }
  276. }
  277. }
  278. }
  279. if labelType == 2 {
  280. if len(slice) != len(labelList) {
  281. br.Msg = "活动和主题个数不符,请核实"
  282. return
  283. }
  284. }
  285. permissionName := req.PermissionName
  286. //List := cygxService.GetActChartPermissionList()
  287. //var haveCheck bool
  288. //for _, v := range List {
  289. // if permissionName == v.PermissionName {
  290. // haveCheck = true
  291. // }
  292. //}
  293. //if !haveCheck {
  294. // br.Msg = "行业名称:" + permissionName + "不存在"
  295. // return
  296. //}
  297. if strings.Contains(permissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
  298. permissionName = utils.CHART_PERMISSION_NAME_MF_YANXUAN
  299. }
  300. //charInfo, errCategory := cygx.GetCategoryInfoById(req.ChartPermissionId)
  301. charInfo, errCategory := cygx.GetCategoryInfoByName(permissionName)
  302. if errCategory != nil {
  303. br.Msg = "请选择所属行业"
  304. br.ErrMsg = "获取所属行业信息失败,Err:" + errCategory.Error()
  305. return
  306. }
  307. if charInfo.PermissionName == "宏观经济" {
  308. charInfo.PermissionName = "宏观"
  309. }
  310. activityTypeInfo, errType := cygx.GetActivityTypeDetailById(activityTypeId)
  311. if errType != nil {
  312. br.Msg = "请选择活动类型"
  313. br.ErrMsg = "获取活动类型信息失败,Err:" + errType.Error()
  314. return
  315. }
  316. var activeState int
  317. var checkYidong bool
  318. if req.ActivityId > 0 {
  319. activityInfo, errInfo := cygx.GetAddActivityInfoById(req.ActivityId)
  320. if errInfo != nil {
  321. br.Msg = "活动不存在"
  322. br.ErrMsg = "活动ID错误,ActivityId:" + strconv.Itoa(req.ActivityId)
  323. return
  324. }
  325. if activityInfo.ActiveState > 1 {
  326. activeState = activityInfo.ActiveState
  327. }
  328. if activityInfo.YidongActivityId != "" {
  329. checkYidong = true
  330. }
  331. //校验活动后台管理员、销售是否有修改权限
  332. havePower, popupMsg, err := cygxService.CheckActivityUpdatePower(AdminUser.AdminId, activityInfo)
  333. if err != nil {
  334. br.Msg = "获取管理员身份信息失败"
  335. br.ErrMsg = "获取管理员身份信息失败,Err:" + err.Error()
  336. return
  337. }
  338. if !havePower {
  339. br.Msg = popupMsg
  340. return
  341. }
  342. }
  343. var itemPointsSet = new(cygx.CygxActivityPointsSet)
  344. var itemPointsSetOld = new(cygx.CygxActivityPointsSetRsq)
  345. if activityId > 0 {
  346. itemPointsSetOld, err = cygx.GetCygxActivityPointsSetDetail(activityId)
  347. if err != nil && err.Error() != utils.ErrNoRow() {
  348. br.Msg = "获取信息失败"
  349. br.ErrMsg = "GetCygxActivityPointsSetDetail,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  350. return
  351. }
  352. }
  353. //校验研选扣点内容,对于已结束的活动不做点数校验
  354. if isResearchPoints == 1 {
  355. errMsg, itemResp, err := cygxService.CheckActivityPointsSet(pointsSet, activityId)
  356. if errMsg != "" {
  357. br.Msg = errMsg
  358. return
  359. }
  360. if err != nil {
  361. br.Msg = "操作失败"
  362. br.ErrMsg = "操作失败,Err:" + err.Error()
  363. return
  364. }
  365. itemPointsSet = itemResp
  366. }
  367. for k, v := range slice {
  368. //如果内容不存在 时间:字段则不予处理
  369. if strings.Contains(v, "时间:") || strings.Contains(v, "时间:") {
  370. slicebr := strings.Split(v, "<br")
  371. //浏览器兼容处理
  372. if len(slicebr) > 5 {
  373. v = strings.Replace(v, "br", "p", -1)
  374. }
  375. v = strings.Replace(v, "<p><br></p>", "", -1) //删除空标签,兼容标题顶部空格、换行
  376. v = strings.Replace(v, "<p><p></p>", "", -1)
  377. v = strings.Replace(v, "<p></p>", "", -1)
  378. v = strings.Replace(v, "<p><p>", "", -1)
  379. v = strings.Replace(v, "<br>", "", -1)
  380. v = strings.Replace(v, "<p id=\"isPasted\"></p>", "", -1)
  381. item, errstr := cygxService.ActivityBodyAnalysis(v, activeState, req)
  382. if len(errstr) > 0 {
  383. br.Msg = errstr
  384. br.IsSendEmail = false
  385. return
  386. }
  387. var temporaryLabel string
  388. if len(labelList) == 1 {
  389. temporaryLabel = labelList[0].TemporaryLabel
  390. } else {
  391. temporaryLabel = labelList[k].TemporaryLabel
  392. }
  393. item.TemporaryLabel = temporaryLabel
  394. item.IsBClass = isBClass
  395. if item.ReportLink != "" {
  396. articleIdLink, err := cygxService.GetReportLinkToArticleid(item.ReportLink)
  397. if err != nil {
  398. br.Msg = "操作失败"
  399. br.ErrMsg = "解析报告链接ID失败,Err:" + err.Error()
  400. return
  401. }
  402. item.ArticleId = articleIdLink
  403. }
  404. //if k == 0 && item.Label == "" {
  405. // br.Msg = "请填写活动标签"
  406. // return
  407. //}
  408. item.AdminId = AdminUser.AdminId
  409. item.AdminName = AdminUser.RealName
  410. item.Body = v
  411. item.ChartPermissionName = charInfo.PermissionName
  412. item.ChartPermissionNames = req.PermissionName
  413. item.ChartPermissionId = charInfo.ChartPermissionId
  414. item.ActivityTypeName = activityTypeInfo.ActivityTypeName
  415. item.ActivityTypeId = activityTypeInfo.ActivityTypeId
  416. item.CustomerTypeIds = req.CustomerTypeIds
  417. item.LimitPeopleNum = req.LimitPeopleNum
  418. item.IsMakerShow = req.IsMakerShow
  419. item.VisibleRange = req.VisibleRange
  420. item.PublishDate = time.Now()
  421. item.IsYidongConduct = req.IsYidongConduct
  422. item.IsCanOutboundCall = req.IsCanOutboundCall
  423. item.IsNeedEmail = isNeedEmail
  424. if len(listImgToText) > 0 {
  425. resultTime := utils.StrTimeToTime(item.ActivityTime) //时间字符串格式转时间格式
  426. item.SiginupDeadline = resultTime.AddDate(0, 0, -1).Format(utils.FormatDate) + " 15:30:00" //批量建会报名截止之前默认:活动前一天15:30:00
  427. } else {
  428. item.SiginupDeadline = siginupDeadline
  429. }
  430. if isResearchPoints == 1 {
  431. item.IsResearchPoints = 1
  432. }
  433. //当不限制人数的时候,强制改为全部客户可见
  434. //if req.LimitPeopleNum == 0 {
  435. // item.VisibleRange = 2
  436. //}
  437. ////除了C类电话会其他类型的会议,强制改为全部客户可见
  438. //if req.ActivityTypeId != 7 {
  439. // item.VisibleRange = 2
  440. //}
  441. item.CreateTime = time.Now()
  442. item.LastUpdatedTime = time.Now()
  443. item.Scale = scale
  444. item.IsExternalLabel = isExternalLabel
  445. item.IsAllCustomerType = req.IsAllCustomerType
  446. item.IsShowHz = isShowHz
  447. item.ChartPermissionIdDeputy = charInfo.ChartPermissionId
  448. item.ChartPermissionNameDeputy = charInfo.PermissionName
  449. if len(labelList) == 1 {
  450. item.IsCanAppointmentMinutes = labelList[0].IsCanAppointmentMinutes
  451. } else {
  452. item.IsCanAppointmentMinutes = labelList[k].IsCanAppointmentMinutes
  453. }
  454. if item.ActivityName == "" {
  455. br.Msg = "请填写活动名称"
  456. return
  457. }
  458. if item.ActivityTime == "" {
  459. br.Msg = "请填写活动时间"
  460. return
  461. }
  462. //过滤标题中的符号,同步进门财经的时候使用
  463. newActivityName := item.ActivityName
  464. newActivityName = strings.Replace(newActivityName, "【", "", -1)
  465. newActivityName = strings.Replace(newActivityName, "】", "", -1)
  466. newActivityName = strings.Replace(newActivityName, "-", "", -1)
  467. newActivityName = strings.Replace(newActivityName, "—", "", -1)
  468. newActivityName = strings.Replace(newActivityName, " ", "", -1)
  469. newActivityName = strings.Replace(newActivityName, ":", "", -1)
  470. item.ActivityNameTask = newActivityName
  471. if !checkYidong {
  472. if activityTypeId == 1 {
  473. if item.Expert == "" {
  474. br.Msg = "请填写专家信息"
  475. return
  476. }
  477. if item.Host == "" {
  478. br.Msg = "请填写主持人信息"
  479. return
  480. }
  481. }
  482. if activityTypeId == 2 {
  483. if item.Speaker == "" {
  484. br.Msg = "请填写主讲人信息"
  485. return
  486. }
  487. }
  488. if activityTypeId == 3 {
  489. if item.DistinguishedGuest == "" {
  490. br.Msg = "请填写嘉宾信息"
  491. return
  492. }
  493. if item.Host == "" {
  494. br.Msg = "请填写主持人信息"
  495. return
  496. }
  497. }
  498. if activityTypeId == 4 {
  499. if item.DistinguishedGuest == "" {
  500. br.Msg = "请填写嘉宾信息"
  501. return
  502. }
  503. if item.Host == "" {
  504. br.Msg = "请填写主持人信息"
  505. return
  506. }
  507. if req.LimitPeopleNum == 0 {
  508. br.Msg = "请填写参会限制人数"
  509. return
  510. }
  511. }
  512. if activityTypeId == 5 {
  513. if item.Expert == "" {
  514. br.Msg = "请填写专家信息"
  515. return
  516. }
  517. if req.LimitPeopleNum == 0 {
  518. br.Msg = "请填写参会限制人数"
  519. return
  520. }
  521. }
  522. if activityTypeId == 6 {
  523. if item.Speaker == "" {
  524. br.Msg = "请填写主讲人信息"
  525. return
  526. }
  527. if req.LimitPeopleNum == 0 {
  528. br.Msg = "请填写参会限制人数"
  529. return
  530. }
  531. }
  532. }
  533. if req.LimitPeopleNum > 0 {
  534. item.IsLimitPeople = 1
  535. }
  536. if req.DoType == 1 {
  537. item.PublishStatus = 1
  538. }
  539. //当临时标的不为空的时候,标签为临时标的,否则为所选产业跟标的的组合
  540. if temporaryLabel != "" {
  541. item.Label = temporaryLabel
  542. } else {
  543. var labelNewStr string
  544. industrialNames = industryAndSubjectNameItems[k].IndustryNames
  545. industrialSubjectNames = industryAndSubjectNameItems[k].SubjectNames
  546. if industrialNames == "" && industrialSubjectNames != "" {
  547. labelNewStr = industrialSubjectNames
  548. } else if industrialNames != "" && industrialSubjectNames != "" {
  549. labelNewStr = industrialNames + "-" + industrialSubjectNames
  550. } else if industrialNames != "" && industrialSubjectNames == "" {
  551. labelNewStr = industrialNames
  552. }
  553. item.Label = labelNewStr
  554. if len(labelList) == 1 {
  555. item.IsShowSubjectName = labelList[0].IsShowSubjectName
  556. } else {
  557. item.IsShowSubjectName = labelList[k].IsShowSubjectName
  558. }
  559. }
  560. if item.ActivityTypeId == 2 {
  561. if item.ReportLink == "" {
  562. if labelList[k].IndustrialSubjectIdS != "" {
  563. item.ReportLink, err = cygxService.ActivityReportLink(item, labelList[k].IndustrialSubjectIdS)
  564. if err != nil {
  565. br.Msg = "发布失败"
  566. br.ErrMsg = "发布失败自动获取报告链接失败,Err:" + err.Error()
  567. return
  568. }
  569. }
  570. } else {
  571. sliceArt := strings.Split(item.ReportLink, "/")
  572. if len(sliceArt) > 0 {
  573. articleId, err := strconv.Atoi(sliceArt[len(sliceArt)-1])
  574. if err != nil {
  575. br.Msg = "报告链接格式错误!"
  576. return
  577. }
  578. detailArt, err := cygx.GetArticleIdInfoByArticleId(articleId)
  579. if err != nil {
  580. br.Msg = "内容不存在"
  581. br.ErrMsg = "操作失败,Err:" + err.Error()
  582. return
  583. }
  584. //类型ID 医药(医享会:28 、药调研:301)、消费【渠道新声:32】、科技【科技前言:79】、智造【匠心智造:84】
  585. if detailArt.CategoryId != 28 && detailArt.CategoryId != 301 && detailArt.CategoryId != 32 && detailArt.CategoryId != 79 && detailArt.CategoryId != 84 {
  586. item.IsHideAppointment = 1
  587. }
  588. }
  589. }
  590. }
  591. items = append(items, item)
  592. var errAct error
  593. if req.ActivityId == 0 {
  594. } else {
  595. if len(slice) > 1 {
  596. br.Msg = "文本格式错误,请删除多余活动"
  597. return
  598. }
  599. item.ActivityId = req.ActivityId
  600. activityInfo, errInfo := cygx.GetAddActivityInfoById(req.ActivityId)
  601. if activityInfo == nil {
  602. br.Msg = "活动不存在"
  603. br.ErrMsg = "活动ID错误,ActivityId:" + strconv.Itoa(req.ActivityId)
  604. return
  605. }
  606. if errInfo != nil {
  607. br.Msg = "操作失败"
  608. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  609. return
  610. }
  611. if item.PublishStatus == 0 {
  612. item.PublishStatus = activityInfo.PublishStatus
  613. }
  614. if req.DoType == 1 {
  615. item.AdminId = AdminUser.AdminId
  616. item.AdminName = AdminUser.RealName
  617. item.PublishDate = time.Now()
  618. item.IsCancel = 0
  619. } else {
  620. item.AdminId = activityInfo.AdminId
  621. item.AdminName = activityInfo.AdminName
  622. item.PublishDate = utils.StrTimeToTime(activityInfo.PublishDate)
  623. }
  624. //音频 目前只有一个
  625. itemVoice := new(cygx.CygxActivityVoice)
  626. //var itemVoiceList []*cygx.CygxActivityVoice
  627. if len(voiceList) > 0 {
  628. for _, vo := range voiceList {
  629. itemVoice.ActivityId = activityId
  630. itemVoice.VoiceName = vo.Name
  631. itemVoice.VoiceUrl = vo.Url
  632. itemVoice.VoicePlaySeconds = vo.PlaySeconds
  633. itemVoice.CreateTime = time.Now()
  634. }
  635. }
  636. //视频
  637. itemVideo := new(cygx.CygxActivityVideo)
  638. if videoDetail != nil {
  639. itemVideo.VideoName = videoDetail.VideoName
  640. itemVideo.ActivityId = activityId
  641. itemVideo.VideoDuration = videoDetail.VideoDuration
  642. itemVideo.VideoUrl = videoDetail.VideoUrl
  643. itemVideo.ModifyDate = time.Now().Format(utils.FormatDateTime)
  644. itemVideo.CreateTime = time.Now().Format(utils.FormatDateTime)
  645. }
  646. //删除原有的视频数据
  647. //if itemVideo.VideoUrl != "" {
  648. //videoDetail, err := cygx.GetCygxActivityVideoReqDetail(activityId)
  649. //if err != nil && err.Error() != utils.ErrNoRow() {
  650. // br.Msg = "获取信息失败"
  651. // br.ErrMsg = "GetCygxActivityVideoReqDetail,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  652. // return
  653. //}
  654. //if videoDetail != nil {
  655. // go cygxService.UpdateResourceData(videoDetail.VideoId, "activityvideo", "delete", time.Now().Format(utils.FormatDateTime))
  656. //}
  657. //}
  658. //处理音视频上传
  659. err := cygxService.UpdateActivityVideoAndVoice(activityInfo, itemVoice, itemVideo)
  660. if err != nil && err.Error() != utils.ErrNoRow() {
  661. br.Msg = "获取信息失败"
  662. br.ErrMsg = "UpdateActivityVideoAndVoice,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  663. return
  664. }
  665. //if itemVoice.VoiceUrl != "" {
  666. voiceReqList, err := cygx.GetCygxActivityVoiceReqList(activityId)
  667. if err != nil && err.Error() != utils.ErrNoRow() {
  668. br.Msg = "获取信息失败"
  669. br.ErrMsg = "GetCygxActivityVoiceReqList,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  670. return
  671. }
  672. if len(voiceReqList) > 0 {
  673. for _, voice := range voiceReqList {
  674. go cygxService.UpdateResourceData(voice.ActivityVoiceId, "activityvoice", "delete", time.Now().Format(utils.FormatDateTime))
  675. }
  676. }
  677. //}
  678. //如果活动信息有如下变更则做消息推送
  679. err = cygx.EditActivity(item, activityInfo.PublishStatus, industrialActivityItemsList, subjectActivityItemsList, itemPointsSet)
  680. if err != nil {
  681. br.Msg = "操作失败"
  682. br.ErrMsg = "操作失败,Err:" + err.Error()
  683. return
  684. }
  685. ////更新活动音频
  686. //if int(voiceIdNew) > 0 {
  687. // go cygxService.UpdateResourceData(int(voiceIdNew), "activityvoice", "add", activityInfo.ActivityTime)
  688. //}
  689. ////更新活动视频
  690. //if int(videoIdNew) > 0 {
  691. // go cygxService.UpdateResourceData(int(videoIdNew), "activityvideo", "add", activityInfo.ActivityTime)
  692. //}
  693. errAct = err
  694. if activityInfo.PublishStatus == 1 && activityInfo.ActivityTimeText != item.ActivityTimeText {
  695. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, activityInfo.ActivityTimeText, item.ActivityTimeText, "timeType")
  696. }
  697. oldExpert, _ := cygx.GetReportContentTextSub(activityInfo.Expert)
  698. newExpert, _ := cygx.GetReportContentTextSub(item.Expert)
  699. if activityInfo.PublishStatus == 1 && oldExpert != newExpert {
  700. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, oldExpert, newExpert, "expertType")
  701. }
  702. if activityInfo.PublishStatus == 1 && activityInfo.Address != item.Address {
  703. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, activityInfo.Address, item.Address, "addressType")
  704. }
  705. if activityInfo.PublishStatus == 1 && activityInfo.ParticipationCode != item.ParticipationCode {
  706. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, activityInfo.ParticipationCode, item.ParticipationCode, "participationCode")
  707. }
  708. if activityInfo.PublishStatus == 1 && activityInfo.Theme != item.Theme {
  709. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, activityInfo.Theme, item.Theme, "Theme")
  710. }
  711. //对于限制人数的活动,如果修改改了可见范围,对于新增的那一部分做新的推送
  712. if req.DoType == 0 && activityInfo.PublishStatus == 1 && activityInfo.ActiveState == 1 && activityInfo.LimitPeopleNum != "0" {
  713. if activityInfo.CustomerTypeIds != req.CustomerTypeIds || activityInfo.Scale != req.Scale || activityInfo.IsMakerShow != req.IsMakerShow || activityInfo.VisibleRange != req.VisibleRange {
  714. go cygxService.DoActivityOnenIdWxTemplateMsg(activityId)
  715. }
  716. }
  717. //已结束或者进行中的活动修改时间后,修改活动状态以及重新发送邮件附件
  718. if activeState != 0 && activeState != 1 {
  719. resultTime := utils.StrTimeToTime(item.ActivityTime) //时间字符串格式转时间格式
  720. if time.Now().Before(resultTime) {
  721. err := cygx.EditActivityStatus(req.ActivityId)
  722. if err != nil {
  723. br.Msg = "发布失败"
  724. br.ErrMsg = "发布失败,Err:" + err.Error()
  725. return
  726. }
  727. }
  728. }
  729. //修改活动人数限制之后,对于因为人数已满而失败的用户,推送模板消息
  730. if activityInfo.PublishStatus == 1 && activityInfo.IsLimitPeople != 0 && activityInfo.LimitPeopleNum != strconv.Itoa(req.LimitPeopleNum) {
  731. go cygxService.SendWxMsgWithCygxActivityUpdateLimitPeople(req.ActivityId)
  732. }
  733. go cygxService.YiDongSaveRoadshowDetail(activityId)
  734. //如果活动名称有变更就生成新的签到码
  735. if activityInfo.ActivityName != item.ActivityName || activityInfo.SigninImg == "" {
  736. go cygxService.MakeActivitySigninImg(req.ActivityId)
  737. }
  738. //如果活动之前是发布的状态,那么就对公司的扣点进行更新(涉及到新老公司的扣点返点,不放在Redis统一处理了)
  739. if activityInfo.PublishStatus == 1 {
  740. go cygxService.UpdateYanXuanActivityPointsBillOldComapny(activityInfo, AdminUser.AdminId, itemPointsSet, itemPointsSetOld) //活动发布以及取消发布处理研选扣点
  741. }
  742. //如果活动之前是未发布的状态,现在又发布了那么就对公司的扣点进行更新
  743. //if req.DoType == 1 && activityInfo.PublishStatus == 0 {
  744. // go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(activityId, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣点
  745. //}
  746. }
  747. if errAct != nil {
  748. br.Msg = "发布失败"
  749. br.ErrMsg = "发布失败,Err:" + errAct.Error()
  750. return
  751. }
  752. //go cygxService.YanXuanActivityPointsBillActivityEdit(activityId, AdminUser.AdminId) //活动编辑处理研选扣点
  753. }
  754. }
  755. if req.ActivityId == 0 {
  756. _, activityIdArr, err := cygx.AddActivity(items, industrialActivityItemsList, subjectActivityItemsList, itemPointsSet)
  757. if err != nil {
  758. br.Msg = "发布失败"
  759. br.ErrMsg = "发布失败,Err:" + err.Error()
  760. return
  761. }
  762. //如果是添加多条活动那么就推送多次
  763. for _, v := range activityIdArr {
  764. if req.DoType == 1 {
  765. go func() {
  766. //同时添加多个活动的时候,避免协程开的过多
  767. cygxService.DoActivityOnenIdWxTemplateMsg(v)
  768. cygxService.UpdateResourceData(v, "activity", "add", time.Now().Format(utils.FormatDateTime))
  769. cygxService.YiDongSaveRoadshowDetail(v)
  770. cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(v, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣
  771. elastic.AddComprehensiveActivity(v)
  772. }()
  773. }
  774. go cygxService.MakeActivitySigninImg(v)
  775. }
  776. } else {
  777. if req.DoType == 1 {
  778. go cygxService.DoActivityOnenIdWxTemplateMsg(req.ActivityId)
  779. go cygxService.UpdateResourceData(req.ActivityId, "activity", "add", time.Now().Format(utils.FormatDateTime))
  780. go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(activityId, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣点
  781. }
  782. //如果二次编辑的时候,取消了易董办会选项,那么就对易董发送取消发布到广场的通知
  783. if req.IsYidongConduct == 0 {
  784. go cygxService.YiDongUpdateActivityStatus(activityId)
  785. }
  786. }
  787. // 查研观向7.4-更新产业布局时间
  788. if len(industryIds) > 0 {
  789. go cygxService.UpdateIndustryLayoutTime(industryIds, false)
  790. }
  791. //添加操作日志记录
  792. br.Ret = 200
  793. br.Success = true
  794. br.Msg = "操作成功"
  795. br.IsAddLog = true
  796. }
  797. // @Title 活动列表
  798. // @Description 获取活动列表接口
  799. // @Param PageSize query int true "每页数据条数"
  800. // @Param CurrentIndex query int true "当前页页码,从1开始"
  801. // @Param PublishStatus query int false "发布状态 ,0未发布,1已发布,3已取消,传2查询所有"
  802. // @Param ChartPermissionId query string false "行业id"
  803. // @Param ActivityTypeId query string false "活动类型id"
  804. // @Param StartDate query string false "开始时间 ,列如2021-03-06 "
  805. // @Param EndDate query string false "结束时间,列如2021-03-06 "
  806. // @Param PublishStartDate query string false "发布开始时间 ,列如2021-03-06 "
  807. // @Param PublishEndDate query string false "发布结束时间,列如2021-03-06 "
  808. // @Param KeyWord query string false "搜索关键词"
  809. // @Param ActiveState query string false "活动进行状态 未开始:NotStarted、进行中HaveInHand、已结束Complete"
  810. // @Param IsResearch query bool true "是否为研选"
  811. // @Success 200 {object} cygx.GetCygxActivityListRep
  812. // @router /activity/list [get]
  813. func (this *ActivityCoAntroller) ActivityList() {
  814. br := new(models.BaseResponse).Init()
  815. defer func() {
  816. this.Data["json"] = br
  817. this.ServeJSON()
  818. }()
  819. sysUser := this.SysUser
  820. if sysUser == nil {
  821. br.Msg = "请登录"
  822. br.ErrMsg = "请登录,SysUser Is Empty"
  823. return
  824. }
  825. pageSize, _ := this.GetInt("PageSize")
  826. currentIndex, _ := this.GetInt("CurrentIndex")
  827. publishStatus, _ := this.GetInt("PublishStatus")
  828. chartPermissionId, _ := this.GetInt("ChartPermissionId")
  829. ActivityTypeId, _ := this.GetInt("ActivityTypeId")
  830. startDate := this.GetString("StartDate")
  831. endDate := this.GetString("EndDate")
  832. publishStartDate := this.GetString("PublishStartDate")
  833. publishEndDate := this.GetString("PublishEndDate")
  834. keyWord := this.GetString("KeyWord")
  835. activeState := this.GetString("ActiveState")
  836. activityLabel := this.GetString("ActivityLabel") // 查研观向7.4-活动标签
  837. isResearch, _ := this.GetBool("IsResearch", false) // 是否为研选 查研观向11.0 (研选活动独立显示)
  838. if activeState != "HaveInHand" && activeState != "Complete" {
  839. activeState = "NotStarted"
  840. }
  841. var startSize int
  842. if pageSize <= 0 {
  843. pageSize = utils.PageSize20
  844. }
  845. if currentIndex <= 0 {
  846. currentIndex = 1
  847. }
  848. startSize = utils.StartIndex(currentIndex, pageSize)
  849. var condition string
  850. var pars []interface{}
  851. //condition += ` FROM cygx_activity as art WHERE 1= 1 `
  852. if keyWord != "" {
  853. condition += ` AND (art.activity_name LIKE '%` + keyWord + `%' ) `
  854. }
  855. if isResearch {
  856. chartPermissionId = utils.CHART_PERMISSION_ID_YANXUAN
  857. } else {
  858. condition += ` AND art.chart_permission_id != '` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `'`
  859. }
  860. //行业名称
  861. if chartPermissionId > 0 {
  862. condition += ` AND art.chart_permission_id = '` + strconv.Itoa(chartPermissionId) + `'`
  863. }
  864. if startDate != "" {
  865. condition += ` AND art.activity_time >= ` + "'" + startDate + " 00:00:00'"
  866. }
  867. if endDate != "" {
  868. condition += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
  869. }
  870. //发布时间状态的筛选
  871. if publishStartDate != "" {
  872. condition += ` AND art.publish_date >= ` + "'" + publishStartDate + " 00:00:00'"
  873. publishStatus = 1
  874. }
  875. if publishEndDate != "" {
  876. condition += ` AND art.publish_date <= ` + "'" + publishEndDate + " 23:59:59'"
  877. publishStatus = 1
  878. }
  879. if publishStatus == 0 {
  880. condition += ` AND art.publish_status = 0 AND art.is_cancel = 0 `
  881. } else if publishStatus == 1 {
  882. condition += ` AND art.publish_status = 1 `
  883. } else if publishStatus == 3 {
  884. condition += ` AND art.publish_status = 0 AND art.is_cancel = 1 `
  885. }
  886. if ActivityTypeId > 0 {
  887. condition += ` AND art.activity_type_id = '` + strconv.Itoa(ActivityTypeId) + `'`
  888. }
  889. if activeState == "NotStarted" {
  890. condition += ` AND art.active_state =1 `
  891. } else if activeState == "HaveInHand" {
  892. condition += ` AND art.active_state =2 `
  893. } else {
  894. condition += ` AND art.active_state =3 `
  895. }
  896. // 活动标签
  897. if activityLabel != "" {
  898. condition += ` AND (art.label LIKE '%` + activityLabel + `%' ) `
  899. }
  900. //C类电话会,仅本组销售、部门管理员、admin、权益研究员账号能看到。
  901. if sysUser.Role != "admin" {
  902. conditionPermission, err := cygxService.GetAdminActivityPermission(sysUser, condition)
  903. if err != nil {
  904. br.Msg = "获取失败"
  905. br.ErrMsg = "获取失败,GetAdminActivityPermission Err:" + err.Error()
  906. return
  907. }
  908. condition += ` AND art.visible_range != 1 `
  909. condition += conditionPermission
  910. pars = append(pars, pars)
  911. }
  912. //1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
  913. total, err := cygx.GetActivityCount(condition, pars)
  914. if err != nil {
  915. br.Msg = "获取失败"
  916. br.ErrMsg = "获取失败,Err:" + err.Error()
  917. return
  918. }
  919. if activeState == "NotStarted" {
  920. condition += ` ORDER BY art.activity_time ASC `
  921. } else {
  922. condition += ` ORDER BY art.activity_time DESC `
  923. }
  924. list, errList := cygx.GetActivityListAll(condition, pars, startSize, pageSize)
  925. if errList != nil {
  926. br.Msg = "获取失败"
  927. br.ErrMsg = "获取失败,Err:" + errList.Error()
  928. return
  929. }
  930. var activityIds string
  931. for k, v := range list {
  932. if v.ChartPermissionNames != "" {
  933. list[k].ChartPermissionName = v.ChartPermissionNames
  934. }
  935. if v.IsCancel == 1 {
  936. v.PublishStatus = 3
  937. }
  938. activityIds += strconv.Itoa(v.ActivityId) + ","
  939. }
  940. activityIds = strings.TrimRight(activityIds, ",")
  941. mapIndustrial := make(map[int]string)
  942. mapSubject := make(map[string]string)
  943. mapUpload := make(map[int]bool)
  944. if activityIds != "" {
  945. industrialList, err := cygx.GetIndustrialActivityGroupListByactivityIds(activityIds)
  946. if err != nil {
  947. br.Msg = "获取失败"
  948. br.ErrMsg = "获取失败,GetIndustrialActivityGroupListByactivityIds Err:" + err.Error()
  949. return
  950. }
  951. subjectList, err := cygx.GetSubjectActivityGroupListByactivityIds(activityIds)
  952. if err != nil {
  953. br.Msg = "获取失败"
  954. br.ErrMsg = "获取失败,GetSubjectActivityGroupListByactivityIds Err:" + err.Error()
  955. return
  956. }
  957. //合并活动对应的多个标的
  958. for _, v := range subjectList {
  959. mapSubject[fmt.Sprint(v.ActivityId, "_", v.IndustrialManagementId)] += v.SubjectName + "/"
  960. }
  961. //活动对应的产业
  962. for _, v := range industrialList {
  963. var labelSubject string
  964. labelSubject = mapSubject[fmt.Sprint(v.ActivityId, "_", v.IndustrialManagementId)]
  965. if labelSubject != "" {
  966. mapIndustrial[v.ActivityId] += v.IndustryName + "--" + strings.TrimRight(labelSubject, "/") + ","
  967. } else {
  968. mapIndustrial[v.ActivityId] += v.IndustryName + ","
  969. }
  970. }
  971. var conditionupload string
  972. var pars []interface{}
  973. conditionupload = " AND activity_id IN (" + activityIds + ") "
  974. listVideo, err := cygx.GetActivityVideoList(conditionupload, pars)
  975. if err != nil && err.Error() != utils.ErrNoRow() {
  976. br.Msg = "获取失败"
  977. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  978. return
  979. }
  980. if len(listVideo) > 0 {
  981. for _, v := range listVideo {
  982. mapUpload[v.ActivityId] = true
  983. }
  984. }
  985. listVoice, err := cygx.GetActivityVoiceList(conditionupload, pars)
  986. if err != nil && err.Error() != utils.ErrNoRow() {
  987. br.Msg = "获取失败"
  988. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  989. return
  990. }
  991. if len(listVoice) > 0 {
  992. for _, v := range listVoice {
  993. mapUpload[v.ActivityId] = true
  994. }
  995. }
  996. }
  997. for k, v := range list {
  998. if mapIndustrial[v.ActivityId] != "" && v.TemporaryLabel == "" {
  999. list[k].Label = strings.TrimRight(mapIndustrial[v.ActivityId], ",")
  1000. }
  1001. if v.YidongActivityId != "" {
  1002. list[k].ActivityTypeName += utils.YI_DONG_NAME
  1003. if v.ChartPermissionNameDeputy != "" && v.ChartPermissionNameDeputy != v.ChartPermissionName {
  1004. v.ChartPermissionName = v.ChartPermissionNameDeputy // 易董同步过来的活动展示副权限 v11.0
  1005. }
  1006. }
  1007. if v.IsYidongConduct == 1 {
  1008. list[k].ActivityTypeName += utils.YI_DONG_NAME_TWO
  1009. }
  1010. list[k].IsUpload = mapUpload[v.ActivityId]
  1011. //是否展示签到码
  1012. if (v.ActivityTypeId == 5 || v.ActivityTypeId == 6 || v.ActivityTypeId == 8) && v.SigninImg != "" && v.ActiveState == 1 && v.PublishStatus == 1 {
  1013. list[k].IsShowSigninButton = true
  1014. }
  1015. }
  1016. if len(list) == 0 {
  1017. list = make([]*cygx.CygxActivityList, 0)
  1018. }
  1019. page := paging.GetPaging(currentIndex, pageSize, total)
  1020. resp := new(cygx.GetCygxActivityListRep)
  1021. resp.List = list
  1022. resp.Paging = page
  1023. br.Ret = 200
  1024. br.Success = true
  1025. br.Msg = "获取成功"
  1026. br.Data = resp
  1027. }
  1028. // @Title 活动详情
  1029. // @Description 获取活动详情接口
  1030. // @Param ActivityId query int true "活动ID"
  1031. // @Success Ret=200 {object} cygx.ActivityDetail
  1032. // @router /activity/detail [get]
  1033. func (this *ActivityCoAntroller) Detail() {
  1034. br := new(models.BaseResponse).Init()
  1035. defer func() {
  1036. this.Data["json"] = br
  1037. this.ServeJSON()
  1038. }()
  1039. AdminUser := this.SysUser
  1040. if AdminUser == nil {
  1041. br.Msg = "请登录"
  1042. br.ErrMsg = "请登录,用户信息为空"
  1043. br.Ret = 408
  1044. return
  1045. }
  1046. activityId, _ := this.GetInt("ActivityId")
  1047. if activityId < 1 {
  1048. br.Msg = "请输入活动ID"
  1049. return
  1050. }
  1051. activityInfo, err := cygx.GetAddActivityInfoById(activityId)
  1052. if err != nil {
  1053. br.Msg = "活动不存在"
  1054. br.ErrMsg = "活动ID错误,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1055. return
  1056. }
  1057. detail, errDetail := cygx.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
  1058. if errDetail != nil {
  1059. br.Msg = "获取信息失败"
  1060. br.ErrMsg = "获取信息失败,Err:" + errDetail.Error()
  1061. return
  1062. }
  1063. industrialList, err := cygx.GetIndustrialActivityGroupManagementList(activityId, 1)
  1064. if err != nil && err.Error() != utils.ErrNoRow() {
  1065. br.Msg = "获取信息失败"
  1066. br.ErrMsg = "获取活动关联的产业列表信息失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1067. return
  1068. }
  1069. var subjectList []*cygx.SubjectActivityGroupManagementRep
  1070. if len(industrialList) > 0 {
  1071. subjectList, err = cygx.GetSubjectActivityGroupManagementList(activityId, 1)
  1072. if err != nil && err.Error() != utils.ErrNoRow() {
  1073. br.Msg = "获取信息失败"
  1074. br.ErrMsg = "获取活动关联的标的列表信息失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1075. return
  1076. }
  1077. }
  1078. VoiceReqList, err := cygx.GetCygxActivityVoiceReqList(activityId)
  1079. if err != nil && err.Error() != utils.ErrNoRow() {
  1080. br.Msg = "获取信息失败"
  1081. br.ErrMsg = "GetCygxActivityVoiceReqList,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1082. return
  1083. }
  1084. if len(VoiceReqList) == 0 {
  1085. VoiceReqList = make([]*cygx.CygxActivityVoiceReq, 0)
  1086. }
  1087. VideoDetail, err := cygx.GetCygxActivityVideoReqDetail(activityId)
  1088. if err != nil && err.Error() != utils.ErrNoRow() {
  1089. br.Msg = "获取信息失败"
  1090. br.ErrMsg = "GetCygxActivityVideoReqDetail,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1091. return
  1092. }
  1093. if activityInfo.CustomerTypeIds != "" {
  1094. customerTypeIdslist := strings.Split(activityInfo.CustomerTypeIds, ",")
  1095. var permissionValueStr string
  1096. for _, v := range customerTypeIdslist {
  1097. permissionValueStr += "'" + v + "',"
  1098. }
  1099. permissionValueStr = strings.TrimRight(permissionValueStr, ",")
  1100. condition := ` AND permission_value IN (` + permissionValueStr + `)`
  1101. listValue, err := cygx.GetActivityCcustomerTypeList(condition)
  1102. if err != nil {
  1103. br.Msg = "活动可见套餐类型错误,请核实"
  1104. br.ErrMsg = "GetActivityCcustomerTypeList,Err:" + err.Error()
  1105. return
  1106. }
  1107. activityInfo.CustomerTypeIds = ""
  1108. for _, v := range listValue {
  1109. activityInfo.CustomerTypeIds += strconv.Itoa(v.CustomerTypeId) + ","
  1110. }
  1111. activityInfo.CustomerTypeIds = strings.TrimRight(activityInfo.CustomerTypeIds, ",")
  1112. }
  1113. if activityInfo.SiginupDeadline == utils.EmptyDateTimeStr {
  1114. activityInfo.SiginupDeadline = ""
  1115. }
  1116. PointsSetDetail, err := cygx.GetCygxActivityPointsSetDetail(activityId)
  1117. if err != nil && err.Error() != utils.ErrNoRow() {
  1118. br.Msg = "获取信息失败"
  1119. br.ErrMsg = "GetCygxActivityPointsSetDetail,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1120. return
  1121. }
  1122. if PointsSetDetail != nil {
  1123. if PointsSetDetail.CancelDeadlineType == "0" {
  1124. PointsSetDetail.CancelDeadlineType = ""
  1125. }
  1126. activityInfo.PointsSet = PointsSetDetail
  1127. } else {
  1128. activityInfo.PointsSet = new(cygx.CygxActivityPointsSetRsq)
  1129. }
  1130. //可见范围 1,仅本组可见 、2,全部客户可见 没设置本组可见的,强制设置为全部客户可见
  1131. if activityInfo.VisibleRange == 0 {
  1132. activityInfo.VisibleRange = 2
  1133. }
  1134. //activityInfo.CancelDeadlineType = cygxService.ActivityCancelDeadlineType(activityInfo) //处理活动取消报名截止时间类型展示
  1135. activityInfo.VoiceList = VoiceReqList
  1136. activityInfo.VideoDetail = VideoDetail
  1137. activityInfo.ShowType = detail.ShowType
  1138. activityInfo.ListIndustrial = industrialList
  1139. activityInfo.ListSubject = subjectList
  1140. br.Ret = 200
  1141. br.Success = true
  1142. br.Msg = "获取成功"
  1143. br.Data = activityInfo
  1144. }
  1145. // @Title 活动的发布与取消发布
  1146. // @Description 活动的发布与取消发布接口
  1147. // @Param request body cygx.ActivityIdRep true "type json string"
  1148. // @Success 200 操作成功
  1149. // @router /activity/PublishAndCancel [post]
  1150. func (this *ActivityCoAntroller) PublishAndCancel() {
  1151. br := new(models.BaseResponse).Init()
  1152. defer func() {
  1153. this.Data["json"] = br
  1154. this.ServeJSON()
  1155. }()
  1156. AdminUser := this.SysUser
  1157. if AdminUser == nil {
  1158. br.Msg = "请登录"
  1159. br.ErrMsg = "请登录,用户信息为空"
  1160. br.Ret = 408
  1161. return
  1162. }
  1163. var req cygx.ActivityIdRep
  1164. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1165. if err != nil {
  1166. br.Msg = "参数解析异常!"
  1167. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1168. return
  1169. }
  1170. activityId := req.ActivityId
  1171. item := new(cygx.CygxActivity)
  1172. activityInfo, errInfo := cygx.GetAddActivityInfoById(activityId)
  1173. if activityInfo == nil {
  1174. br.Msg = "操作失败"
  1175. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  1176. return
  1177. }
  1178. if errInfo != nil {
  1179. br.Msg = "操作失败"
  1180. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1181. return
  1182. }
  1183. //校验活动后台管理员、销售是否有修改权限
  1184. havePower, popupMsg, err := cygxService.CheckActivityUpdatePower(AdminUser.AdminId, activityInfo)
  1185. if err != nil {
  1186. br.Msg = "获取管理员身份信息失败"
  1187. br.ErrMsg = "获取管理员身份信息失败,Err:" + err.Error()
  1188. return
  1189. }
  1190. if !havePower {
  1191. br.Msg = popupMsg
  1192. return
  1193. }
  1194. //if activityInfo.ActiveState != 1 {
  1195. // br.Msg = "活动已经开始,无法修改"
  1196. // return
  1197. //}
  1198. if activityInfo.PublishStatus == 0 {
  1199. item.PublishStatus = 1
  1200. item.IsCancel = 0
  1201. go cygxService.DoActivityOnenIdWxTemplateMsg(activityId)
  1202. go cygxService.UpdateResourceData(activityId, "activity", "add", time.Now().Format(utils.FormatDateTime))
  1203. } else {
  1204. item.PublishStatus = 0
  1205. item.IsCancel = 1
  1206. }
  1207. if activityInfo.PublishStatus == 1 {
  1208. go services.SendWxMsgWithCygxActivity(req.ActivityId)
  1209. //同步活动到最新数据表
  1210. go cygxService.UpdateResourceData(req.ActivityId, "activity", "delete", "")
  1211. }
  1212. item.ActivityId = req.ActivityId
  1213. if item.PublishStatus == 1 {
  1214. item.AdminId = AdminUser.AdminId
  1215. item.AdminName = AdminUser.RealName
  1216. item.PublishDate = time.Now()
  1217. } else {
  1218. item.AdminId = activityInfo.AdminId
  1219. item.AdminName = activityInfo.AdminName
  1220. item.PublishDate = utils.StrTimeToTime(activityInfo.PublishDate)
  1221. }
  1222. err = cygx.ActivityPublishAndCancel(item)
  1223. if err != nil {
  1224. br.Msg = "操作失败"
  1225. br.ErrMsg = "操作失败,Err:" + err.Error()
  1226. return
  1227. }
  1228. if item.PublishStatus == 1 {
  1229. //易董那边重新发布,重新建会
  1230. go cygxService.YiDongSaveRoadshowDetail(activityId)
  1231. } else {
  1232. //易董那边取消发布并删除
  1233. go cygxService.YiDongUpdateActivityPublish(activityId)
  1234. }
  1235. go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(activityId, AdminUser.AdminId, item.PublishStatus) //活动发布以及取消发布处理研选扣点
  1236. go elastic.AddComprehensiveActivity(activityId) // 同步Es添加活动
  1237. br.Ret = 200
  1238. br.Success = true
  1239. br.Msg = "操作成功"
  1240. br.IsAddLog = true //添加操作日志记录
  1241. }
  1242. // @Title 删除活动
  1243. // @Description 删除活动接口
  1244. // @Param request body cygx.ActivityIdRep true "type json string"
  1245. // @Success Ret=200
  1246. // @router /activity/delete [post]
  1247. func (this *ActivityCoAntroller) Delete() {
  1248. br := new(models.BaseResponse).Init()
  1249. defer func() {
  1250. this.Data["json"] = br
  1251. this.ServeJSON()
  1252. }()
  1253. AdminUser := this.SysUser
  1254. if AdminUser == nil {
  1255. br.Msg = "请登录"
  1256. br.ErrMsg = "请登录,SysUser Is Empty"
  1257. br.Ret = 408
  1258. return
  1259. }
  1260. var req cygx.ActivityIdRep
  1261. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1262. if err != nil {
  1263. br.Msg = "参数解析异常!"
  1264. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1265. return
  1266. }
  1267. activityId := req.ActivityId
  1268. if activityId < 1 {
  1269. br.Msg = "请输入活动ID"
  1270. return
  1271. }
  1272. activityInfo, errInfo := cygx.GetAddActivityInfoById(activityId)
  1273. if activityInfo == nil {
  1274. br.Msg = "操作失败"
  1275. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  1276. return
  1277. }
  1278. if errInfo != nil {
  1279. br.Msg = "操作失败"
  1280. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1281. return
  1282. }
  1283. //校验活动后台管理员、销售是否有修改权限
  1284. havePower, popupMsg, err := cygxService.CheckActivityUpdatePower(AdminUser.AdminId, activityInfo)
  1285. if err != nil {
  1286. br.Msg = "获取管理员身份信息失败"
  1287. br.ErrMsg = "获取管理员身份信息失败,Err:" + err.Error()
  1288. return
  1289. }
  1290. if !havePower {
  1291. br.Msg = popupMsg
  1292. return
  1293. }
  1294. resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
  1295. res := time.Now().Before(resultTime)
  1296. if res == false {
  1297. br.Msg = "活动已结束禁止删除!"
  1298. br.ErrMsg = "活动已结束禁止删除!"
  1299. return
  1300. }
  1301. err = cygx.DeleteActivity(activityId)
  1302. if err != nil {
  1303. br.Msg = "删除信息失败"
  1304. br.ErrMsg = "删除信息失败,Err:" + err.Error()
  1305. return
  1306. }
  1307. //添加操作日志记录
  1308. br.Ret = 200
  1309. br.Success = true
  1310. br.Msg = "已删除"
  1311. br.IsAddLog = true
  1312. }
  1313. // @Title 获取活动行业分类
  1314. // @Description 获取活动行业分类接口
  1315. // @Param IsHideResearch query bool false "是否隐藏买方研选(默认不隐藏)"
  1316. // @Success 200 {object} cygx.ChartPermissionRepMoreList
  1317. // @router /activity/chartPermission/list [get]
  1318. func (this *ActivityCoAntroller) ChartPermissionListAct() {
  1319. br := new(models.BaseResponse).Init()
  1320. defer func() {
  1321. this.Data["json"] = br
  1322. this.ServeJSON()
  1323. }()
  1324. AdminUser := this.SysUser
  1325. if AdminUser == nil {
  1326. br.Msg = "请登录"
  1327. br.ErrMsg = "请登录,用户信息为空"
  1328. br.Ret = 408
  1329. return
  1330. }
  1331. //数据库新加行业分类,与之前的项目权限部分冲突太多,故采用自定义而不去数据库查找
  1332. resp := new(cygx.ChartPermissionRepMoreList)
  1333. // 查研观向7.4-策略后面新增一个宏观
  1334. resp.List = cygxService.GetActChartPermissionList()
  1335. br.Ret = 200
  1336. br.Success = true
  1337. br.Msg = "获取成功"
  1338. br.Data = resp
  1339. }
  1340. // @Title 扣点设置
  1341. // @Description 扣点设置接口
  1342. // @Success 200 {object} cygx.CygxActivityPointsSetConfigListResp
  1343. // @router /activity/pointsSet [get]
  1344. func (this *ActivityCoAntroller) PointsSet() {
  1345. br := new(models.BaseResponse).Init()
  1346. defer func() {
  1347. this.Data["json"] = br
  1348. this.ServeJSON()
  1349. }()
  1350. AdminUser := this.SysUser
  1351. if AdminUser == nil {
  1352. br.Msg = "请登录"
  1353. br.ErrMsg = "请登录,用户信息为空"
  1354. br.Ret = 408
  1355. return
  1356. }
  1357. conf, err := cygx.GetCygxConfigDetailByCode("activity_points_set")
  1358. if err != nil {
  1359. br.Msg = "获取数据失败"
  1360. br.ErrMsg = "买方研选产品介绍信息失败,Err:" + err.Error()
  1361. return
  1362. }
  1363. if conf.ConfigValue == "" {
  1364. br.Msg = "获取失败"
  1365. br.ErrMsg = "买方研选产品介绍信息失败"
  1366. return
  1367. }
  1368. list := new(*cygx.CygxActivityPointsSetConfigListResp)
  1369. if err = json.Unmarshal([]byte(conf.ConfigValue), &list); err != nil {
  1370. br.Msg = "获取失败"
  1371. br.ErrMsg = "买方研选产品介绍信配置值解析失败, Err: " + err.Error()
  1372. return
  1373. }
  1374. br.Ret = 200
  1375. br.Success = true
  1376. br.Msg = "获取成功"
  1377. br.Data = list
  1378. }
  1379. // @Title 权益办会机构搜索
  1380. // @Description 权益办会机构搜索
  1381. // @Param KeyWord query string false "搜索关键词"
  1382. // @Success 200 {object} cygx.ChartPermissionRepMoreList
  1383. // @router /activity/companySearch [get]
  1384. func (this *ActivityCoAntroller) CompanySearch() {
  1385. br := new(models.BaseResponse).Init()
  1386. defer func() {
  1387. this.Data["json"] = br
  1388. this.ServeJSON()
  1389. }()
  1390. AdminUser := this.SysUser
  1391. if AdminUser == nil {
  1392. br.Msg = "请登录"
  1393. br.ErrMsg = "请登录,用户信息为空"
  1394. br.Ret = 408
  1395. return
  1396. }
  1397. keyWord := this.GetString("KeyWord")
  1398. if keyWord == "" {
  1399. br.ErrMsg = "请输入搜索关键词"
  1400. return
  1401. }
  1402. resp := new(cygx.CygxActivitySearcCompanyListResp)
  1403. list, err := cygx.GetCygxActivitySearcCompanyList(keyWord)
  1404. if err != nil {
  1405. br.Msg = "操作失败"
  1406. br.ErrMsg = "操作失败,Err:" + err.Error()
  1407. return
  1408. }
  1409. if len(list) == 0 {
  1410. list = make([]*cygx.CygxActivitySearcCompanyResp, 0)
  1411. }
  1412. resp.List = list
  1413. br.Ret = 200
  1414. br.Success = true
  1415. br.Msg = "获取成功"
  1416. br.Data = resp
  1417. }
  1418. // @Title 报名截止时间设置
  1419. // @Description 报名截止时间设置接口
  1420. // @Success Ret=200
  1421. // @router /activity/deadlineSet [get]
  1422. func (this *ActivityCoAntroller) DeadlineSet() {
  1423. br := new(models.BaseResponse).Init()
  1424. defer func() {
  1425. this.Data["json"] = br
  1426. this.ServeJSON()
  1427. }()
  1428. AdminUser := this.SysUser
  1429. if AdminUser == nil {
  1430. br.Msg = "请登录"
  1431. br.ErrMsg = "请登录,SysUser Is Empty"
  1432. return
  1433. }
  1434. list := make([]cygx.SendGroupStr, 0)
  1435. list = append(list, cygx.SendGroupStr{
  1436. Id: "1",
  1437. Name: "同报名截止时间",
  1438. })
  1439. list = append(list, cygx.SendGroupStr{
  1440. Id: "2",
  1441. Name: "活动开始前24小时",
  1442. })
  1443. list = append(list, cygx.SendGroupStr{
  1444. Id: "3",
  1445. Name: "活动开始前48小时",
  1446. })
  1447. br.Ret = 200
  1448. br.Success = true
  1449. br.Data = list
  1450. }
  1451. // @Title 根据图片获取建会信息接口
  1452. // @Description 根据图片获取建会信息接口
  1453. // @Param request body cygx.ActivityIdRep true "type json string"
  1454. // @Success Ret=200
  1455. // @router /activity/imgToText [post]
  1456. func (this *ActivityCoAntroller) ImgToText() {
  1457. br := new(models.BaseResponse).Init()
  1458. defer func() {
  1459. this.Data["json"] = br
  1460. this.ServeJSON()
  1461. }()
  1462. AdminUser := this.SysUser
  1463. if AdminUser == nil {
  1464. br.Msg = "请登录"
  1465. br.ErrMsg = "请登录,SysUser Is Empty"
  1466. br.Ret = 408
  1467. return
  1468. }
  1469. var req cygx.AliyunOcrImgUrlReq
  1470. resp := new(cygx.AliyunOcrTextActivityListResp)
  1471. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1472. if err != nil {
  1473. br.Msg = "参数解析异常!"
  1474. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1475. return
  1476. }
  1477. imgUrl := req.ImgUrl
  1478. if imgUrl == "" {
  1479. br.Msg = "请上传图片"
  1480. return
  1481. }
  1482. ocrResp, err := services.AliOcrByImageToText(imgUrl)
  1483. if err != nil {
  1484. br.Msg = "图片解析失败!"
  1485. br.ErrMsg = "图片解析失败,Err:" + err.Error()
  1486. return
  1487. }
  1488. if len(ocrResp.Ret) == 0 {
  1489. br.Msg = "图片解析失败!"
  1490. return
  1491. }
  1492. var titmeYMD string
  1493. var titmeHM string
  1494. var company string
  1495. var list []*cygx.AliyunOcrTextActivityResp
  1496. var mapTitmeYMD = make(map[int]string)
  1497. var mapTitmeHM = make(map[int]string)
  1498. var mapCompany = make(map[int]string)
  1499. var lineNum int
  1500. for k, v := range ocrResp.Ret {
  1501. if k == 0 && !strings.Contains(v.Word, "/") {
  1502. continue
  1503. }
  1504. if strings.Contains(v.Word, "/") {
  1505. mapTitmeYMD[lineNum] = v.Word
  1506. titmeYMD = v.Word
  1507. }
  1508. if strings.Contains(v.Word, "AM") || strings.Contains(v.Word, "PM") {
  1509. mapTitmeHM[lineNum] = v.Word
  1510. titmeHM = v.Word
  1511. }
  1512. if strings.Contains(v.Word, "(") && strings.Contains(v.Word, ")") {
  1513. if mapTitmeYMD[lineNum] == "" {
  1514. mapTitmeYMD[lineNum] = mapTitmeYMD[lineNum-1]
  1515. }
  1516. titmeYMD = mapTitmeYMD[lineNum]
  1517. mapCompany[lineNum] = v.Word
  1518. company = v.Word
  1519. lineNum++
  1520. }
  1521. if titmeYMD != "" && titmeHM != "" && company != "" {
  1522. item := new(cygx.AliyunOcrTextActivityResp)
  1523. item.TitmeYMD = titmeYMD
  1524. item.TitmeHM = titmeHM
  1525. item.Company = company
  1526. list = append(list, item)
  1527. titmeYMD = ""
  1528. titmeHM = ""
  1529. company = ""
  1530. }
  1531. }
  1532. for _, v := range list {
  1533. v.TitmeYMD = cygxService.ConvertActivityTitmeYMD(v.TitmeYMD)
  1534. v.TitmeHM = cygxService.ConvertActivityTitmeHM(v.TitmeHM)
  1535. }
  1536. resp.List = list
  1537. br.Ret = 200
  1538. br.Success = true
  1539. br.Data = resp
  1540. br.IsAddLog = true
  1541. }