| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- /**
- * @Author: zou.yingbin
- * @Create : 2021/1/7 10:54
- * @Modify : 2021/1/7 10:54
- */
- package ermcp
- import (
- "mtp2_if/global/app"
- "mtp2_if/global/e"
- "mtp2_if/logger"
- "mtp2_if/models"
- "mtp2_if/mtpcache"
- "net/http"
- "github.com/gin-gonic/gin"
- )
- // 查询客户资料请求
- type QryUserInfoReq struct {
- MemberUserID int64 `form:"MemberUserID" binding:"required"` // 所属机构用户ID
- QueryType int32 `form:"queryType" binding:"required"` // 查询类型(1:未提交 2:待审核 3:正常 4:停用)
- }
- // 查询客户资料应答
- type QryUserInfoRsp models.ErmcpUserModel
- // QueryUserInfo 查询客户资料
- // @Summary 查询客户资料
- // @Produce json
- // @Security ApiKeyAuth
- // @Param MemberUserID query int true "所属机构用户ID"
- // @Param queryType query int true "查询类型(1:未提交 2:待审核 3:正常 4:停用)"
- // @Success 200 {array} QryUserInfoRsp
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/QueryUserInfo [get]
- // @Tags 企业风险管理(app)
- func QueryUserInfo(c *gin.Context) {
- appG := app.Gin{C: c}
- var req QryUserInfoReq
- if err := c.ShouldBind(&req); err != nil {
- logger.GetLogger().Errorf("parse query req: %v", err)
- appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- var m = models.ErmcpUserModel{MEMBERUSERID: int(mtpcache.GetAreaUserId(req.MemberUserID, 0))}
- if d, err := m.GetData(req.QueryType); err == nil {
- appG.Response(http.StatusOK, e.SUCCESS, d)
- } else {
- appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
- }
- }
- // GetErmcpRolefuncMenuReq 获取企业风管终端权限请求参数
- type GetErmcpRolefuncMenuReq struct {
- LoginID int `form:"loginID" binding:"required"`
- }
- // GetErmcpRoleFuncMenuLists 获取企业风管终端权限
- // @Summary 获取企业风管终端权限
- // @Produce json
- // @Security ApiKeyAuth
- // @Param loginID query int true "登录账号"
- // @Success 200 {object} models.Funcmenulist
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/GetErmcpRoleFuncMenuLists [get]
- // @Tags 企业风险管理(app)
- func GetErmcpRoleFuncMenuLists(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req GetErmcpRolefuncMenuReq
- if err := appG.C.ShouldBindQuery(&req); err != nil {
- logger.GetLogger().Errorf("GetErmcpRolefuncMenu failed: %s", err.Error())
- appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- // 获取数据
- rst, err := models.GetErmcpRoleFuncMenuLists(req.LoginID, "")
- if err != nil {
- // 查询失败
- logger.GetLogger().Errorf("GetErmcpRolefuncMenu failed: %s", err.Error())
- appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
- return
- }
- // 查询成功返回
- logger.GetLogger().Debugln("GetErmcpRolefuncMenu successed:", rst)
- appG.Response(http.StatusOK, e.SUCCESS, rst)
- }
- // GetErmcpOutAccountStatusReq 获取目标登录账号当前对冲账号在线状态请求参数
- type GetErmcpOutAccountStatusReq struct {
- LoginID int `form:"loginID" binding:"required"`
- }
- // GetErmcpOutAccountStatus 获取目标登录账号当前对冲账号在线状态
- // @Summary 获取目标登录账号当前对冲账号在线状态
- // @Produce json
- // @Security ApiKeyAuth
- // @Param loginID query int true "登录账号"
- // @Success 200 {object} models.Hedgemarketopenlog
- // @Failure 500 {object} app.Response
- // @Router /Ermcp/GetErmcpOutAccountStatus [get]
- // @Tags 企业风险管理(app)
- func GetErmcpOutAccountStatus(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req GetErmcpOutAccountStatusReq
- if err := appG.C.ShouldBindQuery(&req); err != nil {
- logger.GetLogger().Errorf("GetErmcpOutAccountStatus failed: %s", err.Error())
- appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- // 获取数据
- var f models.Hedgemarketopenlog
- rst, err := f.GetOutAccountStatus(req.LoginID)
- if err != nil {
- // 查询失败
- logger.GetLogger().Errorf("GetErmcpOutAccountStatus failed: %s", err.Error())
- appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
- return
- }
- // 查询成功返回
- logger.GetLogger().Debugln("GetErmcpOutAccountStatus successed: %v", rst)
- appG.Response(http.StatusOK, e.SUCCESS, rst)
- }
|