risk_config.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package controllers
  2. import (
  3. "eta/eta_mini_crm_ht/models"
  4. "eta/eta_mini_crm_ht/models/response"
  5. )
  6. type RiskConfigController struct {
  7. BaseAuthController
  8. }
  9. // GetCustomerRiskList
  10. // @Title 获取客户风险等级
  11. // @Description 获取客户风险等级
  12. // @Success 200 {object} models.LoginResp
  13. // @router /customerRiskList [get]
  14. func (this *RiskConfigController) GetCustomerRiskList() {
  15. br := new(models.BaseResponse).Init()
  16. defer func() {
  17. this.Data["json"] = br
  18. this.ServeJSON()
  19. }()
  20. list, err := models.GetCustomerRiskList()
  21. if err != nil {
  22. br.Msg = "获取失败"
  23. br.ErrMsg = "获取失败,Err:" + err.Error()
  24. return
  25. }
  26. var viewList []*models.RiskConfigView
  27. for _, item := range list {
  28. viewList = append(viewList, item.ToView())
  29. }
  30. resp := new(response.RiskConfigResp)
  31. resp.List = viewList
  32. br.Ret = 200
  33. br.Success = true
  34. br.Msg = "获取成功"
  35. br.Data = resp
  36. }
  37. // GetProductRiskList
  38. // @Title 获取产品风险等级
  39. // @Description 获取产品风险等级
  40. // @Success 200 {object} models.LoginResp
  41. // @router /productRiskList [get]
  42. func (this *RiskConfigController) GetProductRiskList() {
  43. br := new(models.BaseResponse).Init()
  44. defer func() {
  45. this.Data["json"] = br
  46. this.ServeJSON()
  47. }()
  48. list, err := models.GetProductRiskList()
  49. if err != nil {
  50. br.Msg = "获取失败"
  51. br.ErrMsg = "获取失败,Err:" + err.Error()
  52. return
  53. }
  54. var viewList []*models.RiskConfigView
  55. for _, item := range list {
  56. viewList = append(viewList, item.ToView())
  57. }
  58. resp := new(response.RiskConfigResp)
  59. resp.List = viewList
  60. br.Ret = 200
  61. br.Success = true
  62. br.Msg = "获取成功"
  63. br.Data = resp
  64. }