fabu renwu
This commit is contained in:
@@ -26,7 +26,7 @@ func PublishJob(ctx *jxcontext.Context, job *model.Job) (err error) {
|
||||
if job.Count <= 0 {
|
||||
return fmt.Errorf("任务数量不能为0!")
|
||||
}
|
||||
if job.Address != "" {
|
||||
if job.Address != "" && (job.Lng == 0 || job.Lat == 0) {
|
||||
lng, lat, err := api.AutonaviAPI.GetCoordinateFromAddressByPage(job.Address)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -45,6 +45,11 @@ func PublishJob(ctx *jxcontext.Context, job *model.Job) (err error) {
|
||||
}
|
||||
}()
|
||||
err = dao.CreateEntity(db, job)
|
||||
for _, v := range job.JobSteps {
|
||||
dao.WrapAddIDCULEntity(v, ctx.GetUserName())
|
||||
v.JobID = job.ID
|
||||
err = dao.CreateEntity(db, v)
|
||||
}
|
||||
if err != nil {
|
||||
dao.Rollback(db)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user