my.go 826 字节
package controllers

import (
	"encoding/json"
	"oppmg/common/log"
	"oppmg/protocol"
	"oppmg/services/usermy"
)

// MyController 个人中心
type MyController struct {
	BaseController
}

//ResetPassword 重置密码
//@router /my/reset_password
func (c *MyController) ResetPassword() {
	var msg *protocol.ResponseMessage
	defer func() {
		c.ResposeJson(msg)
	}()
	type Parameter struct {
		Phone      string `json:"phone"`
		NewPwd     string `json:"newpwd"`
		ConfirmPwd string `json:"confirmpwd"`
	}
	var param Parameter
	if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
		log.Error("json 解析失败 err:%s", err)
		msg = protocol.BadRequestParam("1")
		return
	}

	err := usermy.ResetPasswordBySms(param.Phone, param.NewPwd, param.ConfirmPwd)
	msg = protocol.NewReturnResponse(nil, err)
	return
}