article.go 18 KB

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