This commit is contained in:
苏尹岚
2021-01-04 18:16:30 +08:00
parent 78bb668fad
commit 007fdd7342
6 changed files with 255 additions and 1 deletions

View File

@@ -116,6 +116,9 @@ func PublishJob(ctx *jxcontext.Context, jobExt *model.JobExt) (errCode string, e
if job.FinishedAt.Sub(time.Now()) <= 0 {
return errCode, fmt.Errorf("任务截止日期必须大于今天!")
}
if job2, _ := dao.GetJobWithTitle(db, job.Title); job2 != nil {
return errCode, fmt.Errorf("任务标题重复,请重新输入!")
}
if job.JobCityCode != model.JobCountrywideCode {
_, _, job.JobCityCode, err = getAddressInfoFromCoord(db, job.JobLng, job.JobLat)
}

View File

@@ -158,3 +158,24 @@ func GetPayStatistics(ctx *jxcontext.Context, userID string, pop int, cityCodes
)
return dao.GetPayStatistics(db, userID, pop, cityCodes, mobile, utils.Str2Time(fromTime), utils.Str2Time(toTime), consumeTypes)
}
func GetManageStatisticsImg(ctx *jxcontext.Context, cityCodes []int, fromTime, toTime string, jobIDs []int) (getManageStatistics []*dao.GetManageStatisticsResult, err error) {
var (
db = dao.GetDB()
fromTimeT = utils.Str2Time(fromTime)
toTimeT = utils.Str2Time(toTime)
)
for i := 1; i < utils.Float64TwoInt(toTimeT.Sub(fromTimeT).Hours()/24); i++ {
if getManageStatisticsResult, err := dao.GetManageStatistics(db, cityCodes, fromTimeT.AddDate(0, 0, i), jobIDs); err == nil {
getManageStatistics = append(getManageStatistics, getManageStatisticsResult)
}
}
return getManageStatistics, err
}
func GetManageStatisticsJob(ctx *jxcontext.Context, cityCodes []int, fromTime, toTime string, jobIDs []int, offset, pageSize int) (paged *model.PagedInfo, err error) {
var (
db = dao.GetDB()
)
return dao.GetManageStatisticsJob(db, cityCodes, utils.Str2Time(fromTime), utils.Str2Time(toTime), jobIDs, offset, pageSize)
}