This commit is contained in:
lwl0608 2024-06-24 16:01:26 +08:00
commit 5f86fc08bb
6 changed files with 87 additions and 21 deletions

View File

@ -1,5 +1,7 @@
package proto
import "service/dbstruct"
// op创建订单
type OpCreateOrderReq struct {
Mid int64 `json:"mid"`
@ -101,19 +103,20 @@ type OpOrderListReq struct {
}
type OpOrderVO struct {
Mid int64 `json:"mid"`
UserUserId int64 `json:"user_user_id"`
Uid int64 `json:"uid"`
StreamerUserId int64 `json:"streamer_user_id"`
OrderId string `json:"order_id"`
OrderStatus int32 `json:"order_status"`
OrderStatusDesc string `json:"order_status_desc"`
Coins int64 `json:"coins"`
Money int64 `json:"money"`
Ct int64 `json:"ct"`
ProductName string `json:"product_name"`
RefundType string `json:"refund_type"`
PayType string `json:"pay_type"`
Mid int64 `json:"mid"`
UserUserId int64 `json:"user_user_id"`
Uid int64 `json:"uid"`
StreamerUserId int64 `json:"streamer_user_id"`
OrderId string `json:"order_id"`
OrderStatus int32 `json:"order_status"`
OrderStatusDesc string `json:"order_status_desc"`
Coins int64 `json:"coins"`
Money int64 `json:"money"`
Ct int64 `json:"ct"`
ProductName string `json:"product_name"`
RefundType string `json:"refund_type"`
PayType string `json:"pay_type"`
ZoneMoment *dbstruct.ZoneMoment `json:"zone_moment"`
}
type OpOrderListData struct {

View File

@ -298,3 +298,32 @@ type ZoneMomentOrderListData struct {
Offset int `json:"offset"`
More int `json:"more"`
}
// 收入页面
type IncomePageReq struct {
base.BaseRequest
}
type WeekDashboardSt struct {
Date string `json:"date"` // 日期 x轴
Income int64 `json:"income"` // 收入 y轴
}
type IncomeFromDashboardSt struct {
Desc string `json:"desc"` // 描述
Income int64 `json:"income"` // 收入
}
type IncomePageData struct {
Diamonds int64 `json:"diamonds"` // 当前钻石
WithdrawDiamonds int64 `json:"withdraw_diamonds"` // 待提现钻石
TodayIncome int64 `json:"today_income"` // 今日收益钻石
WaitDealIncome int64 `json:"wait_deal_income"` // 待结算钻石
WeekDashboard []WeekDashboardSt `json:"week_dashboard"` // 周收益看板
IncomeFromDashboard []IncomeFromDashboardSt `json:"income_from_dashboard"` // 收益来源看板
}
type IncomePageResp struct {
base.BaseResponse
Data *IncomePageData `json:"data"`
}

View File

@ -89,6 +89,7 @@ func Init(r *gin.Engine) {
vasPayGroup.POST("deal_one_coin_order", middleware.JSONParamValidator(vasproto.DealOneCoinOrderReq{}), middleware.JwtAuthenticator(), DealOneCoinOrder)
vasPayGroup.POST("deal_one_order", middleware.JSONParamValidator(vasproto.DealOneOrderReq{}), DealOneOrder)
vasPayGroup.POST("moment_order_list", middleware.JSONParamValidator(vasproto.ZoneMomentOrderListReq{}), ZoneMomentOrderList)
//vasPayGroup.POST("income_page", middleware.JSONParamValidator(vasproto.IncomePageReq{}), nil)
// 验证码
apiVeriCodeGroup := r.Group("/api/veri_code", PrepareToC())

View File

@ -4154,6 +4154,23 @@ func (m *Mongo) GetZoneMomentById(ctx *gin.Context, id int64) (*dbstruct.ZoneMom
return zonemoment, err
}
func (m *Mongo) GetZoneMomentByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.ZoneMoment, error) {
list := make([]*dbstruct.ZoneMoment, 0)
col := m.getColZoneMoment()
query := qmgo.M{
"_id": qmgo.M{
"$in": ids,
},
"del_flag": 0,
}
err := col.Find(ctx, query).All(&list)
if err == qmgo.ErrNoSuchDocuments {
err = nil
return list, err
}
return list, err
}
func (m *Mongo) GetZoneMomentListByZidsOrMid(ctx *gin.Context, req *zonemomentproto.OpListByZidsOrMidReq) ([]*dbstruct.ZoneMoment, error) {
list := make([]*dbstruct.ZoneMoment, 0)
col := m.getColZoneMoment()

View File

@ -82,6 +82,20 @@ func (p *ZoneMoment) GetById(ctx *gin.Context, id int64) (*dbstruct.ZoneMoment,
return zonemoment, nil
}
func (p *ZoneMoment) GetMapById(ctx *gin.Context, ids []int64) (map[int64]*dbstruct.ZoneMoment, error) {
m := make(map[int64]*dbstruct.ZoneMoment)
list, err := p.store.GetZoneMomentByIds(ctx, ids)
if err != nil {
logger.Error("GetZoneMomentByIds fail, err: %v", err)
return m, err
}
for _, v := range list {
m[v.GetId()] = v
}
return m, nil
}
func (p *ZoneMoment) OpListByZidsOrMid(ctx *gin.Context, req *zonemomentproto.OpListByZidsOrMidReq) ([]*dbstruct.ZoneMoment, error) {
list, err := p.store.GetZoneMomentListByZidsOrMid(ctx, req)
if err != nil {

View File

@ -708,21 +708,20 @@ func (s *Service) OpOrderList(ctx *gin.Context, req *vasproto.OpOrderListReq) (l
// 获取用户信息
mids := make([]int64, 0)
productIdMap := make(map[string]struct{})
for _, co := range orders {
mids = append(mids, co.GetMid())
mids = append(mids, co.GetUid())
productIdMap[co.GetProductId()] = struct{}{}
}
acntMap, _ := _DefaultAccount.GetAccountMapByMids(ctx, mids)
// 获取商品
productIds := make([]string, 0)
for id := range productIdMap {
productIds = append(productIds, id)
// 获取空间动态信息
momentIds := make([]int64, 0)
for _, o := range orders {
if o.GetProductId() == dbstruct.ProductIdH5ZoneMoment {
momentIds = append(momentIds, o.GetMomentId())
}
}
productMap, _ := _DefaultVas.GetProductMapByIds(ctx, productIds)
logger.Info("GetProductMapByIds, ids: %v, map: %v", productIds, util.ToJson(productMap))
zmMap, _ := _DefaultZoneMoment.GetMapById(ctx, momentIds)
// 组装
for _, o := range orders {
@ -756,6 +755,9 @@ func (s *Service) OpOrderList(ctx *gin.Context, req *vasproto.OpOrderListReq) (l
item.Coins = o.GetPayAmount()
item.Money = 0
}
if o.GetProductId() == dbstruct.ProductIdH5ZoneMoment {
item.ZoneMoment = zmMap[o.GetMomentId()]
}
list = append(list, item)
}
return