eta_forum_hub.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. package eta_forum
  2. import (
  3. "encoding/json"
  4. "eta/eta_api/models/data_manage"
  5. "eta/eta_api/models/data_manage/chart_theme"
  6. "eta/eta_api/models/system"
  7. "eta/eta_api/services/alarm_msg"
  8. "eta/eta_api/utils"
  9. "fmt"
  10. )
  11. type UploadChartToForumReq struct {
  12. ChartInfoId int `description:"图表ID"`
  13. Description string `description:"逻辑简述"`
  14. }
  15. type UpdateChartToForumReq struct {
  16. ChartInfoId int `description:"图表ID"`
  17. }
  18. type ChartSaveLibReq struct {
  19. ChartInfo *data_manage.ChartInfo
  20. Description string `description:"逻辑简述"`
  21. EdbInfoList []*data_manage.EdbInfo
  22. ChartThemeList []*chart_theme.ChartTheme
  23. EdbInfoDataList []*AddEdbDataReq
  24. ChartEdbMapping []*data_manage.ChartEdbMapping
  25. EdbInfoCalculateMapping []*data_manage.EdbInfoCalculateMapping
  26. ChartSeries []*data_manage.ChartSeries
  27. ChartSeriesEdbMapping []*data_manage.ChartSeriesEdbMapping
  28. CreatorInfo *system.Admin //创建者的账号信息
  29. UploaderInfo *system.Admin //上传者的账号信息
  30. }
  31. type ChartSaveLibResp struct {
  32. Ret int
  33. Msg string
  34. ErrMsg string
  35. ErrCode string
  36. Data *data_manage.AddChartInfoResp
  37. Success bool `description:"true 执行成功,false 执行失败"`
  38. IsSendEmail bool `json:"-" description:"true 发送邮件,false 不发送邮件"`
  39. IsAddLog bool `json:"-" description:"true 新增操作日志,false 不新增操作日志" `
  40. }
  41. type AddEdbDataReq struct {
  42. EdbCode string
  43. EdbType int
  44. DataList []*data_manage.EdbDataBase
  45. }
  46. type DeleteChartReq struct {
  47. ChartInfoId int `description:"图表id"`
  48. }
  49. // UploadChart 上传图表接口
  50. func UploadChart(chartInfoId int, description string, uploaderInfo *system.Admin) (err error, errMsg string) {
  51. defer func() {
  52. if err != nil {
  53. go alarm_msg.SendAlarmMsg(fmt.Sprintf("上传图表至社区失败:Err:%v,ErrMsg:%s", err, errMsg), 3)
  54. }
  55. }()
  56. // 查询图表信息
  57. chartInfo, err := data_manage.GetChartInfoById(chartInfoId)
  58. if err != nil {
  59. if err.Error() == utils.ErrNoRow() {
  60. errMsg = "图表不存在"
  61. err = fmt.Errorf(errMsg)
  62. return
  63. }
  64. errMsg = "获取图表信息失败"
  65. err = fmt.Errorf("获取图表信息失败,Err:" + err.Error())
  66. return
  67. }
  68. if chartInfo.ForumChartInfoId > 0 {
  69. errMsg = "该图表已上传至社区,无法再次上传"
  70. err = fmt.Errorf(errMsg)
  71. return
  72. }
  73. //查询图表主题
  74. //查询图表指标
  75. //获取原图表关联的指标信息列表
  76. chartMappingList, err := data_manage.GetChartMappingList(chartInfoId)
  77. if err != nil {
  78. errMsg = "获取图表关联的指标信息失败"
  79. err = fmt.Errorf("获取图表关联的指标信息失败,Err:" + err.Error())
  80. return
  81. }
  82. edbIds := make([]int, 0)
  83. for _, v := range chartMappingList {
  84. edbIds = append(edbIds, v.EdbInfoId)
  85. }
  86. chartSeriesList := make([]*data_manage.ChartSeries, 0)
  87. chartSeriesEdbList := make([]*data_manage.ChartSeriesEdbMapping, 0)
  88. if chartInfo.ChartType == utils.CHART_TYPE_SECTION_COMBINE {
  89. chartSeriesList, err = data_manage.GetChartSeriesByChartInfoId(chartInfoId)
  90. if err != nil {
  91. errMsg = "获取图表关联的系列信息失败"
  92. err = fmt.Errorf("获取图表关联的系列信息失败,Err:" + err.Error())
  93. return
  94. }
  95. chartSeriesEdbList, err = data_manage.GetChartSeriesEdbByChartInfoId(chartInfoId)
  96. if err != nil {
  97. errMsg = "获取图表关联的系列指标信息失败"
  98. err = fmt.Errorf("获取图表关联的系列指标信息失败,Err:" + err.Error())
  99. return
  100. }
  101. }
  102. var (
  103. edbInfoList []*data_manage.EdbInfo
  104. edbMappingList []*data_manage.EdbInfoCalculateMapping
  105. edbInfoDataList []*AddEdbDataReq
  106. )
  107. //查询指标详情
  108. edbInfoList, edbMappingList, edbInfoDataList, err = GetEdbListByEdbInfoId(edbIds)
  109. if err != nil {
  110. errMsg = "获取指标详情失败"
  111. err = fmt.Errorf("获取指标详情失败,Err:" + err.Error())
  112. return
  113. }
  114. req := new(ChartSaveLibReq)
  115. req.ChartInfo = chartInfo
  116. req.ChartEdbMapping = chartMappingList
  117. req.EdbInfoList = edbInfoList
  118. req.EdbInfoDataList = edbInfoDataList
  119. req.EdbInfoCalculateMapping = edbMappingList
  120. req.Description = description
  121. req.ChartSeries = chartSeriesList
  122. req.ChartSeriesEdbMapping = chartSeriesEdbList
  123. // 查询创建者信息
  124. creatorInfo, _ := system.GetSysAdminById(chartInfo.SysUserId)
  125. if creatorInfo != nil {
  126. req.CreatorInfo = creatorInfo
  127. }
  128. req.UploaderInfo = uploaderInfo
  129. // 添加计算指标
  130. reqJson, err := json.Marshal(req)
  131. if err != nil {
  132. errMsg = "参数解析异常"
  133. err = fmt.Errorf("参数解析异常,Err:" + err.Error())
  134. return
  135. }
  136. respItem, err := ChartSaveLib(string(reqJson))
  137. if err != nil {
  138. errMsg = "上传失败"
  139. err = fmt.Errorf("上传失败,Err:" + err.Error())
  140. return
  141. }
  142. if respItem.Ret != 200 {
  143. errMsg = "上传失败"
  144. err = fmt.Errorf(respItem.ErrMsg)
  145. return
  146. }
  147. if respItem.Data != nil && respItem.Data.ChartInfoId != 0 {
  148. // 更新社区返回的图表ID
  149. err = data_manage.SetForumChartInfoId(chartInfoId, respItem.Data.ChartInfoId)
  150. if err != nil {
  151. errMsg = "更新图表ID失败"
  152. err = fmt.Errorf("更新图表ID失败,Err:" + err.Error())
  153. return
  154. }
  155. }
  156. return
  157. }
  158. // UpdateChart 更新社区里的图表接口
  159. func UpdateChart(chartInfoId int) (err error, errMsg string) {
  160. defer func() {
  161. if err != nil {
  162. go alarm_msg.SendAlarmMsg(fmt.Sprintf("同步图表信息至社区失败:Err:%v,ErrMsg:%s", err, errMsg), 3)
  163. }
  164. }()
  165. // 查询图表信息
  166. chartInfo, err := data_manage.GetChartInfoById(chartInfoId)
  167. if err != nil {
  168. if err.Error() == utils.ErrNoRow() {
  169. errMsg = "图表不存在"
  170. err = fmt.Errorf(errMsg)
  171. return
  172. }
  173. errMsg = "获取图表信息失败"
  174. err = fmt.Errorf("获取图表信息失败,Err:" + err.Error())
  175. return
  176. }
  177. if chartInfo.ForumChartInfoId <= 0 {
  178. errMsg = "该图表未上传至社区"
  179. err = fmt.Errorf(errMsg)
  180. return
  181. }
  182. //查询图表主题
  183. //查询图表指标
  184. //获取原图表关联的指标信息列表
  185. chartMappingList, err := data_manage.GetChartMappingList(chartInfoId)
  186. if err != nil {
  187. errMsg = "获取图表关联的指标信息失败"
  188. err = fmt.Errorf("获取图表关联的指标信息失败,Err:" + err.Error())
  189. return
  190. }
  191. edbIds := make([]int, 0)
  192. for _, v := range chartMappingList {
  193. edbIds = append(edbIds, v.EdbInfoId)
  194. }
  195. chartSeriesList := make([]*data_manage.ChartSeries, 0)
  196. chartSeriesEdbList := make([]*data_manage.ChartSeriesEdbMapping, 0)
  197. if chartInfo.ChartType == utils.CHART_TYPE_SECTION_COMBINE {
  198. chartSeriesList, err = data_manage.GetChartSeriesByChartInfoId(chartInfoId)
  199. if err != nil {
  200. errMsg = "获取图表关联的系列信息失败"
  201. err = fmt.Errorf("获取图表关联的系列信息失败,Err:" + err.Error())
  202. return
  203. }
  204. chartSeriesEdbList, err = data_manage.GetChartSeriesEdbByChartInfoId(chartInfoId)
  205. if err != nil {
  206. errMsg = "获取图表关联的系列指标信息失败"
  207. err = fmt.Errorf("获取图表关联的系列指标信息失败,Err:" + err.Error())
  208. return
  209. }
  210. }
  211. var (
  212. edbInfoList []*data_manage.EdbInfo
  213. edbMappingList []*data_manage.EdbInfoCalculateMapping
  214. edbInfoDataList []*AddEdbDataReq
  215. )
  216. //查询指标详情
  217. edbInfoList, edbMappingList, edbInfoDataList, err = GetEdbListByEdbInfoId(edbIds)
  218. if err != nil {
  219. errMsg = "获取指标详情失败"
  220. err = fmt.Errorf("获取指标详情失败,Err:" + err.Error())
  221. return
  222. }
  223. req := new(ChartSaveLibReq)
  224. req.ChartInfo = chartInfo
  225. req.ChartInfo.ChartInfoId = chartInfo.ForumChartInfoId
  226. req.ChartEdbMapping = chartMappingList
  227. req.EdbInfoList = edbInfoList
  228. req.EdbInfoDataList = edbInfoDataList
  229. req.EdbInfoCalculateMapping = edbMappingList
  230. req.ChartSeries = chartSeriesList
  231. req.ChartSeriesEdbMapping = chartSeriesEdbList
  232. // 查询创建者信息
  233. creatorInfo, _ := system.GetSysAdminById(chartInfo.SysUserId)
  234. if creatorInfo != nil {
  235. req.CreatorInfo = creatorInfo
  236. }
  237. // 添加计算指标
  238. reqJson, err := json.Marshal(req)
  239. if err != nil {
  240. errMsg = "参数解析异常"
  241. err = fmt.Errorf("参数解析异常,Err:" + err.Error())
  242. return
  243. }
  244. respItem, err := ChartUpdateLib(string(reqJson))
  245. if err != nil {
  246. errMsg = "更新失败"
  247. err = fmt.Errorf("上传失败,Err:" + err.Error())
  248. return
  249. }
  250. if respItem.Ret != 200 {
  251. errMsg = "更新失败"
  252. err = fmt.Errorf(respItem.ErrMsg)
  253. return
  254. }
  255. return
  256. }
  257. func GetEdbListByEdbInfoId(edbInfoIds []int) (edbInfoList []*data_manage.EdbInfo, edbMappingList []*data_manage.EdbInfoCalculateMapping, edbInfoDataList []*AddEdbDataReq, err error) {
  258. //查询指标信息
  259. //查询指标映射
  260. //查询所有指标数据
  261. //查询这个指标相关的mapping信息放到数组里,
  262. //将得到的指标ID信息放到数组里
  263. hasFindMap := make(map[int]struct{})
  264. edbInfoIdMap := make(map[int]struct{})
  265. edbMappingList = make([]*data_manage.EdbInfoCalculateMapping, 0)
  266. edbMappingMap := make(map[int]struct{})
  267. for _, edbInfoId := range edbInfoIds {
  268. edbMappingList, err = traceEdbInfoByEdbInfoId(edbInfoId, hasFindMap, edbInfoIdMap, edbMappingList, edbMappingMap)
  269. if err != nil {
  270. err = fmt.Errorf(" traceEdbInfoByEdbInfoId err: %s", err.Error())
  271. return
  272. }
  273. }
  274. // 指标信息map
  275. edbInfoIdList := make([]int, 0)
  276. for k, _ := range edbInfoIdMap {
  277. edbInfoIdList = append(edbInfoIdList, k)
  278. }
  279. edbInfoList, err = data_manage.GetEdbInfoByIdList(edbInfoIdList)
  280. if err != nil {
  281. err = fmt.Errorf(" GetEdbInfoByIdList err: %s", err.Error())
  282. return
  283. }
  284. for _, v := range edbInfoList {
  285. var dataList []*data_manage.EdbDataBase
  286. if v.Source == utils.DATA_SOURCE_BUSINESS && utils.UseMongo {
  287. dataList, err = data_manage.GetEdbDataBaseMongoByEdbInfoId(v.EdbInfoId, v.Source, v.SubSource)
  288. } else if v.Source == utils.DATA_SOURCE_THS && v.SubSource == utils.DATA_SUB_SOURCE_HIGH_FREQUENCY && utils.UseMongo {
  289. dataList, err = data_manage.GetThsHfEdbDataBaseMongoByEdbInfoId(v.EdbInfoId, v.Source, v.SubSource)
  290. } else {
  291. dataList, err = data_manage.GetEdbDataBaseByEdbInfoId(v.EdbInfoId, v.Source, v.SubSource)
  292. }
  293. if err != nil {
  294. err = fmt.Errorf("查询指标数据失败 Err: %s", err.Error())
  295. return
  296. }
  297. tmp := new(AddEdbDataReq)
  298. tmp.EdbCode = v.EdbCode
  299. tmp.EdbType = v.EdbType
  300. tmp.DataList = dataList
  301. edbInfoDataList = append(edbInfoDataList, tmp)
  302. }
  303. return
  304. }
  305. // traceEdbInfoByEdbInfoId 指标追溯
  306. func traceEdbInfoByEdbInfoId(edbInfoId int, hasFindMap map[int]struct{}, edbInfoIdMap map[int]struct{}, edbMappingList []*data_manage.EdbInfoCalculateMapping, edbMappingMap map[int]struct{}) (newEdbMappingList []*data_manage.EdbInfoCalculateMapping, err error) {
  307. newEdbMappingList = edbMappingList
  308. _, ok := hasFindMap[edbInfoId]
  309. if ok {
  310. return
  311. }
  312. if _, ok1 := edbInfoIdMap[edbInfoId]; !ok1 {
  313. edbInfoIdMap[edbInfoId] = struct{}{}
  314. }
  315. edbInfoMappingList, e := data_manage.GetEdbInfoCalculateMappingListByEdbInfoId(edbInfoId)
  316. if e != nil {
  317. err = fmt.Errorf("GetEdbInfoCalculateMappingListByEdbInfoId err: %s", e.Error())
  318. return
  319. }
  320. if len(edbInfoMappingList) > 0 {
  321. fromEdbInfoIdList := make([]int, 0)
  322. for _, v := range edbInfoMappingList {
  323. fromEdbInfoIdList = append(fromEdbInfoIdList, v.FromEdbInfoId)
  324. if _, ok1 := edbInfoIdMap[v.FromEdbInfoId]; !ok1 {
  325. edbInfoIdMap[v.FromEdbInfoId] = struct{}{}
  326. }
  327. if _, ok2 := edbMappingMap[v.EdbInfoCalculateMappingId]; !ok2 {
  328. edbMappingMap[v.EdbInfoCalculateMappingId] = struct{}{}
  329. tmp := &data_manage.EdbInfoCalculateMapping{
  330. EdbInfoCalculateMappingId: v.EdbInfoCalculateMappingId,
  331. EdbInfoId: v.EdbInfoId,
  332. Source: v.Source,
  333. SourceName: v.SourceName,
  334. EdbCode: v.EdbCode,
  335. FromEdbInfoId: v.FromEdbInfoId,
  336. FromEdbCode: v.FromEdbCode,
  337. FromEdbName: v.FromEdbName,
  338. FromSource: v.FromSource,
  339. FromSourceName: v.FromSourceName,
  340. FromTag: v.FromTag,
  341. Sort: v.Sort,
  342. CreateTime: v.CreateTime,
  343. ModifyTime: v.ModifyTime,
  344. }
  345. newEdbMappingList = append(newEdbMappingList, tmp)
  346. }
  347. if edbInfoId != v.FromEdbInfoId && (v.FromEdbType == 2 || v.FromEdbInfoType == 1) {
  348. // 查过了就不查了
  349. if _, ok2 := hasFindMap[v.FromEdbInfoId]; !ok2 {
  350. newEdbMappingList, e = traceEdbInfoByEdbInfoId(v.FromEdbInfoId, hasFindMap, edbInfoIdMap, newEdbMappingList, edbMappingMap)
  351. if e != nil {
  352. err = fmt.Errorf("traceEdbInfoByEdbInfoId err: %s", e.Error())
  353. return
  354. }
  355. }
  356. }
  357. hasFindMap[v.FromEdbInfoId] = struct{}{}
  358. }
  359. }
  360. hasFindMap[edbInfoId] = struct{}{}
  361. return
  362. }
  363. // DeleteChart 上传图表接口
  364. func DeleteChart(chartInfoId int) (err error, errMsg string) {
  365. // 查询图表信息
  366. chartInfo, err := data_manage.GetChartInfoById(chartInfoId)
  367. if err != nil {
  368. if err.Error() == utils.ErrNoRow() {
  369. errMsg = "图表不存在"
  370. err = fmt.Errorf(errMsg)
  371. return
  372. }
  373. errMsg = "获取图表信息失败"
  374. err = fmt.Errorf("获取图表信息失败,Err:" + err.Error())
  375. return
  376. }
  377. if chartInfo.ForumChartInfoId <= 0 {
  378. errMsg = "该图表未上传至社区,无需撤回"
  379. err = fmt.Errorf(errMsg)
  380. return
  381. }
  382. req := new(DeleteChartReq)
  383. req.ChartInfoId = chartInfo.ForumChartInfoId
  384. // 添加计算指标
  385. reqJson, err := json.Marshal(req)
  386. if err != nil {
  387. errMsg = "参数解析异常"
  388. err = fmt.Errorf("参数解析异常,Err:" + err.Error())
  389. return
  390. }
  391. respItem, err := ChartDeleteLib(string(reqJson))
  392. if err != nil {
  393. errMsg = "撤回失败"
  394. err = fmt.Errorf("撤回失败,Err:" + err.Error())
  395. return
  396. }
  397. if respItem.Ret != 200 {
  398. errMsg = "撤回失败"
  399. err = fmt.Errorf(respItem.ErrMsg)
  400. return
  401. }
  402. // 更新社区返回的图表ID
  403. err = data_manage.SetForumChartInfoId(chartInfoId, 0)
  404. if err != nil {
  405. errMsg = "撤回失败"
  406. err = fmt.Errorf("更新图表ID失败,Err:" + err.Error())
  407. return
  408. }
  409. return
  410. }
  411. type AdminSaveReq struct {
  412. *system.Admin
  413. BusinessCode string `description:"商家编码"`
  414. }
  415. // 上传管理员信息
  416. func AdminSave(adminId int) (err error) {
  417. if utils.BusinessCode == "" || (utils.BusinessCode != utils.BusinessCodeRelease && utils.BusinessCode != utils.BusinessCodeDebug && utils.BusinessCode != utils.BusinessCodeSandbox) {
  418. return
  419. }
  420. //查询用户信息
  421. adminInfo, err := system.GetSysAdminById(adminId)
  422. if err != nil {
  423. if err.Error() == utils.ErrNoRow() {
  424. err = fmt.Errorf("用户不存在")
  425. return
  426. }
  427. err = fmt.Errorf("获取用户信息失败,Err:" + err.Error())
  428. return
  429. }
  430. var req AdminSaveReq
  431. req.Admin = adminInfo
  432. req.BusinessCode = utils.BusinessCode
  433. reqJson, err := json.Marshal(req)
  434. if err != nil {
  435. err = fmt.Errorf("参数解析异常,Err:" + err.Error())
  436. return
  437. }
  438. respItem, err := AdminSaveLib(string(reqJson))
  439. if err != nil {
  440. err = fmt.Errorf("上传管理员信息失败,Err:" + err.Error())
  441. return
  442. }
  443. if respItem.Ret != 200 {
  444. err = fmt.Errorf("上传管理员信息失败,Err:%v,errMsg:%v", respItem.Msg, respItem.ErrMsg)
  445. return
  446. }
  447. return
  448. }
  449. type AdminDeleteReq struct {
  450. AdminName string
  451. BusinessCode string `description:"商家编码"`
  452. }
  453. // 上传管理员信息
  454. func AdminDelete(adminName string) (err error) {
  455. if utils.BusinessCode == "" || (utils.BusinessCode != utils.BusinessCodeRelease && utils.BusinessCode != utils.BusinessCodeDebug && utils.BusinessCode != utils.BusinessCodeSandbox) {
  456. return
  457. }
  458. var req AdminDeleteReq
  459. req.AdminName = adminName
  460. req.BusinessCode = utils.BusinessCode
  461. reqJson, err := json.Marshal(req)
  462. if err != nil {
  463. err = fmt.Errorf("参数解析异常,Err:" + err.Error())
  464. return
  465. }
  466. respItem, err := AdminDeleteLib(string(reqJson))
  467. if err != nil {
  468. err = fmt.Errorf("删除管理员信息失败,Err:" + err.Error())
  469. return
  470. }
  471. if respItem.Ret != 200 {
  472. err = fmt.Errorf("删除管理员信息失败,Err:%v,errMsg:%v", respItem.Msg, respItem.ErrMsg)
  473. return
  474. }
  475. return
  476. }
  477. type ChartThemeReq struct {
  478. *chart_theme.ChartTheme
  479. BusinessCode string `description:"商家编码"`
  480. }
  481. // 上传主题信息
  482. func ChartThemeSave(theme *chart_theme.ChartTheme) (err error) {
  483. if utils.BusinessCode == "" || (utils.BusinessCode != utils.BusinessCodeRelease && utils.BusinessCode != utils.BusinessCodeDebug && utils.BusinessCode != utils.BusinessCodeSandbox) {
  484. return
  485. }
  486. var req ChartThemeReq
  487. req.ChartTheme = theme
  488. req.BusinessCode = utils.BusinessCode
  489. reqJson, err := json.Marshal(req)
  490. if err != nil {
  491. err = fmt.Errorf("参数解析异常,Err:" + err.Error())
  492. return
  493. }
  494. respItem, err := ChartThemeSaveLib(string(reqJson))
  495. if err != nil {
  496. err = fmt.Errorf("上传图表主题信息失败,Err:" + err.Error())
  497. return
  498. }
  499. if respItem.Ret != 200 {
  500. err = fmt.Errorf("上传图表主题信息失败,Err:%v,errMsg:%v", respItem.Msg, respItem.ErrMsg)
  501. return
  502. }
  503. return
  504. }
  505. // ChartThemeTypeSave 上传主题类型信息
  506. func ChartThemeTypeSave(theme *chart_theme.ChartThemeType) (err error) {
  507. if utils.BusinessCode == "" || (utils.BusinessCode != utils.BusinessCodeRelease && utils.BusinessCode != utils.BusinessCodeDebug && utils.BusinessCode != utils.BusinessCodeSandbox) {
  508. return
  509. }
  510. //req.BusinessCode = utils.BusinessCode
  511. reqJson, err := json.Marshal(theme)
  512. if err != nil {
  513. err = fmt.Errorf("参数解析异常,Err:" + err.Error())
  514. return
  515. }
  516. respItem, err := ChartThemeTypeSaveLib(string(reqJson))
  517. if err != nil {
  518. err = fmt.Errorf("上传图表主题信息失败,Err:" + err.Error())
  519. return
  520. }
  521. if respItem.Ret != 200 {
  522. err = fmt.Errorf("上传图表主题信息失败,Err:%v,errMsg:%v", respItem.Msg, respItem.ErrMsg)
  523. return
  524. }
  525. return
  526. }