天假支付宝提现操作
This commit is contained in:
@@ -129,3 +129,9 @@ func GetUserBillDetail(db *DaoDB, userID string, fromTime, toTime time.Time, pag
|
||||
}
|
||||
return pagedInfo, err
|
||||
}
|
||||
|
||||
// UpdateUserBill 修改用户余额
|
||||
func UpdateUserBill(userId string, money int) error {
|
||||
_, err := ExecuteSQL(GetDB(), `UPDATE user_bill SET account_balance = ? WHERE user_id = ? `, []interface{}{money, userId}...)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ func GetUsers2(db *DaoDB, keyword string, userID string, pop int, mobile string,
|
||||
sqlParams := []interface{}{}
|
||||
sql := `
|
||||
SELECT SQL_CALC_FOUND_ROWS DISTINCT
|
||||
a.*
|
||||
a.*,ub.account_balance
|
||||
FROM user a`
|
||||
for _, v := range consumeTypes {
|
||||
switch v {
|
||||
@@ -171,6 +171,7 @@ func GetUsers2(db *DaoDB, keyword string, userID string, pop int, mobile string,
|
||||
}
|
||||
}
|
||||
}
|
||||
sql += ` JOIN user_bill ub ON ub.user_id = a.user_id`
|
||||
sql += `
|
||||
WHERE a.status = 1 AND a.deleted_at = ?`
|
||||
sqlParams = append(sqlParams, utils.DefaultTimeValue)
|
||||
|
||||
@@ -54,14 +54,15 @@ type User struct {
|
||||
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo" compact:"idCardNo"` // 身份证号
|
||||
Remark string `orm:"size(255)" json:"remark"`
|
||||
|
||||
LastLoginAt *time.Time `orm:"null" json:"lastLoginAt"`
|
||||
LastLoginIP string `orm:"size(64);column(last_login_ip)" json:"lastLoginIP"`
|
||||
LastLoginType string `orm:"size(16)" json:"lastLoginType"`
|
||||
PopCode string `json:"popCode"` //推广码
|
||||
PopUser string `json:"popUser"` //推广人
|
||||
PopCount int `json:"popCount"` //推荐人数
|
||||
PopFlag int `json:"popFlag"` //是否已通过推荐获得免费会员
|
||||
PopedFlag int `json:"popedFlag"` //被邀请标志(弹框)
|
||||
LastLoginAt *time.Time `orm:"null" json:"lastLoginAt"`
|
||||
LastLoginIP string `orm:"size(64);column(last_login_ip)" json:"lastLoginIP"`
|
||||
LastLoginType string `orm:"size(16)" json:"lastLoginType"`
|
||||
PopCode string `json:"popCode"` //推广码
|
||||
PopUser string `json:"popUser"` //推广人
|
||||
PopCount int `json:"popCount"` //推荐人数
|
||||
PopFlag int `json:"popFlag"` //是否已通过推荐获得免费会员
|
||||
PopedFlag int `json:"popedFlag"` //被邀请标志(弹框)
|
||||
AccountBalance int64 `json:"-"` // 银行余额
|
||||
}
|
||||
|
||||
func (*User) TableUnique() [][]string {
|
||||
|
||||
32
controllers/user_balance.go
Normal file
32
controllers/user_balance.go
Normal file
@@ -0,0 +1,32 @@
|
||||
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)
|
||||
})
|
||||
}
|
||||
@@ -1078,4 +1078,13 @@ func init() {
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
// 修改用户账户余额
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:UserBalanceController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:UserBalanceController"],
|
||||
beego.ControllerComments{
|
||||
Method: "UpdateUserBalance",
|
||||
Router: "/UpdateUserBalance",
|
||||
AllowHTTPMethods: []string{"post"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
}
|
||||
|
||||
@@ -67,6 +67,12 @@ func init() {
|
||||
&controllers.QBiDaExpressController{},
|
||||
),
|
||||
),
|
||||
// 用户账户余额
|
||||
web.NSNamespace("/balance",
|
||||
web.NSInclude(
|
||||
&controllers.UserBalanceController{},
|
||||
),
|
||||
),
|
||||
)
|
||||
web.AddNamespace(ns)
|
||||
web.AutoRouter(&controllers.WXPayController{})
|
||||
|
||||
Reference in New Issue
Block a user