Пример #1
0
func (jv JobValidation) GetVariables() []map[string]interface{} {
	job := jv.jobValidation.Job

	data := []map[string]interface{}{}
	data = append(data, map[string]interface{}{
		"name":            job.CreateUser.Name,
		"job_name":        job.Type,
		"job_link":        fmt.Sprintf("%s/job/view/%d", utils.BaseUrl(), job.Id),
		"job_status_desc": jv.GetDesc(),
		"job_created_at":  jv.jobValidation.Job.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	})

	if job.IsPassedValidation() {
		data = append(data, map[string]interface{}{
			"name":            job.Employee.Name,
			"job_name":        job.Type,
			"job_link":        fmt.Sprintf("%s/job/view/%d", utils.BaseUrl(), job.Id),
			"job_status_desc": jv.GetDesc(),
			"job_created_at":  jv.jobValidation.Job.Created.Format(utils.YMDHIS),
			"datetime":        time.Now().Format(utils.YMDHIS),
		})
	}

	return data
}
Пример #2
0
func (jc JobClaim) GetVariables() []map[string]interface{} {
	data := []map[string]interface{}{}
	data = append(data, map[string]interface{}{
		"name":            jc.job.CreateUser.Name,
		"job_name":        jc.job.Type,
		"job_link":        fmt.Sprintf("%s/job/view/%d", utils.BaseUrl(), jc.job.Id),
		"job_status_desc": jc.GetDesc(),
		"job_created_at":  jc.job.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	})
	return data
}
Пример #3
0
func (p Project) GetVariables() []map[string]interface{} {
	if !p.isFetchedProject {
		p.GetOne(fmt.Sprintf("%d", p.project.Id))
	}

	data := []map[string]interface{}{}

	bussinessUserContent := map[string]interface{}{
		"name":            (&p).project.BussinessUser.Name,
		"job_name":        "项目创建",
		"job_link":        fmt.Sprintf("%s", utils.BaseUrl()),
		"job_status_desc": "项目创建",
		"job_created_at":  p.project.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	}
	data = append(data, bussinessUserContent)

	techUserContent := map[string]interface{}{
		"name":            (&p).project.TechUser.Name,
		"job_name":        "项目创建",
		"job_link":        fmt.Sprintf("%s", utils.BaseUrl()),
		"job_status_desc": "项目创建",
		"job_created_at":  p.project.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	}
	data = append(data, techUserContent)

	artUserContent := map[string]interface{}{
		"name":            (&p).project.ArtUser.Name,
		"job_name":        "项目创建",
		"job_link":        fmt.Sprintf("%s", utils.BaseUrl()),
		"job_status_desc": "项目创建",
		"job_created_at":  p.project.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	}
	data = append(data, artUserContent)

	return data
}
Пример #4
0
func (cp ComplaintCreator) GetVariables() []map[string]interface{} {
	complain := cp.compliant
	data := []map[string]interface{}{}
	data = append(data, map[string]interface{}{
		"name":            cp.employee.Name,
		"job_name":        cp.GetDesc(),
		"job_link":        fmt.Sprintf("%s/job/view/%d", utils.BaseUrl(), cp.jobId),
		"job_status_desc": complain.Complain,
		"job_created_at":  complain.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	})
	return data
}
Пример #5
0
func (cpr ComplaintReplytor) GetVariables() []map[string]interface{} {
	complainReply := cpr.complainReply

	data := []map[string]interface{}{}
	data = append(data, map[string]interface{}{
		"name":            cpr.touser.Name,
		"job_name":        cpr.GetDesc(),
		"job_link":        fmt.Sprintf("%s/job/view/%d", utils.BaseUrl(), cpr.jobId),
		"job_status_desc": complainReply.Message,
		"job_created_at":  complainReply.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	})
	return data
}
Пример #6
0
func (ja JobAssignment) GetVariables() (data []map[string]interface{}) {
	toUser, _ := (&ja).getToUser()
	job, _ := (&ja).getJob()

	data = append(data, map[string]interface{}{
		"name":            toUser.Name,
		"job_name":        job.Type,
		"job_link":        fmt.Sprintf("%s/job/view/%d", utils.BaseUrl(), ja.job.Id),
		"job_status_desc": ja.GetDesc(),
		"job_created_at":  ja.jobAssign.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	})

	data = append(data, map[string]interface{}{
		"name":            job.CreateUser.Name,
		"job_name":        job.Type,
		"job_link":        fmt.Sprintf("%s/job/view/%d", utils.BaseUrl(), ja.job.Id),
		"job_status_desc": ja.GetDesc(),
		"job_created_at":  ja.jobAssign.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	})

	return data
}
Пример #7
0
func (jm JobModify) GetVariables() []map[string]interface{} {
	name := jm.job.CreateUser.Name
	if jm.job.ValidStatus == models.Job_Valid_OK {
		name = jm.job.Employee.Name
	}

	data := []map[string]interface{}{}
	data = append(data, map[string]interface{}{
		"name":            name,
		"job_name":        jm.job.Type,
		"job_link":        fmt.Sprintf("%s/job/view/%d", utils.BaseUrl(), jm.job.Id),
		"job_status_desc": jm.GetDesc(),
		"job_created_at":  jm.job.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	})
	return data
}
Пример #8
0
func (js JobSubmit) GetVariables() []map[string]interface{} {
	var name string
	status := js.mapJob["Status"].(int)
	if status > models.Job_Submit_Wait_Acceptance {
		name = js.job.Employee.Name
	} else {
		name = js.job.CreateUser.Name
	}

	data := []map[string]interface{}{}
	data = append(data, map[string]interface{}{
		"name":            name,
		"job_name":        js.job.Type,
		"job_link":        fmt.Sprintf("%s/job/view/%d", utils.BaseUrl(), js.job.Id),
		"job_status_desc": js.GetDesc(),
		"job_created_at":  js.job.Created.Format(utils.YMDHIS),
		"datetime":        time.Now().Format(utils.YMDHIS),
	})
	return data
}