public.go 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package logic
  2. import (
  3. "fmt"
  4. "hongze/hongze_yb/models/tables/rddp/chart_permission"
  5. "hongze/hongze_yb/utils"
  6. )
  7. type ApplyVariety struct {
  8. PermissionName string `json:"permission_name" description:"权限名称"`
  9. Name string `json:"name" description:"品种名称"`
  10. PicUrl string `json:"pic_url" description:"品种图片"`
  11. }
  12. // GetApplyVarietyList 获取所有可以申请的品种权限
  13. func GetApplyVarietyList() (list []ApplyVariety, err error) {
  14. // 查询所有的二级品种,按照顺序排序,
  15. permissionImgMap := make(map[string]string, 0)
  16. permissionImgMap["宏观经济"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/宏观经济.png"
  17. permissionImgMap["资产配置"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/资产配置.png"
  18. permissionImgMap["贵金属"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/贵金属.png"
  19. permissionImgMap["汇率"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/汇率.png"
  20. permissionImgMap["利率债"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/利率债.png"
  21. permissionImgMap["原油"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/原油.png"
  22. permissionImgMap["成品油"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/成品油.png"
  23. permissionImgMap["LPG"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/LPG.png"
  24. permissionImgMap["PTA"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/PTA.png"
  25. permissionImgMap["MEG"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/MEG.png"
  26. permissionImgMap["纺服"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/纺服.png"
  27. permissionImgMap["甲醇"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/甲醇.png"
  28. permissionImgMap["聚烯烃"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/聚烯烃.png"
  29. permissionImgMap["尿素"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/尿素.png"
  30. permissionImgMap["沥青"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/沥青.png"
  31. permissionImgMap["苯乙烯"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/苯乙烯.png"
  32. permissionImgMap["PVC"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/PVC.png"
  33. permissionImgMap["聚酯"] = "https://hzstatic.hzinsights.com/static/yb_variety/聚酯.png"
  34. permissionImgMap["钢材"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/钢材.png"
  35. permissionImgMap["铁矿"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/铁矿.png"
  36. permissionImgMap["玻璃纯碱"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/玻璃纯碱.png"
  37. permissionImgMap["烧碱"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/烧碱.png"
  38. permissionImgMap["双焦"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/双焦.png"
  39. permissionImgMap["铜"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/铜.png"
  40. permissionImgMap["铝"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/铝.png"
  41. permissionImgMap["镍/不锈钢"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/镍不锈钢.png"
  42. permissionImgMap["锌"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/锌.png"
  43. permissionImgMap["钴锂"] = "https://hzstatic.hzinsights.com/static/yb_variety/钴锂.png"
  44. permissionImgMap["碳酸锂"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/碳酸锂.png"
  45. permissionImgMap["工业硅"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/工业硅.png"
  46. permissionImgMap["策略"] = "https://hzstatic.hzinsights.com/static/yb_variety/v2/策略.png"
  47. allFiccPermissions, e := chart_permission.GetListByProductIdAndPermissionType(1)
  48. if e != nil {
  49. err = fmt.Errorf("获取品种权限失败 Err:%s", e.Error())
  50. return
  51. }
  52. for _, v := range allFiccPermissions {
  53. if v.ParentId > 0 {
  54. tmp := ApplyVariety{PermissionName: v.PermissionName, Name: v.PermissionName, PicUrl: utils.APPLY_VARIETY_IMG_DEFAULT}
  55. img, ok := permissionImgMap[v.PermissionName]
  56. if ok {
  57. tmp.PicUrl = img
  58. }
  59. list = append(list, tmp)
  60. }
  61. }
  62. /*list = append(list, ApplyVariety{PermissionName: "宏观经济", Name: "宏观经济", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/宏观经济.png"})
  63. list = append(list, ApplyVariety{PermissionName: "利率债", Name: "利率债", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/利率债.png"})
  64. list = append(list, ApplyVariety{PermissionName: "原油", Name: "原油", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/原油.png"})
  65. list = append(list, ApplyVariety{PermissionName: "PTA", Name: "PTA", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/PTA.png"})
  66. list = append(list, ApplyVariety{PermissionName: "MEG", Name: "MEG", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/MEG.png"})
  67. list = append(list, ApplyVariety{PermissionName: "织造终端", Name: "织造终端", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/织造终端.png"})
  68. list = append(list, ApplyVariety{PermissionName: "甲醇", Name: "甲醇", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/甲醇.png"})
  69. list = append(list, ApplyVariety{PermissionName: "聚烯烃", Name: "聚烯烃", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/聚烯烃.png"})
  70. list = append(list, ApplyVariety{PermissionName: "沥青", Name: "沥青", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/沥青.png"})
  71. list = append(list, ApplyVariety{PermissionName: "纯苯+苯乙烯", Name: "纯苯+苯乙烯", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/苯乙烯.png"})
  72. list = append(list, ApplyVariety{PermissionName: "PVC", Name: "PVC", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/PVC.png"})
  73. list = append(list, ApplyVariety{PermissionName: "聚酯", Name: "聚酯", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/聚酯.png"})
  74. list = append(list, ApplyVariety{PermissionName: "钢材", Name: "钢材", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/钢材.png"})
  75. list = append(list, ApplyVariety{PermissionName: "铁矿", Name: "铁矿", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/铁矿.png"})
  76. list = append(list, ApplyVariety{PermissionName: "玻璃纯碱", Name: "玻璃纯碱", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/玻璃纯碱.png"})
  77. list = append(list, ApplyVariety{PermissionName: "双焦(焦煤、焦炭)", Name: "双焦(焦煤、焦炭)", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/双焦(焦煤、焦炭).png"})
  78. list = append(list, ApplyVariety{PermissionName: "有色(铜、铝)", Name: "有色(铜、铝)", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/有色(铜、铝).png"})
  79. list = append(list, ApplyVariety{PermissionName: "镍+不锈钢", Name: "镍+不锈钢", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/镍2不锈钢.png"})
  80. list = append(list, ApplyVariety{PermissionName: "有色(锌)", Name: "有色(锌)", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/有色锌.png"})
  81. list = append(list, ApplyVariety{PermissionName: "钴锂", Name: "钴锂", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/钴锂.png"})*/
  82. //list = append(list, ApplyVariety{PermissionName: "苯乙烯", Name: "苯乙烯", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/苯乙烯.png"})
  83. //list = append(list, ApplyVariety{PermissionName: "橡胶", Name: "橡胶", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/橡胶.png"})
  84. //list = append(list, ApplyVariety{PermissionName: "策略", Name: "市场策略", PicUrl: "https://hzstatic.hzinsights.com/static/yb_variety/市场策略.png"})
  85. return
  86. }