From 8fcd186ed352c89dceba559f85b1c6de58e6d2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 2 Dec 2020 17:42:44 +0800 Subject: [PATCH] a --- business/jxstore/cms/user2.go | 3 +++ business/model/dao/dao_user.go | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/business/jxstore/cms/user2.go b/business/jxstore/cms/user2.go index b74b101c0..f8972ecd3 100644 --- a/business/jxstore/cms/user2.go +++ b/business/jxstore/cms/user2.go @@ -508,6 +508,9 @@ func GetSelfInfo(ctx *jxcontext.Context) (getSelfInfoResult *dao.GetSelfInfoResu if price, err := dao.GetUserAllWaitCashPrice(dao.GetDB(), getSelfInfoResult.User.UserID); err == nil { getSelfInfoResult.WaitCashPrice = price } + if price, err := dao.GetUserAllWaitRealCashPrice(dao.GetDB(), getSelfInfoResult.User.UserID); err == nil { + getSelfInfoResult.WaitRealCashPrice = price + } } } return getSelfInfoResult, err diff --git a/business/model/dao/dao_user.go b/business/model/dao/dao_user.go index ddd6fde60..1be9d2e5b 100644 --- a/business/model/dao/dao_user.go +++ b/business/model/dao/dao_user.go @@ -22,6 +22,7 @@ type GetSelfInfoResult struct { model.User model.UserBill WaitCashPrice int `json:"waitCashPrice"` + WaitRealCashPrice int `json:"waitRealCashPrice"` UserMembers []*model.UserMember `json:"userMembers"` PopedUserName string `json:"popedUserName"` UnReadMessageCount int `json:"unReadMessageCount"` @@ -272,3 +273,17 @@ func GetUserAllWaitCashPrice(db *DaoDB, userID string) (price int, err error) { err = GetRow(db, &result, sql, sqlParams) return result.Price, err } + +func GetUserAllWaitRealCashPrice(db *DaoDB, userID string) (price int, err error) { + var result = &GetUserAllWaitCashPriceResult{} + sql := ` + SELECT SUM(pay_price) price FROM order WHERE user_id = ? AND status = ? AND type = ? + ` + sqlParams := []interface{}{ + userID, + model.OrderStatusWait4Pay, + model.OrderTypeCash, + } + err = GetRow(db, &result, sql, sqlParams) + return result.Price, err +}