a
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user