|
|
@ -215,6 +215,32 @@ func (c *CouponUsers) IssueCouponUser(r *ghttp.Request) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 添加用户选择武器记录
|
|
|
|
func (c *CouponUsers) AddRecord(r *ghttp.Request) { |
|
|
|
var req *couponusers.AddRecordReq |
|
|
|
if err := r.Parse(&req); err != nil { |
|
|
|
r.Response.WriteJsonExit(dto.Error(err.Error())) |
|
|
|
} |
|
|
|
//解析token,获取jwcode
|
|
|
|
token := r.Header.Get("token") |
|
|
|
if token == "" { |
|
|
|
r.Response.WriteJsonExit(dto.Error("token为空")) |
|
|
|
} |
|
|
|
|
|
|
|
jwcode, err := utility.GetJwcodeJSON(token) |
|
|
|
if err != nil { |
|
|
|
r.Response.WriteJsonExit(dto.Error(err.Error())) |
|
|
|
} |
|
|
|
|
|
|
|
err = service.CouponUsers().AddRecord(r.Context(), jwcode, req.CouponId, req.Name) |
|
|
|
//错误处理
|
|
|
|
if err != nil { |
|
|
|
r.Response.WriteJsonExit(dto.Error(err.Error())) |
|
|
|
} |
|
|
|
//成功处理
|
|
|
|
r.Response.WriteJsonExit(dto.SuccessWithMsg("记录成功")) |
|
|
|
} |
|
|
|
|
|
|
|
/*近期使用*/ |
|
|
|
|
|
|
|
// 未编写
|
|
|
|