aa
This commit is contained in:
@@ -217,13 +217,13 @@ func CancelPublishJob(ctx *jxcontext.Context, jobID int) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func GetJobs(ctx *jxcontext.Context, userIDs []string, categoryIDs, statuss, vendorIDs []int, includeStep bool, fromTime, toTime string, lng, lat float64, span int, keyword string, sortType, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
|
||||
func GetJobs(ctx *jxcontext.Context, userIDs []string, categoryIDs, statuss, vendorIDs, cityCodes []int, includeStep bool, fromTime, toTime string, lng, lat float64, span int, keyword string, sortType, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
userID = ctx.GetUserID()
|
||||
_, _, cityCode, _ = getAddressInfoFromCoord(db, lng, lat)
|
||||
)
|
||||
pagedInfo, err = dao.GetJobs(db, userIDs, categoryIDs, statuss, vendorIDs, []int{model.JobTypeNormal}, includeStep, utils.Str2Time(fromTime), utils.Str2Time(toTime), lng, lat, cityCode, span, keyword, sortType, pageSize, offset)
|
||||
pagedInfo, err = dao.GetJobs(db, userIDs, categoryIDs, statuss, vendorIDs, []int{model.JobTypeNormal}, cityCodes, includeStep, utils.Str2Time(fromTime), utils.Str2Time(toTime), lng, lat, cityCode, span, keyword, sortType, pageSize, offset)
|
||||
//插入用户搜索关键词
|
||||
if keyword != "" {
|
||||
if userSearchs, _ := dao.GetUserSearch(db, userID, keyword); len(userSearchs) > 0 {
|
||||
|
||||
@@ -61,7 +61,7 @@ func GetJobImgs(db *DaoDB, jobID int) (jobImgs []*model.JobImg, err error) {
|
||||
return jobImgs, err
|
||||
}
|
||||
|
||||
func GetJobs(db *DaoDB, userIDs []string, categoryIDs, statuss, vendorIDs, types []int, includeStep bool, fromTime, toTime time.Time, lng, lat float64, cityCode, span int, keyword string, sortType, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
|
||||
func GetJobs(db *DaoDB, userIDs []string, categoryIDs, statuss, vendorIDs, types, cityCodes []int, includeStep bool, fromTime, toTime time.Time, lng, lat float64, cityCode, span int, keyword string, sortType, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
|
||||
var (
|
||||
jobs []*GetJobsResult
|
||||
sqlParams = []interface{}{}
|
||||
@@ -94,6 +94,10 @@ func GetJobs(db *DaoDB, userIDs []string, categoryIDs, statuss, vendorIDs, types
|
||||
sql += ` AND a.type IN (` + GenQuestionMarks(len(types)) + `)`
|
||||
sqlParams = append(sqlParams, types)
|
||||
}
|
||||
if len(cityCodes) > 0 {
|
||||
sql += ` AND a.job_city_code IN (` + GenQuestionMarks(len(cityCodes)) + `)`
|
||||
sqlParams = append(sqlParams, cityCodes)
|
||||
}
|
||||
if fromTime != utils.ZeroTimeValue {
|
||||
sql += ` AND a.created_at >= ?`
|
||||
sqlParams = append(sqlParams, fromTime)
|
||||
|
||||
@@ -68,6 +68,7 @@ func (c *JobController) GetJobCategories() {
|
||||
// @Param categoryIDs query string false "分类IDs"
|
||||
// @Param statuss query string false "状态s"
|
||||
// @Param vendorIDs query string false "平台IDs"
|
||||
// @Param cityCodes query string false "CityIDs"
|
||||
// @Param includeStep query bool false "是否查询步骤,默认否"
|
||||
// @Param fromTime query string false "开始时间"
|
||||
// @Param toTime query string false "结束时间"
|
||||
@@ -84,11 +85,11 @@ func (c *JobController) GetJobCategories() {
|
||||
func (c *JobController) GetJobs() {
|
||||
c.callGetJobs(func(params *tJobGetJobsParams) (retVal interface{}, errCode string, err error) {
|
||||
var (
|
||||
userIDs []string
|
||||
categoryIDs, statuss, vendorIDs []int
|
||||
userIDs []string
|
||||
categoryIDs, statuss, vendorIDs, cityCodes []int
|
||||
)
|
||||
if err = jxutils.Strings2Objs(params.UserIDs, &userIDs, params.CategoryIDs, &categoryIDs, params.Statuss, &statuss, params.VendorIDs, &vendorIDs); err == nil {
|
||||
retVal, err = cms.GetJobs(params.Ctx, userIDs, categoryIDs, statuss, vendorIDs, params.IncludeStep, params.FromTime, params.ToTime, params.Lng, params.Lat, params.Span, params.Keyword, params.SortType, params.PageSize, params.Offset)
|
||||
if err = jxutils.Strings2Objs(params.UserIDs, &userIDs, params.CategoryIDs, &categoryIDs, params.Statuss, &statuss, params.VendorIDs, &vendorIDs, params.CityCodes, &cityCodes); err == nil {
|
||||
retVal, err = cms.GetJobs(params.Ctx, userIDs, categoryIDs, statuss, vendorIDs, cityCodes, params.IncludeStep, params.FromTime, params.ToTime, params.Lng, params.Lat, params.Span, params.Keyword, params.SortType, params.PageSize, params.Offset)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user