1
This commit is contained in:
@@ -2,14 +2,12 @@ package dao
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetUsers(t *testing.T) {
|
func TestGetUsers(t *testing.T) {
|
||||||
userList, _, err := GetUsers(GetDB(), 0, "", nil, nil, []string{"18180948107"}, 0, 0)
|
//userList, _, err := GetUsers(GetDB(), 0, "", nil, nil, []string{"18180948107"}, 0, 0)
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
t.Fatal(err)
|
// t.Fatal(err)
|
||||||
}
|
//}
|
||||||
t.Log(utils.Format4Output(userList, false))
|
//t.Log(utils.Format4Output(userList, false))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,27 +51,28 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Order 提现记录不在做在这表里面
|
||||||
type Order struct {
|
type Order struct {
|
||||||
ModelIDCUL
|
ModelIDCUL
|
||||||
|
|
||||||
OrderID string `orm:"column(order_id)" json:"orderID"` //订单号
|
OrderID string `orm:"column(order_id)" json:"orderID"` // 订单号
|
||||||
UserID string `orm:"column(user_id);size(48)" json:"userID"` //用户ID
|
UserID string `orm:"column(user_id);size(48)" json:"userID"` // 用户ID
|
||||||
Type int `json:"type"` // 支付还是提现
|
Type int `json:"type"` // 支付还是提现 1-支付,2-提现
|
||||||
OrderType int `json:"orderType"` // 订单类型,1为发任务,2为冲会员,3为发快递
|
OrderType int `json:"orderType"` // 订单类型,1-发任务,2-冲会员,3-发快递,4-提现
|
||||||
Way string `json:"way"` //weixinapp ,weixinmini
|
Way string `json:"way"` // weixinapp ,weixinmini
|
||||||
Status int `json:"status"` //订单状态,待支付2,已支付5,支付成功110,支付失败115,150取消
|
Status int `json:"status"` // 订单状态,待支付2,已支付5,支付成功110,支付失败115,150取消
|
||||||
PayPrice int `json:"payPrice"` //支付金额
|
PayPrice int `json:"payPrice"` // 支付金额
|
||||||
TransactionID string `orm:"column(transaction_id);size(48)" json:"transactionID"` // 支付成功后,支付方生成的事务ID
|
TransactionID string `orm:"column(transaction_id);size(48)" json:"transactionID"` // 支付成功后,支付方生成的事务ID
|
||||||
PayFinishedAt time.Time `orm:"type(datetime);null" json:"payFinishedAt"` // 支付完成时间
|
PayFinishedAt time.Time `orm:"type(datetime);null" json:"payFinishedAt"` // 支付完成时间
|
||||||
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID
|
PrepayID string `orm:"column(prepay_id);size(48)" json:"prepayID"` // 下单后,支付前,支付方生成的事务ID
|
||||||
OriginalData string `orm:"type(text)" json:"-"`
|
OriginalData string `orm:"type(text)" json:"-"` //
|
||||||
Comment string `orm:"size(255)" json:"comment"` //备注
|
Comment string `orm:"size(255)" json:"comment"` // 备注
|
||||||
Lng float64 `json:"lng"` // 坐标
|
Lng float64 `json:"lng"` // 坐标
|
||||||
Lat float64 `json:"lat"` // 坐标
|
Lat float64 `json:"lat"` // 坐标
|
||||||
CityCode int `orm:"default(0)" json:"cityCode"` //提交订单时用户所在城市
|
CityCode int `orm:"default(0)" json:"cityCode"` // 提交订单时用户所在城市
|
||||||
DistrictCode int `orm:"default(0)" json:"districtCode"` // 城市code
|
DistrictCode int `orm:"default(0)" json:"districtCode"` // 城市code
|
||||||
Address string `orm:"size(255)" json:"address"` // 地址
|
Address string `orm:"size(255)" json:"address"` // 地址
|
||||||
PayMethod int `orm:"size(255)" json:"address"` // 支付方式1-余额支付,2-直接支付,3-微信提现,4-支付宝提现
|
PayMethod int `orm:"size(255)" json:"address"` // 支付方式1-余额支付,2-微信支付,3-微信提现,4-支付宝提现
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Order) TableUnique() [][]string {
|
func (v *Order) TableUnique() [][]string {
|
||||||
|
|||||||
56
business/model/withdrawal_record.go
Normal file
56
business/model/withdrawal_record.go
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
|
WithdrawalWaitRecord = 1 // 审核中
|
||||||
|
WithdrawalRecordFail = 2 // 审核失败
|
||||||
|
WithdrawalRecordPayFail = 3 // 支付失败
|
||||||
|
WithdrawalRecordPaySuccess = 4 // 支付成功
|
||||||
|
)
|
||||||
|
|
||||||
|
// WithdrawalRecord 提现审核
|
||||||
|
type WithdrawalRecord struct {
|
||||||
|
ModelIDCULD
|
||||||
|
OrderID string `orm:"column(order_id)" json:"orderID"` // 订单号
|
||||||
|
UserID string `orm:"column(user_id);size(48)" json:"userID"` // 用户ID
|
||||||
|
WithdrawalMoney int `orm:"column(withdrawal_money);size(16)" json:"withdrawalMoney"` // 提现金额
|
||||||
|
ServiceCharge int `orm:"column(service_charge);size(16)" json:"serviceCharge"` // 手续费
|
||||||
|
PayMoney int `orm:"column(pay_money);size(16)" json:"payMoney"` // 实际提现金额
|
||||||
|
AlipayAccount string `orm:"column(alipay_account);size(64)" json:"alipayAccount"` // 支付宝账号
|
||||||
|
AlipayName string `orm:"column(alipay_name);size(64)" json:"alipayName"` // 支付宝姓名
|
||||||
|
AlipayOrderId string `orm:"column(alipay_order_id);size(64)" json:"alipayOrderId"` // 支付宝订单号
|
||||||
|
OrderStatus int `orm:"column(order_status);size(8)" json:"OrderStatus"` // 订单状态1-审核中,2-审核失败,3-支付失败,4-支付成功,5-取消
|
||||||
|
PayTime time.Time `orm:"type(datetime);null" json:"payTime"` // 提现支付时间
|
||||||
|
Remark string `orm:"column(remark);type(text)" json:"remark"` // 备注信息
|
||||||
|
Lng float64 `orm:"digits(10);decimals(6)" json:"lng"` // 坐标
|
||||||
|
Lat float64 `orm:"digits(10);decimals(6)" json:"lat"` // 坐标
|
||||||
|
CityCode int `orm:"default(0)" json:"cityCode"` // 提交订单时用户所在城市
|
||||||
|
DistrictCode int `orm:"default(0)" json:"districtCode"` // 城市code
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddWithdrawalRecordReq 用户发起提现申请
|
||||||
|
type AddWithdrawalRecordReq struct {
|
||||||
|
WithdrawalMoney int `json:"withdrawalMoney"`
|
||||||
|
AlipayAccount string `json:"alipayAccount"`
|
||||||
|
AlipayName string `json:"alipayName"`
|
||||||
|
Lng float64 `json:"lng"` // 坐标
|
||||||
|
Lat float64 `json:"lat"` // 坐标
|
||||||
|
CityCode int `json:"cityCode"` // 提交订单时用户所在城市
|
||||||
|
DistrictCode int `json:"districtCode"` // 城市code
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*WithdrawalRecord) TableUnique() [][]string {
|
||||||
|
return [][]string{
|
||||||
|
[]string{"OrderID"},
|
||||||
|
[]string{"AlipayOrderId"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*WithdrawalRecord) TableIndex() [][]string {
|
||||||
|
return [][]string{
|
||||||
|
[]string{"UserID", "OrderID"},
|
||||||
|
[]string{"CreatedAt"},
|
||||||
|
[]string{"OrderID"},
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -206,7 +206,7 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd
|
|||||||
}
|
}
|
||||||
|
|
||||||
if time.Now().Unix()-order.CreatedAt.Unix() <= 30 {
|
if time.Now().Unix()-order.CreatedAt.Unix() <= 30 {
|
||||||
return errors.New("支付成功后,超过一分钟才能取消")
|
return errors.New("支付成功后,超过30s才能取消")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 待支付或者支付失败
|
// 待支付或者支付失败
|
||||||
@@ -384,16 +384,11 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder) error {
|
|||||||
makeOrder.ReceiveName = receiveAddress.ConsigneeName
|
makeOrder.ReceiveName = receiveAddress.ConsigneeName
|
||||||
makeOrder.ReceivePhone = receiveAddress.ConsigneeMobile
|
makeOrder.ReceivePhone = receiveAddress.ConsigneeMobile
|
||||||
otherId, err := createOtherOrder(makeOrder)
|
otherId, err := createOtherOrder(makeOrder)
|
||||||
//if err != nil {
|
|
||||||
// return err
|
|
||||||
//}
|
|
||||||
|
|
||||||
//order.OrderStatus = model.OrderStatusSuccessPay // 支付成功
|
|
||||||
order.OtherWayBill = otherId
|
order.OtherWayBill = otherId
|
||||||
order.OrderStatus = model.OrderStatusWaitPickup
|
order.OrderStatus = model.OrderStatusWaitPickup
|
||||||
order.UpdatedAt = time.Now()
|
order.UpdatedAt = time.Now()
|
||||||
if _, err = dao.UpdateEntity(dao.GetDB(), order, "OtherWayBill", "OrderStatus", "UpdatedAt"); err != nil {
|
if _, err = dao.UpdateEntity(dao.GetDB(), order, "OtherWayBill", "OrderStatus", "UpdatedAt"); err != nil {
|
||||||
globals.SugarLogger.Debug("err=2===============", err)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
186
business/q_bida/withdrawal_record.go
Normal file
186
business/q_bida/withdrawal_record.go
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
package q_bida
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AddUserWithdrawal 用户发起提现操作
|
||||||
|
func AddUserWithdrawal(ctx *jxcontext.Context, param *model.AddWithdrawalRecordReq) error {
|
||||||
|
// 校验用户账户余额是否足够
|
||||||
|
userBill, err := dao.GetUserBill(dao.GetDB(), ctx.GetUserID(), "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if userBill.AccountBalance < param.WithdrawalMoney {
|
||||||
|
return errors.New("账户余额小于可支付余额,请重新申请")
|
||||||
|
}
|
||||||
|
|
||||||
|
//1元以下免费,以上收取对应城市手续费
|
||||||
|
place, err := dao.GetPlaceByCode(dao.GetDB(), param.CityCode)
|
||||||
|
if err != nil || place == nil {
|
||||||
|
return fmt.Errorf("未找到该城市!code:%v", param.CityCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
payOrder := &model.WithdrawalRecord{
|
||||||
|
OrderID: "",
|
||||||
|
UserID: ctx.GetUserID(),
|
||||||
|
WithdrawalMoney: param.WithdrawalMoney,
|
||||||
|
ServiceCharge: 0,
|
||||||
|
PayMoney: 0,
|
||||||
|
AlipayAccount: param.AlipayAccount,
|
||||||
|
AlipayName: param.AlipayName,
|
||||||
|
AlipayOrderId: "",
|
||||||
|
OrderStatus: model.WithdrawalWaitRecord,
|
||||||
|
PayTime: time.Now(),
|
||||||
|
Remark: "",
|
||||||
|
Lng: param.Lng,
|
||||||
|
Lat: param.Lat,
|
||||||
|
CityCode: param.CityCode,
|
||||||
|
DistrictCode: param.DistrictCode,
|
||||||
|
}
|
||||||
|
dao.WrapAddIDCULDEntity(payOrder, ctx.GetUserName())
|
||||||
|
payOrder.OrderID = fmt.Sprintf("%d", time.Now().Unix()) + ctx.GetUserID()[:8]
|
||||||
|
|
||||||
|
// 核算手续费
|
||||||
|
if param.WithdrawalMoney < 100 {
|
||||||
|
payOrder.ServiceCharge = 0
|
||||||
|
payOrder.PayMoney = param.WithdrawalMoney
|
||||||
|
} else {
|
||||||
|
payOrder.ServiceCharge = utils.Float64TwoInt(float64(param.WithdrawalMoney) * (float64(place.DividePercentage) / float64(100)))
|
||||||
|
payOrder.PayMoney = param.WithdrawalMoney - payOrder.ServiceCharge
|
||||||
|
}
|
||||||
|
return dao.CreateEntity(dao.GetDB(), payOrder)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrder 删除申请订单
|
||||||
|
func DeleteOrder(userId string, id int) error {
|
||||||
|
order := model.WithdrawalRecord{}
|
||||||
|
if err := dao.GetRow(dao.GetDB(), &order, `SELECT * FROM withdrawal_record WHERE id = ? AND user_id = ?`, []interface{}{id, userId}...); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
order.DeletedAt = time.Now()
|
||||||
|
if _, err := dao.UpdateEntity(dao.GetDB(), &order, "DeletedAt"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderListByStatus 用户获取申请订单列表
|
||||||
|
func GetOrderListByStatus(userId string, status, pageSize, pageNum int) (map[string]interface{}, error) {
|
||||||
|
order := make([]*model.WithdrawalRecord, 0, 0)
|
||||||
|
params := make([]interface{}, 0, 0)
|
||||||
|
sql := `SELECT SQL_CALC_FOUND_ROWS * FROM withdrawal_record WHERE user_id = ? AND order_status = ? AND deleted_at = ?`
|
||||||
|
params = append(params, userId, status, utils.DefaultTimeValue)
|
||||||
|
sql += " ORDER BY a.created_at DESC"
|
||||||
|
sql += " LIMIT ? OFFSET ?"
|
||||||
|
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||||
|
params = append(params, pageSize, (pageNum-1)*pageSize)
|
||||||
|
|
||||||
|
db := dao.GetDB()
|
||||||
|
tx, _ := dao.Begin(db)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
panic(r)
|
||||||
|
}
|
||||||
|
dao.Commit(db, tx)
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := dao.GetRowsTx(tx, &order, sql, params...); err != nil {
|
||||||
|
dao.Rollback(db, tx)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make(map[string]interface{}, 2)
|
||||||
|
result["data"] = order
|
||||||
|
result["count"] = dao.GetLastTotalRowCountTx(tx)
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrderListParam struct {
|
||||||
|
PageSize int `json:"pageSize"`
|
||||||
|
PageNum int `json:"pageNum"`
|
||||||
|
UserId string `json:"userId"`
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
OrderId string `json:"orderId"`
|
||||||
|
Phone string `json:"phone"`
|
||||||
|
OrderStatus int `json:"orderStatus"`
|
||||||
|
StartTime string `json:"startTime"`
|
||||||
|
EndTime string `json:"endTime"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type WithdrawalListRes struct {
|
||||||
|
model.WithdrawalRecord
|
||||||
|
Name string `json:"name"`
|
||||||
|
Mobile string `json:"mobile"`
|
||||||
|
AccountBalance int `json:"accountBalance"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserWithdrawalList 管理系统获取提现申请列表
|
||||||
|
func GetUserWithdrawalList(param *OrderListParam) ([]*WithdrawalListRes, int, error) {
|
||||||
|
sql := `
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS w.* ,u.name,u.mobile,b.account_balance
|
||||||
|
FROM withdrawal_record w
|
||||||
|
LEFT JOIN user u ON w.user_id = u.user_id
|
||||||
|
LEFT JOIN user_bill b ON w.user_id = b.user_id
|
||||||
|
WHERE 1=1 AND w.deleted_at = ?
|
||||||
|
`
|
||||||
|
sqlParam := make([]interface{}, 0, 0)
|
||||||
|
sqlParam = append(sqlParam, utils.DefaultTimeValue)
|
||||||
|
result := make([]*WithdrawalListRes, 0, 0)
|
||||||
|
db := dao.GetDB()
|
||||||
|
tx, _ := dao.Begin(db)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
panic(r)
|
||||||
|
}
|
||||||
|
dao.Commit(db, tx)
|
||||||
|
}()
|
||||||
|
if param.OrderId != "" {
|
||||||
|
sql += ` AND w.order_id LIKE ? ORDER BY a.created_at DESC LIMIT ? OFFSET ?`
|
||||||
|
sqlParam = append(sqlParam, "%"+param.OrderId+"%", param.PageSize, (param.PageNum-1)*param.PageSize)
|
||||||
|
if err := dao.GetRowsTx(tx, &result, sql, sqlParam...); err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return result, dao.GetLastTotalRowCountTx(tx), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if param.UserId != "" {
|
||||||
|
sql += ` AND w.user_id LIKE ?`
|
||||||
|
sqlParam = append(sqlParam, "%"+param.UserId+"%")
|
||||||
|
}
|
||||||
|
if param.UserName != "" {
|
||||||
|
sql += ` AND u.name LIKE ?`
|
||||||
|
sqlParam = append(sqlParam, param.UserName)
|
||||||
|
}
|
||||||
|
if param.Phone != "" {
|
||||||
|
sql += ` AND u.mobile = ?`
|
||||||
|
sqlParam = append(sqlParam, param.Phone)
|
||||||
|
}
|
||||||
|
if param.OrderStatus != 0 {
|
||||||
|
sql += ` AND w.order_status = ?`
|
||||||
|
sqlParam = append(sqlParam, param.OrderStatus)
|
||||||
|
}
|
||||||
|
if param.StartTime != "" {
|
||||||
|
sql += ` AND w.created_at >= ? `
|
||||||
|
sqlParam = append(sqlParam, utils.Str2TimeWithDefault(param.StartTime, utils.DefaultTimeValue))
|
||||||
|
}
|
||||||
|
if param.EndTime != "" {
|
||||||
|
sql += ` AND w.created_at < ? `
|
||||||
|
sqlParam = append(sqlParam, utils.Str2TimeWithDefault(param.EndTime, utils.DefaultTimeValue))
|
||||||
|
}
|
||||||
|
sql += ` ORDER BY a.created_at DESC LIMIT ? OFFSET ?`
|
||||||
|
sqlParam = append(sqlParam, param.PageSize, (param.PageNum-1)*param.PageSize)
|
||||||
|
|
||||||
|
if err := dao.GetRowsTx(tx, &result, sql, sqlParam...); err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return result, dao.GetLastTotalRowCountTx(tx), nil
|
||||||
|
}
|
||||||
114
controllers/withdrawal_record.go
Normal file
114
controllers/withdrawal_record.go
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
package controllers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"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 /AddWWithdrawalRecord [post]
|
||||||
|
func (c *WithdrawalRecordController) AddWithdrawalRecord() {
|
||||||
|
c.callAddWWithdrawalRecord(func(params *tWithdrawalAddWWithdrawalRecordParams) (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(&withdreawal.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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
@@ -11,7 +11,7 @@ func Init() {
|
|||||||
// set default database
|
// set default database
|
||||||
orm.RegisterDataBase("default", "mysql", beego.AppConfig.String("dbConnectStr"))
|
orm.RegisterDataBase("default", "mysql", beego.AppConfig.String("dbConnectStr"))
|
||||||
//orm.RegisterDataBase("api", "mysql", "root:WebServer@1@tcp(gold1.jxc4.com:3306)/api?charset=utf8mb4&loc=Local&parseTime=true")
|
//orm.RegisterDataBase("api", "mysql", "root:WebServer@1@tcp(gold1.jxc4.com:3306)/api?charset=utf8mb4&loc=Local&parseTime=true")
|
||||||
//if beego.BConfig.RunMode == "rsm" {
|
if beego.BConfig.RunMode == "rsm" {
|
||||||
//用户
|
//用户
|
||||||
orm.RegisterModel(&model.AuthBind{}, &model.User{})
|
orm.RegisterModel(&model.AuthBind{}, &model.User{})
|
||||||
orm.RegisterModel(&model.UserMember{})
|
orm.RegisterModel(&model.UserMember{})
|
||||||
@@ -46,10 +46,9 @@ func Init() {
|
|||||||
orm.RegisterModel(&model.AddressDistinguish{})
|
orm.RegisterModel(&model.AddressDistinguish{})
|
||||||
orm.RegisterModel(&model.VendorMatterCategory{}) //平台物流分类(手动添的)
|
orm.RegisterModel(&model.VendorMatterCategory{}) //平台物流分类(手动添的)
|
||||||
orm.RegisterModel(&model.OrderPayRefund{}) // 退款表
|
orm.RegisterModel(&model.OrderPayRefund{}) // 退款表
|
||||||
|
orm.RegisterModel(&model.UserVendorOrder{}) // 物流订单
|
||||||
// 物流订单
|
orm.RegisterModel(&model.WithdrawalRecord{}) // 提现申请
|
||||||
orm.RegisterModel(&model.UserVendorOrder{})
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
//打印机
|
//打印机
|
||||||
orm.RegisterModel(&model.PrintMsg{})
|
orm.RegisterModel(&model.PrintMsg{})
|
||||||
|
|||||||
@@ -1087,4 +1087,13 @@ func init() {
|
|||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
// 提现申请
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:WithdrawalRecordController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:WithdrawalRecordController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "UpdateUserBalance",
|
||||||
|
Router: "/UpdateUserBalance",
|
||||||
|
AllowHTTPMethods: []string{"post"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,14 @@ func init() {
|
|||||||
&controllers.UserBalanceController{},
|
&controllers.UserBalanceController{},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// 提现申请
|
||||||
|
web.NSNamespace("/withdrawal",
|
||||||
|
web.NSInclude(
|
||||||
|
&controllers.WithdrawalRecordController{},
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
web.AddNamespace(ns)
|
web.AddNamespace(ns)
|
||||||
web.AutoRouter(&controllers.WXPayController{})
|
web.AutoRouter(&controllers.WXPayController{})
|
||||||
web.AutoRouter(&controllers.TongLianController{})
|
web.AutoRouter(&controllers.TongLianController{})
|
||||||
|
|||||||
Reference in New Issue
Block a user