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. updateDailyMonthReadBillboard := task.NewTask("updateDailyMonthReadBillboard", "0 0 3 * * *", UpdateDailyMonthReadBillboard) // 每日3:00更新阅读飙升榜单
  82. task.AddTask("updateDailyMonthReadBillboard", updateDailyMonthReadBillboard)
  83. dotongbuShangHai := task.NewTask("dotongbuShangHai", "0 */20 * * * *", DotongbuShangHai) //把信息同步到上海策略品台
  84. task.AddTask("同步用户到上海", dotongbuShangHai)
  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. //GetCygxActivityAttendanceDetail()
  134. //CreateIndexNameArticleHistory()
  135. //AddAllArticleHistory()
  136. //DoCompany()
  137. //ActivityAttendanceDetail()
  138. //SynchronizationArthistory()//同步原有的阅读记录
  139. //GetAddpArticle() //同步日度点评数据
  140. //SendEmailAllUserWithRAI() //发送当前所有权益用户到沈大爷的邮箱
  141. //SendEmailAllUserWithCompany() //发送这些公司下的用户到沈大爷的邮箱
  142. task.StartTask()
  143. //StatisticalReport()//导出报表
  144. fmt.Println("end")
  145. }
  146. ////白名单发送
  147. //sendEmailUserWhiteList := task.NewTask("sendEmailUserWhiteList", "0 27 17 * * *", SendEmailUserWhiteList) //白名单发送
  148. //task.AddTask("sendEmailUserWhiteList", sendEmailUserWhiteList)
  149. //editOutboundMobile := task.NewTask("editOutboundMobile", "0 */1 8-22 * * *", EditOutboundMobile) //同步外呼号码与手机号
  150. //task.AddTask("sendEmailFileToExpert", editOutboundMobile)
  151. //editUserOutboundMobile := task.NewTask("editUserOutboundMobile", "0 27 14 * * * ", EditUserOutboundMobile) //同步外呼号码与手机号
  152. //task.AddTask("editUserOutboundMobile", editUserOutboundMobile)
  153. func CreateIndex() {
  154. indexName := utils.IndexName
  155. mappingJson := `{
  156. "mappings": {
  157. "dynamic": true,
  158. "properties": {
  159. "ArticleId": {
  160. "type": "integer"
  161. },
  162. "CategoryId": {
  163. "type": "text"
  164. },
  165. "BodyText": {
  166. "type": "text",
  167. "term_vector": "with_positions_offsets",
  168. "analyzer": "ik_smart"
  169. },
  170. "PublishDate": {
  171. "type": "keyword"
  172. },
  173. "SubCategoryName": {
  174. "type": "text",
  175. "term_vector": "with_positions_offsets",
  176. "analyzer": "ik_smart"
  177. },
  178. "Title": {
  179. "type": "text",
  180. "term_vector": "with_positions_offsets",
  181. "analyzer": "ik_smart"
  182. },
  183. "Abstract": {
  184. "type": "text",
  185. "term_vector": "with_positions_offsets",
  186. "analyzer": "ik_smart"
  187. },
  188. "Annotation": {
  189. "type": "text",
  190. "term_vector": "with_positions_offsets",
  191. "analyzer": "ik_smart"
  192. },
  193. "TitleEn": {
  194. "type": "text",
  195. "term_vector": "with_positions_offsets"
  196. },
  197. "UpdateFrequency": {
  198. "type": "text",
  199. "term_vector": "with_positions_offsets"
  200. },
  201. "ExpertBackground": {
  202. "type": "text",
  203. "term_vector": "with_positions_offsets"
  204. }
  205. }
  206. }
  207. }`
  208. EsCreateIndex(indexName, mappingJson)
  209. AddAllArticle()
  210. }
  211. func AddAllArticle() {
  212. endDate := time.Now().AddDate(0, 0, -30).Format(utils.FormatDate)
  213. //allList, err := models.GetArticleAll()
  214. allList, err := models.GetArticleAllDate(endDate)
  215. if err != nil {
  216. fmt.Println("GetArticleAll Err:", err.Error())
  217. return
  218. }
  219. indexName := utils.IndexName
  220. for _, v := range allList {
  221. content := html.UnescapeString(v.Body)
  222. doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
  223. if err != nil {
  224. fmt.Println("create doc err:", err.Error())
  225. return
  226. }
  227. bodyText := doc.Text()
  228. item := new(ElasticTestArticleDetail)
  229. item.ArticleId = v.ArticleId
  230. item.Title = v.Title
  231. item.PublishDate = v.PublishDate
  232. item.BodyText = bodyText
  233. item.ExpertBackground = v.ExpertBackground
  234. item.Annotation, _ = GetReportContentTextSubNew(v.Annotation)
  235. item.Abstract, _ = GetReportContentTextSubNew(v.Abstract)
  236. item.CategoryId = strconv.Itoa(v.CategoryId)
  237. EsAddOrEditData(indexName, strconv.Itoa(v.ArticleId), item)
  238. fmt.Println(v.ArticleId)
  239. }
  240. }
  241. func AddAllArticleV4() {
  242. allList, err := models.GetArticleAll2()
  243. if err != nil {
  244. fmt.Println("GetArticleAll Err:", err.Error())
  245. return
  246. }
  247. indexName := "cygx_article_v4"
  248. for _, v := range allList {
  249. content := html.UnescapeString(v.Body)
  250. doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
  251. if err != nil {
  252. fmt.Println("create doc err:", err.Error())
  253. return
  254. }
  255. bodyText := doc.Text()
  256. item := new(ElasticTestArticleDetailV4)
  257. item.ArticleId = v.ArticleId
  258. item.Title = v.Title
  259. item.PublishDate = v.PublishDate
  260. item.BodyText = bodyText
  261. item.IsSummary = v.IsSummary
  262. item.IsReport = v.IsReport
  263. //if v.IsReport == 1 {
  264. // item.IsReport = true
  265. //}
  266. //if v.IsSummary == 1 {
  267. // item.IsSummary = true
  268. //}
  269. EsAddOrEditDataV4(indexName, strconv.Itoa(v.ArticleId), item)
  270. fmt.Println(v.ArticleId)
  271. }
  272. }
  273. // "term_vector": "with_positions_offsets"
  274. type ElasticArticleDetail struct {
  275. ArticleId int `description:"报告id"`
  276. Title string `description:"标题"`
  277. TitleEn string `description:"英文标题 "`
  278. UpdateFrequency string `description:"更新周期"`
  279. CreateDate string `description:"创建时间"`
  280. PublishDate string `description:"发布时间"`
  281. Abstract string `description:"摘要"`
  282. CategoryName string `description:"一级分类"`
  283. SubCategoryName string `description:"二级分类"`
  284. InterviewDate string `description:"访谈时间"`
  285. ExpertBackground string `description:"专家背景"`
  286. ExpertNumber string `description:"专家编号"`
  287. Department string `description:"作者"`
  288. ArticleIdMd5 string `description:"纪要id"`
  289. BodyText string `description:"内容"`
  290. }
  291. type ElasticTestArticleDetail struct {
  292. ArticleId int `description:"报告id"`
  293. Title string `description:"标题"`
  294. BodyText string `description:"内容"`
  295. PublishDate string `description:"发布时间"`
  296. ExpertBackground string `description:"专家背景"`
  297. CategoryId string `description:"文章分类"`
  298. Abstract string `description:"摘要"`
  299. Annotation string `description:"核心观点"`
  300. }
  301. type ElasticTestArticleDetailV4 struct {
  302. ArticleId int `description:"报告id"`
  303. Title string `description:"标题"`
  304. BodyText string `description:"内容"`
  305. PublishDate string `description:"发布时间"`
  306. IsSummary int `description:"是否属于纪要库"`
  307. IsReport int `description:"是否属于报告"`
  308. }
  309. func GetAddpArticle() {
  310. list, err := models.GetReportList()
  311. for _, v := range list {
  312. var articleId int
  313. maxArticleIdArticleInfo, errMax := models.GetMaxArticleIdInfo()
  314. if errMax != nil {
  315. fmt.Println(errMax)
  316. return
  317. }
  318. articleId = maxArticleIdArticleInfo.ArticleId + 1
  319. item := new(models.CygxArticle)
  320. item.Title = v.Title
  321. item.ArticleId = articleId
  322. item.SellerAndMobile = v.Author
  323. item.PublishDate = v.PublishTime
  324. item.Abstract = v.Abstract
  325. item.Body = html.UnescapeString(v.Content)
  326. item.BodyText, _ = GetReportContentTextSub(v.Content)
  327. item.IsReport = 1
  328. item.Source = 1
  329. item.ArticleIdMd5 = utils.MD5(strconv.Itoa(articleId))
  330. item.Department = "弘则产品组"
  331. item.ArticleType = "lyjh"
  332. item.IsClass = 1
  333. item.CreateDate = v.CreateTime
  334. item.UpdateFrequency = "unknow"
  335. item.CategoryId = 100 // 100是路演精华对应ID
  336. item.SubCategoryName = "路演精华"
  337. item.HavePublish = 1
  338. item.PublishStatus = 1
  339. item.Periods = strconv.Itoa(v.Stage)
  340. item.VideoUrl = v.VideoUrl
  341. item.VideoName = v.VideoName
  342. item.VideoPlaySeconds = v.VideoPlaySeconds
  343. newId, _ := models.AddCygxArticles(item)
  344. fmt.Println(articleId)
  345. fmt.Println(newId)
  346. fmt.Println(item.ArticleIdMd5)
  347. }
  348. fmt.Println(err)
  349. fmt.Println(list)
  350. }
  351. func SynchronizationArthistory() {
  352. go SynchronizationArtclehistory()
  353. }
  354. //func init() {
  355. //
  356. // var newActivityName string
  357. // list, err := models.GetActivityList()
  358. // if err != nil {
  359. // fmt.Println(err)
  360. // }
  361. // for _, v := range list {
  362. //
  363. // fmt.Println("原来的", v.ActivityName)
  364. // newActivityName = v.ActivityName
  365. // newActivityName = strings.Replace(newActivityName, "【", "", -1)
  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. // fmt.Println("处理的", newActivityName)
  372. // err = models.UpdateCygxActivityName(v.ActivityId, newActivityName)
  373. // if err != nil {
  374. // fmt.Println(err)
  375. // }
  376. // }
  377. //}
  378. //func init() {
  379. // fmt.Println("init start")
  380. // go UpdateDailyMonthReadBillboardV2()
  381. // fmt.Println("init end")
  382. //}