task.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. package services
  2. import (
  3. "fmt"
  4. "github.com/PuerkitoBio/goquery"
  5. "github.com/beego/beego/v2/task"
  6. "hongze/hongze_cygx/models"
  7. "hongze/hongze_cygx/utils"
  8. "html"
  9. "strconv"
  10. "strings"
  11. "time"
  12. )
  13. func Task() {
  14. fmt.Println("start")
  15. if utils.RunMode == "release" && utils.IsTask {
  16. //syncTacticsListAddreport := task.NewTask("syncTacticsListAddreport", "0 */5 * * * *", SyncTacticsListAddreport) //同步文章
  17. //task.AddTask("syncTacticsListAddreport", syncTacticsListAddreport)
  18. //getSummarytoEs := task.NewTask("getSummarytoEs", "0 */30 * * * *", GetSummarytoEs) //同步纪要库内容到Es
  19. //task.AddTask("getSummarytoEs", getSummarytoEs)
  20. //getArticleListByApi := task.NewTask("getArticleListByApi", "0 */5 * * * *", GetArticleListByApi) //通过三方接口获取策略平台上的文章
  21. //task.AddTask("getArticleListByApi", getArticleListByApi)
  22. //预约外呼名单,会前1小时自动发送邮件给专家组
  23. sendEmailFileToExpert := task.NewTask("sendEmailFileToExpert", "0 */5 6-23 * * *", SendEmailFileToExpert) //预约外呼名单,会前1小时自动发送邮件给专家组
  24. task.AddTask("sendEmailFileToExpert", sendEmailFileToExpert)
  25. sendEmailUserWhiteListChange := task.NewTask("sendEmailUserWhiteListChange", "0 00 17 * * *", SendEmailUserWhiteListChange) //新增 和冻结的客户白名单
  26. task.AddTask("白名单发送", sendEmailUserWhiteListChange)
  27. //dotongbuShangHaiSendEmail := task.NewTask("dotongbuShangHaiSendEmail", "0 00 4 * * *", DotongbuShangHaiSendEmail) //发送上海策略品台同步结果名单的邮件附件
  28. //task.AddTask("发送上海策略品台同步结果名单的邮件附件", dotongbuShangHaiSendEmail)
  29. getChartListByApi := task.NewTask("getChartListByApi", "0 */10 * * * *", GetChartDetailByChartId) //同步图表
  30. task.AddTask("getChartListByApi", getChartListByApi)
  31. getYiDongActivityMeeting := task.NewTask("getYiDongActivityMeeting", "0 */60 * * * *", GetYiDongActivityMeeting) //同步易董的活动到会信息
  32. task.AddTask("getYiDongActivityMeeting", getYiDongActivityMeeting)
  33. yiDongSignAppointmentsForThird := task.NewTask("yiDongSignAppointmentsForThird", "0 */10 * * * *", YiDongSignAppointmentsForThird) //会前一小时将,报名信息同步到易董
  34. task.AddTask("yiDongSignAppointmentsForThird", yiDongSignAppointmentsForThird)
  35. groupingActivityToYiDong := task.NewTask("groupingActivityToYiDong", "0 00 1 * * *", GroupingActivityToYiDong) //建立与易董的活动关联
  36. task.AddTask("groupingActivityToYiDong", groupingActivityToYiDong)
  37. getYiDongActivity := task.NewTask("getYiDongActivity", "0 */10 * * * *", GetYiDongActivity) //同步易董的活动信息
  38. task.AddTask("getYiDongActivity", getYiDongActivity)
  39. updateYiDongActivityDataToCygx := task.NewTask("updateYiDongActivityDataToCygx", "0 20 1 * * *", UpdateYiDongActivityDataToCygx) // 更新易董活动信息,到会信息到查研观向数据库
  40. task.AddTask("updateYiDongActivityDataToCygx", updateYiDongActivityDataToCygx)
  41. pushVmpRobotMeeting := task.NewTask("pushVmpRobotMeeting", "0 */10 6-23 * * *", PushVmpRobotMeeting) //研选活动会前15分钟推送给上海那边的机器人
  42. task.AddTask("pushVmpRobotMeeting", pushVmpRobotMeeting)
  43. }
  44. if utils.IsTask {
  45. //会议提醒模板消息推送
  46. sendActivityBeginMsg := task.NewTask("sendActivityBeginMsg", "0 */10 6-23 * * *", SendActivityBeginMsg) //会议前60分钟的提醒
  47. task.AddTask("sendActivityBeginMsg", sendActivityBeginMsg)
  48. sendActivityBeginMsgMeeting := task.NewTask("sendActivityBeginMsgMeeting", "0 */5 6-23 * * *", SendActivityBeginMsgMeeting) //会议前15分钟的提醒
  49. task.AddTask("sendActivityBeginMsgMeeting", sendActivityBeginMsgMeeting)
  50. //修改任务状
  51. updateActivitySattus := task.NewTask("syncTacticsListAddreport", "0 */1 6-23 * * *", UpdateActivitySattus)
  52. task.AddTask("updateActivitySattus", updateActivitySattus)
  53. //更新深 和新的标签
  54. updateIndustrialManagementLabel := task.NewTask("updateIndustrialManagementLabel", "0 */30 * * * *", UpdateIndustrialManagementLabel)
  55. task.AddTask("updateIndustrialManagementLabel", updateIndustrialManagementLabel)
  56. //更改对应产业的文章阅读数量
  57. chageIndustrialArticleNum := task.NewTask("chageIndustrialArticleNum", "0 01 00 * * *", ChageIndustrialArticleNum) //更改对应产业的文章阅读数量
  58. task.AddTask("chageIndustrialArticleNum", chageIndustrialArticleNum)
  59. //activityAttendanceDetail := task.NewTask("activityAttendanceDetail", "0 00 3 * * *", ActivityAttendanceDetail) //同步进门财经的路演信息
  60. //task.AddTask("activityAttendanceDetail", activityAttendanceDetail)
  61. groupingActivityToJmcj := task.NewTask("groupingActivityToJmcj", "0 00 1 * * *", GroupingActivityToJmcj) //建立进门财经与弘则活动的匹配关系
  62. task.AddTask("groupingActivityToJmcj", groupingActivityToJmcj)
  63. getActivityMeetingByJmcj := task.NewTask("getActivityMeetingByJmcj", "0 00 3 * * *", GetActivityMeetingByJmcj) //同步进门财经的路演信息
  64. task.AddTask("getActivityMeetingByJmcj", getActivityMeetingByJmcj)
  65. sendEmailFileForAskMsgResearch := task.NewTask("sendEmailFileForAskMsgResearch", "0 */5 6-23 * * *", SendEmailFileForAskMsgResearch) //研选系列专家电话会,会前1小时将问题列表发送给邮箱
  66. task.AddTask("sendEmailFileForAskMsgResearch", sendEmailFileForAskMsgResearch)
  67. sendEmailFileForAskMsg := task.NewTask("sendEmailFileForAskMsg", "0 */5 6-23 * * *", SendEmailFileForAskMsg) //非研选系列专家电话会,根据主持人姓名,会前15分钟将问题列表发送给至该主持人对应邮箱
  68. task.AddTask("sendEmailFileForAskMsg", sendEmailFileForAskMsg)
  69. updateWxUserLabel := task.NewTask("updateWxUserLabel", "0 01 0 * * *", UpdateWxUserLabel) //更新用户的标签
  70. task.AddTask("updateWxUserLabel", updateWxUserLabel)
  71. addAllArticleHistory := task.NewTask("addAllArticleHistory", "0 30 2 * * *", AddAllArticleAndYanxuanHistory) //把前一天的用户阅读记录同步到ES
  72. task.AddTask("addAllArticleHistory", addAllArticleHistory)
  73. getCeLueArticlePv := task.NewTask("getCeLueArticlePv", "0 */10 * * * *", GetCeLueArticlePv) //通过三方接口获取策略平台上的阅读记录
  74. task.AddTask("getCeLueArticlePv", getCeLueArticlePv)
  75. reportBillboardUpdate := task.NewTask("reportBillboardUpdate", "0 10 0 * * *", ReportBillboardUpdate) //报告榜单更新
  76. task.AddTask("reportBillboardUpdate", reportBillboardUpdate)
  77. doActivityOnenIdWxTemplateMsg := task.NewTask("doActivityOnenIdWxTemplateMsg", "0 30 16 * * 0", DoActivityOnenIdWxTemplateMsg) //周日下午四点半推送全部活动
  78. task.AddTask("doActivityOnenIdWxTemplateMsg", doActivityOnenIdWxTemplateMsg)
  79. updateCygxActivitySpecialSignupNum := task.NewTask("updateCygxActivitySpecialSignupNum", "0 25 0 * * *", UpdateCygxActivitySpecialSignupNum) //修改专项调研,用户与公司的参与数量
  80. task.AddTask("updateCygxActivitySpecialSignupNum", updateCygxActivitySpecialSignupNum)
  81. dotongbuShangHai := task.NewTask("dotongbuShangHai", "0 */20 * * * *", DotongbuShangHai) //把信息同步到上海策略品台
  82. task.AddTask("同步用户到上海", dotongbuShangHai)
  83. updateDailyMonthReadBillboard := task.NewTask("updateDailyMonthReadBillboard", "0 0 3 * * *", UpdateDailyMonthReadBillboard) // 每日3:00更新阅读飙升榜单
  84. task.AddTask("updateDailyMonthReadBillboard", updateDailyMonthReadBillboard)
  85. addctivitySignupDetail := task.NewTask("addctivitySignupDetail", "0 0 23 * * *", AddctivitySignupDetail) // 获取当天已结束的活动的报名信息。添加到到会详情
  86. task.AddTask("addctivitySignupDetail", addctivitySignupDetail)
  87. sendWxMsgActivitySpecialTwoDays := task.NewTask("sendWxMsgActivitySpecialTwoDays", "0 0 8 * * *", SendWxMsgActivitySpecialTwoDays)
  88. task.AddTask("sendWxMsgActivitySpecialTwoDays", sendWxMsgActivitySpecialTwoDays) //活动开始前两天08:00,提醒报名客户 \提醒报名客户的对口销售
  89. //sendWxMsgActivitySpecialCancel := task.NewTask("sendWxMsgActivitySpecialCancel", "0 0 8 * * *", SendWxMsgActivitySpecialCancel)
  90. //task.AddTask("sendWxMsgActivitySpecialCancel", sendWxMsgActivitySpecialCancel) // 线下活动前4天08:00报名人数不足7人,线上活动前3天08:00报名人数不足10人,活动自动取消发布,并推送模板消息至报名客户及对口销售
  91. makeMorningMeetingReviews := task.NewTask("makeMorningMeetingReviews", "0 30 10 * * *", MakeMorningMeetingReviews)
  92. task.AddTask("makeMorningMeetingReviews", makeMorningMeetingReviews) //每天10::30定时生成晨会精华汇总
  93. cygxActivityRestrictSignupByTask := task.NewTask("cygxActivityRestrictSignupByTask", "0 */10 6-23 * * *", CygxActivityRestrictSignupByTask)
  94. task.AddTask("cygxActivityRestrictSignupByTask", cygxActivityRestrictSignupByTask) //定时任务处理为到会人员的爽约
  95. getStocksFromVmp := task.NewTask("getStocksFromVmp", "0 40 3 * * *", GetStocksFromVmp)
  96. task.AddTask("getStocksFromVmp", getStocksFromVmp) //定时任务更新上市公司表
  97. updateIndustrialManagementOneMonthFollowNum := task.NewTask("updateIndustrialManagementOneMonthFollowNum", "0 10 1 * * *", UpdateIndustrialManagementOneMonthFollowNum)
  98. task.AddTask("updateIndustrialManagementOneMonthFollowNum", updateIndustrialManagementOneMonthFollowNum) //更新产业近一个月被关注的数量
  99. updateCygxUserYanxuanPermissionToClose := task.NewTask("updateCygxUserYanxuanPermissionToClose", "0 10 1 * * *", UpdateCygxUserYanxuanPermissionToClose)
  100. task.AddTask("updateCygxUserYanxuanPermissionToClose", updateCygxUserYanxuanPermissionToClose) //关闭到期个人用户研选权限
  101. updateYanxuanSpecialAuthoMomentsImg := task.NewTask("updateYanxuanSpecialAuthoMomentsImg", "0 0 1 * * *", UpdateYanxuanSpecialAuthoMomentsImg)
  102. task.AddTask(" 更新研选专栏作者朋友圈封面图片,并删除老的图片", updateYanxuanSpecialAuthoMomentsImg) // 更新研选专栏作者朋友圈封面图片,并删除老的图片
  103. sendMfyxEmailFileForAskMsgResearch := task.NewTask("sendMfyxEmailFileForAskMsgResearch", "0 */5 6-23 * * *", SendMfyxEmailFileForAskMsgResearch) //研选系列专家电话会,会前1小时将问题列表发送给邮箱
  104. task.AddTask("sendMfyxEmailFileForAskMsgResearch", sendMfyxEmailFileForAskMsgResearch)
  105. sendMfyxActivityBeginMsgMeeting := task.NewTask("sendMfyxActivityBeginMsgMeeting", "0 */5 6-23 * * *", SendMfyxActivityBeginMsgMeeting) //会议前15分钟的提醒
  106. task.AddTask("sendMfyxActivityBeginMsgMeeting", sendMfyxActivityBeginMsgMeeting)
  107. sendMfyxActivityBeginMsg := task.NewTask("sendMfyxActivityBeginMsg", "0 */5 6-23 * * *", SendMfyxActivityBeginMsg) //会议前60分钟的提醒
  108. task.AddTask("sendMfyxActivityBeginMsg", sendMfyxActivityBeginMsg)
  109. cancelCygxOrder := task.NewTask("CancelCygxOrder", "0 */1 * * * *", CancelCygxOrder)
  110. task.AddTask("十分钟内未付款的订单自动取消", cancelCygxOrder) //十分钟内未付款的订单自动取消
  111. getQueryOrderByOutTradeNoTask := task.NewTask("getQueryOrderByOutTradeNoTask", "0 */1 * * * *", GetQueryOrderByOutTradeNoTask)
  112. task.AddTask("定时任务主动获取订单支付状态", getQueryOrderByOutTradeNoTask) //定时任务主动获取订单支付状态
  113. handleOrderRefundTask := task.NewTask("handleOrderRefundTask", "0 */1 * * * *", HandleOrderRefundTask)
  114. task.AddTask("定时任务处理退款回调", handleOrderRefundTask) //定时任务处理退款回调
  115. updateRaiServeBillDate := task.NewTask("updateRaiServeBillDate", "0 */10 * * * *", UpdateRaiServeBillDate)
  116. task.AddTask("定时任务处理权益服务记录明细", updateRaiServeBillDate) //定时任务处理权益服务记录明细
  117. updateCygxRaiCompanyUserBillDate := task.NewTask("updateCygxRaiCompanyUserBillDate", "0 */10 * * * *", UpdateCygxRaiCompanyUserBillDate)
  118. task.AddTask("权益正式,试用、X类试用客户近四周互动记录", updateCygxRaiCompanyUserBillDate) //// 权益正式,试用、X类试用客户近四周互动记录
  119. getYanxuanSpecialLikeCountDifferent := task.NewTask("getYanxuanSpecialLikeCountDifferent", "0 0 */1 * * *", GetYanxuanSpecialLikeCountDifferent)
  120. task.AddTask("定时任务处理退款回调", getYanxuanSpecialLikeCountDifferent) // 专栏文章获得点赞时,模板消息通知作者(每个整点发送,不同文章分多条发送)
  121. getFiccRreportToCygxArticle := task.NewTask("getFiccRreportToCygxArticle", "0 */10 * * * *", GetFiccRreportToCygxArticle)
  122. task.AddTask("获取FICC研报到查研观向数据库中", getFiccRreportToCygxArticle) //获取FICC研报到查研观向数据库中
  123. }
  124. //UpdateRaiServeBillDate()
  125. //if utils.RunMode != "release" {
  126. // getArticleListByApi := task.NewTask("getArticleListByApi", "0 */60 * * * *", GetArticleListByApi) //通过三方接口获取策略平台上的文章
  127. // task.AddTask("getArticleListByApi", getArticleListByApi)
  128. //}
  129. go UserLabelLogReduce() // 处理用户标签的队列消息
  130. go YanXuanActivityPointsBillReduce() // 处理研选活动扣点
  131. go UpdateArticleByRedis() // 处理策略平台同步过来的文章
  132. go UpdateIndustrialManagementTimeLineDateList3ByRedis() // 处理产业管理时间线相关内容的数据
  133. go UpdateWxUserRaiLabelRedis() // 处理用户标签队列消息CRM_16.5
  134. //GetCygxActivityAttendanceDetail()
  135. //CreateIndexNameArticleHistory()
  136. //AddAllArticleHistory()
  137. //DoCompany()
  138. //ActivityAttendanceDetail()
  139. //SynchronizationArthistory()//同步原有的阅读记录
  140. //GetAddpArticle() //同步日度点评数据
  141. //SendEmailAllUserWithRAI() //发送当前所有权益用户到沈大爷的邮箱
  142. //SendEmailAllUserWithCompany() //发送这些公司下的用户到沈大爷的邮箱
  143. task.StartTask()
  144. //StatisticalReport()//导出报表
  145. fmt.Println("end")
  146. }
  147. ////白名单发送
  148. //sendEmailUserWhiteList := task.NewTask("sendEmailUserWhiteList", "0 27 17 * * *", SendEmailUserWhiteList) //白名单发送
  149. //task.AddTask("sendEmailUserWhiteList", sendEmailUserWhiteList)
  150. //editOutboundMobile := task.NewTask("editOutboundMobile", "0 */1 8-22 * * *", EditOutboundMobile) //同步外呼号码与手机号
  151. //task.AddTask("sendEmailFileToExpert", editOutboundMobile)
  152. //editUserOutboundMobile := task.NewTask("editUserOutboundMobile", "0 27 14 * * * ", EditUserOutboundMobile) //同步外呼号码与手机号
  153. //task.AddTask("editUserOutboundMobile", editUserOutboundMobile)
  154. func CreateIndex() {
  155. indexName := utils.IndexName
  156. mappingJson := `{
  157. "mappings": {
  158. "dynamic": true,
  159. "properties": {
  160. "ArticleId": {
  161. "type": "integer"
  162. },
  163. "CategoryId": {
  164. "type": "text"
  165. },
  166. "BodyText": {
  167. "type": "text",
  168. "term_vector": "with_positions_offsets",
  169. "analyzer": "ik_smart"
  170. },
  171. "PublishDate": {
  172. "type": "keyword"
  173. },
  174. "SubCategoryName": {
  175. "type": "text",
  176. "term_vector": "with_positions_offsets",
  177. "analyzer": "ik_smart"
  178. },
  179. "Title": {
  180. "type": "text",
  181. "term_vector": "with_positions_offsets",
  182. "analyzer": "ik_smart"
  183. },
  184. "Abstract": {
  185. "type": "text",
  186. "term_vector": "with_positions_offsets",
  187. "analyzer": "ik_smart"
  188. },
  189. "Annotation": {
  190. "type": "text",
  191. "term_vector": "with_positions_offsets",
  192. "analyzer": "ik_smart"
  193. },
  194. "TitleEn": {
  195. "type": "text",
  196. "term_vector": "with_positions_offsets"
  197. },
  198. "UpdateFrequency": {
  199. "type": "text",
  200. "term_vector": "with_positions_offsets"
  201. },
  202. "ExpertBackground": {
  203. "type": "text",
  204. "term_vector": "with_positions_offsets"
  205. }
  206. }
  207. }
  208. }`
  209. EsCreateIndex(indexName, mappingJson)
  210. AddAllArticle()
  211. }
  212. func AddAllArticle() {
  213. endDate := time.Now().AddDate(0, 0, -30).Format(utils.FormatDate)
  214. //allList, err := models.GetArticleAll()
  215. allList, err := models.GetArticleAllDate(endDate)
  216. if err != nil {
  217. fmt.Println("GetArticleAll Err:", err.Error())
  218. return
  219. }
  220. indexName := utils.IndexName
  221. for _, v := range allList {
  222. content := html.UnescapeString(v.Body)
  223. doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
  224. if err != nil {
  225. fmt.Println("create doc err:", err.Error())
  226. return
  227. }
  228. bodyText := doc.Text()
  229. item := new(ElasticTestArticleDetail)
  230. item.ArticleId = v.ArticleId
  231. item.Title = v.Title
  232. item.PublishDate = v.PublishDate
  233. item.BodyText = bodyText
  234. item.ExpertBackground = v.ExpertBackground
  235. item.Annotation, _ = GetReportContentTextSubNew(v.Annotation)
  236. item.Abstract, _ = GetReportContentTextSubNew(v.Abstract)
  237. item.CategoryId = strconv.Itoa(v.CategoryId)
  238. EsAddOrEditData(indexName, strconv.Itoa(v.ArticleId), item)
  239. fmt.Println(v.ArticleId)
  240. }
  241. }
  242. func AddAllArticleV4() {
  243. allList, err := models.GetArticleAll2()
  244. if err != nil {
  245. fmt.Println("GetArticleAll Err:", err.Error())
  246. return
  247. }
  248. indexName := "cygx_article_v4"
  249. for _, v := range allList {
  250. content := html.UnescapeString(v.Body)
  251. doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
  252. if err != nil {
  253. fmt.Println("create doc err:", err.Error())
  254. return
  255. }
  256. bodyText := doc.Text()
  257. item := new(ElasticTestArticleDetailV4)
  258. item.ArticleId = v.ArticleId
  259. item.Title = v.Title
  260. item.PublishDate = v.PublishDate
  261. item.BodyText = bodyText
  262. item.IsSummary = v.IsSummary
  263. item.IsReport = v.IsReport
  264. //if v.IsReport == 1 {
  265. // item.IsReport = true
  266. //}
  267. //if v.IsSummary == 1 {
  268. // item.IsSummary = true
  269. //}
  270. EsAddOrEditDataV4(indexName, strconv.Itoa(v.ArticleId), item)
  271. fmt.Println(v.ArticleId)
  272. }
  273. }
  274. // "term_vector": "with_positions_offsets"
  275. type ElasticArticleDetail struct {
  276. ArticleId int `description:"报告id"`
  277. Title string `description:"标题"`
  278. TitleEn string `description:"英文标题 "`
  279. UpdateFrequency string `description:"更新周期"`
  280. CreateDate string `description:"创建时间"`
  281. PublishDate string `description:"发布时间"`
  282. Abstract string `description:"摘要"`
  283. CategoryName string `description:"一级分类"`
  284. SubCategoryName string `description:"二级分类"`
  285. InterviewDate string `description:"访谈时间"`
  286. ExpertBackground string `description:"专家背景"`
  287. ExpertNumber string `description:"专家编号"`
  288. Department string `description:"作者"`
  289. ArticleIdMd5 string `description:"纪要id"`
  290. BodyText string `description:"内容"`
  291. }
  292. type ElasticTestArticleDetail struct {
  293. ArticleId int `description:"报告id"`
  294. Title string `description:"标题"`
  295. BodyText string `description:"内容"`
  296. PublishDate string `description:"发布时间"`
  297. ExpertBackground string `description:"专家背景"`
  298. CategoryId string `description:"文章分类"`
  299. Abstract string `description:"摘要"`
  300. Annotation string `description:"核心观点"`
  301. }
  302. type ElasticTestArticleDetailV4 struct {
  303. ArticleId int `description:"报告id"`
  304. Title string `description:"标题"`
  305. BodyText string `description:"内容"`
  306. PublishDate string `description:"发布时间"`
  307. IsSummary int `description:"是否属于纪要库"`
  308. IsReport int `description:"是否属于报告"`
  309. }
  310. func GetAddpArticle() {
  311. list, err := models.GetReportList()
  312. for _, v := range list {
  313. var articleId int
  314. maxArticleIdArticleInfo, errMax := models.GetMaxArticleIdInfo()
  315. if errMax != nil {
  316. fmt.Println(errMax)
  317. return
  318. }
  319. articleId = maxArticleIdArticleInfo.ArticleId + 1
  320. item := new(models.CygxArticle)
  321. item.Title = v.Title
  322. item.ArticleId = articleId
  323. item.SellerAndMobile = v.Author
  324. item.PublishDate = v.PublishTime
  325. item.Abstract = v.Abstract
  326. item.Body = html.UnescapeString(v.Content)
  327. item.BodyText, _ = GetReportContentTextSub(v.Content)
  328. item.IsReport = 1
  329. item.Source = 1
  330. item.ArticleIdMd5 = utils.MD5(strconv.Itoa(articleId))
  331. item.Department = "弘则产品组"
  332. item.ArticleType = "lyjh"
  333. item.IsClass = 1
  334. item.CreateDate = v.CreateTime
  335. item.UpdateFrequency = "unknow"
  336. item.CategoryId = 100 // 100是路演精华对应ID
  337. item.SubCategoryName = "路演精华"
  338. item.HavePublish = 1
  339. item.PublishStatus = 1
  340. item.Periods = strconv.Itoa(v.Stage)
  341. item.VideoUrl = v.VideoUrl
  342. item.VideoName = v.VideoName
  343. item.VideoPlaySeconds = v.VideoPlaySeconds
  344. newId, _ := models.AddCygxArticles(item)
  345. fmt.Println(articleId)
  346. fmt.Println(newId)
  347. fmt.Println(item.ArticleIdMd5)
  348. }
  349. fmt.Println(err)
  350. fmt.Println(list)
  351. }
  352. func SynchronizationArthistory() {
  353. go SynchronizationArtclehistory()
  354. }
  355. //func init() {
  356. //
  357. // var newActivityName string
  358. // list, err := models.GetActivityList()
  359. // if err != nil {
  360. // fmt.Println(err)
  361. // }
  362. // for _, v := range list {
  363. //
  364. // fmt.Println("原来的", v.ActivityName)
  365. // newActivityName = v.ActivityName
  366. // newActivityName = strings.Replace(newActivityName, "【", "", -1)
  367. // newActivityName = strings.Replace(newActivityName, "】", "", -1)
  368. // newActivityName = strings.Replace(newActivityName, "-", "", -1)
  369. // newActivityName = strings.Replace(newActivityName, "—", "", -1)
  370. // newActivityName = strings.Replace(newActivityName, " ", "", -1)
  371. // newActivityName = strings.Replace(newActivityName, ":", "", -1)
  372. // fmt.Println("处理的", newActivityName)
  373. // err = models.UpdateCygxActivityName(v.ActivityId, newActivityName)
  374. // if err != nil {
  375. // fmt.Println(err)
  376. // }
  377. // }
  378. //}
  379. //func init() {
  380. // fmt.Println("init start")
  381. // go UpdateDailyMonthReadBillboardV2()
  382. // fmt.Println("init end")
  383. //}