risk.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package http
  2. import (
  3. grpcv1 "go-common/app/service/openplatform/anti-fraud/api/grpc/v1"
  4. "go-common/app/service/openplatform/anti-fraud/api/http/v1"
  5. "go-common/app/service/openplatform/anti-fraud/model"
  6. bm "go-common/library/net/http/blademaster"
  7. )
  8. //riskCheck 风险检查
  9. func riskCheck(c *bm.Context) {
  10. params := new(grpcv1.RiskCheckRequest)
  11. if err := c.Bind(params); err != nil {
  12. return
  13. }
  14. res, err := svc.RiskCheck(c, params)
  15. svc.Ticket2PayShield(c, params, res)
  16. if res.Rank == model.RankDoubt {
  17. res.Rank = model.RankNormal
  18. res.Method = model.MethodPass
  19. res.Desc = model.CheckPass
  20. }
  21. c.JSON(res, err)
  22. }
  23. //riskCheckV2 风险检查
  24. func riskCheckV2(c *bm.Context) {
  25. params := new(v1.RiskCheckV2Request)
  26. if err := c.Bind(params); err != nil {
  27. return
  28. }
  29. res, err := svc.RiskCheckV2(c, params)
  30. if err == nil {
  31. svc.PayShield(c, params, res)
  32. }
  33. c.JSON(res, err)
  34. }
  35. // ipList IP列表接口
  36. func ipList(c *bm.Context) {
  37. params := new(v1.IPListRequest)
  38. c.JSON(svc.IPList(c, params))
  39. }
  40. //ipDetail ip详情列表
  41. func ipDetail(c *bm.Context) {
  42. params := new(v1.IPDetailRequest)
  43. if err := c.Bind(params); err != nil {
  44. return
  45. }
  46. c.JSON(svc.IPDetail(c, params))
  47. }
  48. // uidList uid列表接口
  49. func uidList(c *bm.Context) {
  50. params := new(v1.UIDListRequest)
  51. c.JSON(svc.UIDList(c, params))
  52. }
  53. //uidDetail uid详情列表
  54. func uidDetail(c *bm.Context) {
  55. params := new(v1.UIDDetailRequest)
  56. if err := c.Bind(params); err != nil {
  57. return
  58. }
  59. c.JSON(svc.UIDDetail(c, params))
  60. }
  61. // ipBlack ip黑名单
  62. func ipBlack(c *bm.Context) {
  63. params := new(v1.IPBlackRequest)
  64. if err := c.Bind(params); err != nil {
  65. return
  66. }
  67. c.JSON(svc.IPBlack(c, params))
  68. }
  69. // uidBlack uid黑名单
  70. func uidBlack(c *bm.Context) {
  71. params := new(v1.UIDBlackRequest)
  72. if err := c.Bind(params); err != nil {
  73. return
  74. }
  75. c.JSON(svc.UIDBlack(c, params))
  76. }