33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
package controllers
|
|
|
|
import (
|
|
"errors"
|
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
|
"github.com/astaxie/beego/server/web"
|
|
)
|
|
|
|
type UserBalanceController struct {
|
|
web.Controller
|
|
}
|
|
|
|
var DefaultMobile = map[string]string{"18048531223": "ok", "15729837802": "ok"}
|
|
|
|
// UpdateUserBalance
|
|
// @Title 修改用户账户余额
|
|
// @Description 用户余额
|
|
// @Param token header string true "认证token"
|
|
// @Param phone formData string true "发起修改人电话"
|
|
// @Param userID formData string true "被修用户Id"
|
|
// @Param money formData int false "修改后金额"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /UpdateUserBalance [post]
|
|
func (c *UserBalanceController) UpdateUserBalance() {
|
|
c.callUpdateUserBalance(func(params *tBalanceUpdateUserBalanceParams) (interface{}, string, error) {
|
|
if DefaultMobile[params.Phone] != "ok" {
|
|
return nil, "", errors.New("此用户不能修改用户金额")
|
|
}
|
|
return nil, "", dao.UpdateUserBill(params.UserID, params.Money)
|
|
})
|
|
}
|