task.go 20 KB

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