137 lines
5.3 KiB
Go
137 lines
5.3 KiB
Go
package controllers
|
|
|
|
import (
|
|
"errors"
|
|
"git.rosy.net.cn/jx-callback/business/model"
|
|
withdreawal "git.rosy.net.cn/jx-callback/business/q_bida"
|
|
"github.com/astaxie/beego/server/web"
|
|
)
|
|
|
|
type WithdrawalRecordController struct {
|
|
web.Controller
|
|
}
|
|
|
|
// AddWithdrawalRecord
|
|
// @Title 用户发起提现申请
|
|
// @Description 提现申请
|
|
// @Param token header string true "认证token"
|
|
// @Param withdrawalMoney formData int true "提现金额"
|
|
// @Param alipayAccount formData string true "支付宝绑定账号[邮箱/电话]"
|
|
// @Param alipayName formData string true "真是姓名"
|
|
// @Param lng formData float64 true "经度"
|
|
// @Param lat formData float64 true "纬度"
|
|
// @Param cityCode formData int true "城市code"
|
|
// @Param districtCode formData int true "省code"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /AddWithdrawalRecord [post]
|
|
func (c *WithdrawalRecordController) AddWithdrawalRecord() {
|
|
c.callAddWithdrawalRecord(func(params *tWithdrawalAddWithdrawalRecordParams) (interface{}, string, error) {
|
|
param := &model.AddWithdrawalRecordReq{
|
|
WithdrawalMoney: params.WithdrawalMoney,
|
|
AlipayAccount: params.AlipayAccount,
|
|
AlipayName: params.AlipayName,
|
|
Lng: params.Lng,
|
|
Lat: params.Lat,
|
|
CityCode: params.CityCode,
|
|
DistrictCode: params.DistrictCode,
|
|
}
|
|
err := withdreawal.AddUserWithdrawal(params.Ctx, param)
|
|
return nil, "", err
|
|
})
|
|
}
|
|
|
|
// DeleteWithdrawalRecord
|
|
// @Title 取消或者删除提现生情
|
|
// @Description 提现申请
|
|
// @Param token header string true "认证token"
|
|
// @Param id formData int64 true "数据主键Id"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /DeleteWithdrawalRecord [post]
|
|
func (c *WithdrawalRecordController) DeleteWithdrawalRecord() {
|
|
c.callDeleteWithdrawalRecord(func(params *tWithdrawalDeleteWithdrawalRecordParams) (interface{}, string, error) {
|
|
err := withdreawal.DeleteOrder(params.Ctx.GetUserID(), params.Id)
|
|
return nil, "", err
|
|
})
|
|
}
|
|
|
|
// GetWithdrawalRecord
|
|
// 用户查询申请列表
|
|
// @Title 查询申请列表
|
|
// @Description 提现申请
|
|
// @Param token header string true "认证token"
|
|
// @Param status formData int true "申请订单状态"
|
|
// @Param pageSize formData int true "页数"
|
|
// @Param pageNum formData int true "页码"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetWithdrawalRecord [post]
|
|
func (c *WithdrawalRecordController) GetWithdrawalRecord() {
|
|
c.callGetWithdrawalRecord(func(params *tWithdrawalGetWithdrawalRecordParams) (interface{}, string, error) {
|
|
result, err := withdreawal.GetOrderListByStatus(params.Ctx.GetUserID(), params.Status, params.PageSize, params.PageNum)
|
|
return result, "", err
|
|
})
|
|
}
|
|
|
|
// GetWithdrawalList
|
|
// 管理系统查询列表
|
|
// @Title 查询申请列表
|
|
// @Description 提现申请
|
|
// @Param token header string true "认证token"
|
|
// @Param pageSize formData int true "页数"
|
|
// @Param pageNum formData int true "页码"
|
|
// @Param userName formData string false "用户昵称"
|
|
// @Param userId formData string false "用户id"
|
|
// @Param orderId formData string false "订单Id"
|
|
// @Param startTime formData string false "开始时间"
|
|
// @Param endTime formData string false "结束时间"
|
|
// @Param phone formData string false "电话"
|
|
// @Param orderStatus formData int false "订单状态"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetWithdrawalList [post]
|
|
func (c *WithdrawalRecordController) GetWithdrawalList() {
|
|
c.callGetWithdrawalList(func(params *tWithdrawalGetWithdrawalListParams) (interface{}, string, error) {
|
|
data, count, err := withdreawal.GetUserWithdrawalList(&model.OrderListParam{
|
|
PageSize: params.PageSize,
|
|
PageNum: params.PageNum,
|
|
UserId: params.UserId,
|
|
UserName: params.UserName,
|
|
OrderId: params.OrderId,
|
|
Phone: params.Phone,
|
|
OrderStatus: params.OrderStatus,
|
|
StartTime: params.StartTime,
|
|
EndTime: params.EndTime,
|
|
})
|
|
if err != nil {
|
|
return nil, "", err
|
|
}
|
|
|
|
return map[string]interface{}{"data": data, "count": count}, "", err
|
|
})
|
|
}
|
|
|
|
// ExamineWithdrawalOrder
|
|
// 管理员审核提现申请
|
|
// @Title 审核提现申请
|
|
// @Description 审核提现申请
|
|
// @Param token header string true "认证token"
|
|
// @Param phone formData string true "当前审核人员电话号码"
|
|
// @Param orderId formData string true "被审核订单Id"
|
|
// @Param examineStatus formData int true "1-通过"
|
|
// @Param remark formData string false "不通过原因"
|
|
// @Param userId formData string false "提现人员Id"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /ExamineWithdrawalOrder [post]
|
|
func (c *WithdrawalRecordController) ExamineWithdrawalOrder() {
|
|
c.callExamineWithdrawalOrder(func(params *tWithdrawalExamineWithdrawalOrderParams) (interface{}, string, error) {
|
|
if DefaultMobile[params.Phone] != "ok" {
|
|
return nil, "", errors.New("当前用户不具备操作权限,请联系管理员")
|
|
}
|
|
err := withdreawal.ManagerExamineWithdrawal(params.UserId, params.OrderId, params.ExamineStatus, params.Phone, params.Remark)
|
|
return nil, "", err
|
|
})
|
|
}
|