diff --git a/src/guanlixitong/interview.go b/src/guanlixitong/interview.go index 20cb0fa..0e10e31 100644 --- a/src/guanlixitong/interview.go +++ b/src/guanlixitong/interview.go @@ -7,15 +7,16 @@ type interview struct { fields string `data:"title,content,address,begin_time,end_time,user_uid"` create string `name:"create title* content* address* begin_time*@date end_time*@date" role:"leader"` remove string `name:"remove" role:"leader"` + start string `name:"start" role:"leader"` + stop string `name:"stop" role:"leader"` } func (s interview) List(m *ice.Message, arg ...string) { - s.ValueList(m, arg) - m.Table(func(value ice.Maps) { + s.ValueList(m, arg).Table(func(value ice.Maps) { m.PushButton(s.Start) }) } func (s interview) Start(m *ice.Message, arg ...string) {} -func (s interview) stop(m *ice.Message, arg ...string) {} +func (s interview) Stop(m *ice.Message, arg ...string) {} func init() { ice.TeamCtxCmd(interview{}) } diff --git a/src/guanlixitong/model/model.go b/src/guanlixitong/model/model.go index b09e10e..d873b35 100644 --- a/src/guanlixitong/model/model.go +++ b/src/guanlixitong/model/model.go @@ -21,9 +21,12 @@ const ( COMPANY_NAME = "company_name" AUTH_UID = "auth_uid" RECRUITMENT_STATUS = "recruitment_status" + RECRUITMENT_UID = "recruitment_uid" SALARY = "salary" SENIORITY = "seniority" + MOBILE = "mobile" DEGREE = "degree" + COUNT = "count" ) type UserGroup struct { @@ -53,10 +56,11 @@ type Recruitment struct { } type Resume struct { db.ModelNameInfo - GroupUID string `gorm:"type:char(32);index"` - Email string `gorm:"type:varchar(32)"` - Mobile string `gorm:"type:varchar(32)"` - Degree string `gorm:"type:varchar(32)"` + RecruitmentUID string `gorm:"type:char(32);index"` + GroupUID string `gorm:"type:char(32);index"` + Email string `gorm:"type:varchar(32)"` + Mobile string `gorm:"type:varchar(32)"` + Degree string `gorm:"type:varchar(32)"` } type Interview struct { db.ModelContent diff --git a/src/guanlixitong/portal.json b/src/guanlixitong/portal.json index fd35a12..daeb5ba 100644 --- a/src/guanlixitong/portal.json +++ b/src/guanlixitong/portal.json @@ -43,7 +43,8 @@ "resume": { "name": "姓名", "info": "简介", - "degree": "学历" + "degree": "学历", + "address": "面试地址" }, "interview": { "start": "开始面试" diff --git a/src/guanlixitong/recruitment.go b/src/guanlixitong/recruitment.go index 4899011..9d348d5 100644 --- a/src/guanlixitong/recruitment.go +++ b/src/guanlixitong/recruitment.go @@ -11,9 +11,9 @@ type recruitment struct { Table resume resume fields string `data:"title,degree,seniority,salary,content,total,count,recruitment_status,user_uid"` - create string `name:"create title* degree* seniority* salary* content* total*=1" role:"leader"` - modify string `name:"modify content*" role:"leader"` - remove string `name:"remove" role:"leader"` + create string `name:"create title* degree* seniority* salary* content* total*=1" role:"leader,worker"` + modify string `name:"modify content*" role:"leader,worker"` + remove string `name:"remove" role:"leader,worker"` start string `name:"start" role:"leader"` stop string `name:"stop" role:"leader"` resumeInsert string `name:"create name* info* mobile* email degree*" role:"void"` @@ -52,22 +52,37 @@ func (s recruitment) Inputs(m *ice.Message, arg ...string) { } } func (s recruitment) List(m *ice.Message, arg ...string) { + msg := m.Spawn() + list := map[string]int{} + s.Fields(msg, model.RECRUITMENT_UID, "count(*) AS `count`").Groups(msg, model.RECRUITMENT_UID) + msg = msg.Cmd(s.resume, s.Select, m.OptionSimple(model.GROUP_UID, model.USER_UID)) + msg.Table(func(value ice.Maps) { list[value[model.RECRUITMENT_UID]] = kit.Int(value[model.COUNT]) }) s.ValueList(m, arg).Table(func(value ice.Maps) { + count := list[value[model.UID]] + button := []ice.Any{} switch RecruitmentStatus(kit.Int(value[model.RECRUITMENT_STATUS])) { case RecruitmentCreate: - m.PushButton(s.Start, s.Modify, s.Remove) - case RecruitmentStart: - if m.Option(model.MARKET_UID) != "" { - m.PushButton(s.ResumeInsert) - } else if s.IsLeader(m) { - m.PushButton(s.ResumeInsert, s.MarketInsert, s.Modify, s.Stop) - } else { - m.PushButton(s.ResumeInsert) + if s.IsLeader(m) { + button = append(button, s.Start) + } + if s.IsWorker(m) { + button = append(button, s.Modify, s.Remove) + } + case RecruitmentStart: + if count == 0 || s.IsWorker(m) { + button = append(button, s.ResumeInsert) + } + if m.Option(model.MARKET_UID) == "" { + if s.IsLeader(m) { + button = append(button, s.MarketInsert, s.Modify, s.Stop) + } else if s.IsWorker(m) { + button = append(button, s.Modify) + } } - case RecruitmentStop: - m.PushButton() } + m.PushButton(button...) }).Display("") + kit.If(m.Length() == 0, func() { s.Button(m.SetResult(), "") }) } func (s recruitment) Start(m *ice.Message, arg ...string) { s.ValueModify(m, model.STATUS, kit.Format(RecruitmentStart)) @@ -76,7 +91,10 @@ func (s recruitment) Stop(m *ice.Message, arg ...string) { s.ValueModify(m, model.STATUS, kit.Format(RecruitmentStop)) } func (s recruitment) ResumeInsert(m *ice.Message, arg ...string) { - m.Cmdy(s.resume, s.Insert, arg, m.OptionSimple(model.GROUP_UID, model.USER_UID)) + if m.Warn(m.Cmd(s.resume, s.Select, model.RECRUITMENT_UID, m.Option(model.UID), m.OptionSimple(model.MOBILE)).Length() > 0, "已经投过简历,请勿重复投递,投递") { + return + } + m.Cmdy(s.resume, s.Insert, arg, m.OptionSimple(model.GROUP_UID, model.USER_UID), model.RECRUITMENT_UID, m.Option(model.UID)) } func init() { ice.TeamCtxCmd(recruitment{}) } diff --git a/src/guanlixitong/resume.go b/src/guanlixitong/resume.go index e53be39..1cbd004 100644 --- a/src/guanlixitong/resume.go +++ b/src/guanlixitong/resume.go @@ -12,14 +12,21 @@ type resume struct { fields string `data:"name,info,mobile,email,degree,user_uid"` create string `name:"create name* info* mobile* email degree" role:"leader"` remove string `name:"remove" role:"leader"` - interviewInsert string `name:"create title* content* address* begin_time*@date end_time*@date" role:"leader"` + interviewInsert string `name:"create title* content* begin_time*:select@date end_time*:select@date address*" role:"leader"` } +func (s resume) Inputs(m *ice.Message, arg ...string) { + switch arg[0] { + case model.TITLE: + m.Push(arg[0], "一面") + m.Push(arg[0], "二面") + m.Push(arg[0], "三面") + } +} func (s resume) List(m *ice.Message, arg ...string) { - s.ValueList(m, arg).Display("") - m.Table(func(value ice.Maps) { + s.ValueList(m, arg).Table(func(value ice.Maps) { m.PushButton(s.InterviewInsert) - }) + }).Display("") } func (s resume) InterviewInsert(m *ice.Message, arg ...string) { m.Cmdy(s.interview, s.interview.Insert, arg, m.OptionSimple(model.GROUP_UID, model.USER_UID)) diff --git a/src/guanlixitong/resume.js b/src/guanlixitong/resume.js index 9f6524b..9cffe6b 100644 --- a/src/guanlixitong/resume.js +++ b/src/guanlixitong/resume.js @@ -6,6 +6,7 @@ Volcanos(chat.ONIMPORT, { can.onimport.titleAction(can, value), ]}, {view: html.STATUS, list: [ + can.onimport.timeView(can, value), can.onimport.textView(can, value, "degree", "status"), can.onimport.textView(can, value, "seniority", "status"), can.onimport.textView(can, value, "salary", "status"),