This commit is contained in:
苏尹岚
2021-04-21 16:04:08 +08:00
parent e80007e3ea
commit 5c825f44df
3 changed files with 21 additions and 3 deletions

View File

@@ -236,7 +236,7 @@ func CancelPublishJob(ctx *jxcontext.Context, jobID int) (err error) {
if job.CashbackType == model.JobCashbackPrice {
price = job.SurplusCount * job.AvgPrice
} else {
if billIncomes, err := dao.GetBillIncome(db, jobID); err == nil {
if billIncomes, err := dao.GetBillIncome(db, jobID, 0); err == nil {
for _, v := range billIncomes {
price += v.IncomePrice
}
@@ -912,7 +912,7 @@ func RefreshJobStatus(ctx *jxcontext.Context) (err error) {
if job.CashbackType == model.JobCashbackPrice {
price = job.SurplusCount * job.AvgPrice
} else {
if billIncomes, err := dao.GetBillIncome(db, job.ID); err == nil {
if billIncomes, err := dao.GetBillIncome(db, job.ID, 0); err == nil {
for _, v := range billIncomes {
price += v.IncomePrice
}
@@ -2003,5 +2003,18 @@ func GetUnionJobOrderInfo(ctx *jxcontext.Context, jobOrderID int) (getUnionJobOr
if job.JobCategoryID != model.JobCategoryIDUnion {
return nil, fmt.Errorf("只允许联盟任务才能查看!")
}
userBill, err := dao.GetUserBill(db, jobOrder.UserID, "")
if err != nil {
return nil, err
}
incomes, err := dao.GetBillIncome(db, job.ID, userBill.BillID)
if err != nil {
return nil, err
}
incomeTotal := 0
for _, v := range incomes {
incomeTotal += v.IncomePrice
}
getUnionJobOrderInfoResult.IncomePrice = incomeTotal
return getUnionJobOrderInfoResult, err
}

View File

@@ -53,7 +53,7 @@ func GetBillExpend(db *DaoDB, userID string, billType int, fromTime, toTime time
return billExpends, err
}
func GetBillIncome(db *DaoDB, jobID int) (billIncomes []*model.BillIncome, err error) {
func GetBillIncome(db *DaoDB, jobID int, billID int64) (billIncomes []*model.BillIncome, err error) {
sql := `
SELECT b.*
FROM user_bill a
@@ -65,6 +65,10 @@ func GetBillIncome(db *DaoDB, jobID int) (billIncomes []*model.BillIncome, err e
sql += ` AND b.job_id = ?`
sqlParams = append(sqlParams, jobID)
}
if billID != 0 {
sql += ` AND b.bill_id = ?`
sqlParams = append(sqlParams, billID)
}
err = GetRows(db, &billIncomes, sql, sqlParams)
return billIncomes, err
}

View File

@@ -590,6 +590,7 @@ func (c *JobController) ShareUnionLink() {
// @router /GetUnionJobOrderInfo [get]
func (c *JobController) GetUnionJobOrderInfo() {
c.callGetUnionJobOrderInfo(func(params *tJobGetUnionJobOrderInfoParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetUnionJobOrderInfo(params.Ctx, params.JobOrderID)
return retVal, "", err
})
}