aa
This commit is contained in:
@@ -1575,7 +1575,6 @@ func UpdateJob(ctx *jxcontext.Context, payload map[string]interface{}) (err erro
|
|||||||
job.ID = jobExt.ID
|
job.ID = jobExt.ID
|
||||||
dao.GetEntity(db, job)
|
dao.GetEntity(db, job)
|
||||||
valid := dao.StrictMakeMapByStructObject(payload, job, ctx.GetUserName())
|
valid := dao.StrictMakeMapByStructObject(payload, job, ctx.GetUserName())
|
||||||
fmt.Println("valid,,,,,,,,,,,,,,,,,,,,,,,,,,", utils.Format4Output(valid, false))
|
|
||||||
if len(valid) > 0 {
|
if len(valid) > 0 {
|
||||||
dao.Begin(db)
|
dao.Begin(db)
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|||||||
@@ -190,9 +190,7 @@ type GetPayStatisticsResult struct {
|
|||||||
MemberIncome int `json:"memberIncome"` //会员收益
|
MemberIncome int `json:"memberIncome"` //会员收益
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile string, fromTime, toTime time.Time, orderTypes []int) (getPayStatisticsResult *GetPayStatisticsResult, err error) {
|
func getWhereSql(sqlP []interface{}, fromTime, toTime time.Time, orderTypes []int) (sql string) {
|
||||||
var sqlParams []interface{}
|
|
||||||
getWhereSql := func(sqlP []interface{}) (sql string) {
|
|
||||||
if len(orderTypes) > 0 {
|
if len(orderTypes) > 0 {
|
||||||
sql += ` AND b.order_type IN ` + GenQuestionMarks(len(orderTypes)) + `)`
|
sql += ` AND b.order_type IN ` + GenQuestionMarks(len(orderTypes)) + `)`
|
||||||
sqlP = append(sqlP, orderTypes)
|
sqlP = append(sqlP, orderTypes)
|
||||||
@@ -206,12 +204,13 @@ func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile
|
|||||||
sqlP = append(sqlP, toTime)
|
sqlP = append(sqlP, toTime)
|
||||||
}
|
}
|
||||||
return sql
|
return sql
|
||||||
}
|
}
|
||||||
getFromSql := func(sqlP []interface{}, orderType, status int, alies string) (sql string) {
|
|
||||||
|
func getFromSql(sqlP []interface{}, orderType, status int, alies string, userID string, pop int, cityCodes []int, mobile string, fromTime, toTime time.Time, orderTypes []int) (sql string) {
|
||||||
sql += `
|
sql += `
|
||||||
(SELECT SUM(IFNULL(b.pay_price,0)) total_pay
|
(SELECT SUM(IFNULL(b.pay_price,0)) total_pay
|
||||||
FROM user a
|
FROM user a
|
||||||
JOIN ` + "`order` b " + `ON b.user_id = a.user_id AND b.type = ? AND b.status = ? ` + getWhereSql(sqlP) + `
|
JOIN ` + "`order` b " + `ON b.user_id = a.user_id AND b.type = ? AND b.status = ? ` + getWhereSql(sqlP, fromTime, toTime, orderTypes) + `
|
||||||
`
|
`
|
||||||
sqlP = append(sqlP, orderType, status)
|
sqlP = append(sqlP, orderType, status)
|
||||||
if mobile != "" {
|
if mobile != "" {
|
||||||
@@ -244,12 +243,15 @@ func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile
|
|||||||
}
|
}
|
||||||
sql += `) ` + alies
|
sql += `) ` + alies
|
||||||
return sql
|
return sql
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetPayStatistics(db *DaoDB, userID string, pop int, cityCodes []int, mobile string, fromTime, toTime time.Time, orderTypes []int) (getPayStatisticsResult *GetPayStatisticsResult, err error) {
|
||||||
|
var sqlParams []interface{}
|
||||||
sql := `SELECT t1.total_pay, t2.total_pay submit_cash, t3.total_pay cashed, t4.account_balance, t4.account_balance + t2.total_pay can_cash, t3.total_pay / 10 cash_income
|
sql := `SELECT t1.total_pay, t2.total_pay submit_cash, t3.total_pay cashed, t4.account_balance, t4.account_balance + t2.total_pay can_cash, t3.total_pay / 10 cash_income
|
||||||
FROM `
|
FROM `
|
||||||
sql += getFromSql(sqlParams, model.OrderTypePay, model.OrderStatusFinished, "t1") + ","
|
sql += getFromSql(sqlParams, model.OrderTypePay, model.OrderStatusFinished, "t1", userID, pop, cityCodes, mobile, fromTime, toTime, orderTypes) + ","
|
||||||
sql += getFromSql(sqlParams, model.OrderTypeCash, model.OrderStatusWait4Pay, "t2") + ","
|
sql += getFromSql(sqlParams, model.OrderTypeCash, model.OrderStatusWait4Pay, "t2", userID, pop, cityCodes, mobile, fromTime, toTime, orderTypes) + ","
|
||||||
sql += getFromSql(sqlParams, model.OrderTypeCash, model.OrderStatusFinished, "t3") + ","
|
sql += getFromSql(sqlParams, model.OrderTypeCash, model.OrderStatusFinished, "t3", userID, pop, cityCodes, mobile, fromTime, toTime, orderTypes) + ","
|
||||||
sql += `(SELECT SUM(IFNULL(b.account_balance,0)) account_balacne
|
sql += `(SELECT SUM(IFNULL(b.account_balance,0)) account_balacne
|
||||||
FROM user a
|
FROM user a
|
||||||
JOIN user_bill b ON a.user_id = b.user_id
|
JOIN user_bill b ON a.user_id = b.user_id
|
||||||
|
|||||||
Reference in New Issue
Block a user