article.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  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. defer func() {
  261. if err != nil {
  262. fmt.Println("GetArticleListByApi Err:" + err.Error())
  263. go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "GetArticleListByApi ErrMsg:"+err.Error(), utils.EmailSendToUsers)
  264. }
  265. }()
  266. url := "https://vmp.hzinsights.com/v2api/articles/mp?take=100&skip=0&publish_status=1"
  267. method := "GET"
  268. client := &nhttp.Client{}
  269. req, err := nhttp.NewRequest(method, url, nil)
  270. if err != nil {
  271. fmt.Println("GetListApi Err:", err.Error())
  272. return err
  273. }
  274. req.Header.Add("Authorization", "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkiLCJwaG9uZV9udW1iZXIiOiIxMjM0NTY3ODkiLCJuYW1lIjoi5YW25LuWIiwiZW50cmFuY2UiOiJwYXNzd3dvcmQiLCJpYXQiOjE2MzQ4NzA1OTQsImV4cCI6MTYzNDg3NDE5NH0.tho2L9jsbDPn8ltEGUVDve_nHsh0Kzf6ZrSz0RcZ0ag")
  275. res, err := client.Do(req)
  276. if err != nil {
  277. fmt.Println(err)
  278. return err
  279. }
  280. defer res.Body.Close()
  281. body, err := ioutil.ReadAll(res.Body)
  282. if err != nil {
  283. fmt.Println("Getres.Body Err:", err.Error())
  284. return err
  285. }
  286. var pdfResult models.ArticleResultApi
  287. err = json.Unmarshal(body, &pdfResult)
  288. if err != nil {
  289. fmt.Println("Getres.pdfResult Err:", err.Error())
  290. return err
  291. }
  292. exitMap := make(map[int]int)
  293. classMap := make(map[int]int)
  294. reportMap := make(map[int]int)
  295. summaryMap := make(map[int]int)
  296. listMap, err := models.GetArticleApiMap()
  297. if err != nil {
  298. fmt.Println("GetlistMap Err:", err.Error())
  299. return err
  300. }
  301. //新旧分类 反向隐射,是否归类,是否是报告,是否是纪要库
  302. for _, v := range listMap {
  303. exitMap[v.Id] = v.OldId
  304. if v.IsClass == 1 {
  305. classMap[v.OldId] = 1
  306. }
  307. if v.IsReport == 1 {
  308. reportMap[v.OldId] = 1
  309. }
  310. if v.IsSummary == 1 {
  311. summaryMap[v.OldId] = 1
  312. }
  313. }
  314. listData := pdfResult.Data
  315. var list []*models.Tactics2
  316. var listAuthor []*models.CygxArticleAuthor
  317. for _, v := range listData {
  318. if exitMap[v.SeriesId] > 0 {
  319. v.PublishDate = time.Date(v.PublishDate.Year(), v.PublishDate.Month(), v.PublishDate.Day(), v.PublishDate.Hour(), v.PublishDate.Minute(), v.PublishDate.Second(), v.PublishDate.Nanosecond(), time.Local)
  320. item := new(models.Tactics2)
  321. itemAuthor := new(models.CygxArticleAuthor)
  322. item.ArticleId = v.ArticleId
  323. item.Title = v.Title
  324. item.TitleEn = v.TitleEn
  325. if v.Frequency == "日度" {
  326. item.UpdateFrequency = "daily"
  327. } else if v.Frequency == "周度" {
  328. item.UpdateFrequency = "weekly"
  329. } else if v.Frequency == "月度" {
  330. item.UpdateFrequency = "monthly"
  331. } else if v.Frequency == "季度" {
  332. item.UpdateFrequency = "quarterly"
  333. } else if v.Frequency == "年度" {
  334. item.UpdateFrequency = "yearly"
  335. } else {
  336. item.UpdateFrequency = "unknow"
  337. }
  338. item.CreateDate = v.CreateDate
  339. item.PublishDate = v.PublishDate
  340. item.PublishStatus = v.PublishStatus
  341. item.Body = v.Content.Body
  342. item.Abstract = v.Content.Abstract
  343. item.CategoryName = v.Industry.Name
  344. item.CategoryId = exitMap[v.SeriesId]
  345. item.SubCategoryName = v.Series.Name
  346. list = append(list, item)
  347. itemAuthor.ArticleId = v.ArticleId
  348. itemAuthor.Name = v.Author.Name
  349. itemAuthor.Mobile = v.Author.PhoneNumber
  350. listAuthor = append(listAuthor, itemAuthor)
  351. }
  352. }
  353. //同步作者
  354. for _, v := range listAuthor {
  355. var count int
  356. count, err = models.GetActivityAuthorCount(v.ArticleId, v.Mobile)
  357. if err != nil {
  358. fmt.Println("GetCount Err:", err.Error())
  359. return err
  360. }
  361. if count == 0 {
  362. _, err = models.AddCygxActivityAuthor(v)
  363. if err != nil {
  364. fmt.Println("AddCygxActivityAuthor Err:", err.Error())
  365. return err
  366. }
  367. }
  368. }
  369. fmt.Println("同步文章条数:", len(list))
  370. listCustomArticle, err := models.GetCustomArticleId() //手动归类的文章,不替换文章类型
  371. if err != nil {
  372. fmt.Println("GetTacticsList Err:", err.Error())
  373. return err
  374. }
  375. listGetMatchTypeName, errMatch := models.GetMatchTypeNamenNotNull() //手动归类的文章,不替换文章类型
  376. if errMatch != nil {
  377. fmt.Println("GetTacticsList Err:", errMatch.Error())
  378. return err
  379. }
  380. fmt.Println("list len:", len(list))
  381. 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
  382. listNoSummaryArticleIds := strings.Split(noSummaryArticleIds, ",")
  383. for k, v := range list {
  384. //同步匹配类型
  385. matchTypeName := ""
  386. for _, vMatch := range listGetMatchTypeName {
  387. if v.CategoryId == vMatch.CategoryId {
  388. matchTypeName = vMatch.MatchTypeName
  389. }
  390. }
  391. //是否属于纪要库的数据
  392. if _, has := summaryMap[v.CategoryId]; has {
  393. v.IsSummary = 1
  394. }
  395. //排除不属于纪要库类型的文章
  396. for _, vArt := range listNoSummaryArticleIds {
  397. vArtInt, _ := strconv.Atoi(vArt)
  398. if v.ArticleId == vArtInt {
  399. v.IsSummary = 0
  400. }
  401. }
  402. if _, has := reportMap[v.CategoryId]; has {
  403. v.IsReport = 1
  404. if _, ok := classMap[v.CategoryId]; ok {
  405. v.IsClass = 1
  406. v.ReportType = 1 //是否属于行业报告
  407. } else {
  408. v.ReportType = 2 //是否属于产业报告
  409. }
  410. }
  411. v.Department = "弘则权益研究"
  412. //判断是否已经存在
  413. if v.ArticleId < 0 {
  414. fmt.Println("AddCygxArticle Err:")
  415. return err
  416. }
  417. var count int
  418. count, err = models.GetArticleCountById(v.ArticleId)
  419. if err != nil && err.Error() != utils.ErrNoRow() {
  420. fmt.Println("AddCygxArticle Err:", err.Error())
  421. return err
  422. }
  423. v.Body = strings.Replace(v.Body, "http://vmp.hzinsights.com", "https://vmp.hzinsights.com", -1)
  424. expertNumStr, expertContentStr, interviewDateStr, fileLink, bodyReturn := BodyAnalysis2(v.Body)
  425. if strings.Index(v.Body, "报告全文(") > 0 && strings.Index(v.Body, "PDF格式报告下载.pdf") > 0 {
  426. v.Body = strings.Replace(v.Body, "报告全文(", "", -1)
  427. v.Body = strings.Replace(v.Body, "PDF格式报告下载.pdf", "", -1)
  428. v.Body = strings.Replace(v.Body, "):", "", -1)
  429. }
  430. var titleNew string
  431. titleNew = v.Title
  432. // 7资金流向 、11大类资产 、51每日复盘 、80医药周报、9估值研究
  433. if v.CategoryId == 7 || v.CategoryId == 11 || v.CategoryId == 51 || v.CategoryId == 9 {
  434. if v.UpdateFrequency == "daily" {
  435. var daystr string
  436. daystr = strconv.Itoa(v.PublishDate.Day())
  437. if len(daystr) == 1 {
  438. daystr = "0" + daystr
  439. }
  440. titleNew = v.Title + "(" + strconv.Itoa(v.PublishDate.Year())[2:len(strconv.Itoa(v.PublishDate.Year()))-0] + v.PublishDate.Format("01") + daystr + ")"
  441. } else if v.UpdateFrequency == "weekly" {
  442. titleNew = v.Title + utils.WeekByDate(v.PublishDate)
  443. }
  444. }
  445. if v.CategoryId == 80 {
  446. titleNew = v.Title + utils.WeekByDate(v.PublishDate)
  447. }
  448. if count > 0 {
  449. fmt.Println(k, v.ArticleId, "edit")
  450. var isCustom bool
  451. bodyText, _ := GetReportContentTextSub(v.Body)
  452. updateParams := make(map[string]interface{})
  453. //updateParams["Title"] = v.Title
  454. updateParams["Title"] = titleNew
  455. updateParams["TitleEn"] = v.TitleEn
  456. updateParams["UpdateFrequency"] = v.UpdateFrequency
  457. updateParams["CreateDate"] = v.CreateDate
  458. updateParams["PublishDate"] = v.PublishDate
  459. //updateParams["Body"] = html.EscapeString(v.Body)
  460. updateParams["Body"] = html.EscapeString(bodyReturn)
  461. updateParams["BodyText"] = bodyText
  462. updateParams["Abstract"] = html.EscapeString(v.Abstract)
  463. updateParams["CategoryName"] = v.CategoryName
  464. for _, vCustom := range listCustomArticle {
  465. if v.ArticleId == vCustom.ArticleId {
  466. fmt.Println("手动归类的文章:" + strconv.Itoa(v.ArticleId))
  467. isCustom = true
  468. }
  469. }
  470. if isCustom == false {
  471. updateParams["CategoryId"] = v.CategoryId
  472. updateParams["MatchTypeName"] = matchTypeName
  473. updateParams["IsSummary"] = v.IsSummary
  474. updateParams["IsReport"] = v.IsReport
  475. updateParams["ReportType"] = v.ReportType
  476. updateParams["SubCategoryName"] = v.SubCategoryName
  477. }
  478. //updateParams["CategoryId"] = v.CategoryId
  479. updateParams["PublishStatus"] = v.PublishStatus
  480. updateParams["ExpertBackground"] = expertContentStr
  481. updateParams["ExpertNumber"] = expertNumStr
  482. updateParams["InterviewDate"] = interviewDateStr
  483. //updateParams["IsClass"] = v.IsClass
  484. v.Department = "弘则权益研究"
  485. updateParams["Department"] = v.Department
  486. updateParams["FileLink"] = fileLink
  487. whereParam := map[string]interface{}{"article_id": v.ArticleId}
  488. err = models.UpdateByExpr(models.CygxArticle{}, whereParam, updateParams)
  489. if err != nil {
  490. fmt.Println("UpdateByExpr Err:" + err.Error())
  491. return err
  492. }
  493. } else {
  494. fmt.Println(k, v.ArticleId, "add")
  495. item := new(models.CygxArticle)
  496. articleIdInt := v.ArticleId
  497. item.ArticleId = articleIdInt
  498. //item.Title = v.Title
  499. item.Title = titleNew
  500. item.TitleEn = v.TitleEn
  501. item.UpdateFrequency = v.UpdateFrequency
  502. item.CreateDate = v.CreateDate
  503. item.PublishDate = v.PublishDate.Format(utils.FormatDateTime)
  504. //item.Body = html.EscapeString(v.Body)
  505. item.Body = html.EscapeString(bodyReturn)
  506. item.Abstract = html.EscapeString(v.Abstract)
  507. item.CategoryName = v.CategoryName
  508. item.SubCategoryName = v.SubCategoryName
  509. item.CategoryId = v.CategoryId
  510. item.PublishStatus = v.PublishStatus
  511. item.ExpertBackground = expertContentStr
  512. item.ExpertNumber = expertNumStr
  513. item.InterviewDate = interviewDateStr
  514. item.Department = v.Department
  515. item.ArticleIdMd5 = utils.MD5(strconv.Itoa(articleIdInt))
  516. item.IsClass = v.IsClass
  517. item.IsSummary = v.IsSummary
  518. item.IsReport = v.IsReport
  519. item.ReportType = v.ReportType
  520. item.FileLink = fileLink
  521. item.MatchTypeName = matchTypeName
  522. _, err = models.AddCygxArticles(item)
  523. if err != nil {
  524. fmt.Println("AddCygxArticle Err:", err.Error())
  525. return err
  526. }
  527. }
  528. }
  529. return
  530. }