article.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. package services
  2. import (
  3. "context"
  4. "encoding/json"
  5. "fmt"
  6. "github.com/PuerkitoBio/goquery"
  7. "hongze/hongze_cygx/models"
  8. "hongze/hongze_cygx/utils"
  9. "html"
  10. "io/ioutil"
  11. nhttp "net/http"
  12. "strconv"
  13. "strings"
  14. "time"
  15. )
  16. func GetReportContentSub(content string) (contentSub string, err error) {
  17. content = html.UnescapeString(content)
  18. doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
  19. if err != nil {
  20. fmt.Println("create doc err:", err.Error())
  21. return
  22. }
  23. n := 0
  24. doc.Find("p").Each(func(i int, s *goquery.Selection) {
  25. if n > 3 {
  26. return
  27. }
  28. n++
  29. phtml, err := s.Html()
  30. if err != nil {
  31. fmt.Println("get html err", err.Error())
  32. return
  33. }
  34. if s.Text() != "" || strings.Contains(phtml, "src") {
  35. contentSub = contentSub + "<p>" + phtml + "</p>"
  36. }
  37. })
  38. return
  39. }
  40. func GetReportContentTextSub(content string) (contentSub string, err error) {
  41. content = html.UnescapeString(content)
  42. doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
  43. //if err != nil {
  44. // fmt.Println("create doc err:", err.Error())
  45. // return
  46. //}
  47. //doc.Find("p").Each(func(i int, s *goquery.Selection) {
  48. // pHtml, _ := s.Html()
  49. // if strings.Contains(pHtml, "img") || strings.Contains(pHtml, "table") {
  50. // s.Remove()
  51. // }
  52. //})
  53. //if contentSub == "" || len(contentSub) < 200 {
  54. // //m := 0
  55. // doc.Find("span").Each(func(i int, s *goquery.Selection) {
  56. // spanHtml, _ := s.Html()
  57. // if strings.Contains(spanHtml, "img") || strings.Contains(spanHtml, "table") {
  58. // s.Remove()
  59. // }
  60. // })
  61. //}
  62. docText := doc.Text()
  63. bodyRune := []rune(docText)
  64. bodyRuneLen := len(bodyRune)
  65. if bodyRuneLen > 200 {
  66. bodyRuneLen = 200
  67. }
  68. body := string(bodyRune[:bodyRuneLen])
  69. contentSub = body
  70. return
  71. }
  72. //解析文章内容
  73. func GetArticleAll() {
  74. var err error
  75. defer func() {
  76. if err != nil {
  77. fmt.Println("err:", err.Error())
  78. return
  79. }
  80. }()
  81. list, err := models.GetArticleAll()
  82. if err != nil {
  83. return
  84. }
  85. for _, v := range list {
  86. fmt.Println(v.ArticleId, v.Title)
  87. FixArticleContent(v.ArticleId)
  88. }
  89. }
  90. //解析报告
  91. func FixArticleContent(articleId int) {
  92. item, err := models.GetArticleDetailById(articleId)
  93. if err != nil {
  94. fmt.Println("GetArticleDetailById Err:" + err.Error())
  95. return
  96. }
  97. content := item.Body
  98. bodyText, _ := GetReportContentTextSub(content)
  99. content = html.UnescapeString(content)
  100. content = strings.Replace(content, "http", "https", -1)
  101. doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
  102. if err != nil {
  103. fmt.Println("create doc err:", err.Error())
  104. return
  105. }
  106. var expertNumArr []string
  107. var expertContentArr []string
  108. var interviewDateArr []string
  109. doc.Find("p").Each(func(i int, s *goquery.Selection) {
  110. contentTxt := s.Text()
  111. if strings.Contains(contentTxt, "#访谈时间:") || strings.Contains(contentTxt, "访谈时间:") {
  112. interviewDate := s.Next().Text()
  113. interviewDateArr = append(interviewDateArr, interviewDate)
  114. }
  115. if strings.Contains(contentTxt, "#专家评价") || strings.Contains(contentTxt, "专家评价") {
  116. expertContent := s.Next().Text()
  117. if expertContent == "" {
  118. expertContent = contentTxt
  119. }
  120. if expertContent != "" {
  121. rightIndex := strings.Index(expertContent, ")")
  122. if rightIndex == 0 {
  123. rightIndex = strings.Index(expertContent, ")")
  124. }
  125. if rightIndex > 0 {
  126. expertNum := expertContent[:rightIndex]
  127. expertNum = strings.Replace(expertNum, "(", "", -1)
  128. expertNum = strings.Replace(expertNum, "(", "", -1)
  129. expertNum = strings.Replace(expertNum, "专家评价", "", -1)
  130. if expertNum != "" {
  131. expertNumArr = append(expertNumArr, expertNum)
  132. rightIndex = rightIndex
  133. expertContentStr := expertContent[rightIndex:]
  134. expertContentStr = strings.Replace(expertContentStr, ")", "", -1)
  135. expertContentStr = strings.TrimLeft(expertContentStr, ":")
  136. expertContentStr = strings.TrimRight(expertContentStr, "(推荐")
  137. expertContentArr = append(expertContentArr, expertContentStr)
  138. }
  139. }
  140. }
  141. }
  142. })
  143. if len(expertContentArr) <= 0 {
  144. doc.Find("pre").Each(func(i int, pre *goquery.Selection) {
  145. pre.Find("span").Each(func(n int, span *goquery.Selection) {
  146. contentTxt := span.Text()
  147. if strings.Contains(contentTxt, "#专家评价") || strings.Contains(contentTxt, "专家评价") {
  148. span.Find("span").Each(func(m int, subspan *goquery.Selection) {
  149. subspanText := subspan.Text()
  150. if strings.Contains(subspanText, "专家评价") {
  151. expertContent := subspan.Next().Text()
  152. if expertContent != "" {
  153. rightIndex := strings.Index(expertContent, ")")
  154. if rightIndex == 0 {
  155. rightIndex = strings.Index(expertContent, ")")
  156. }
  157. if rightIndex > 0 {
  158. expertNum := expertContent[:rightIndex]
  159. expertNum = strings.Replace(expertNum, "(", "", -1)
  160. expertNum = strings.Replace(expertNum, "(", "", -1)
  161. expertNum = strings.Replace(expertNum, "专家评价", "", -1)
  162. if expertNum != "" {
  163. expertNumArr = append(expertNumArr, expertNum)
  164. rightIndex = rightIndex
  165. expertContentStr := expertContent[rightIndex:]
  166. expertContentStr = strings.Replace(expertContentStr, ")", "", -1)
  167. expertContentStr = strings.TrimLeft(expertContentStr, ":")
  168. expertContentStr = strings.TrimRight(expertContentStr, "(推荐")
  169. expertContentArr = append(expertContentArr, expertContentStr)
  170. }
  171. }
  172. }
  173. }
  174. })
  175. }
  176. span.Find("span").Each(func(k int, sspan *goquery.Selection) {
  177. sspanText := sspan.Text()
  178. if strings.Contains(sspanText, "访谈时间") {
  179. sspanText = strings.Replace(sspanText, "#访谈时间:", "", -1)
  180. sspanText = strings.Replace(sspanText, "访谈时间:", "", -1)
  181. sspanText = strings.Replace(sspanText, "\n", "", -1)
  182. sspanText = strings.Replace(sspanText, " ", "", -1)
  183. sspanText = strings.Trim(sspanText, " ")
  184. sspanText = sspanText[:10]
  185. interviewDate := sspanText
  186. if interviewDate != "" {
  187. interviewDateArr = append(interviewDateArr, interviewDate)
  188. }
  189. }
  190. })
  191. })
  192. })
  193. }
  194. if len(expertContentArr) <= 0 {
  195. doc.Find("span").Each(func(i int, span *goquery.Selection) {
  196. span.Find("strong").Each(func(n int, strong *goquery.Selection) {
  197. spanText := span.Text()
  198. strongText := strong.Text()
  199. if strings.Contains(strongText, "#专家评价") || strings.Contains(strongText, "专家评价") {
  200. expertContent := strong.Parents().Text()
  201. if expertContent != "" {
  202. rightIndex := strings.Index(expertContent, ")")
  203. if rightIndex == 0 {
  204. rightIndex = strings.Index(expertContent, ")")
  205. }
  206. if rightIndex > 0 {
  207. expertNum := expertContent[:rightIndex]
  208. expertNum = strings.Replace(expertNum, "(", "", -1)
  209. expertNum = strings.Replace(expertNum, "(", "", -1)
  210. expertNum = strings.Replace(expertNum, "专家评价", "", -1)
  211. expertNum = strings.Replace(expertNum, "#", "", -1)
  212. expertNum = strings.Replace(expertNum, ":", "", -1)
  213. expertNum = strings.Replace(expertNum, "\n", "", -1)
  214. if expertNum != "" {
  215. expertNumArr = append(expertNumArr, expertNum)
  216. rightIndex = rightIndex
  217. expertContentStr := expertContent[rightIndex:]
  218. expertContentStr = strings.Replace(expertContentStr, ")", "", -1)
  219. expertContentStr = strings.TrimLeft(expertContentStr, ":")
  220. expertContentStr = strings.TrimRight(expertContentStr, "(推荐")
  221. expertContentArr = append(expertContentArr, expertContentStr)
  222. return
  223. }
  224. }
  225. }
  226. }
  227. if strings.Contains(spanText, "访谈时间") {
  228. spanText = strings.Replace(spanText, "#访谈时间:", "", -1)
  229. spanText = strings.Replace(spanText, "访谈时间:", "", -1)
  230. spanText = strings.Replace(spanText, "\n", "", -1)
  231. spanText = strings.Replace(spanText, " ", "", -1)
  232. spanText = strings.Trim(spanText, " ")
  233. spanText = spanText[:10]
  234. interviewDate := spanText
  235. if interviewDate != "" {
  236. interviewDateArr = append(interviewDateArr, interviewDate)
  237. }
  238. }
  239. })
  240. })
  241. }
  242. var expertNumStr, expertContentStr, interviewDateStr string
  243. if len(expertNumArr) > 0 {
  244. expertNumStr = expertNumArr[0]
  245. }
  246. if len(expertContentArr) > 0 {
  247. expertContentStr = expertContentArr[0]
  248. }
  249. if len(interviewDateArr) > 0 {
  250. interviewDateStr = interviewDateArr[0]
  251. }
  252. expertNumStr = strings.Replace(expertNumStr, "#:", "", -1)
  253. err = models.ModifyArticleExpert(articleId, expertNumStr, expertContentStr, interviewDateStr, bodyText)
  254. if err != nil {
  255. fmt.Println("ModifyArticleExpert Err:" + err.Error())
  256. return
  257. }
  258. }
  259. func GetArticleListByApi(cont context.Context) (err error) {
  260. url := "https://vmp.hzinsights.com/v2api/articles/mp?take=100&skip=0&publish_status=1"
  261. method := "GET"
  262. client := &nhttp.Client{}
  263. req, err := nhttp.NewRequest(method, url, nil)
  264. if err != nil {
  265. fmt.Println("GetListApi Err:", err.Error())
  266. return
  267. }
  268. req.Header.Add("Authorization", "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkiLCJwaG9uZV9udW1iZXIiOiIxMjM0NTY3ODkiLCJuYW1lIjoi5YW25LuWIiwiZW50cmFuY2UiOiJwYXNzd3dvcmQiLCJpYXQiOjE2MzQ4NzA1OTQsImV4cCI6MTYzNDg3NDE5NH0.tho2L9jsbDPn8ltEGUVDve_nHsh0Kzf6ZrSz0RcZ0ag")
  269. res, err := client.Do(req)
  270. if err != nil {
  271. fmt.Println(err)
  272. return
  273. }
  274. defer res.Body.Close()
  275. body, err := ioutil.ReadAll(res.Body)
  276. if err != nil {
  277. fmt.Println("Getres.Body Err:", err.Error())
  278. return
  279. }
  280. var pdfResult models.ArticleResultApi
  281. err = json.Unmarshal(body, &pdfResult)
  282. if err != nil {
  283. fmt.Println("Getres.pdfResult Err:", err.Error())
  284. return
  285. }
  286. exitMap := make(map[int]int)
  287. listMap, err := models.GetArticleApiMap()
  288. if err != nil {
  289. fmt.Println("GetlistMap Err:", err.Error())
  290. return
  291. }
  292. //新旧分类 反向隐射
  293. for _, v := range listMap {
  294. exitMap[v.Id] = v.OldId
  295. }
  296. listData := pdfResult.Data
  297. var list []*models.Tactics2
  298. var listAuthor []*models.CygxArticleAuthor
  299. for _, v := range listData {
  300. if exitMap[v.SeriesId] > 0 {
  301. item := new(models.Tactics2)
  302. itemAuthor := new(models.CygxArticleAuthor)
  303. item.ArticleId = v.ArticleId
  304. item.Title = v.Title
  305. item.TitleEn = v.TitleEn
  306. if v.Frequency == "日度" {
  307. item.UpdateFrequency = "daily"
  308. } else if v.Frequency == "周度" {
  309. item.UpdateFrequency = "weekly"
  310. } else if v.Frequency == "月度" {
  311. item.UpdateFrequency = "monthly"
  312. } else if v.Frequency == "季度" {
  313. item.UpdateFrequency = "quarterly"
  314. } else if v.Frequency == "年度" {
  315. item.UpdateFrequency = "yearly"
  316. } else {
  317. item.UpdateFrequency = "unknow"
  318. }
  319. item.CreateDate = v.CreateDate
  320. item.PublishDate = v.PublishDate
  321. item.PublishStatus = v.PublishStatus
  322. item.Body = v.Content.Body
  323. item.Abstract = v.Content.Abstract
  324. item.CategoryName = v.Industry.Name
  325. item.CategoryId = exitMap[v.SeriesId]
  326. item.SubCategoryName = v.Series.Name
  327. list = append(list, item)
  328. itemAuthor.ArticleId = v.ArticleId
  329. itemAuthor.Name = v.Author.Name
  330. itemAuthor.Mobile = v.Author.PhoneNumber
  331. listAuthor = append(listAuthor, itemAuthor)
  332. }
  333. }
  334. //同步作者
  335. for _, v := range listAuthor {
  336. var count int
  337. count, err = models.GetActivityAuthorCount(v.ArticleId, v.Mobile)
  338. if err != nil {
  339. fmt.Println("GetCount Err:", err.Error())
  340. return
  341. }
  342. if count == 0 {
  343. _, err = models.AddCygxActivityAuthor(v)
  344. if err != nil {
  345. fmt.Println("AddCygxActivityAuthor Err:", err.Error())
  346. return
  347. }
  348. }
  349. }
  350. fmt.Println("同步文章条数:", len(list))
  351. listCustomArticle, err := models.GetCustomArticleId() //手动归类的文章,不替换文章类型
  352. if err != nil {
  353. fmt.Println("GetTacticsList Err:", err.Error())
  354. return
  355. }
  356. listGetMatchTypeName, errMatch := models.GetMatchTypeNamenNotNull() //手动归类的文章,不替换文章类型
  357. if errMatch != nil {
  358. fmt.Println("GetTacticsList Err:", errMatch.Error())
  359. return
  360. }
  361. fmt.Println("list len:", len(list))
  362. summaryCategoryIds := "28,32,45,50,57,62,72,74,79,84,86,88,90,93,95,96" //纪要库的文章类型categoty_id
  363. listSummary := strings.Split(summaryCategoryIds, ",")
  364. noSummaryArticleIds := "3454,3456,3457,3459,2449,2450,2453,2454,2459,2530,2583,2663,2670,2699,2715,2732,2748,2759,2399,2356,2870,3173,2978,2826,3470" //非纪要库类型的文章ID
  365. listNoSummaryArticleIds := strings.Split(noSummaryArticleIds, ",")
  366. listPermission, errper := models.GetPermissionMappingCategoryID()
  367. if errper != nil {
  368. fmt.Println("GetTacticsList Err:", errper.Error())
  369. return
  370. }
  371. summaryMap := make(map[int]int)
  372. for _, vSum := range listSummary {
  373. vSumInt, _ := strconv.Atoi(vSum)
  374. summaryMap[vSumInt] = 1
  375. }
  376. for k, v := range list {
  377. //同步匹配类型
  378. matchTypeName := ""
  379. for _, vMatch := range listGetMatchTypeName {
  380. if v.CategoryId == vMatch.CategoryId {
  381. matchTypeName = vMatch.MatchTypeName
  382. }
  383. }
  384. //是否属于纪要库的数据
  385. if _, has := summaryMap[v.CategoryId]; has {
  386. v.IsSummary = 1
  387. }
  388. //排除不属于纪要库类型的文章
  389. for _, vArt := range listNoSummaryArticleIds {
  390. vArtInt, _ := strconv.Atoi(vArt)
  391. if v.ArticleId == vArtInt {
  392. v.IsSummary = 0
  393. }
  394. }
  395. for _, vPer := range listPermission {
  396. if v.CategoryId == vPer.CategoryId {
  397. v.IsReport = 1
  398. }
  399. }
  400. if v.IsReport > 0 {
  401. //是否属于策略 策略自动归类
  402. //是否属于行业报告 行业报告自动归类
  403. if v.CategoryId == 7 || v.CategoryId == 9 || v.CategoryId == 11 || v.CategoryId == 51 || v.CategoryId == 52 || v.CategoryId == 64 || v.CategoryId == 80 || v.CategoryId == 87 {
  404. v.IsClass = 1
  405. v.ReportType = 1 //是否属于行业报告
  406. } else {
  407. v.ReportType = 2 //是否属于产业报告
  408. }
  409. }
  410. v.Department = "弘则权益研究"
  411. fmt.Println(k, v.ArticleId)
  412. hh, _ := time.ParseDuration("8h")
  413. //pDate := publishDate.Add(hh)
  414. v.PublishDate = v.PublishDate.Add(hh)
  415. //判断是否已经存在
  416. if v.ArticleId < 0 {
  417. fmt.Println("AddCygxArticle Err:")
  418. return
  419. }
  420. var count int
  421. count, err = models.GetArticleCountById(v.ArticleId)
  422. if err != nil && err.Error() != utils.ErrNoRow() {
  423. fmt.Println("AddCygxArticle Err:", err.Error())
  424. return
  425. }
  426. v.Body = strings.Replace(v.Body, "http://vmp.hzinsights.com", "https://vmp.hzinsights.com", -1)
  427. expertNumStr, expertContentStr, interviewDateStr, fileLink, bodyReturn := BodyAnalysis2(v.Body)
  428. if strings.Index(v.Body, "报告全文(") > 0 && strings.Index(v.Body, "PDF格式报告下载.pdf") > 0 {
  429. v.Body = strings.Replace(v.Body, "报告全文(", "", -1)
  430. v.Body = strings.Replace(v.Body, "PDF格式报告下载.pdf", "", -1)
  431. v.Body = strings.Replace(v.Body, "):", "", -1)
  432. }
  433. var titleNew string
  434. titleNew = v.Title
  435. // 7资金流向 、11大类资产 、51每日复盘 、80医药周报、9估值研究
  436. if v.CategoryId == 7 || v.CategoryId == 11 || v.CategoryId == 51 || v.CategoryId == 9 {
  437. if v.UpdateFrequency == "daily" {
  438. var daystr string
  439. daystr = strconv.Itoa(v.PublishDate.Day())
  440. if len(daystr) == 1 {
  441. daystr = "0" + daystr
  442. }
  443. titleNew = v.Title + "(" + strconv.Itoa(v.PublishDate.Year())[2:len(strconv.Itoa(v.PublishDate.Year()))-0] + v.PublishDate.Format("01") + daystr + ")"
  444. } else if v.UpdateFrequency == "weekly" {
  445. titleNew = v.Title + utils.WeekByDate(v.PublishDate)
  446. }
  447. }
  448. if v.CategoryId == 80 {
  449. titleNew = v.Title + utils.WeekByDate(v.PublishDate)
  450. }
  451. if count > 0 {
  452. fmt.Println(k, v.ArticleId, "edit")
  453. var isCustom bool
  454. bodyText, _ := GetReportContentTextSub(v.Body)
  455. updateParams := make(map[string]interface{})
  456. //updateParams["Title"] = v.Title
  457. updateParams["Title"] = titleNew
  458. updateParams["TitleEn"] = v.TitleEn
  459. updateParams["UpdateFrequency"] = v.UpdateFrequency
  460. updateParams["CreateDate"] = v.CreateDate
  461. updateParams["PublishDate"] = v.PublishDate
  462. //updateParams["Body"] = html.EscapeString(v.Body)
  463. updateParams["Body"] = html.EscapeString(bodyReturn)
  464. updateParams["BodyText"] = bodyText
  465. updateParams["Abstract"] = html.EscapeString(v.Abstract)
  466. updateParams["CategoryName"] = v.CategoryName
  467. for _, vCustom := range listCustomArticle {
  468. if v.ArticleId == vCustom.ArticleId {
  469. fmt.Println("手动归类的文章:" + strconv.Itoa(v.ArticleId))
  470. isCustom = true
  471. }
  472. }
  473. if isCustom == false {
  474. updateParams["CategoryId"] = v.CategoryId
  475. updateParams["MatchTypeName"] = matchTypeName
  476. updateParams["IsSummary"] = v.IsSummary
  477. updateParams["IsReport"] = v.IsReport
  478. updateParams["ReportType"] = v.ReportType
  479. updateParams["SubCategoryName"] = v.SubCategoryName
  480. }
  481. //updateParams["CategoryId"] = v.CategoryId
  482. updateParams["PublishStatus"] = v.PublishStatus
  483. updateParams["ExpertBackground"] = expertContentStr
  484. updateParams["ExpertNumber"] = expertNumStr
  485. updateParams["InterviewDate"] = interviewDateStr
  486. //updateParams["IsClass"] = v.IsClass
  487. if v.Department != "弘则权益研究" {
  488. v.Department = "弘则权益研究"
  489. }
  490. updateParams["Department"] = v.Department
  491. updateParams["FileLink"] = fileLink
  492. whereParam := map[string]interface{}{"article_id": v.ArticleId}
  493. err = models.UpdateByExpr(models.CygxArticle{}, whereParam, updateParams)
  494. if err != nil {
  495. fmt.Println("UpdateByExpr Err:" + err.Error())
  496. }
  497. } else {
  498. fmt.Println(k, v.ArticleId, "add")
  499. item := new(models.CygxArticle)
  500. articleIdInt := v.ArticleId
  501. item.ArticleId = articleIdInt
  502. //item.Title = v.Title
  503. item.Title = titleNew
  504. item.TitleEn = v.TitleEn
  505. item.UpdateFrequency = v.UpdateFrequency
  506. item.CreateDate = v.CreateDate
  507. item.PublishDate = v.PublishDate.Format(utils.FormatDateTime)
  508. //item.Body = html.EscapeString(v.Body)
  509. item.Body = html.EscapeString(bodyReturn)
  510. item.Abstract = html.EscapeString(v.Abstract)
  511. item.CategoryName = v.CategoryName
  512. item.SubCategoryName = v.SubCategoryName
  513. item.CategoryId = v.CategoryId
  514. item.PublishStatus = v.PublishStatus
  515. item.ExpertBackground = expertContentStr
  516. item.ExpertNumber = expertNumStr
  517. item.InterviewDate = interviewDateStr
  518. item.Department = v.Department
  519. item.ArticleIdMd5 = utils.MD5(strconv.Itoa(articleIdInt))
  520. item.IsClass = v.IsClass
  521. item.IsSummary = v.IsSummary
  522. item.IsReport = v.IsReport
  523. item.ReportType = v.ReportType
  524. item.FileLink = fileLink
  525. item.MatchTypeName = matchTypeName
  526. _, err = models.AddCygxArticles(item)
  527. if err != nil {
  528. fmt.Println("AddCygxArticle Err:", err.Error())
  529. return
  530. }
  531. }
  532. }
  533. return
  534. }