aa
This commit is contained in:
@@ -150,3 +150,10 @@ func FinishedCashOrders(ctx *jxcontext.Context, orderIDs []string) (err error) {
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetPayStatistics(ctx *jxcontext.Context, userID string, pop int, cityCodes []int, mobile, fromTime, toTime string, consumeTypes []int) (getPayStatisticsResult *dao.GetPayStatisticsResult, err error) {
|
||||||
|
var (
|
||||||
|
db = dao.GetDB()
|
||||||
|
)
|
||||||
|
return dao.GetPayStatistics(db, userID, pop, cityCodes, mobile, utils.Str2Time(fromTime), utils.Str2Time(toTime), consumeTypes)
|
||||||
|
}
|
||||||
|
|||||||
@@ -177,3 +177,28 @@ func GetOrders(db *DaoDB, orderID, userID string, orderType int, cityCodes []int
|
|||||||
}
|
}
|
||||||
return pagedInfo, err
|
return pagedInfo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetPayStatisticsResult struct {
|
||||||
|
TotalPay int `json:"totalPay"` //支付总额
|
||||||
|
CanCash int `json:"canCash"` //可提现(未提现+申请提现)
|
||||||
|
AccountBalance int `json:"accountBalance"` //未提现(含保证金)
|
||||||
|
SubmitCash int `json:"submitCash"` //申请提现
|
||||||
|
Cashed int `json:"cashed"` //已经体现
|
||||||
|
TotalIncome int `json:"totalIncome"` //收益总额
|
||||||
|
MemberIncome int `json:"memberIncome"` //会员收益
|
||||||
|
CashIncome int `json:"cashIncome"` //提现收益
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile string, fromTime, toTime time.Time, consumeTypes []int) (getPayStatisticsResult *GetPayStatisticsResult, err error) {
|
||||||
|
sqlParams := []interface{}{}
|
||||||
|
sql := `
|
||||||
|
SELECT a.*
|
||||||
|
FROM user a
|
||||||
|
WHERE 1 = 1
|
||||||
|
`
|
||||||
|
if userID != "" {
|
||||||
|
sql += " AND a.user_id = ?"
|
||||||
|
sqlParams = append(sqlParams, userID)
|
||||||
|
}
|
||||||
|
return getPayStatisticsResult, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -175,11 +175,12 @@ func GetUsers2(db *DaoDB, keyword string, userID string, pop int, mobile string,
|
|||||||
WHERE a.status = 1 AND a.deleted_at = ?`
|
WHERE a.status = 1 AND a.deleted_at = ?`
|
||||||
sqlParams = append(sqlParams, utils.DefaultTimeValue)
|
sqlParams = append(sqlParams, utils.DefaultTimeValue)
|
||||||
if userID != "" {
|
if userID != "" {
|
||||||
sql += " AND a.user_id = ?"
|
|
||||||
sqlParams = append(sqlParams, userID)
|
|
||||||
if pop == 1 {
|
if pop == 1 {
|
||||||
sql += " AND a.pop_user = ?"
|
sql += " AND a.pop_user = ?"
|
||||||
sqlParams = append(sqlParams, userID)
|
sqlParams = append(sqlParams, userID)
|
||||||
|
} else {
|
||||||
|
sql += " AND a.user_id = ?"
|
||||||
|
sqlParams = append(sqlParams, userID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(cityCodes) > 0 {
|
if len(cityCodes) > 0 {
|
||||||
|
|||||||
@@ -101,3 +101,26 @@ func (c *OrderController) FinishedCashOrders() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 支付统计
|
||||||
|
// @Description 支付统计
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param userID query string false "用户id"
|
||||||
|
// @Param pop query int false "1为你邀请的,0为全部"
|
||||||
|
// @Param cityCodes query string false "城市id列表"
|
||||||
|
// @Param mobile query string false "用户手机,必须全匹配"
|
||||||
|
// @Param fromTime query string false "消费开始时间"
|
||||||
|
// @Param toTime query string false "消费结束时间"
|
||||||
|
// @Param consumeTypes query string false "1为发任务,2为冲会员,3为发快递"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /GetPayStatistics [get]
|
||||||
|
func (c *OrderController) GetPayStatistics() {
|
||||||
|
c.callGetPayStatistics(func(params *tOrderGetPayStatisticsParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
var cityCodes, consumeTypes []int
|
||||||
|
if err = jxutils.Strings2Objs(params.CityCodes, &cityCodes, params.ConsumeTypes, &consumeTypes); err == nil {
|
||||||
|
retVal, err = cms.GetPayStatistics(params.Ctx, params.UserID, params.Pop, cityCodes, params.Mobile, params.FromTime, params.ToTime, consumeTypes)
|
||||||
|
}
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user