1
This commit is contained in:
105
controllers/recharge_controller.go
Normal file
105
controllers/recharge_controller.go
Normal file
@@ -0,0 +1,105 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
beego "github.com/astaxie/beego/adapter"
|
||||
)
|
||||
|
||||
type RechargeManagerController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// GetUserRecharge 用户查询充值记录
|
||||
// @Title 分页查询用户充值列表
|
||||
// @Description 分页查询用户充值列表
|
||||
// @Param token header string true "认证token"
|
||||
// @Param page formData int true "页码"
|
||||
// @Param pageSize formData int true "页数"
|
||||
// @Param mobile formData string false "电话"
|
||||
// @Param orderId formData string false "订单号"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetUserRecharge [post]
|
||||
func (c *RechargeManagerController) GetUserRecharge() {
|
||||
c.callGetUserRecharge(func(params *tRechargeGetUserRechargeParams) (interface{}, string, error) {
|
||||
result, count, err := cms.QueryUserRecharge([]string{params.Ctx.GetUserID()}, params.Mobile, params.OrderId, params.Page, params.PageSize, "", "", 0)
|
||||
userRecharge := make(map[string]interface{}, 2)
|
||||
userRecharge["data"] = result
|
||||
userRecharge["count"] = count
|
||||
return userRecharge, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// GetRechargeOrderDetail 订单详情查询
|
||||
// @Title 订单详情查询
|
||||
// @Description 订单详情查询
|
||||
// @Param token header string true "认证token"
|
||||
// @Param orderId formData string true "订单号"
|
||||
// @Param mobile formData string true "手机号"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetRechargeOrderDetail [get]
|
||||
func (c *RechargeManagerController) GetRechargeOrderDetail() {
|
||||
c.callGetRechargeOrderDetail(func(params *tRechargeGetRechargeOrderDetailParams) (interface{}, string, error) {
|
||||
result, err := cms.QueryUserOrderDetail(params.OrderId, params.Mobile)
|
||||
return result, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// SystemQueryRechargeList 管理系统获取订单详情
|
||||
// @Title 管理系统获取订单详情
|
||||
// @Description 管理系统获取订单详情
|
||||
// @Param token header string true "认证token"
|
||||
// @Param orderId formData string false "订单号"
|
||||
// @Param mobile formData string false "手机号"
|
||||
// @Param rechargeStatus formData int false "充值状态 0-未提交,3-等待待充值(本地) 1:充值中(三方),2:已充值,-1:失败(三方)"
|
||||
// @Param page formData int true "页码"
|
||||
// @Param pageSize formData int true "页数"
|
||||
// @Param startTime formData string true "开始时间"
|
||||
// @Param endTime formData string true "结束时间"
|
||||
// @Param userName formData string false "用户名"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /SystemQueryRechargeList [post]
|
||||
func (c *RechargeManagerController) SystemQueryRechargeList() {
|
||||
c.callSystemQueryRechargeList(func(params *tRechargeSystemQueryRechargeListParams) (interface{}, string, error) {
|
||||
userIdList := make([]string, 0, 0)
|
||||
// 根据用户获取用户id
|
||||
if params.UserName != "" {
|
||||
userList, _, err := dao.GetUsers(dao.GetDB(), 0, params.UserName, "", nil, nil, nil, 0, 0)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
if len(userList) == 0 {
|
||||
return nil, "", errors.New(fmt.Sprintf("未查询到此用户:[%s]", params.UserName))
|
||||
}
|
||||
for _, v := range userList {
|
||||
userIdList = append(userIdList, v.UserID)
|
||||
}
|
||||
}
|
||||
|
||||
result, count, err := cms.QueryUserRecharge(userIdList, params.Mobile, params.OrderId, params.Page, params.PageSize, params.StartTime, params.EndTime, params.RechargeStatus)
|
||||
userRecharge := make(map[string]interface{}, 2)
|
||||
userRecharge["data"] = result
|
||||
userRecharge["count"] = count
|
||||
return userRecharge, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// QueryAccountBill 查询当前账号余额
|
||||
// @Title 查询当前账号余额
|
||||
// @Description 查询当前账号余额
|
||||
// @Param token header string true "认证token"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /QueryAccountBill [get]
|
||||
func (c *RechargeManagerController) QueryAccountBill() {
|
||||
c.callQueryAccountBill(func(params *tRechargeQueryAccountBillParams) (interface{}, string, error) {
|
||||
balance, err := api.TelephoneAPI.QueryAccountBill()
|
||||
return balance, "", err
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user