This commit is contained in:
苏尹岚
2020-12-23 11:35:36 +08:00
parent 35d3330f9d
commit 25671ad532
3 changed files with 55 additions and 34 deletions

View File

@@ -61,12 +61,23 @@ func PublishJob(ctx *jxcontext.Context, jobExt *model.JobExt) (errCode string, e
finishedAt = utils.Str2Time(jobExt.FinishedAtStr)
job.FinishedAt = &finishedAt
// 需根据任务类型做一些参数判断,比如门店商品链接,地址
if job.AvgPrice == 0 {
return errCode, fmt.Errorf("请输入单个任务奖励(保证)金额!")
}
switch job.JobCategoryID {
case model.JobCategoryIDwmtg:
if job.Address == "" {
return errCode, fmt.Errorf("外卖推广任务请输入门店地址!")
}
case model.JobCategoryIDOther:
case model.JobCategoryIDDropShipping:
if job.DropShippingAt == 0 {
return errCode, fmt.Errorf("一件代发任务请输入承诺x天内发货")
}
if job.DropShippingSkuPrice == 0 {
return errCode, fmt.Errorf("一件代发任务请输入商品价格!")
}
job.CashbackType = model.JobCashbackPrice
default:
return errCode, fmt.Errorf("暂不支持的任务类型! %v", job.JobCategoryID)
}

View File

@@ -73,6 +73,13 @@ func GetJobs(db *DaoDB, userIDs []string, categoryIDs, statuss, vendorIDs, types
WHERE a.deleted_at = ?
AND (a.job_city_code = ? OR a.job_city_code = ?)
`
if cityCode == 0 {
if len(cityCodes) > 0 {
cityCode = cityCodes[0]
} else {
cityCode = 510100
}
}
sqlParams = append(sqlParams, lng, lat, utils.DefaultTimeValue, utils.DefaultTimeValue, cityCode, model.JobCountrywideCode)
if len(userIDs) > 0 {
sql += ` AND a.user_id IN (` + GenQuestionMarks(len(userIDs)) + `)`

View File

@@ -36,6 +36,7 @@ const (
JobCategoryIDwmtg = 3 //任务类型外卖推广
JobCategoryIDOther = 4 //其他任务类型
JobCategoryIDDropShipping = 5 //一件代发
JobSpanTop = 1 //置顶
JobSpanRecommend = 2 //推荐
@@ -84,6 +85,7 @@ type Job struct {
Count int `json:"count"` //任务数量
SurplusCount int `json:"surplusCount"` //剩余数量
AvgPrice int `json:"avgPrice"` //单个任务金额或预估金额
DropShippingSkuPrice int `json:"dropShippingSkuPrice"` //一件代发任务商品价格
Percentage int `json:"percentage"` //如果是比例返现,返现比例
CashbackType int `json:"cashbackType"` //返现方式1为固定返现2为比例返现
TotalPrice int `json:"totalPrice"` //任务总金额
@@ -94,6 +96,7 @@ type Job struct {
JobLng float64 `json:"jobLng"` //任务发布地址
JobLat float64 `json:"jobLat"` //任务发布地址
JobCityCode int `json:"jobCityCode"` //任务所属城市,999代表全国
DropShippingAt int `json:"dropShippingAt"` //承诺一件代发几天内发货,小时数
JobLimitAt int `json:"jobLimitAt"` //任务限时完成小时数
AuditLimitAt int `json:"auditLimitAt"` //任务审核限时小时数
FinishedAt *time.Time `orm:"null" json:"finishedAt"` //接单截止日期