chart.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. package services
  2. import (
  3. "context"
  4. "encoding/json"
  5. "fmt"
  6. "hongze/hongze_cygx/models"
  7. "hongze/hongze_cygx/utils"
  8. "io/ioutil"
  9. nhttp "net/http"
  10. "strconv"
  11. "strings"
  12. "time"
  13. )
  14. // get公共请求方法
  15. func PublicGetDate(url, authorization string) (body []byte, err error) {
  16. defer func() {
  17. if err != nil {
  18. go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", url+"Get ErrMsg:"+err.Error(), utils.EmailSendToUsers)
  19. }
  20. }()
  21. method := "GET"
  22. client := &nhttp.Client{}
  23. req, err := nhttp.NewRequest(method, url, nil)
  24. if err != nil {
  25. return
  26. }
  27. req.Header.Add("Authorization", authorization)
  28. res, err := client.Do(req)
  29. if err != nil {
  30. return
  31. }
  32. defer res.Body.Close()
  33. body, err = ioutil.ReadAll(res.Body)
  34. if err != nil {
  35. return
  36. }
  37. return
  38. }
  39. // 同步图表列表
  40. func GetChartListByApi(cont context.Context) (err error) {
  41. defer func() {
  42. if err != nil {
  43. go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败", 2)
  44. go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "GetArticleListByApi ErrMsg:"+err.Error(), utils.EmailSendToUsers)
  45. }
  46. }()
  47. mapChartid := make(map[int]int)
  48. chartList, err := models.GetChartListAll()
  49. if err != nil {
  50. return
  51. }
  52. for _, v := range chartList {
  53. mapChartid[v.ChartId] = v.ChartId
  54. }
  55. mapAllChartid := make(map[int]int)
  56. chartAllList, err := models.GetChartAllListAll()
  57. if err != nil {
  58. return
  59. }
  60. for _, v := range chartAllList {
  61. mapAllChartid[v.ChartId] = v.ChartId
  62. }
  63. var chartIdsDelete []int
  64. url := utils.ApiUrl + "charts/mp?take=100&skip=0"
  65. authorization := utils.ApiAuthorization
  66. body, err := PublicGetDate(url, authorization)
  67. if err != nil {
  68. return
  69. }
  70. var chartResult models.ChartResultApi
  71. err = json.Unmarshal(body, &chartResult)
  72. if err != nil {
  73. return err
  74. }
  75. for _, v := range chartResult.Data {
  76. item := new(models.CygxChart)
  77. item.ChartId = v.ChartId
  78. item.PtagId = v.PtagId
  79. item.CtagId = v.CtagId
  80. item.Title = v.Title
  81. item.TitleEn = v.TitleEn
  82. item.CreateDateApi = time.Now()
  83. item.CreateDate = v.CreateDate
  84. item.PublishStatus = v.PublishStatus
  85. item.PtagName = v.Ptag.Name
  86. item.CtagName = v.Ctag.Name
  87. item.PtagNameTwo = v.PtagTwo.Name
  88. item.CtagNameTwo = v.CtagTwo.Name
  89. item.PtagIdTwo = v.PtagTwo.Id
  90. item.CtagIdTwo = v.CtagTwo.Id
  91. item.Cover = v.Cover
  92. item.Iframe = v.Iframe
  93. //如果没有就新增 有就更新
  94. if mapChartid[v.ChartId] == 0 {
  95. _, err := models.AddCygxChart(item)
  96. if item.PublishStatus == 1 {
  97. go UpdateResourceData(item.ChartId, "newchart", "add", time.Now().Format(utils.FormatDateTime))
  98. }
  99. if err != nil {
  100. return err
  101. }
  102. } else {
  103. if item.PublishStatus == 0 {
  104. chartIdsDelete = append(chartIdsDelete, item.ChartId)
  105. }
  106. updateParams := make(map[string]interface{})
  107. updateParams["Title"] = v.Title
  108. updateParams["PtagId"] = v.PtagId
  109. updateParams["CtagId"] = v.CtagId
  110. updateParams["TitleEn"] = v.TitleEn
  111. updateParams["CreateDate"] = v.CreateDate
  112. updateParams["PublishStatus"] = v.PublishStatus
  113. updateParams["PtagName"] = v.Ptag.Name
  114. updateParams["CtagName"] = v.Ctag.Name
  115. updateParams["PtagNameTwo"] = v.PtagTwo.Name
  116. updateParams["CtagNameTwo"] = v.CtagTwo.Name
  117. updateParams["PtagIdTwo"] = v.PtagTwo.Id
  118. updateParams["CtagIdTwo"] = v.CtagTwo.Id
  119. updateParams["Cover"] = v.Cover
  120. updateParams["Iframe"] = v.Iframe
  121. whereParam := map[string]interface{}{"chart_id": v.ChartId}
  122. err = models.UpdateByExpr(models.CygxChart{}, whereParam, updateParams)
  123. if err != nil {
  124. return err
  125. }
  126. }
  127. }
  128. fmt.Println("删除的", chartIdsDelete)
  129. if len(chartIdsDelete) > 0 {
  130. go Deletenewchart(chartIdsDelete)
  131. }
  132. //策略平台图表,记录所有,的显示用户收藏使用
  133. url = utils.ApiUrl + "charts?take=100&skip=0" // 获取所有的图表链接
  134. body, err = PublicGetDate(url, authorization)
  135. if err != nil {
  136. return
  137. }
  138. err = json.Unmarshal(body, &chartResult)
  139. if err != nil {
  140. return err
  141. }
  142. for _, v := range chartResult.Data {
  143. item := new(models.CygxChartAll)
  144. item.ChartId = v.ChartId
  145. item.PtagId = v.PtagId
  146. item.CtagId = v.CtagId
  147. item.Title = v.Title
  148. item.TitleEn = v.TitleEn
  149. item.CreateDateApi = time.Now()
  150. item.CreateDate = v.CreateDate
  151. item.PublishStatus = v.PublishStatus
  152. item.PtagName = v.Ptag.Name
  153. item.CtagName = v.Ctag.Name
  154. item.PtagNameTwo = v.PtagTwo.Name
  155. item.CtagNameTwo = v.CtagTwo.Name
  156. item.PtagIdTwo = v.PtagTwo.Id
  157. item.CtagIdTwo = v.CtagTwo.Id
  158. item.Cover = v.Cover
  159. item.Iframe = v.Iframe
  160. //如果没有就新增 有就更新
  161. if mapAllChartid[v.ChartId] == 0 {
  162. _, err := models.AddCygxChartAll(item)
  163. if err != nil {
  164. return err
  165. }
  166. } else {
  167. updateParams := make(map[string]interface{})
  168. updateParams["Title"] = v.Title
  169. updateParams["PtagId"] = v.PtagId
  170. updateParams["CtagId"] = v.CtagId
  171. updateParams["TitleEn"] = v.TitleEn
  172. updateParams["CreateDate"] = v.CreateDate
  173. updateParams["PublishStatus"] = v.PublishStatus
  174. updateParams["PtagName"] = v.Ptag.Name
  175. updateParams["CtagName"] = v.Ctag.Name
  176. updateParams["PtagNameTwo"] = v.PtagTwo.Name
  177. updateParams["CtagNameTwo"] = v.CtagTwo.Name
  178. updateParams["PtagIdTwo"] = v.PtagTwo.Id
  179. updateParams["CtagIdTwo"] = v.CtagTwo.Id
  180. updateParams["Cover"] = v.Cover
  181. updateParams["Iframe"] = v.Iframe
  182. whereParam := map[string]interface{}{"chart_id": v.ChartId}
  183. err = models.UpdateByExpr(models.CygxChartAll{}, whereParam, updateParams)
  184. if err != nil {
  185. return err
  186. }
  187. }
  188. }
  189. return
  190. }
  191. // 获取图表分类
  192. func GetChartPtagByApi() (items []*models.ChartPtagResp, err error) {
  193. defer func() {
  194. if err != nil {
  195. go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "GetChartPtagByApi ErrMsg:"+err.Error(), utils.EmailSendToUsers)
  196. }
  197. }()
  198. url := utils.ApiUrl + "charts/ptag"
  199. authorization := utils.ApiAuthorization
  200. body, err := PublicGetDate(url, authorization)
  201. if err != nil {
  202. return
  203. }
  204. var chartResult models.ChartPtagResultApi
  205. err = json.Unmarshal(body, &chartResult)
  206. if err != nil {
  207. return
  208. }
  209. for _, v := range chartResult.Data {
  210. item := new(models.ChartPtagResp)
  211. item.PermissionName = v.ChartPermissionName
  212. item.ChartPermissionId = v.ChartPermissionId
  213. if len(v.Ctag) > 0 {
  214. for _, v2 := range v.Ctag {
  215. itemCtag := new(models.CtagResp)
  216. itemCtag.CtagId = v2.Id
  217. itemCtag.Name = v2.Name
  218. item.List = append(item.List, itemCtag)
  219. }
  220. }
  221. items = append(items, item)
  222. }
  223. return
  224. }
  225. // 获取用户的Token
  226. func GetUserTokenByMobile(mobile string) (token string, err error) {
  227. //缓存校验
  228. cacheKey := fmt.Sprint("xygx_chart:chart_token:add:", "Mobile", mobile)
  229. ttlTime := utils.Rc.GetRedisTTL(cacheKey)
  230. if ttlTime > 0 {
  231. token, _ = utils.Rc.RedisString(cacheKey)
  232. }
  233. if token == "" {
  234. url := utils.ApiUrl + "auth/login"
  235. method := "POST"
  236. payload := strings.NewReader(`{
  237. "phone_number":"` + mobile + `",
  238. "password":"hz123456"}`)
  239. client := &nhttp.Client{}
  240. req, errReq := nhttp.NewRequest(method, url, payload)
  241. if errReq != nil {
  242. err = errReq
  243. return
  244. }
  245. req.Header.Add("Content-Type", "application/json")
  246. req.Header.Add("Cookie", "sessionid=naj5j5kl1jjynh7og1rsaxkl1vrsl829")
  247. res, errReq := client.Do(req)
  248. if errReq != nil {
  249. err = errReq
  250. return
  251. }
  252. defer res.Body.Close()
  253. body, errReq := ioutil.ReadAll(res.Body)
  254. if errReq != nil {
  255. err = errReq
  256. return
  257. }
  258. var chartResult models.ChartUserTokenResultApi
  259. errReq = json.Unmarshal(body, &chartResult)
  260. if errReq != nil {
  261. err = errReq
  262. return
  263. }
  264. token = chartResult.Data.AccessToken
  265. utils.Rc.Put(cacheKey, token, time.Hour*24)
  266. }
  267. return
  268. }
  269. // 获取图表收藏
  270. func GetChartCollectionByApi(mobile string, take, skip int) (items []*models.HomeChartListResp, err error, total int) {
  271. defer func() {
  272. if err != nil {
  273. //go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "GetChartPtagByApi ErrMsg:"+err.Error(), utils.EmailSendToUsers)
  274. }
  275. }()
  276. url := utils.ApiUrl + "charts/favorites?take=" + strconv.Itoa(take) + "&skip=" + strconv.Itoa(skip)
  277. authorization, err := GetUserTokenByMobile(mobile)
  278. if err != nil {
  279. return
  280. }
  281. authorization = "bearer " + authorization
  282. body, err := PublicGetDate(url, authorization)
  283. if err != nil {
  284. return
  285. }
  286. var chartResult models.ChartFavoritesResultApi
  287. err = json.Unmarshal(body, &chartResult)
  288. if err != nil {
  289. return
  290. }
  291. for _, v := range chartResult.Data {
  292. item := new(models.HomeChartListResp)
  293. item.ChartId = v.ChartId
  294. item.Title = v.ChartInfo.Title
  295. item.TitleEn = v.ChartInfo.TitleEn
  296. item.CreateDate = v.CreateDate
  297. item.PtagName = v.ChartInfo.Ptag.Name
  298. item.CtagName = v.ChartInfo.Ctag.Name
  299. item.BodyHtml = v.ChartInfo.Cover
  300. item.HttpUrl = utils.CHART_INFO_HTTP_URL + strconv.Itoa(v.ChartId)
  301. item.IsNeedJump = true
  302. items = append(items, item)
  303. }
  304. total = chartResult.Pagination.Total
  305. return
  306. }
  307. // 判断策略平台是否已经添加过收藏
  308. func GetIsCollectionChart(mobile string, chartId int) (isCollection bool, err error) {
  309. //获取所有的收藏列表,进行比对看看是否收藏,调用三方接口详情没有是否收藏的字段
  310. list, err, _ := GetChartCollectionByApi(mobile, 9999, 0)
  311. if err != nil {
  312. return
  313. }
  314. for _, v := range list {
  315. if v.ChartId == chartId {
  316. isCollection = true
  317. }
  318. }
  319. return
  320. }
  321. // 添加收藏
  322. func AddCollectionChart(mobile string, chartId int) (err error) {
  323. authorization, err := GetUserTokenByMobile(mobile)
  324. if err != nil {
  325. return
  326. }
  327. authorization = "bearer " + authorization
  328. url := utils.ApiUrl + "charts/favorites"
  329. method := "POST"
  330. payload := strings.NewReader(`{
  331. "chart_id":` + strconv.Itoa(chartId) + `
  332. }`)
  333. client := &nhttp.Client{}
  334. req, err := nhttp.NewRequest(method, url, payload)
  335. if err != nil {
  336. return
  337. }
  338. req.Header.Add("Authorization", authorization)
  339. req.Header.Add("Content-Type", "application/json")
  340. req.Header.Add("Cookie", "sessionid=naj5j5kl1jjynh7og1rsaxkl1vrsl829")
  341. res, err := client.Do(req)
  342. if err != nil {
  343. return
  344. }
  345. defer res.Body.Close()
  346. _, err = ioutil.ReadAll(res.Body)
  347. if err != nil {
  348. return
  349. }
  350. return
  351. }
  352. // 移除收藏
  353. func DeleteCollectionChart(mobile string, chartId int) (err error) {
  354. authorization, err := GetUserTokenByMobile(mobile)
  355. if err != nil {
  356. return
  357. }
  358. authorization = "bearer " + authorization
  359. url := utils.ApiUrl + "charts/favorites/" + strconv.Itoa(chartId)
  360. method := "DELETE"
  361. client := &nhttp.Client{}
  362. req, err := nhttp.NewRequest(method, url, nil)
  363. if err != nil {
  364. return
  365. }
  366. req.Header.Add("Authorization", authorization)
  367. req.Header.Add("Cookie", "sessionid=naj5j5kl1jjynh7og1rsaxkl1vrsl829")
  368. res, err := client.Do(req)
  369. if err != nil {
  370. return
  371. }
  372. defer res.Body.Close()
  373. _, err = ioutil.ReadAll(res.Body)
  374. if err != nil {
  375. return
  376. }
  377. return
  378. }
  379. func GetChartDetailByChartId(cont context.Context) (err error) {
  380. listUpdate, err := models.GetChartCeluePushList()
  381. if err != nil && err.Error() != utils.ErrNoRow() {
  382. go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表1ID:"+err.Error(), 2)
  383. }
  384. //如果长度为零就不处理
  385. if len(listUpdate) == 0 {
  386. return err
  387. }
  388. for _, v := range listUpdate {
  389. err = GetChartDetailByApi(v.ChartId)
  390. if err != nil {
  391. go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表2ID:"+strconv.Itoa(v.ChartId)+err.Error(), 2)
  392. }
  393. err = models.UpdateCygxChartCeluePush(v.ChartId)
  394. if err != nil {
  395. go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表3ID:"+strconv.Itoa(v.ChartId)+err.Error(), 2)
  396. }
  397. }
  398. return
  399. }
  400. //func init() {
  401. // GetChartDetailByApi(6370)
  402. //}
  403. // 同步图表详情
  404. func GetChartDetailByApi(chartId int) (err error) {
  405. defer func() {
  406. if err != nil {
  407. //fmt.Println(err)
  408. go utils.SendAlarmMsg("发送邮件:同步用户到策略平台信息失败,图表4ID:"+strconv.Itoa(chartId)+err.Error(), 2)
  409. go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "GetArticleListByApi ,图表ID:"+strconv.Itoa(chartId)+"ErrMsg:"+err.Error(), utils.EmailSendToUsers)
  410. }
  411. }()
  412. mapChartid := make(map[int]int)
  413. chartList, err := models.GetChartListAll()
  414. if err != nil {
  415. return
  416. }
  417. for _, v := range chartList {
  418. mapChartid[v.ChartId] = v.ChartId
  419. }
  420. mapAllChartid := make(map[int]int)
  421. chartAllList, err := models.GetChartAllListAll()
  422. if err != nil {
  423. return
  424. }
  425. for _, v := range chartAllList {
  426. mapAllChartid[v.ChartId] = v.ChartId
  427. }
  428. var chartIdsDelete []int
  429. url := utils.ApiUrl + "charts/" + strconv.Itoa(chartId)
  430. authorization := utils.ApiAuthorization
  431. body, err := PublicGetDate(url, authorization)
  432. if err != nil {
  433. return
  434. }
  435. var resultDate models.ChartResultDetailApi
  436. err = json.Unmarshal(body, &resultDate)
  437. if err != nil {
  438. return err
  439. }
  440. v := resultDate.Data
  441. if v.ChartId == 0 {
  442. err = models.DeleteCygxChart(chartId)
  443. return
  444. }
  445. item := new(models.CygxChart)
  446. item.ChartId = v.ChartId
  447. item.PtagId = v.PtagId
  448. item.CtagId = v.CtagId
  449. item.Title = v.Title
  450. item.TitleEn = v.TitleEn
  451. item.CreateDateApi = time.Now()
  452. item.CreateDate = v.CreateDate
  453. item.PublishStatus = v.PublishStatus
  454. item.PtagName = v.Ptag.Name
  455. item.CtagName = v.Ctag.Name
  456. item.PtagNameTwo = v.PtagTwo.Name
  457. item.CtagNameTwo = v.CtagTwo.Name
  458. item.PtagIdTwo = v.PtagTwo.Id
  459. item.CtagIdTwo = v.CtagTwo.Id
  460. item.Cover = v.Cover
  461. item.Iframe = v.Iframe
  462. //如果是软删除就做取消发布处理
  463. if !v.IsActive {
  464. item.PublishStatus = 0
  465. }
  466. //如果没有就新增 有就更新
  467. if mapChartid[chartId] == 0 {
  468. _, err := models.AddCygxChart(item)
  469. if item.PublishStatus == 1 && v.IsActive {
  470. //go UpdateResourceData(chartId, "newchart", "add", time.Now().Format(utils.FormatDateTime))
  471. }
  472. if err != nil {
  473. return err
  474. }
  475. } else {
  476. if item.PublishStatus == 0 {
  477. chartIdsDelete = append(chartIdsDelete, chartId)
  478. }
  479. updateParams := make(map[string]interface{})
  480. updateParams["Title"] = v.Title
  481. updateParams["PtagId"] = v.PtagId
  482. updateParams["CtagId"] = v.CtagId
  483. updateParams["TitleEn"] = v.TitleEn
  484. updateParams["CreateDate"] = v.CreateDate
  485. updateParams["PublishStatus"] = v.PublishStatus
  486. updateParams["PtagName"] = v.Ptag.Name
  487. updateParams["CtagName"] = v.Ctag.Name
  488. updateParams["PtagNameTwo"] = v.PtagTwo.Name
  489. updateParams["CtagNameTwo"] = v.CtagTwo.Name
  490. updateParams["PtagIdTwo"] = v.PtagTwo.Id
  491. updateParams["CtagIdTwo"] = v.CtagTwo.Id
  492. updateParams["Cover"] = v.Cover
  493. updateParams["Iframe"] = v.Iframe
  494. whereParam := map[string]interface{}{"chart_id": chartId}
  495. err = models.UpdateByExpr(models.CygxChart{}, whereParam, updateParams)
  496. if err != nil {
  497. return err
  498. }
  499. if item.PublishStatus == 0 {
  500. //go UpdateResourceData(chartId, "newchart", "delete", time.Now().Format(utils.FormatDateTime))
  501. }
  502. }
  503. //}
  504. fmt.Println("删除的", chartIdsDelete)
  505. //if len(chartIdsDelete) > 0 {
  506. // go Deletenewchart(chartIdsDelete)
  507. //}
  508. //策略平台图表,记录所有,的显示用户收藏使用
  509. {
  510. item := new(models.CygxChartAll)
  511. item.ChartId = v.ChartId
  512. item.PtagId = v.PtagId
  513. item.CtagId = v.CtagId
  514. item.Title = v.Title
  515. item.TitleEn = v.TitleEn
  516. item.CreateDateApi = time.Now()
  517. item.CreateDate = v.CreateDate
  518. item.PublishStatus = v.PublishStatus
  519. item.PtagName = v.Ptag.Name
  520. item.CtagName = v.Ctag.Name
  521. item.PtagNameTwo = v.PtagTwo.Name
  522. item.CtagNameTwo = v.CtagTwo.Name
  523. item.PtagIdTwo = v.PtagTwo.Id
  524. item.CtagIdTwo = v.CtagTwo.Id
  525. item.Cover = v.Cover
  526. item.Iframe = v.Iframe
  527. //如果是软删除就做取消发布处理
  528. if !v.IsActive {
  529. item.PublishStatus = 0
  530. }
  531. //如果没有就新增 有就更新
  532. if mapAllChartid[chartId] == 0 {
  533. _, err := models.AddCygxChartAll(item)
  534. if err != nil {
  535. return err
  536. }
  537. } else {
  538. updateParams := make(map[string]interface{})
  539. updateParams["Title"] = v.Title
  540. updateParams["PtagId"] = v.PtagId
  541. updateParams["CtagId"] = v.CtagId
  542. updateParams["TitleEn"] = v.TitleEn
  543. updateParams["CreateDate"] = v.CreateDate
  544. updateParams["PublishStatus"] = v.PublishStatus
  545. updateParams["PtagName"] = v.Ptag.Name
  546. updateParams["CtagName"] = v.Ctag.Name
  547. updateParams["PtagNameTwo"] = v.PtagTwo.Name
  548. updateParams["CtagNameTwo"] = v.CtagTwo.Name
  549. updateParams["PtagIdTwo"] = v.PtagTwo.Id
  550. updateParams["CtagIdTwo"] = v.CtagTwo.Id
  551. updateParams["Cover"] = v.Cover
  552. updateParams["Iframe"] = v.Iframe
  553. whereParam := map[string]interface{}{"chart_id": chartId}
  554. err = models.UpdateByExpr(models.CygxChartAll{}, whereParam, updateParams)
  555. if err != nil {
  556. return err
  557. }
  558. }
  559. }
  560. go AddComprehensiveChart(chartId) //同步图表到综合页面的搜索
  561. go UpdateNewchartResourceData(chartId) ////把数据写入 cygx_resource_data 表
  562. return
  563. }