package web_hook import ( logger "eta/eta_mini_ht_api/common/component/log" "eta/eta_mini_ht_api/controllers" userService "eta/eta_mini_ht_api/domian/user" ) type HTFuturesAccountController struct { controllers.WebHookController } // SyncCustomerRiskLevel 风险测评同步接口 // @Summary 风险测评同步接口 // @Description 风险测评同步接口 // @Success 200 {object} controllers.BaseResponse // @router /v1/syncRiskLevel/ [post] func (h *HTFuturesAccountController) SyncCustomerRiskLevel() { controllers.WrapWebhook(&h.WebHookController, func() (result *controllers.WrapData, err error) { result = h.InitWrapData("同步风险等级") syncCustomerRiskLevelReq := new(SyncCustomerRiskLevelReq) h.GetPostParams(syncCustomerRiskLevelReq) if syncCustomerRiskLevelReq.Name == "" { h.FailedResult("用户名字不能为空", result) return } if syncCustomerRiskLevelReq.PhoneNumber == "" { h.FailedResult("手机号码不能为空", result) return } if syncCustomerRiskLevelReq.RiskLevel == "" { h.FailedResult("风险等级不能为空", result) return } if syncCustomerRiskLevelReq.RiskValidEndDate == "" { h.FailedResult("风险测评有效期不能为空", result) return } err = userService.UpdateRiskLevelInfo(userService.RiskLevelInfoDTO{ Name: syncCustomerRiskLevelReq.Name, PhoneNumber: syncCustomerRiskLevelReq.PhoneNumber, RiskLevel: syncCustomerRiskLevelReq.RiskLevel, RiskValidEndDate: syncCustomerRiskLevelReq.RiskValidEndDate, }) if err != nil { logger.ErrorWithTraceId(h.Ctx, err.Error()) h.FailedResult(err.Error(), result) return } logger.InfoWithTraceId(h.Ctx, err.Error()) result = h.InitWrapData("同步风险等级成功") h.SuccessResult("success", syncCustomerRiskLevelReq, result) return }) } type SyncCustomerRiskLevelReq struct { Name string `json:"name"` PhoneNumber string `json:"phoneNumber"` RiskLevel string `json:"riskLevel"` RiskValidEndDate string `json:"riskValidEndDate"` }