func (js *JobSubmit) submit() (submitId uint, err error) { if js.getJob() != nil { return } var jc models.JobSubmit jc.Job = js.job jc.Status = uint8(js.mapJob["Status"].(int)) jc.Remark = js.mapJob["Remark"].(string) jc.ProduceUser = js.user q := models.GetDB().QueryTable(models.TABLE_NAME_JOB).Filter("id", js.jobId) newData := orm.Params{ "submit_status": jc.Status, } var codeType uint8 = job.JobCode_NoneModify if jc.Status == models.Job_Submit_Wait_Acceptance { newData["submit_time"] = time.Now() if js.job.SubmitStatus == models.Job_Submit_Acceptance_Refuse { codeType = job.JobCode_ProduceModify } } else if jc.Status == models.Job_Submit_Acceptance_OK { newData["acceptance_time"] = time.Now() } newData["Code"] = job.NewJobCode(js.job.Code, js.user.Company.Code, codeType).GetCode() _, err = q.Update(newData) var insertId int64 insertId, err = models.GetDB().Insert(&jc) if err != nil { utils.GetLog().Debug("services.job.Submit : debug : jobSubmit=%s", utils.Sdump(jc)) return } submitId = uint(insertId) return }
func (js JobSubmit) GetTableName() string { j := models.JobSubmit{} return j.TableName() }