qryUser.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /**
  2. * @Author: zou.yingbin
  3. * @Create : 2021/1/7 10:54
  4. * @Modify : 2021/1/7 10:54
  5. */
  6. package ermcp
  7. import (
  8. "mtp2_if/global/app"
  9. "mtp2_if/global/e"
  10. "mtp2_if/logger"
  11. "mtp2_if/models"
  12. "mtp2_if/mtpcache"
  13. "net/http"
  14. "github.com/gin-gonic/gin"
  15. )
  16. // 查询客户资料请求
  17. type QryUserInfoReq struct {
  18. MemberUserID int64 `form:"MemberUserID" binding:"required"` // 所属机构用户ID
  19. QueryType int32 `form:"queryType" binding:"required"` // 查询类型(1:未提交 2:待审核 3:正常 4:停用)
  20. }
  21. // 查询客户资料应答
  22. type QryUserInfoRsp models.ErmcpUserModel
  23. // QueryUserInfo 查询客户资料
  24. // @Summary 查询客户资料
  25. // @Produce json
  26. // @Security ApiKeyAuth
  27. // @Param MemberUserID query int true "所属机构用户ID"
  28. // @Param queryType query int true "查询类型(1:未提交 2:待审核 3:正常 4:停用)"
  29. // @Success 200 {array} QryUserInfoRsp
  30. // @Failure 500 {object} app.Response
  31. // @Router /Ermcp/QueryUserInfo [get]
  32. // @Tags 企业风险管理(app)
  33. func QueryUserInfo(c *gin.Context) {
  34. appG := app.Gin{C: c}
  35. var req QryUserInfoReq
  36. if err := c.ShouldBind(&req); err != nil {
  37. logger.GetLogger().Errorf("parse query req: %v", err)
  38. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  39. return
  40. }
  41. var m = models.ErmcpUserModel{MEMBERUSERID: int(mtpcache.GetAreaUserId(req.MemberUserID, 0))}
  42. if d, err := m.GetData(req.QueryType); err == nil {
  43. appG.Response(http.StatusOK, e.SUCCESS, d)
  44. } else {
  45. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  46. }
  47. }
  48. // GetErmcpRolefuncMenuReq 获取企业风管终端权限请求参数
  49. type GetErmcpRolefuncMenuReq struct {
  50. LoginID int `form:"loginID" binding:"required"`
  51. }
  52. // GetErmcpRoleFuncMenuLists 获取企业风管终端权限
  53. // @Summary 获取企业风管终端权限
  54. // @Produce json
  55. // @Security ApiKeyAuth
  56. // @Param loginID query int true "登录账号"
  57. // @Success 200 {object} models.Funcmenulist
  58. // @Failure 500 {object} app.Response
  59. // @Router /Ermcp/GetErmcpRoleFuncMenuLists [get]
  60. // @Tags 企业风险管理(app)
  61. func GetErmcpRoleFuncMenuLists(c *gin.Context) {
  62. appG := app.Gin{C: c}
  63. // 获取请求参数
  64. var req GetErmcpRolefuncMenuReq
  65. if err := appG.C.ShouldBindQuery(&req); err != nil {
  66. logger.GetLogger().Errorf("GetErmcpRolefuncMenu failed: %s", err.Error())
  67. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  68. return
  69. }
  70. // 获取数据
  71. rst, err := models.GetErmcpRoleFuncMenuLists(req.LoginID, "")
  72. if err != nil {
  73. // 查询失败
  74. logger.GetLogger().Errorf("GetErmcpRolefuncMenu failed: %s", err.Error())
  75. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  76. return
  77. }
  78. // 查询成功返回
  79. logger.GetLogger().Debugln("GetErmcpRolefuncMenu successed: %v", rst)
  80. appG.Response(http.StatusOK, e.SUCCESS, rst)
  81. }
  82. // GetErmcpOutAccountStatusReq 获取目标登录账号当前对冲账号在线状态请求参数
  83. type GetErmcpOutAccountStatusReq struct {
  84. LoginID int `form:"loginID" binding:"required"`
  85. }
  86. // GetErmcpOutAccountStatus 获取目标登录账号当前对冲账号在线状态
  87. // @Summary 获取目标登录账号当前对冲账号在线状态
  88. // @Produce json
  89. // @Security ApiKeyAuth
  90. // @Param loginID query int true "登录账号"
  91. // @Success 200 {object} models.Hedgemarketopenlog
  92. // @Failure 500 {object} app.Response
  93. // @Router /Ermcp/GetErmcpOutAccountStatus [get]
  94. // @Tags 企业风险管理(app)
  95. func GetErmcpOutAccountStatus(c *gin.Context) {
  96. appG := app.Gin{C: c}
  97. // 获取请求参数
  98. var req GetErmcpOutAccountStatusReq
  99. if err := appG.C.ShouldBindQuery(&req); err != nil {
  100. logger.GetLogger().Errorf("GetErmcpOutAccountStatus failed: %s", err.Error())
  101. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  102. return
  103. }
  104. // 获取数据
  105. var f models.Hedgemarketopenlog
  106. rst, err := f.GetOutAccountStatus(req.LoginID)
  107. if err != nil {
  108. // 查询失败
  109. logger.GetLogger().Errorf("GetErmcpOutAccountStatus failed: %s", err.Error())
  110. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  111. return
  112. }
  113. // 查询成功返回
  114. logger.GetLogger().Debugln("GetErmcpOutAccountStatus successed: %v", rst)
  115. appG.Response(http.StatusOK, e.SUCCESS, rst)
  116. }