This commit is contained in:
苏尹岚
2020-12-02 17:42:44 +08:00
parent 0f561dc394
commit 8fcd186ed3
2 changed files with 18 additions and 0 deletions

View File

@@ -508,6 +508,9 @@ func GetSelfInfo(ctx *jxcontext.Context) (getSelfInfoResult *dao.GetSelfInfoResu
if price, err := dao.GetUserAllWaitCashPrice(dao.GetDB(), getSelfInfoResult.User.UserID); err == nil { if price, err := dao.GetUserAllWaitCashPrice(dao.GetDB(), getSelfInfoResult.User.UserID); err == nil {
getSelfInfoResult.WaitCashPrice = price getSelfInfoResult.WaitCashPrice = price
} }
if price, err := dao.GetUserAllWaitRealCashPrice(dao.GetDB(), getSelfInfoResult.User.UserID); err == nil {
getSelfInfoResult.WaitRealCashPrice = price
}
} }
} }
return getSelfInfoResult, err return getSelfInfoResult, err

View File

@@ -22,6 +22,7 @@ type GetSelfInfoResult struct {
model.User model.User
model.UserBill model.UserBill
WaitCashPrice int `json:"waitCashPrice"` WaitCashPrice int `json:"waitCashPrice"`
WaitRealCashPrice int `json:"waitRealCashPrice"`
UserMembers []*model.UserMember `json:"userMembers"` UserMembers []*model.UserMember `json:"userMembers"`
PopedUserName string `json:"popedUserName"` PopedUserName string `json:"popedUserName"`
UnReadMessageCount int `json:"unReadMessageCount"` UnReadMessageCount int `json:"unReadMessageCount"`
@@ -272,3 +273,17 @@ func GetUserAllWaitCashPrice(db *DaoDB, userID string) (price int, err error) {
err = GetRow(db, &result, sql, sqlParams) err = GetRow(db, &result, sql, sqlParams)
return result.Price, err 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
}