task.go 21 KB

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