123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package handler
- import (
- "fmt"
- "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() {
- tag, err := service.LoginAuth.SubAccountAuthCode(h.ctx, h.req)
- if err != nil {
- fmt.Println(err)
- h.resp.Status = 40000
- h.resp.Message = err.Error()
- return
- }
- if tag == 1 {
- h.resp.Status = 34000
- h.resp.Message = "验证码校验错误"
- h.resp.Data = nil
- return
- }
- if tag == 2 {
- h.resp.Status = 35000
- h.resp.Message = "手机号被已认证的商家用户绑定"
- h.resp.Data = nil
- return
- }
- if tag == 3 {
- h.resp.Status = 36000
- h.resp.Message = "手机号已经被其他子账号绑定"
- h.resp.Data = nil
- return
- }
- }
- func (h *AddNewSubAccountHandler) checkParam() error {
- return nil
- }
|