|
@@ -244,31 +244,31 @@ func (a *EtaTrialController) UpdateActiveTime(c *gin.Context) {
|
|
|
// @Description 更新登录时长
|
|
|
// @Success 200 {string} string "操作成功"
|
|
|
// @Router /eta_trial/user/update_login_duration [post]
|
|
|
-//func (a *EtaTrialController) UpdateLoginDuration(c *gin.Context) {
|
|
|
-// var req etaTrialReq.UpdateUserLoginDurationReq
|
|
|
-// err := c.Bind(&req)
|
|
|
-// if err != nil {
|
|
|
-// errs, ok := err.(validator.ValidationErrors)
|
|
|
-// if !ok {
|
|
|
-// resp.FailData("参数解析失败", "Err:"+err.Error(), c)
|
|
|
-// return
|
|
|
-// }
|
|
|
-// resp.FailData("参数解析失败", errs.Translate(global.Trans), c)
|
|
|
-// return
|
|
|
-// }
|
|
|
-//
|
|
|
-// record := new(crm.EtaTrialLoginDurationRecord)
|
|
|
-// record.UserName = req.UserName
|
|
|
-// record.Mobile = req.Mobile
|
|
|
-// record.Duration = req.ActiveTime
|
|
|
-// record.CreateTime = time.Now().Local()
|
|
|
-// if e := record.Create(); e != nil {
|
|
|
-// resp.FailData("操作失败", "新增试用客户登录时长记录失败, Err:"+e.Error(), c)
|
|
|
-// return
|
|
|
-// }
|
|
|
-// if e := crm.UpdateEtaTrailLastLoginDuration(req.ActiveTime, req.Mobile); e != nil {
|
|
|
-// resp.FailData("操作失败", "更新试用客户登录时长失败, Err:"+e.Error(), c)
|
|
|
-// return
|
|
|
-// }
|
|
|
-// resp.OkData("操作成功", true, c)
|
|
|
-//}
|
|
|
+func (a *EtaTrialController) UpdateLoginDuration(c *gin.Context) {
|
|
|
+ var req etaTrialReq.UpdateUserLoginDurationReq
|
|
|
+ err := c.Bind(&req)
|
|
|
+ if err != nil {
|
|
|
+ errs, ok := err.(validator.ValidationErrors)
|
|
|
+ if !ok {
|
|
|
+ resp.FailData("参数解析失败", "Err:"+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.FailData("参数解析失败", errs.Translate(global.Trans), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ record := new(crm.EtaTrialLoginDurationRecord)
|
|
|
+ record.UserName = req.UserName
|
|
|
+ record.Mobile = req.Mobile
|
|
|
+ record.Duration = req.ActiveTime
|
|
|
+ record.CreateTime = time.Now().Local()
|
|
|
+ if e := record.Create(); e != nil {
|
|
|
+ resp.FailData("操作失败", "新增试用客户登录时长记录失败, Err:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if e := crm.UpdateEtaTrailLastLoginDuration(req.ActiveTime, req.Mobile); e != nil {
|
|
|
+ resp.FailData("操作失败", "更新试用客户登录时长失败, Err:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.OkData("操作成功", true, c)
|
|
|
+}
|