activity.go 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
  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. //if itemVoice.VoiceUrl != "" {
  659. voiceReqList, err := cygx.GetCygxActivityVoiceReqList(activityId)
  660. if err != nil && err.Error() != utils.ErrNoRow() {
  661. br.Msg = "获取信息失败"
  662. br.ErrMsg = "GetCygxActivityVoiceReqList,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  663. return
  664. }
  665. if len(voiceReqList) > 0 {
  666. for _, voice := range voiceReqList {
  667. go cygxService.UpdateResourceData(voice.ActivityVoiceId, "activityvoice", "delete", time.Now().Format(utils.FormatDateTime))
  668. }
  669. }
  670. //}
  671. //如果活动信息有如下变更则做消息推送
  672. voiceIdNew, videoIdNew, err := cygx.EditActivity(item, activityInfo.PublishStatus, industrialActivityItemsList, subjectActivityItemsList, itemVoice, itemVideo, itemPointsSet)
  673. if err != nil {
  674. br.Msg = "操作失败"
  675. br.ErrMsg = "操作失败,Err:" + err.Error()
  676. return
  677. }
  678. //更新活动音频
  679. if int(voiceIdNew) > 0 {
  680. go cygxService.UpdateResourceData(int(voiceIdNew), "activityvoice", "add", activityInfo.ActivityTime)
  681. }
  682. //更新活动视频
  683. if int(videoIdNew) > 0 {
  684. go cygxService.UpdateResourceData(int(videoIdNew), "activityvideo", "add", activityInfo.ActivityTime)
  685. }
  686. errAct = err
  687. if activityInfo.PublishStatus == 1 && activityInfo.ActivityTimeText != item.ActivityTimeText {
  688. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, activityInfo.ActivityTimeText, item.ActivityTimeText, "timeType")
  689. }
  690. oldExpert, _ := cygx.GetReportContentTextSub(activityInfo.Expert)
  691. newExpert, _ := cygx.GetReportContentTextSub(item.Expert)
  692. if activityInfo.PublishStatus == 1 && oldExpert != newExpert {
  693. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, oldExpert, newExpert, "expertType")
  694. }
  695. if activityInfo.PublishStatus == 1 && activityInfo.Address != item.Address {
  696. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, activityInfo.Address, item.Address, "addressType")
  697. }
  698. if activityInfo.PublishStatus == 1 && activityInfo.ParticipationCode != item.ParticipationCode {
  699. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, activityInfo.ParticipationCode, item.ParticipationCode, "participationCode")
  700. }
  701. if activityInfo.PublishStatus == 1 && activityInfo.Theme != item.Theme {
  702. go services.SendWxMsgWithCygxActivityUpdateTime(req.ActivityId, activityInfo.Theme, item.Theme, "Theme")
  703. }
  704. //对于限制人数的活动,如果修改改了可见范围,对于新增的那一部分做新的推送
  705. if req.DoType == 0 && activityInfo.PublishStatus == 1 && activityInfo.ActiveState == 1 && activityInfo.LimitPeopleNum != "0" {
  706. if activityInfo.CustomerTypeIds != req.CustomerTypeIds || activityInfo.Scale != req.Scale || activityInfo.IsMakerShow != req.IsMakerShow || activityInfo.VisibleRange != req.VisibleRange {
  707. go cygxService.DoActivityOnenIdWxTemplateMsg(activityId)
  708. }
  709. }
  710. //已结束或者进行中的活动修改时间后,修改活动状态以及重新发送邮件附件
  711. if activeState != 0 && activeState != 1 {
  712. resultTime := utils.StrTimeToTime(item.ActivityTime) //时间字符串格式转时间格式
  713. if time.Now().Before(resultTime) {
  714. err := cygx.EditActivityStatus(req.ActivityId)
  715. if err != nil {
  716. br.Msg = "发布失败"
  717. br.ErrMsg = "发布失败,Err:" + err.Error()
  718. return
  719. }
  720. }
  721. }
  722. //修改活动人数限制之后,对于因为人数已满而失败的用户,推送模板消息
  723. if activityInfo.PublishStatus == 1 && activityInfo.IsLimitPeople != 0 && activityInfo.LimitPeopleNum != strconv.Itoa(req.LimitPeopleNum) {
  724. go cygxService.SendWxMsgWithCygxActivityUpdateLimitPeople(req.ActivityId)
  725. }
  726. go cygxService.YiDongSaveRoadshowDetail(activityId)
  727. //如果活动名称有变更就生成新的签到码
  728. if activityInfo.ActivityName != item.ActivityName || activityInfo.SigninImg == "" {
  729. go cygxService.MakeActivitySigninImg(req.ActivityId)
  730. }
  731. //如果活动之前是发布的状态,那么就对公司的扣点进行更新(涉及到新老公司的扣点返点,不放在Redis统一处理了)
  732. if activityInfo.PublishStatus == 1 {
  733. go cygxService.UpdateYanXuanActivityPointsBillOldComapny(activityInfo, AdminUser.AdminId, itemPointsSet, itemPointsSetOld) //活动发布以及取消发布处理研选扣点
  734. }
  735. //如果活动之前是未发布的状态,现在又发布了那么就对公司的扣点进行更新
  736. //if req.DoType == 1 && activityInfo.PublishStatus == 0 {
  737. // go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(activityId, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣点
  738. //}
  739. }
  740. if errAct != nil {
  741. br.Msg = "发布失败"
  742. br.ErrMsg = "发布失败,Err:" + errAct.Error()
  743. return
  744. }
  745. //go cygxService.YanXuanActivityPointsBillActivityEdit(activityId, AdminUser.AdminId) //活动编辑处理研选扣点
  746. }
  747. }
  748. if req.ActivityId == 0 {
  749. _, activityIdArr, err := cygx.AddActivity(items, industrialActivityItemsList, subjectActivityItemsList, itemPointsSet)
  750. if err != nil {
  751. br.Msg = "发布失败"
  752. br.ErrMsg = "发布失败,Err:" + err.Error()
  753. return
  754. }
  755. //如果是添加多条活动那么就推送多次
  756. for _, v := range activityIdArr {
  757. if req.DoType == 1 {
  758. go func() {
  759. //同时添加多个活动的时候,避免协程开的过多
  760. cygxService.DoActivityOnenIdWxTemplateMsg(v)
  761. //cygxService.UpdateResourceData(v, "activity", "add", time.Now().Format(utils.FormatDateTime))
  762. cygxService.UpdateActivityResourceData(v) //写入首页最新 cygx_resource_data 表
  763. cygxService.YiDongSaveRoadshowDetail(v)
  764. cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(v, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣
  765. elastic.AddComprehensiveActivity(v)
  766. }()
  767. }
  768. go cygxService.MakeActivitySigninImg(v)
  769. }
  770. } else {
  771. if req.DoType == 1 {
  772. go cygxService.DoActivityOnenIdWxTemplateMsg(req.ActivityId)
  773. //go cygxService.UpdateResourceData(req.ActivityId, "activity", "add", time.Now().Format(utils.FormatDateTime))
  774. cygxService.UpdateActivityResourceData(req.ActivityId) //写入首页最新 cygx_resource_data 表
  775. go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(activityId, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣点
  776. }
  777. //如果二次编辑的时候,取消了易董办会选项,那么就对易董发送取消发布到广场的通知
  778. if req.IsYidongConduct == 0 {
  779. go cygxService.YiDongUpdateActivityStatus(activityId)
  780. }
  781. }
  782. // 查研观向7.4-更新产业布局时间
  783. if len(industryIds) > 0 {
  784. go cygxService.UpdateIndustryLayoutTime(industryIds, false)
  785. }
  786. //添加操作日志记录
  787. br.Ret = 200
  788. br.Success = true
  789. br.Msg = "操作成功"
  790. br.IsAddLog = true
  791. }
  792. // @Title 活动列表
  793. // @Description 获取活动列表接口
  794. // @Param PageSize query int true "每页数据条数"
  795. // @Param CurrentIndex query int true "当前页页码,从1开始"
  796. // @Param PublishStatus query int false "发布状态 ,0未发布,1已发布,3已取消,传2查询所有"
  797. // @Param ChartPermissionId query string false "行业id"
  798. // @Param ActivityTypeId query string false "活动类型id"
  799. // @Param StartDate query string false "开始时间 ,列如2021-03-06 "
  800. // @Param EndDate query string false "结束时间,列如2021-03-06 "
  801. // @Param PublishStartDate query string false "发布开始时间 ,列如2021-03-06 "
  802. // @Param PublishEndDate query string false "发布结束时间,列如2021-03-06 "
  803. // @Param KeyWord query string false "搜索关键词"
  804. // @Param ActiveState query string false "活动进行状态 未开始:NotStarted、进行中HaveInHand、已结束Complete"
  805. // @Param IsResearch query bool true "是否为研选"
  806. // @Success 200 {object} cygx.GetCygxActivityListRep
  807. // @router /activity/list [get]
  808. func (this *ActivityCoAntroller) ActivityList() {
  809. br := new(models.BaseResponse).Init()
  810. defer func() {
  811. this.Data["json"] = br
  812. this.ServeJSON()
  813. }()
  814. sysUser := this.SysUser
  815. if sysUser == nil {
  816. br.Msg = "请登录"
  817. br.ErrMsg = "请登录,SysUser Is Empty"
  818. return
  819. }
  820. pageSize, _ := this.GetInt("PageSize")
  821. currentIndex, _ := this.GetInt("CurrentIndex")
  822. publishStatus, _ := this.GetInt("PublishStatus")
  823. chartPermissionId, _ := this.GetInt("ChartPermissionId")
  824. ActivityTypeId, _ := this.GetInt("ActivityTypeId")
  825. startDate := this.GetString("StartDate")
  826. endDate := this.GetString("EndDate")
  827. publishStartDate := this.GetString("PublishStartDate")
  828. publishEndDate := this.GetString("PublishEndDate")
  829. keyWord := this.GetString("KeyWord")
  830. activeState := this.GetString("ActiveState")
  831. activityLabel := this.GetString("ActivityLabel") // 查研观向7.4-活动标签
  832. isResearch, _ := this.GetBool("IsResearch", false) // 是否为研选 查研观向11.0 (研选活动独立显示)
  833. if activeState != "HaveInHand" && activeState != "Complete" {
  834. activeState = "NotStarted"
  835. }
  836. var startSize int
  837. if pageSize <= 0 {
  838. pageSize = utils.PageSize20
  839. }
  840. if currentIndex <= 0 {
  841. currentIndex = 1
  842. }
  843. startSize = utils.StartIndex(currentIndex, pageSize)
  844. var condition string
  845. var pars []interface{}
  846. //condition += ` FROM cygx_activity as art WHERE 1= 1 `
  847. if keyWord != "" {
  848. condition += ` AND (art.activity_name LIKE '%` + keyWord + `%' ) `
  849. }
  850. if isResearch {
  851. chartPermissionId = utils.CHART_PERMISSION_ID_YANXUAN
  852. } else {
  853. condition += ` AND art.chart_permission_id != '` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `'`
  854. }
  855. //行业名称
  856. if chartPermissionId > 0 {
  857. condition += ` AND art.chart_permission_id = '` + strconv.Itoa(chartPermissionId) + `'`
  858. }
  859. if startDate != "" {
  860. condition += ` AND art.activity_time >= ` + "'" + startDate + " 00:00:00'"
  861. }
  862. if endDate != "" {
  863. condition += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
  864. }
  865. //发布时间状态的筛选
  866. if publishStartDate != "" {
  867. condition += ` AND art.publish_date >= ` + "'" + publishStartDate + " 00:00:00'"
  868. publishStatus = 1
  869. }
  870. if publishEndDate != "" {
  871. condition += ` AND art.publish_date <= ` + "'" + publishEndDate + " 23:59:59'"
  872. publishStatus = 1
  873. }
  874. if publishStatus == 0 {
  875. condition += ` AND art.publish_status = 0 AND art.is_cancel = 0 `
  876. } else if publishStatus == 1 {
  877. condition += ` AND art.publish_status = 1 `
  878. } else if publishStatus == 3 {
  879. condition += ` AND art.publish_status = 0 AND art.is_cancel = 1 `
  880. }
  881. if ActivityTypeId > 0 {
  882. condition += ` AND art.activity_type_id = '` + strconv.Itoa(ActivityTypeId) + `'`
  883. }
  884. if activeState == "NotStarted" {
  885. condition += ` AND art.active_state =1 `
  886. } else if activeState == "HaveInHand" {
  887. condition += ` AND art.active_state =2 `
  888. } else {
  889. condition += ` AND art.active_state =3 `
  890. }
  891. // 活动标签
  892. if activityLabel != "" {
  893. condition += ` AND (art.label LIKE '%` + activityLabel + `%' ) `
  894. }
  895. //C类电话会,仅本组销售、部门管理员、admin、权益研究员账号能看到。
  896. if sysUser.Role != "admin" {
  897. conditionPermission, err := cygxService.GetAdminActivityPermission(sysUser, condition)
  898. if err != nil {
  899. br.Msg = "获取失败"
  900. br.ErrMsg = "获取失败,GetAdminActivityPermission Err:" + err.Error()
  901. return
  902. }
  903. condition += ` AND art.visible_range != 1 `
  904. condition += conditionPermission
  905. pars = append(pars, pars)
  906. }
  907. //1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
  908. total, err := cygx.GetActivityCount(condition, pars)
  909. if err != nil {
  910. br.Msg = "获取失败"
  911. br.ErrMsg = "获取失败,Err:" + err.Error()
  912. return
  913. }
  914. if activeState == "NotStarted" {
  915. condition += ` ORDER BY art.activity_time ASC `
  916. } else {
  917. condition += ` ORDER BY art.activity_time DESC `
  918. }
  919. list, errList := cygx.GetActivityListAll(condition, pars, startSize, pageSize)
  920. if errList != nil {
  921. br.Msg = "获取失败"
  922. br.ErrMsg = "获取失败,Err:" + errList.Error()
  923. return
  924. }
  925. var activityIds string
  926. for k, v := range list {
  927. if v.ChartPermissionNames != "" {
  928. list[k].ChartPermissionName = v.ChartPermissionNames
  929. }
  930. if v.IsCancel == 1 {
  931. v.PublishStatus = 3
  932. }
  933. activityIds += strconv.Itoa(v.ActivityId) + ","
  934. }
  935. activityIds = strings.TrimRight(activityIds, ",")
  936. mapIndustrial := make(map[int]string)
  937. mapSubject := make(map[string]string)
  938. mapUpload := make(map[int]bool)
  939. if activityIds != "" {
  940. industrialList, err := cygx.GetIndustrialActivityGroupListByactivityIds(activityIds)
  941. if err != nil {
  942. br.Msg = "获取失败"
  943. br.ErrMsg = "获取失败,GetIndustrialActivityGroupListByactivityIds Err:" + err.Error()
  944. return
  945. }
  946. subjectList, err := cygx.GetSubjectActivityGroupListByactivityIds(activityIds)
  947. if err != nil {
  948. br.Msg = "获取失败"
  949. br.ErrMsg = "获取失败,GetSubjectActivityGroupListByactivityIds Err:" + err.Error()
  950. return
  951. }
  952. //合并活动对应的多个标的
  953. for _, v := range subjectList {
  954. mapSubject[fmt.Sprint(v.ActivityId, "_", v.IndustrialManagementId)] += v.SubjectName + "/"
  955. }
  956. //活动对应的产业
  957. for _, v := range industrialList {
  958. var labelSubject string
  959. labelSubject = mapSubject[fmt.Sprint(v.ActivityId, "_", v.IndustrialManagementId)]
  960. if labelSubject != "" {
  961. mapIndustrial[v.ActivityId] += v.IndustryName + "--" + strings.TrimRight(labelSubject, "/") + ","
  962. } else {
  963. mapIndustrial[v.ActivityId] += v.IndustryName + ","
  964. }
  965. }
  966. var conditionupload string
  967. var pars []interface{}
  968. conditionupload = " AND activity_id IN (" + activityIds + ") "
  969. listVideo, err := cygx.GetActivityVideoList(conditionupload, pars)
  970. if err != nil && err.Error() != utils.ErrNoRow() {
  971. br.Msg = "获取失败"
  972. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  973. return
  974. }
  975. if len(listVideo) > 0 {
  976. for _, v := range listVideo {
  977. mapUpload[v.ActivityId] = true
  978. }
  979. }
  980. listVoice, err := cygx.GetActivityVoiceList(conditionupload, pars)
  981. if err != nil && err.Error() != utils.ErrNoRow() {
  982. br.Msg = "获取失败"
  983. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  984. return
  985. }
  986. if len(listVoice) > 0 {
  987. for _, v := range listVoice {
  988. mapUpload[v.ActivityId] = true
  989. }
  990. }
  991. }
  992. for k, v := range list {
  993. if mapIndustrial[v.ActivityId] != "" && v.TemporaryLabel == "" {
  994. list[k].Label = strings.TrimRight(mapIndustrial[v.ActivityId], ",")
  995. }
  996. if v.YidongActivityId != "" {
  997. list[k].ActivityTypeName += utils.YI_DONG_NAME
  998. if v.ChartPermissionNameDeputy != "" && v.ChartPermissionNameDeputy != v.ChartPermissionName {
  999. v.ChartPermissionName = v.ChartPermissionNameDeputy // 易董同步过来的活动展示副权限 v11.0
  1000. }
  1001. }
  1002. if v.IsYidongConduct == 1 {
  1003. list[k].ActivityTypeName += utils.YI_DONG_NAME_TWO
  1004. }
  1005. list[k].IsUpload = mapUpload[v.ActivityId]
  1006. //是否展示签到码
  1007. if (v.ActivityTypeId == 5 || v.ActivityTypeId == 6 || v.ActivityTypeId == 8) && v.SigninImg != "" && v.ActiveState == 1 && v.PublishStatus == 1 {
  1008. list[k].IsShowSigninButton = true
  1009. }
  1010. }
  1011. if len(list) == 0 {
  1012. list = make([]*cygx.CygxActivityList, 0)
  1013. }
  1014. page := paging.GetPaging(currentIndex, pageSize, total)
  1015. resp := new(cygx.GetCygxActivityListRep)
  1016. resp.List = list
  1017. resp.Paging = page
  1018. br.Ret = 200
  1019. br.Success = true
  1020. br.Msg = "获取成功"
  1021. br.Data = resp
  1022. }
  1023. // @Title 活动详情
  1024. // @Description 获取活动详情接口
  1025. // @Param ActivityId query int true "活动ID"
  1026. // @Success Ret=200 {object} cygx.ActivityDetail
  1027. // @router /activity/detail [get]
  1028. func (this *ActivityCoAntroller) Detail() {
  1029. br := new(models.BaseResponse).Init()
  1030. defer func() {
  1031. this.Data["json"] = br
  1032. this.ServeJSON()
  1033. }()
  1034. AdminUser := this.SysUser
  1035. if AdminUser == nil {
  1036. br.Msg = "请登录"
  1037. br.ErrMsg = "请登录,用户信息为空"
  1038. br.Ret = 408
  1039. return
  1040. }
  1041. activityId, _ := this.GetInt("ActivityId")
  1042. if activityId < 1 {
  1043. br.Msg = "请输入活动ID"
  1044. return
  1045. }
  1046. activityInfo, err := cygx.GetAddActivityInfoById(activityId)
  1047. if err != nil {
  1048. br.Msg = "活动不存在"
  1049. br.ErrMsg = "活动ID错误,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1050. return
  1051. }
  1052. detail, errDetail := cygx.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
  1053. if errDetail != nil {
  1054. br.Msg = "获取信息失败"
  1055. br.ErrMsg = "获取信息失败,Err:" + errDetail.Error()
  1056. return
  1057. }
  1058. industrialList, err := cygx.GetIndustrialActivityGroupManagementList(activityId, 1)
  1059. if err != nil && err.Error() != utils.ErrNoRow() {
  1060. br.Msg = "获取信息失败"
  1061. br.ErrMsg = "获取活动关联的产业列表信息失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1062. return
  1063. }
  1064. var subjectList []*cygx.SubjectActivityGroupManagementRep
  1065. if len(industrialList) > 0 {
  1066. subjectList, err = cygx.GetSubjectActivityGroupManagementList(activityId, 1)
  1067. if err != nil && err.Error() != utils.ErrNoRow() {
  1068. br.Msg = "获取信息失败"
  1069. br.ErrMsg = "获取活动关联的标的列表信息失败,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1070. return
  1071. }
  1072. }
  1073. VoiceReqList, err := cygx.GetCygxActivityVoiceReqList(activityId)
  1074. if err != nil && err.Error() != utils.ErrNoRow() {
  1075. br.Msg = "获取信息失败"
  1076. br.ErrMsg = "GetCygxActivityVoiceReqList,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1077. return
  1078. }
  1079. if len(VoiceReqList) == 0 {
  1080. VoiceReqList = make([]*cygx.CygxActivityVoiceReq, 0)
  1081. }
  1082. VideoDetail, err := cygx.GetCygxActivityVideoReqDetail(activityId)
  1083. if err != nil && err.Error() != utils.ErrNoRow() {
  1084. br.Msg = "获取信息失败"
  1085. br.ErrMsg = "GetCygxActivityVideoReqDetail,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1086. return
  1087. }
  1088. if activityInfo.CustomerTypeIds != "" {
  1089. customerTypeIdslist := strings.Split(activityInfo.CustomerTypeIds, ",")
  1090. var permissionValueStr string
  1091. for _, v := range customerTypeIdslist {
  1092. permissionValueStr += "'" + v + "',"
  1093. }
  1094. permissionValueStr = strings.TrimRight(permissionValueStr, ",")
  1095. condition := ` AND permission_value IN (` + permissionValueStr + `)`
  1096. listValue, err := cygx.GetActivityCcustomerTypeList(condition)
  1097. if err != nil {
  1098. br.Msg = "活动可见套餐类型错误,请核实"
  1099. br.ErrMsg = "GetActivityCcustomerTypeList,Err:" + err.Error()
  1100. return
  1101. }
  1102. activityInfo.CustomerTypeIds = ""
  1103. for _, v := range listValue {
  1104. activityInfo.CustomerTypeIds += strconv.Itoa(v.CustomerTypeId) + ","
  1105. }
  1106. activityInfo.CustomerTypeIds = strings.TrimRight(activityInfo.CustomerTypeIds, ",")
  1107. }
  1108. if activityInfo.SiginupDeadline == utils.EmptyDateTimeStr {
  1109. activityInfo.SiginupDeadline = ""
  1110. }
  1111. PointsSetDetail, err := cygx.GetCygxActivityPointsSetDetail(activityId)
  1112. if err != nil && err.Error() != utils.ErrNoRow() {
  1113. br.Msg = "获取信息失败"
  1114. br.ErrMsg = "GetCygxActivityPointsSetDetail,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
  1115. return
  1116. }
  1117. if PointsSetDetail != nil {
  1118. if PointsSetDetail.CancelDeadlineType == "0" {
  1119. PointsSetDetail.CancelDeadlineType = ""
  1120. }
  1121. activityInfo.PointsSet = PointsSetDetail
  1122. } else {
  1123. activityInfo.PointsSet = new(cygx.CygxActivityPointsSetRsq)
  1124. }
  1125. //可见范围 1,仅本组可见 、2,全部客户可见 没设置本组可见的,强制设置为全部客户可见
  1126. if activityInfo.VisibleRange == 0 {
  1127. activityInfo.VisibleRange = 2
  1128. }
  1129. //activityInfo.CancelDeadlineType = cygxService.ActivityCancelDeadlineType(activityInfo) //处理活动取消报名截止时间类型展示
  1130. activityInfo.VoiceList = VoiceReqList
  1131. activityInfo.VideoDetail = VideoDetail
  1132. activityInfo.ShowType = detail.ShowType
  1133. activityInfo.ListIndustrial = industrialList
  1134. activityInfo.ListSubject = subjectList
  1135. br.Ret = 200
  1136. br.Success = true
  1137. br.Msg = "获取成功"
  1138. br.Data = activityInfo
  1139. }
  1140. // @Title 活动的发布与取消发布
  1141. // @Description 活动的发布与取消发布接口
  1142. // @Param request body cygx.ActivityIdRep true "type json string"
  1143. // @Success 200 操作成功
  1144. // @router /activity/PublishAndCancel [post]
  1145. func (this *ActivityCoAntroller) PublishAndCancel() {
  1146. br := new(models.BaseResponse).Init()
  1147. defer func() {
  1148. this.Data["json"] = br
  1149. this.ServeJSON()
  1150. }()
  1151. AdminUser := this.SysUser
  1152. if AdminUser == nil {
  1153. br.Msg = "请登录"
  1154. br.ErrMsg = "请登录,用户信息为空"
  1155. br.Ret = 408
  1156. return
  1157. }
  1158. var req cygx.ActivityIdRep
  1159. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1160. if err != nil {
  1161. br.Msg = "参数解析异常!"
  1162. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1163. return
  1164. }
  1165. activityId := req.ActivityId
  1166. item := new(cygx.CygxActivity)
  1167. activityInfo, errInfo := cygx.GetAddActivityInfoById(activityId)
  1168. if activityInfo == nil {
  1169. br.Msg = "操作失败"
  1170. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  1171. return
  1172. }
  1173. if errInfo != nil {
  1174. br.Msg = "操作失败"
  1175. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1176. return
  1177. }
  1178. //校验活动后台管理员、销售是否有修改权限
  1179. havePower, popupMsg, err := cygxService.CheckActivityUpdatePower(AdminUser.AdminId, activityInfo)
  1180. if err != nil {
  1181. br.Msg = "获取管理员身份信息失败"
  1182. br.ErrMsg = "获取管理员身份信息失败,Err:" + err.Error()
  1183. return
  1184. }
  1185. if !havePower {
  1186. br.Msg = popupMsg
  1187. return
  1188. }
  1189. //if activityInfo.ActiveState != 1 {
  1190. // br.Msg = "活动已经开始,无法修改"
  1191. // return
  1192. //}
  1193. if activityInfo.PublishStatus == 0 {
  1194. item.PublishStatus = 1
  1195. item.IsCancel = 0
  1196. go cygxService.DoActivityOnenIdWxTemplateMsg(activityId)
  1197. //go cygxService.UpdateResourceData(activityId, "activity", "add", time.Now().Format(utils.FormatDateTime))
  1198. cygxService.UpdateActivityResourceData(activityId) //写入首页最新 cygx_resource_data 表
  1199. } else {
  1200. item.PublishStatus = 0
  1201. item.IsCancel = 1
  1202. }
  1203. if activityInfo.PublishStatus == 1 {
  1204. go services.SendWxMsgWithCygxActivity(req.ActivityId)
  1205. //同步活动到最新数据表
  1206. //go cygxService.UpdateResourceData(req.ActivityId, "activity", "delete", "")
  1207. cygxService.UpdateActivityResourceData(activityId) //写入首页最新 cygx_resource_data 表
  1208. }
  1209. item.ActivityId = req.ActivityId
  1210. if item.PublishStatus == 1 {
  1211. item.AdminId = AdminUser.AdminId
  1212. item.AdminName = AdminUser.RealName
  1213. item.PublishDate = time.Now()
  1214. } else {
  1215. item.AdminId = activityInfo.AdminId
  1216. item.AdminName = activityInfo.AdminName
  1217. item.PublishDate = utils.StrTimeToTime(activityInfo.PublishDate)
  1218. }
  1219. err = cygx.ActivityPublishAndCancel(item)
  1220. if err != nil {
  1221. br.Msg = "操作失败"
  1222. br.ErrMsg = "操作失败,Err:" + err.Error()
  1223. return
  1224. }
  1225. if item.PublishStatus == 1 {
  1226. //易董那边重新发布,重新建会
  1227. go cygxService.YiDongSaveRoadshowDetail(activityId)
  1228. } else {
  1229. //易董那边取消发布并删除
  1230. go cygxService.YiDongUpdateActivityPublish(activityId)
  1231. }
  1232. go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(activityId, AdminUser.AdminId, item.PublishStatus) //活动发布以及取消发布处理研选扣点
  1233. go elastic.AddComprehensiveActivity(activityId) // 同步Es添加活动
  1234. br.Ret = 200
  1235. br.Success = true
  1236. br.Msg = "操作成功"
  1237. br.IsAddLog = true //添加操作日志记录
  1238. }
  1239. // @Title 删除活动
  1240. // @Description 删除活动接口
  1241. // @Param request body cygx.ActivityIdRep true "type json string"
  1242. // @Success Ret=200
  1243. // @router /activity/delete [post]
  1244. func (this *ActivityCoAntroller) Delete() {
  1245. br := new(models.BaseResponse).Init()
  1246. defer func() {
  1247. this.Data["json"] = br
  1248. this.ServeJSON()
  1249. }()
  1250. AdminUser := this.SysUser
  1251. if AdminUser == nil {
  1252. br.Msg = "请登录"
  1253. br.ErrMsg = "请登录,SysUser Is Empty"
  1254. br.Ret = 408
  1255. return
  1256. }
  1257. var req cygx.ActivityIdRep
  1258. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1259. if err != nil {
  1260. br.Msg = "参数解析异常!"
  1261. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1262. return
  1263. }
  1264. activityId := req.ActivityId
  1265. if activityId < 1 {
  1266. br.Msg = "请输入活动ID"
  1267. return
  1268. }
  1269. activityInfo, errInfo := cygx.GetAddActivityInfoById(activityId)
  1270. if activityInfo == nil {
  1271. br.Msg = "操作失败"
  1272. br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
  1273. return
  1274. }
  1275. if errInfo != nil {
  1276. br.Msg = "操作失败"
  1277. br.ErrMsg = "操作失败,Err:" + errInfo.Error()
  1278. return
  1279. }
  1280. //校验活动后台管理员、销售是否有修改权限
  1281. havePower, popupMsg, err := cygxService.CheckActivityUpdatePower(AdminUser.AdminId, activityInfo)
  1282. if err != nil {
  1283. br.Msg = "获取管理员身份信息失败"
  1284. br.ErrMsg = "获取管理员身份信息失败,Err:" + err.Error()
  1285. return
  1286. }
  1287. if !havePower {
  1288. br.Msg = popupMsg
  1289. return
  1290. }
  1291. resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
  1292. res := time.Now().Before(resultTime)
  1293. if res == false {
  1294. br.Msg = "活动已结束禁止删除!"
  1295. br.ErrMsg = "活动已结束禁止删除!"
  1296. return
  1297. }
  1298. err = cygx.DeleteActivity(activityId)
  1299. if err != nil {
  1300. br.Msg = "删除信息失败"
  1301. br.ErrMsg = "删除信息失败,Err:" + err.Error()
  1302. return
  1303. }
  1304. //添加操作日志记录
  1305. br.Ret = 200
  1306. br.Success = true
  1307. br.Msg = "已删除"
  1308. br.IsAddLog = true
  1309. }
  1310. // @Title 获取活动行业分类
  1311. // @Description 获取活动行业分类接口
  1312. // @Param IsHideResearch query bool false "是否隐藏买方研选(默认不隐藏)"
  1313. // @Success 200 {object} cygx.ChartPermissionRepMoreList
  1314. // @router /activity/chartPermission/list [get]
  1315. func (this *ActivityCoAntroller) ChartPermissionListAct() {
  1316. br := new(models.BaseResponse).Init()
  1317. defer func() {
  1318. this.Data["json"] = br
  1319. this.ServeJSON()
  1320. }()
  1321. AdminUser := this.SysUser
  1322. if AdminUser == nil {
  1323. br.Msg = "请登录"
  1324. br.ErrMsg = "请登录,用户信息为空"
  1325. br.Ret = 408
  1326. return
  1327. }
  1328. //数据库新加行业分类,与之前的项目权限部分冲突太多,故采用自定义而不去数据库查找
  1329. resp := new(cygx.ChartPermissionRepMoreList)
  1330. // 查研观向7.4-策略后面新增一个宏观
  1331. resp.List = cygxService.GetActChartPermissionList()
  1332. br.Ret = 200
  1333. br.Success = true
  1334. br.Msg = "获取成功"
  1335. br.Data = resp
  1336. }
  1337. // @Title 扣点设置
  1338. // @Description 扣点设置接口
  1339. // @Success 200 {object} cygx.CygxActivityPointsSetConfigListResp
  1340. // @router /activity/pointsSet [get]
  1341. func (this *ActivityCoAntroller) PointsSet() {
  1342. br := new(models.BaseResponse).Init()
  1343. defer func() {
  1344. this.Data["json"] = br
  1345. this.ServeJSON()
  1346. }()
  1347. AdminUser := this.SysUser
  1348. if AdminUser == nil {
  1349. br.Msg = "请登录"
  1350. br.ErrMsg = "请登录,用户信息为空"
  1351. br.Ret = 408
  1352. return
  1353. }
  1354. conf, err := cygx.GetCygxConfigDetailByCode("activity_points_set")
  1355. if err != nil {
  1356. br.Msg = "获取数据失败"
  1357. br.ErrMsg = "买方研选产品介绍信息失败,Err:" + err.Error()
  1358. return
  1359. }
  1360. if conf.ConfigValue == "" {
  1361. br.Msg = "获取失败"
  1362. br.ErrMsg = "买方研选产品介绍信息失败"
  1363. return
  1364. }
  1365. list := new(*cygx.CygxActivityPointsSetConfigListResp)
  1366. if err = json.Unmarshal([]byte(conf.ConfigValue), &list); err != nil {
  1367. br.Msg = "获取失败"
  1368. br.ErrMsg = "买方研选产品介绍信配置值解析失败, Err: " + err.Error()
  1369. return
  1370. }
  1371. br.Ret = 200
  1372. br.Success = true
  1373. br.Msg = "获取成功"
  1374. br.Data = list
  1375. }
  1376. // @Title 权益办会机构搜索
  1377. // @Description 权益办会机构搜索
  1378. // @Param KeyWord query string false "搜索关键词"
  1379. // @Success 200 {object} cygx.ChartPermissionRepMoreList
  1380. // @router /activity/companySearch [get]
  1381. func (this *ActivityCoAntroller) CompanySearch() {
  1382. br := new(models.BaseResponse).Init()
  1383. defer func() {
  1384. this.Data["json"] = br
  1385. this.ServeJSON()
  1386. }()
  1387. AdminUser := this.SysUser
  1388. if AdminUser == nil {
  1389. br.Msg = "请登录"
  1390. br.ErrMsg = "请登录,用户信息为空"
  1391. br.Ret = 408
  1392. return
  1393. }
  1394. keyWord := this.GetString("KeyWord")
  1395. if keyWord == "" {
  1396. br.ErrMsg = "请输入搜索关键词"
  1397. return
  1398. }
  1399. resp := new(cygx.CygxActivitySearcCompanyListResp)
  1400. list, err := cygx.GetCygxActivitySearcCompanyList(keyWord)
  1401. if err != nil {
  1402. br.Msg = "操作失败"
  1403. br.ErrMsg = "操作失败,Err:" + err.Error()
  1404. return
  1405. }
  1406. if len(list) == 0 {
  1407. list = make([]*cygx.CygxActivitySearcCompanyResp, 0)
  1408. }
  1409. resp.List = list
  1410. br.Ret = 200
  1411. br.Success = true
  1412. br.Msg = "获取成功"
  1413. br.Data = resp
  1414. }
  1415. // @Title 报名截止时间设置
  1416. // @Description 报名截止时间设置接口
  1417. // @Success Ret=200
  1418. // @router /activity/deadlineSet [get]
  1419. func (this *ActivityCoAntroller) DeadlineSet() {
  1420. br := new(models.BaseResponse).Init()
  1421. defer func() {
  1422. this.Data["json"] = br
  1423. this.ServeJSON()
  1424. }()
  1425. AdminUser := this.SysUser
  1426. if AdminUser == nil {
  1427. br.Msg = "请登录"
  1428. br.ErrMsg = "请登录,SysUser Is Empty"
  1429. return
  1430. }
  1431. list := make([]cygx.SendGroupStr, 0)
  1432. list = append(list, cygx.SendGroupStr{
  1433. Id: "1",
  1434. Name: "同报名截止时间",
  1435. })
  1436. list = append(list, cygx.SendGroupStr{
  1437. Id: "2",
  1438. Name: "活动开始前24小时",
  1439. })
  1440. list = append(list, cygx.SendGroupStr{
  1441. Id: "3",
  1442. Name: "活动开始前48小时",
  1443. })
  1444. br.Ret = 200
  1445. br.Success = true
  1446. br.Data = list
  1447. }
  1448. // @Title 根据图片获取建会信息接口
  1449. // @Description 根据图片获取建会信息接口
  1450. // @Param request body cygx.ActivityIdRep true "type json string"
  1451. // @Success Ret=200
  1452. // @router /activity/imgToText [post]
  1453. func (this *ActivityCoAntroller) ImgToText() {
  1454. br := new(models.BaseResponse).Init()
  1455. defer func() {
  1456. this.Data["json"] = br
  1457. this.ServeJSON()
  1458. }()
  1459. AdminUser := this.SysUser
  1460. if AdminUser == nil {
  1461. br.Msg = "请登录"
  1462. br.ErrMsg = "请登录,SysUser Is Empty"
  1463. br.Ret = 408
  1464. return
  1465. }
  1466. var req cygx.AliyunOcrImgUrlReq
  1467. resp := new(cygx.AliyunOcrTextActivityListResp)
  1468. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  1469. if err != nil {
  1470. br.Msg = "参数解析异常!"
  1471. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  1472. return
  1473. }
  1474. imgUrl := req.ImgUrl
  1475. if imgUrl == "" {
  1476. br.Msg = "请上传图片"
  1477. return
  1478. }
  1479. ocrResp, err := services.AliOcrByImageToText(imgUrl)
  1480. if err != nil {
  1481. br.Msg = "图片解析失败!"
  1482. br.ErrMsg = "图片解析失败,Err:" + err.Error()
  1483. return
  1484. }
  1485. if len(ocrResp.Ret) == 0 {
  1486. br.Msg = "图片解析失败!"
  1487. return
  1488. }
  1489. var titmeYMD string
  1490. var titmeHM string
  1491. var company string
  1492. var list []*cygx.AliyunOcrTextActivityResp
  1493. var mapTitmeYMD = make(map[int]string)
  1494. var mapTitmeHM = make(map[int]string)
  1495. var mapCompany = make(map[int]string)
  1496. var lineNum int
  1497. for k, v := range ocrResp.Ret {
  1498. if k == 0 && !strings.Contains(v.Word, "/") {
  1499. continue
  1500. }
  1501. if strings.Contains(v.Word, "/") {
  1502. mapTitmeYMD[lineNum] = v.Word
  1503. titmeYMD = v.Word
  1504. }
  1505. if strings.Contains(v.Word, "AM") || strings.Contains(v.Word, "PM") {
  1506. mapTitmeHM[lineNum] = v.Word
  1507. titmeHM = v.Word
  1508. }
  1509. if strings.Contains(v.Word, "(") && strings.Contains(v.Word, ")") {
  1510. if mapTitmeYMD[lineNum] == "" {
  1511. mapTitmeYMD[lineNum] = mapTitmeYMD[lineNum-1]
  1512. }
  1513. titmeYMD = mapTitmeYMD[lineNum]
  1514. mapCompany[lineNum] = v.Word
  1515. company = v.Word
  1516. lineNum++
  1517. }
  1518. if titmeYMD != "" && titmeHM != "" && company != "" {
  1519. item := new(cygx.AliyunOcrTextActivityResp)
  1520. item.TitmeYMD = titmeYMD
  1521. item.TitmeHM = titmeHM
  1522. item.Company = company
  1523. list = append(list, item)
  1524. titmeYMD = ""
  1525. titmeHM = ""
  1526. company = ""
  1527. }
  1528. }
  1529. for _, v := range list {
  1530. v.TitmeYMD = cygxService.ConvertActivityTitmeYMD(v.TitmeYMD)
  1531. v.TitmeHM = cygxService.ConvertActivityTitmeHM(v.TitmeHM)
  1532. }
  1533. resp.List = list
  1534. br.Ret = 200
  1535. br.Success = true
  1536. br.Data = resp
  1537. br.IsAddLog = true
  1538. }