diff --git a/business/jxstore/cms/job.go b/business/jxstore/cms/job.go index c3f1bb444..db4d27e1f 100644 --- a/business/jxstore/cms/job.go +++ b/business/jxstore/cms/job.go @@ -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) } diff --git a/business/model/dao/dao_job.go b/business/model/dao/dao_job.go index 5c4ee3b5c..3d0b617c8 100644 --- a/business/model/dao/dao_job.go +++ b/business/model/dao/dao_job.go @@ -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)) + `)` diff --git a/business/model/job.go b/business/model/job.go index 037e16370..c13513ca6 100644 --- a/business/model/job.go +++ b/business/model/job.go @@ -34,8 +34,9 @@ const ( JobCashbackPrice = 1 //返现类型固定返现 JobCashbackPercentage = 2 //返现类型比例返现 - JobCategoryIDwmtg = 3 //任务类型外卖推广 - JobCategoryIDOther = 4 //其他任务类型 + JobCategoryIDwmtg = 3 //任务类型外卖推广 + JobCategoryIDOther = 4 //其他任务类型 + JobCategoryIDDropShipping = 5 //一件代发 JobSpanTop = 1 //置顶 JobSpanRecommend = 2 //推荐 @@ -73,38 +74,40 @@ var ( type Job struct { ModelIDCULD - UserID string `orm:"column(user_id)" json:"userID"` //发布人ID - JobCategoryID int `orm:"column(job_category_id)" json:"jobCategoryID"` //任务类型 - JobSpanTop int `json:"jobSpanTop"` //置顶标签 - TopSeq int `json:"topSeq"` //置顶顺序 - JobSpanRecmd int `json:"jobSpanRecmd"` //推荐标签 - RecmdSeq int `json:"recmdSeq"` //推荐顺序 - Title string `orm:"size(255)" json:"title"` //任务标题 - Content string `orm:"size(500)" json:"content"` //任务内容 - Count int `json:"count"` //任务数量 - SurplusCount int `json:"surplusCount"` //剩余数量 - AvgPrice int `json:"avgPrice"` //单个任务金额或预估金额 - Percentage int `json:"percentage"` //如果是比例返现,返现比例 - CashbackType int `json:"cashbackType"` //返现方式,1为固定返现,2为比例返现 - TotalPrice int `json:"totalPrice"` //任务总金额 - Status int `json:"status"` //任务状态 - Address string `orm:"size(500)" json:"address"` //门店地址 - Lng int `json:"lng"` //乘了10的6次方 - Lat int `json:"lat"` //乘了10的6次方 - JobLng float64 `json:"jobLng"` //任务发布地址 - JobLat float64 `json:"jobLat"` //任务发布地址 - JobCityCode int `json:"jobCityCode"` //任务所属城市,999代表全国 - JobLimitAt int `json:"jobLimitAt"` //任务限时完成小时数 - AuditLimitAt int `json:"auditLimitAt"` //任务审核限时小时数 - FinishedAt *time.Time `orm:"null" json:"finishedAt"` //接单截止日期 - LimitCountType int `json:"limitCountType"` //任务限次类型,1为每人一次,2为每人每天一次,3为每人每周一次,4为不限制 - VendorID int `orm:"column(vendor_id)" json:"vendorID"` //推广平台 - StoreURL string `orm:"column(store_url)" json:"storeURL"` //门店链接 - SkuURL string `orm:"column(sku_url)" json:"skuURL"` //商品优惠券链接 - Type int `json:"type"` //任务类型,0为普通任务,1为特殊任务 - BrowseCount int `json:"browseCount"` //任务浏览量,点一下加一下 - JobSteps []*JobStep `orm:"-" json:"jobSteps"` - JobImgs []*JobImg `orm:"-" json:"jobImgs"` + UserID string `orm:"column(user_id)" json:"userID"` //发布人ID + JobCategoryID int `orm:"column(job_category_id)" json:"jobCategoryID"` //任务类型 + JobSpanTop int `json:"jobSpanTop"` //置顶标签 + TopSeq int `json:"topSeq"` //置顶顺序 + JobSpanRecmd int `json:"jobSpanRecmd"` //推荐标签 + RecmdSeq int `json:"recmdSeq"` //推荐顺序 + Title string `orm:"size(255)" json:"title"` //任务标题 + Content string `orm:"size(500)" json:"content"` //任务内容 + 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"` //任务总金额 + Status int `json:"status"` //任务状态 + Address string `orm:"size(500)" json:"address"` //门店地址 + Lng int `json:"lng"` //乘了10的6次方 + Lat int `json:"lat"` //乘了10的6次方 + 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"` //接单截止日期 + LimitCountType int `json:"limitCountType"` //任务限次类型,1为每人一次,2为每人每天一次,3为每人每周一次,4为不限制 + VendorID int `orm:"column(vendor_id)" json:"vendorID"` //推广平台 + StoreURL string `orm:"column(store_url)" json:"storeURL"` //门店链接 + SkuURL string `orm:"column(sku_url)" json:"skuURL"` //商品优惠券链接 + Type int `json:"type"` //任务类型,0为普通任务,1为特殊任务 + BrowseCount int `json:"browseCount"` //任务浏览量,点一下加一下 + JobSteps []*JobStep `orm:"-" json:"jobSteps"` + JobImgs []*JobImg `orm:"-" json:"jobImgs"` } func (v *Job) TableIndex() [][]string {