package handler import ( "github.com/gin-gonic/gin" "youngee_b_api/model/http_model" "youngee_b_api/service" ) func WrapAddNewSubAccountHandler(ctx *gin.Context) { handler := newAddNewSubAccountHandler(ctx) baseRun(handler) } func newAddNewSubAccountHandler(ctx *gin.Context) *AddNewSubAccountHandler { return &AddNewSubAccountHandler{ req: http_model.NewAddSubAccountRequest(), resp: http_model.NewAddSubAccountResponse(), ctx: ctx, } } type AddNewSubAccountHandler struct { req *http_model.AddNewSubAccountRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *AddNewSubAccountHandler) getRequest() interface{} { return h.req } func (h *AddNewSubAccountHandler) getContext() *gin.Context { return h.ctx } func (h *AddNewSubAccountHandler) getResponse() interface{} { return h.resp } func (h *AddNewSubAccountHandler) run() { // 1. 验证码校验 tag, data, err := service.LoginAuth.SubAccountAuthCode(h.ctx, h.req) if err != nil { h.resp.Data = data h.resp.Message = err.Error() h.resp.Status = 40000 return } if tag == 1 { h.resp.Data = data h.resp.Message = "验证码校验错误" h.resp.Status = 34000 return } if tag == 2 { h.resp.Data = data h.resp.Message = "此手机号已被已认证的服务商主账号绑定" h.resp.Status = 35000 return } if tag == 3 { h.resp.Data = data h.resp.Message = "此手机号已被服务商子账号绑定" h.resp.Status = 36000 return } h.resp.Data = data h.resp.Message = "ok" h.resp.Status = 20000 } func (h *AddNewSubAccountHandler) checkParam() error { return nil }