This commit is contained in:
lwl0608 2024-01-04 18:10:19 +08:00
parent 5050e01352
commit ac91201240
5 changed files with 77 additions and 1 deletions

View File

@ -9,3 +9,23 @@ type OpCreateOrderReq struct {
}
type OpCreateOrderData struct{}
// 获取订单列表
type OpOrderListReq struct {
Mid int64 `json:"mid"` // 用户mid
UserName int64 `json:"user_name"` // 用户昵称
St int64 `json:"st"` // 开始时间戳
Et int64 `json:"et"` // 结束时间戳
OrderStatus int32 `json:"order_status"` // 订单状态
Offset int `json:"offset"`
Limit int `json:"limit"`
}
type OpOrderVO struct {
}
type OpOrderListData struct {
List []*OpOrderVO `json:"list"`
Offset int `json:"offset"`
More int `json:"more"`
}

View File

@ -0,0 +1,21 @@
package controller
import (
"github.com/gin-gonic/gin"
"service/api/errcode"
vasproto "service/api/proto/vas/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
)
func OpOrderList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*vasproto.OpOrderListReq)
data, ec := service.DefaultService.H5DirectUnlockWechat(ctx, req)
if ec != errcode.ErrCodeVasSrvOk {
logger.Error("H5DirectUnlockWechat fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, data)
}

View File

@ -1,6 +1,7 @@
package dao
import (
"database/sql"
"errors"
"fmt"
"service/app/mix/conf"
@ -177,6 +178,29 @@ func (m *Mysql) GetOrderByIdForUpdate(ctx *gin.Context, tx *sqlx.Tx, id string)
return
}
// op 获取订单
func (m *Mysql) GetOrdersByMid(ctx *gin.Context, tx *sqlx.Tx, mid int64, offset, limit int, status int32) (list []*dbstruct.Order, err error) {
list = make([]*dbstruct.Order, 0)
sqlStr := fmt.Sprintf("select * from %s where mid=? limit ? offset ?", TableOrder)
if status > dbstruct.VasOrderStatusNone {
sqlStr = fmt.Sprintf("select * from %s where mid=? and status=%d limit ? offset ?", TableOrder, status)
}
if tx != nil {
err = tx.SelectContext(ctx, &list, sqlStr, mid, limit, offset)
} else {
db := m.getDBVas()
err = db.SelectContext(ctx, &list, sqlStr, mid, limit, offset)
}
if err == sql.ErrNoRows {
err = nil
return
}
if err != nil {
return
}
return
}
// 更新订单状态
func (m *Mysql) UpdateOrderStatus(ctx *gin.Context, tx *sqlx.Tx, orderId string, preStatus, aftStatus int32) error {
var err error

View File

@ -0,0 +1,11 @@
package logic
import (
"github.com/gin-gonic/gin"
"service/dbstruct"
)
// 获取订单
func (v *Vas) GetOrders(ctx *gin.Context, mid int64) (*dbstruct.CoinOrder, error) {
return v.store.GetCoinOrderById(ctx, nil, id)
}

View File

@ -29,7 +29,7 @@ CREATE TABLE `vas_order`
PRIMARY KEY (`id`)
);
CREATE INDEX out_order_id ON vas_order (out_order_id);
CREATE INDEX ct_status ON vas_order (ct, order_status);
CREATE TABLE `vas_wallet`
(