修复 bug 客户管理领域信息没存起来,高层次人才单选的形式存储的 #1

Merged
zhoupengwei merged 1 commits from liyun into zct-v2 2022-05-07 12:55:28 +00:00
2 changed files with 95 additions and 4 deletions
Showing only changes of commit 9330f7f5ea - Show all commits

View File

@ -108,14 +108,41 @@ var DeclareCtr = Ctr{
delete(company, "create_time") delete(company, "create_time")
delete(company, "modify_time") delete(company, "modify_time")
data := Map{} data := Map{}
//for k, _ := range company {
// if that.Req.Form[k] != nil {
// if k == "technology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" {
// data[k] = ObjToStr(that.Req.Form[k])
// } else {
// data[k] = that.Req.FormValue(k)
// }
//
// }
//}
for k, _ := range company { for k, _ := range company {
// 前端传传值不规范
if k == "high_level_talents_flag" {
that.Req.Form[k] = that.Req.Form["highLevel_talents_flag"]
}
if that.Req.Form[k] != nil { if that.Req.Form[k] != nil {
if k == "technology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" { if k == "technology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" {
data[k] = ObjToStr(that.Req.Form[k]) data[k] = ObjToStr(that.Req.Form[k])
} else if k == "tags" || k == "high_level_talents_flag" {
keyObj := that.Req.Form[k]
if keyObj != nil && ObjToStr(keyObj) != "" {
tagsStr := ""
for k2, v2 := range keyObj {
if k == "tags" && k2 < len(keyObj)-1 {
tagsStr = tagsStr + v2 + ","
} else {
tagsStr += v2
}
}
data[k] = tagsStr
}
} else { } else {
data[k] = that.Req.FormValue(k) data[k] = that.Req.FormValue(k)
} }
} }
} }

View File

@ -3,6 +3,8 @@ package provider
import ( import (
. "code.hoteas.com/golang/hotime" . "code.hoteas.com/golang/hotime"
. "code.hoteas.com/golang/hotime/common" . "code.hoteas.com/golang/hotime/common"
"code.hoteas.com/golang/hotime/dri/aliyun"
"fmt"
) )
var CompanyCtr = Ctr{ var CompanyCtr = Ctr{
@ -35,6 +37,7 @@ var CompanyCtr = Ctr{
res["engineering_laboratory_flag"] = ObjToSlice(res["engineering_laboratory_flag"]) res["engineering_laboratory_flag"] = ObjToSlice(res["engineering_laboratory_flag"])
res["key_laboratory_flag"] = ObjToSlice(res["key_laboratory_flag"]) res["key_laboratory_flag"] = ObjToSlice(res["key_laboratory_flag"])
res["industrial_design_center_flag"] = ObjToSlice(res["industrial_design_center_flag"]) res["industrial_design_center_flag"] = ObjToSlice(res["industrial_design_center_flag"])
//res["high_level_talents_flag"] = ObjToSlice(res["high_level_talents_flag"])
that.Display(0, res) that.Display(0, res)
}, },
@ -61,20 +64,81 @@ var CompanyCtr = Ctr{
delete(company, "create_time") delete(company, "create_time")
delete(company, "modify_time") delete(company, "modify_time")
data := Map{} data := Map{}
//for k, _ := range company {
// if that.Req.Form[k] != nil {
// if k == "technology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" {
// data[k] = ObjToStr(that.Req.Form[k])
// } else {
// data[k] = that.Req.FormValue(k)
// }
//
// }
//}
for k, _ := range company { for k, _ := range company {
// 前端传传值不规范
if k == "high_level_talents_flag" {
that.Req.Form[k] = that.Req.Form["highLevel_talents_flag"]
}
if k == "attendee" {
continue
}
if that.Req.Form[k] != nil { if that.Req.Form[k] != nil {
if k == "technology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" { if k == "technology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" {
data[k] = ObjToStr(that.Req.Form[k]) data[k] = ObjToStr(that.Req.Form[k])
} else if k == "tags" || k == "high_level_talents_flag" {
keyObj := that.Req.Form[k]
if keyObj != nil && ObjToStr(keyObj) != "" {
tagsStr := ""
for k2, v2 := range keyObj {
if k == "tags" && k2 < len(keyObj)-1 {
tagsStr = tagsStr + v2 + ","
} else { } else {
tagsStr += v2
}
}
data[k] = tagsStr
}
} else {
fmt.Println(that.Req.FormValue(k))
if that.Req.FormValue(k) != "" {
data[k] = that.Req.FormValue(k) data[k] = that.Req.FormValue(k)
} }
}
} }
} }
that.Db.Update("company", company, Map{"id": id}) data["modify_time[#]"] = "NOW()"
that.Db.Update("company", data, Map{"id": id})
that.Display(0, "更新成功") that.Display(0, "更新成功")
}, },
"search": func(that *Context) {
keywords := that.Req.FormValue("keywords")
if keywords == "" {
keywords = that.Req.FormValue("company_name")
}
if keywords == "" {
keywords = that.Req.FormValue("name")
}
if len(keywords) < 2 {
that.Display(0, Slice{})
return
}
res, err := aliyun.Company.GetCompanyList(keywords)
if err != nil {
fmt.Println(err)
that.Display(0, Slice{})
return
}
if res.GetCeilInt64("status") != 200 {
fmt.Println(err)
that.Display(0, Slice{})
return
}
that.Display(0, res.GetMap("data").GetSlice("list"))
},
} }