Example #1
0
func AddHistory(j *models.Job, user *models.User, isCreate bool) (jid uint, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.AddHistory : error : %s, ", err.Error())
		} else {
			utils.GetLog().Debug("services.job.AddHistory : debug : Job=%s", utils.Sdump(j))
		}
	}()

	var jh models.JobHistory
	jh.Job = j
	jh.IsCreate = isCreate
	jh.Code = j.Code
	jh.CreateUser = j.CreateUser
	jh.Project = j.Project
	jh.Employee = j.Employee
	jh.Type = j.Type
	jh.Department = j.Department
	jh.Target = j.Target
	jh.TargetUrl = j.TargetUrl
	jh.Desc = j.Desc
	jh.Message = j.Message
	jh.FinishTime = j.FinishTime
	jh.ValidTime = j.ValidTime
	jh.ClaimTime = j.ClaimTime
	jh.ValidStatus = j.ValidStatus
	jh.ClaimStatus = j.ClaimStatus
	jh.SubmitStatus = j.SubmitStatus

	var insertId int64
	insertId, err = models.GetDB().Insert(&jh)
	jid = uint(insertId)

	return
}
Example #2
0
func (jv JobModify) GetTableName() string {
	j := models.JobHistory{}
	return j.TableName()
}