config.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. package http
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "go-common/app/admin/main/config/model"
  6. "go-common/library/ecode"
  7. "go-common/library/log"
  8. bm "go-common/library/net/http/blademaster"
  9. "go-common/library/time"
  10. "strconv"
  11. "strings"
  12. "github.com/jinzhu/gorm"
  13. )
  14. func createConfig(c *bm.Context) {
  15. res := map[string]interface{}{}
  16. v := new(model.CreateConfigReq)
  17. err := c.Bind(v)
  18. if err != nil {
  19. return
  20. }
  21. user := user(c)
  22. if _, err = svr.AuthApp(c, user, c.Request.Header.Get("Cookie"), v.TreeID); err != nil {
  23. res["message"] = "服务树权限不足"
  24. c.JSONMap(res, err)
  25. return
  26. }
  27. conf := &model.Config{}
  28. conf.Operator = user
  29. conf.Name = v.Name
  30. conf.Mark = v.Mark
  31. conf.Comment = v.Comment
  32. conf.State = v.State
  33. conf.From = v.From
  34. c.JSON(nil, svr.CreateConf(conf, v.TreeID, v.Env, v.Zone, v.SkipLint))
  35. }
  36. func lintConfig(c *bm.Context) {
  37. var req struct {
  38. Name string `form:"name" validate:"required"`
  39. Comment string `form:"comment" validate:"required"`
  40. }
  41. if err := c.Bind(&req); err != nil {
  42. // ignore error
  43. return
  44. }
  45. c.JSON(svr.LintConfig(req.Name, req.Comment))
  46. }
  47. func updateConfValue(c *bm.Context) {
  48. res := map[string]interface{}{}
  49. v := new(model.UpdateConfValueReq)
  50. err := c.Bind(v)
  51. if err != nil {
  52. return
  53. }
  54. user := user(c)
  55. if _, err = svr.AuthApps(c, user, c.Request.Header.Get("Cookie")); err != nil {
  56. res["message"] = "服务树权限不足"
  57. c.JSONMap(res, err)
  58. return
  59. }
  60. conf := &model.Config{}
  61. conf.Name = v.Name
  62. conf.ID = v.ID
  63. conf.Operator = user
  64. conf.Mark = v.Mark
  65. conf.Comment = v.Comment
  66. conf.State = v.State
  67. conf.Mtime = time.Time(v.Mtime)
  68. var configs *model.Config
  69. configs, err = svr.Value(v.ID)
  70. if err != nil {
  71. res["message"] = "未找到源文件"
  72. c.JSONMap(res, err)
  73. return
  74. }
  75. if v.NewCommon > 0 {
  76. common := &model.CommonConf{}
  77. common2 := &model.CommonConf{}
  78. if err = svr.DB.Where("id = ?", configs.From).First(common).Error; err != nil {
  79. res["message"] = "未找到公共源文件"
  80. c.JSONMap(res, err)
  81. return
  82. }
  83. if err = svr.DB.Where("team_id = ? and name = ? and state = 2 and id = ?", common.TeamID, common.Name, v.NewCommon).Order("id desc").First(common2).Error; err != nil {
  84. res["message"] = "未找到最新的公共文件"
  85. c.JSONMap(res, err)
  86. return
  87. }
  88. conf.From = v.NewCommon
  89. }
  90. //验证是否最新源文件
  91. newConfig := &model.Config{}
  92. if err = svr.DB.Where("app_id = ? and name = ?", configs.AppID, configs.Name).Order("id desc").First(newConfig).Error; err != nil {
  93. res["message"] = "未找到最新文件"
  94. c.JSONMap(res, err)
  95. return
  96. }
  97. //默认验证ignore 0
  98. if newConfig.ID != v.ID && v.Ignore == 0 && user != newConfig.Operator {
  99. err = ecode.ConfigNotNow
  100. res["message"] = fmt.Sprintf("当前源文件:(%d)有最新源文件版本(%d)操作人:%s是否继续提交?", v.ID, newConfig.ID, newConfig.Operator)
  101. c.JSONMap(res, err)
  102. return
  103. }
  104. c.JSON(nil, svr.UpdateConfValue(conf, v.SkipLint))
  105. }
  106. func value(c *bm.Context) {
  107. res := map[string]interface{}{}
  108. v := new(model.ValueReq)
  109. err := c.Bind(v)
  110. if err != nil {
  111. return
  112. }
  113. var TreeID int64
  114. TreeID, err = svr.ConfigGetTreeID(v.ConfigID)
  115. if err != nil {
  116. res["message"] = "未找到tree_id"
  117. c.JSONMap(res, err)
  118. return
  119. }
  120. if _, err = svr.AuthApp(c, user(c), c.Request.Header.Get("Cookie"), TreeID); err != nil {
  121. res["message"] = "服务树权限不足"
  122. c.JSONMap(res, err)
  123. return
  124. }
  125. c.JSON(svr.Value(v.ConfigID))
  126. }
  127. func configsByBuildID(c *bm.Context) {
  128. res := map[string]interface{}{}
  129. v := new(model.ConfigsByBuildIDReq)
  130. err := c.Bind(v)
  131. if err != nil {
  132. return
  133. }
  134. if _, err = svr.AuthApps(c, user(c), c.Request.Header.Get("Cookie")); err != nil {
  135. res["message"] = "服务树权限不足"
  136. c.JSONMap(res, err)
  137. return
  138. }
  139. c.JSON(svr.ConfigsByBuildID(v.BuildID))
  140. }
  141. func configsByTagID(c *bm.Context) {
  142. res := map[string]interface{}{}
  143. v := new(model.ConfigsByTagIDReq)
  144. err := c.Bind(v)
  145. if err != nil {
  146. return
  147. }
  148. if _, err = svr.AuthApps(c, user(c), c.Request.Header.Get("Cookie")); err != nil {
  149. res["message"] = "服务树权限不足"
  150. c.JSONMap(res, err)
  151. return
  152. }
  153. c.JSON(svr.ConfigsByTagID(v.TagID))
  154. }
  155. func configsByAppName(c *bm.Context) {
  156. res := map[string]interface{}{}
  157. v := new(model.ConfigsByAppNameReq)
  158. err := c.Bind(v)
  159. if err != nil {
  160. return
  161. }
  162. if _, err = svr.AuthApp(c, user(c), c.Request.Header.Get("Cookie"), v.TreeID); err != nil {
  163. res["message"] = "服务树权限不足"
  164. c.JSONMap(res, err)
  165. return
  166. }
  167. c.JSON(svr.ConfigsByAppName(v.AppName, v.Env, v.Zone, v.TreeID, 0))
  168. }
  169. func configSearchAll(c *bm.Context) {
  170. res := map[string]interface{}{}
  171. v := new(model.ConfigSearchAllReq)
  172. err := c.Bind(v)
  173. if err != nil {
  174. return
  175. }
  176. nodes, err := svr.AuthApps(c, user(c), c.Request.Header.Get("Cookie"))
  177. if err != nil {
  178. res["message"] = "服务树权限不足"
  179. c.JSONMap(res, err)
  180. return
  181. }
  182. c.JSON(svr.ConfigSearchAll(c, v.Env, v.Zone, v.Like, nodes))
  183. }
  184. func configSearchApp(c *bm.Context) {
  185. res := map[string]interface{}{}
  186. v := new(model.ConfigSearchAppReq)
  187. err := c.Bind(v)
  188. if err != nil {
  189. return
  190. }
  191. if _, err = svr.AuthApp(c, user(c), c.Request.Header.Get("Cookie"), v.TreeID); err != nil {
  192. res["message"] = "服务树权限不足"
  193. c.JSONMap(res, err)
  194. return
  195. }
  196. c.JSON(svr.ConfigSearchApp(c, v.AppName, v.Env, v.Zone, v.Like, v.BuildID, v.TreeID))
  197. }
  198. func configsByName(c *bm.Context) {
  199. res := map[string]interface{}{}
  200. v := new(model.ConfigsByNameReq)
  201. err := c.Bind(v)
  202. if err != nil {
  203. return
  204. }
  205. if _, err = svr.AuthApp(c, user(c), c.Request.Header.Get("Cookie"), v.TreeID); err != nil {
  206. res["message"] = "服务树权限不足"
  207. c.JSONMap(res, err)
  208. return
  209. }
  210. c.JSON(svr.ConfigsByTree(v.TreeID, v.Env, v.Zone, v.Name))
  211. }
  212. func configs(c *bm.Context) {
  213. res := map[string]interface{}{}
  214. v := new(model.ConfigsReq)
  215. err := c.Bind(v)
  216. if err != nil {
  217. return
  218. }
  219. if _, err = svr.AuthApp(c, user(c), c.Request.Header.Get("Cookie"), v.TreeID); err != nil {
  220. res["message"] = "服务树权限不足"
  221. c.JSONMap(res, err)
  222. return
  223. }
  224. c.JSON(svr.Configs(v.AppName, v.Env, v.Zone, v.BuildID, v.TreeID))
  225. }
  226. func configRefs(c *bm.Context) {
  227. res := map[string]interface{}{}
  228. v := new(model.ConfigRefsReq)
  229. err := c.Bind(v)
  230. if err != nil {
  231. return
  232. }
  233. if _, err = svr.AuthApp(c, user(c), c.Request.Header.Get("Cookie"), v.TreeID); err != nil {
  234. res["message"] = "服务树权限不足"
  235. c.JSONMap(res, err)
  236. return
  237. }
  238. c.JSON(svr.ConfigRefs(v.AppName, v.Env, v.Zone, v.BuildID, v.TreeID))
  239. }
  240. func namesByAppName(c *bm.Context) {
  241. res := map[string]interface{}{}
  242. v := new(model.NamesByAppNameReq)
  243. err := c.Bind(v)
  244. if err != nil {
  245. return
  246. }
  247. if _, err = svr.AuthApp(c, user(c), c.Request.Header.Get("Cookie"), v.TreeID); err != nil {
  248. res["message"] = "服务树权限不足"
  249. c.JSONMap(res, err)
  250. return
  251. }
  252. c.JSON(svr.NamesByAppTree(v.AppName, v.Env, v.Zone, v.TreeID))
  253. }
  254. func diff(c *bm.Context) {
  255. res := map[string]interface{}{}
  256. v := new(model.DiffReq)
  257. err := c.Bind(v)
  258. if err != nil {
  259. return
  260. }
  261. if _, err = svr.AuthApps(c, user(c), c.Request.Header.Get("Cookie")); err != nil {
  262. res["message"] = "服务树权限不足"
  263. c.JSONMap(res, err)
  264. return
  265. }
  266. c.JSON(svr.Diff(v.ConfigID, v.BuildID))
  267. }
  268. func configDel(c *bm.Context) {
  269. res := map[string]interface{}{}
  270. v := new(model.ConfigDelReq)
  271. err := c.Bind(v)
  272. if err != nil {
  273. return
  274. }
  275. if _, err = svr.AuthApps(c, user(c), c.Request.Header.Get("Cookie")); err != nil {
  276. res["message"] = "服务树权限不足"
  277. c.JSONMap(res, err)
  278. return
  279. }
  280. c.JSON(nil, svr.ConfigDel(v.ConfigID))
  281. }
  282. func configBuildInfos(c *bm.Context) {
  283. res := map[string]interface{}{}
  284. v := new(model.ConfigBuildInfosReq)
  285. err := c.Bind(v)
  286. if err != nil {
  287. return
  288. }
  289. if _, err = svr.AuthApp(c, user(c), c.Request.Header.Get("Cookie"), v.TreeID); err != nil {
  290. res["message"] = "服务树权限不足"
  291. c.JSONMap(res, err)
  292. return
  293. }
  294. c.JSON(svr.BuildConfigInfos(v.AppName, v.Env, v.Zone, v.BuildID, v.TreeID))
  295. }
  296. func configUpdate(c *bm.Context) {
  297. res := map[string]interface{}{}
  298. v := new(model.ConfigUpdateReq)
  299. err := c.Bind(v)
  300. if err != nil {
  301. return
  302. }
  303. app := &model.App{}
  304. if err = svr.DB.Where("name = ? and env = ? and zone = ? and tree_id = ? and token = ?", v.AppName, v.Env, v.Zone, v.TreeID, v.Token).First(app).Error; err != nil {
  305. res["message"] = "参数不正确,未找到该服务"
  306. c.JSONMap(res, err)
  307. return
  308. }
  309. var obj []map[string]string
  310. err = json.Unmarshal([]byte(v.Data), &obj)
  311. tx := svr.DB.Begin()
  312. for _, val := range obj {
  313. if len(val["name"]) > 0 {
  314. config := &model.Config{}
  315. if err = tx.Where("app_id = ? and name = ? and state = 1", app.ID, val["name"]).First(config).Error; err != nil {
  316. if err != gorm.ErrRecordNotFound {
  317. c.JSON(nil, err)
  318. tx.Rollback()
  319. return
  320. }
  321. } else {
  322. //把老的更新了再加新的
  323. ups := map[string]interface{}{
  324. "state": 2,
  325. }
  326. if err = tx.Model(&model.App{}).Where("id = ? ", config.ID).Updates(ups).Error; err != nil {
  327. c.JSON(nil, err)
  328. tx.Rollback()
  329. return
  330. }
  331. }
  332. //加新的
  333. m := &model.Config{
  334. AppID: app.ID,
  335. Name: val["name"],
  336. Comment: val["comment"],
  337. State: 2,
  338. Mark: val["mark"],
  339. Operator: v.User,
  340. }
  341. db := tx.Create(m)
  342. if err = db.Error; err != nil {
  343. res["message"] = "创建失败"
  344. c.JSONMap(res, err)
  345. tx.Rollback()
  346. return
  347. }
  348. } else {
  349. c.JSON(nil, ecode.RequestErr)
  350. tx.Rollback()
  351. return
  352. }
  353. }
  354. tx.Commit()
  355. c.JSON(nil, err)
  356. }
  357. func tagUpdate(c *bm.Context) {
  358. res := map[string]interface{}{}
  359. v := new(model.TagUpdateReq)
  360. err := c.Bind(v)
  361. if err != nil {
  362. return
  363. }
  364. if len(strings.TrimSpace(v.Build)) == 0 {
  365. c.JSON(nil, ecode.RequestErr)
  366. return
  367. }
  368. app := &model.App{}
  369. if err = svr.DB.Where("name = ? and env = ? and zone = ? and tree_id = ? and token = ?", v.AppName, v.Env, v.Zone, v.TreeID, v.Token).First(app).Error; err != nil {
  370. res["message"] = "参数不正确,未找到该服务"
  371. c.JSONMap(res, err)
  372. return
  373. }
  374. confs := []*model.Config{}
  375. tags := &model.Tag{}
  376. tag := &model.Tag{}
  377. build := &model.Build{}
  378. tagConfigs := []*model.Config{}
  379. var in []string
  380. var in2 []string
  381. var nameString string
  382. tmp := make(map[string]struct{})
  383. if v.ConfigIDs == "" && v.Names == "" {
  384. c.JSON(nil, ecode.RequestErr)
  385. return
  386. } else if v.Names != "" {
  387. in = strings.Split(v.Names, ",")
  388. if err = svr.DB.Select("max(id) as id,name").Where("app_id = ? and state = 2 and is_delete = 0 and name in (?)", app.ID, in).Group("name").Find(&confs).Error; err != nil {
  389. res["message"] = "未找到发版文件"
  390. c.JSONMap(res, err)
  391. return
  392. }
  393. for _, vv := range confs {
  394. if len(nameString) > 0 {
  395. nameString = nameString + ","
  396. }
  397. nameString = nameString + strconv.FormatInt(vv.ID, 10)
  398. }
  399. tag.ConfigIDs = nameString
  400. } else if v.ConfigIDs != "" {
  401. in = strings.Split(v.ConfigIDs, ",")
  402. if err = svr.DB.Where("app_id = ? and state = 2 and is_delete = 0 and id in (?)", app.ID, in).Find(&confs).Error; err != nil {
  403. res["message"] = "未找到发版文件"
  404. c.JSONMap(res, err)
  405. return
  406. }
  407. tag.ConfigIDs = v.ConfigIDs
  408. }
  409. if v.Names != "" && v.Increment == 1 {
  410. if err = svr.DB.Where("app_id = ? and name = ?", app.ID, v.Build).Order("id desc").First(build).Error; err != nil {
  411. res["message"] = "未找到对应的build"
  412. c.JSONMap(res, err)
  413. return
  414. }
  415. if err = svr.DB.Where("app_id = ? and build_id = ?", app.ID, build.ID).Order("id desc").First(tags).Error; err != nil {
  416. res["message"] = "未找到对应的tag"
  417. c.JSONMap(res, err)
  418. return
  419. }
  420. in2 = strings.Split(tags.ConfigIDs, ",")
  421. if err = svr.DB.Where("app_id = ? and state = 2 and id in (?)", app.ID, in2).Find(&tagConfigs).Error; err != nil {
  422. res["message"] = "未找到tag中的文件"
  423. c.JSONMap(res, err)
  424. return
  425. }
  426. for _, vv := range tagConfigs {
  427. tss := 0
  428. for _, vvv := range confs {
  429. if vv.Name == vvv.Name {
  430. tss = 1
  431. }
  432. }
  433. if tss != 1 {
  434. if len(nameString) > 0 {
  435. nameString = nameString + ","
  436. }
  437. nameString = nameString + strconv.FormatInt(vv.ID, 10)
  438. }
  439. }
  440. tag.ConfigIDs = nameString
  441. } else {
  442. if len(confs) != len(in) {
  443. res["message"] = "发版数据不符"
  444. c.JSONMap(res, ecode.RequestErr)
  445. return
  446. }
  447. for _, vv := range confs {
  448. if _, ok := tmp[vv.Name]; !ok {
  449. tmp[vv.Name] = struct{}{}
  450. }
  451. }
  452. if len(tmp) != len(confs) {
  453. res["message"] = "有重复的文件名"
  454. c.JSONMap(res, ecode.RequestErr)
  455. return
  456. }
  457. }
  458. tag.Operator = v.User
  459. tag.Mark = v.Mark
  460. if v.Force == 1 {
  461. tag.Force = 1
  462. }
  463. c.JSON(nil, svr.UpdateTag(c, v.TreeID, v.Env, v.Zone, v.Build, tag))
  464. }
  465. func canalTagUpdate(c *bm.Context) {
  466. res := map[string]interface{}{}
  467. v := new(model.CanalTagUpdateReq)
  468. err := c.Bind(v)
  469. if err != nil {
  470. return
  471. }
  472. if v.Force != 1 {
  473. v.Force = 0
  474. }
  475. if len(strings.TrimSpace(v.Build)) == 0 {
  476. c.JSON(nil, ecode.RequestErr)
  477. return
  478. }
  479. app := &model.App{}
  480. if err = svr.DB.Where("name = ? and env = ? and zone = ? and tree_id = ? and token = ?", v.AppName, v.Env, v.Zone, v.TreeID, v.Token).First(app).Error; err != nil {
  481. res["message"] = "参数不正确,未找到该服务"
  482. c.JSONMap(res, err)
  483. return
  484. }
  485. confs := []*model.Config{}
  486. configs := []*model.Config{}
  487. tags := &model.Tag{}
  488. tag := &model.Tag{}
  489. build := &model.Build{}
  490. tagConfigs := []*model.Config{}
  491. var in []string
  492. var in2 []string
  493. var nameString string
  494. tmp := make(map[string]struct{})
  495. in = strings.Split(v.ConfigIDs, ",")
  496. if err = svr.DB.Where("app_id = ? and state = 2 and id in(?)", app.ID, in).Find(&configs).Error; err != nil {
  497. res["message"] = "未找到文件"
  498. c.JSONMap(res, err)
  499. return
  500. }
  501. if len(configs) != len(in) {
  502. res["message"] = fmt.Sprintf("数据不匹配,传的数据为(%v)条,查到的数据为(%v)条,app_id(%v),config_ids(%v),in(%v)", len(in), len(configs), app.ID, v.ConfigIDs, in)
  503. err = ecode.RequestErr
  504. c.JSONMap(res, err)
  505. return
  506. }
  507. if err = svr.DB.Where("app_id = ? and name = ?", app.ID, v.Build).Order("id desc").First(build).Error; err != nil {
  508. res["message"] = "未找到对应的build"
  509. c.JSONMap(res, err)
  510. return
  511. }
  512. if err = svr.DB.Where("app_id = ? and build_id = ?", app.ID, build.ID).Order("id desc").First(tags).Error; err != nil {
  513. res["message"] = "未找到对应的tag"
  514. c.JSONMap(res, err)
  515. return
  516. }
  517. in2 = strings.Split(tags.ConfigIDs, ",")
  518. if err = svr.DB.Where("app_id = ? and state = 2 and id in (?)", app.ID, in2).Find(&tagConfigs).Error; err != nil {
  519. res["message"] = "未找到tag中的文件"
  520. c.JSONMap(res, err)
  521. return
  522. }
  523. if err = svr.DB.Select("id,app_id,name,`from`,state,mark,operator,ctime,mtime").Where(in2).Find(&confs).Error; err != nil {
  524. log.Error("ConfigsByIDs(%v) error(%v)", in2, err)
  525. res["message"] = "config文件未找到"
  526. c.JSONMap(res, err)
  527. return
  528. }
  529. for _, val := range confs {
  530. for _, vv := range configs {
  531. if val.Name == vv.Name {
  532. if len(nameString) > 0 {
  533. nameString = nameString + ","
  534. }
  535. nameString = nameString + strconv.FormatInt(vv.ID, 10)
  536. tmp[vv.Name] = struct{}{}
  537. }
  538. }
  539. if _, ok := tmp[val.Name]; !ok {
  540. if len(nameString) > 0 {
  541. nameString = nameString + ","
  542. }
  543. nameString = nameString + strconv.FormatInt(val.ID, 10)
  544. }
  545. }
  546. for _, val := range configs {
  547. if _, ok := tmp[val.Name]; !ok {
  548. if len(nameString) > 0 {
  549. nameString = nameString + ","
  550. }
  551. nameString = nameString + strconv.FormatInt(val.ID, 10)
  552. }
  553. }
  554. tag.ConfigIDs = nameString
  555. tag.Operator = v.User
  556. tag.Mark = v.Mark
  557. tag.Force = v.Force
  558. c.JSON(nil, svr.UpdateTag(c, v.TreeID, v.Env, v.Zone, v.Build, tag))
  559. }
  560. func canalConfigCreate(c *bm.Context) {
  561. res := map[string]interface{}{}
  562. v := new(model.CanalConfigCreateReq)
  563. err := c.Bind(v)
  564. if err != nil {
  565. return
  566. }
  567. if err = svr.CanalCheckToken(v.AppName, v.Env, v.Zone, v.Token); err != nil {
  568. res["message"] = "未找到数据"
  569. c.JSONMap(res, err)
  570. return
  571. }
  572. conf := &model.Config{}
  573. conf.Operator = v.User
  574. conf.Name = v.Name
  575. conf.Mark = v.Mark
  576. conf.Comment = v.Comment
  577. conf.State = v.State
  578. conf.From = v.From
  579. c.JSON(nil, svr.CreateConf(conf, v.TreeID, v.Env, v.Zone, true))
  580. }
  581. func canalNameConfigs(c *bm.Context) {
  582. res := map[string]interface{}{}
  583. v := new(model.CanalNameConfigsReq)
  584. err := c.Bind(v)
  585. if err != nil {
  586. return
  587. }
  588. if err = svr.CanalCheckToken(v.AppName, v.Env, v.Zone, v.Token); err != nil {
  589. res["message"] = "未找到数据"
  590. c.JSONMap(res, err)
  591. return
  592. }
  593. c.JSON(svr.ConfigsByTree(v.TreeID, v.Env, v.Zone, v.Name))
  594. }