调优
This commit is contained in:
+76
-19
@@ -4,6 +4,7 @@ import (
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type paixuArr []Map
|
||||
@@ -12,7 +13,8 @@ func (x paixuArr) Len() int {
|
||||
return len(x)
|
||||
}
|
||||
func (x paixuArr) Less(i, j int) bool {
|
||||
return x[i].GetCeilInt64("count") < x[j].GetCeilInt64("count")
|
||||
|
||||
return x[i].GetCeilInt64("count") > x[j].GetCeilInt64("count")
|
||||
}
|
||||
func (x paixuArr) Swap(i, j int) {
|
||||
x[i], x[j] = x[j], x[i]
|
||||
@@ -67,7 +69,7 @@ var DeclareCtr = Ctr{
|
||||
//政策匹配
|
||||
"match": func(that *Context) {
|
||||
|
||||
if that.Session("user_id").Data != nil {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
@@ -83,6 +85,18 @@ var DeclareCtr = Ctr{
|
||||
that.Display(3, "参数错误")
|
||||
return
|
||||
}
|
||||
qu := that.Req.FormValue("register_address")
|
||||
qus := strings.Split(qu, "/")
|
||||
|
||||
for _, v := range qus {
|
||||
if v != "" {
|
||||
qu = v
|
||||
}
|
||||
}
|
||||
|
||||
if !strings.Contains(qu, "区") && !strings.Contains(qu, "县") {
|
||||
qu = "没有此项数据随意填充的"
|
||||
}
|
||||
|
||||
company := that.Db.Get("company", "*", Map{"user_id": that.Session("user_id").Data})
|
||||
delete(company, "id")
|
||||
@@ -125,7 +139,7 @@ var DeclareCtr = Ctr{
|
||||
//标签分析
|
||||
if tags != nil {
|
||||
for _, v := range tags {
|
||||
dtag := that.Db.Select("declare_tag", "id,declare_id", Map{"tag_id": v})
|
||||
dtag := that.Db.Select("declare_tag", Map{"[><]`declare`": "declare_tag.declare_id=declare.id"}, "declare_tag.declare_id", Map{"AND": Map{"OR": Map{"declare.policy_level": Slice{"省", "市"}, "declare.dispatch_department[~]": qu}, "declare_tag.tag_id": v}})
|
||||
for _, v1 := range dtag {
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
declares[v1.GetCeilInt64("declare_id")] = v1
|
||||
@@ -137,7 +151,7 @@ var DeclareCtr = Ctr{
|
||||
}
|
||||
|
||||
//企业规模分析
|
||||
dtag := that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "company_scale[<=]": ObjToInt(that.Req.FormValue("company_scale"))}})
|
||||
dtag := that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "company_scale[<=]": ObjToInt(that.Req.FormValue("company_scale"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -150,7 +164,7 @@ var DeclareCtr = Ctr{
|
||||
//是否是有效期内的科技型中小企业称号:0-否,1-是
|
||||
if ObjToInt(that.Req.FormValue("smes_flag")) > 0 {
|
||||
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "smes_flag": ObjToInt(that.Req.FormValue("smes_flag"))}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "smes_flag": ObjToInt(that.Req.FormValue("smes_flag"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -164,7 +178,7 @@ var DeclareCtr = Ctr{
|
||||
//是否是有效期内的高新区技术企业称号:0-否,1-是
|
||||
if ObjToInt(that.Req.FormValue("htzte_flag")) > 0 {
|
||||
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "htzte_flag": ObjToInt(that.Req.FormValue("htzte_flag"))}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "htzte_flag": ObjToInt(that.Req.FormValue("htzte_flag"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -179,11 +193,14 @@ var DeclareCtr = Ctr{
|
||||
flagslice := Slice{}
|
||||
if flags != nil {
|
||||
for _, v := range flags {
|
||||
if v == "0" {
|
||||
continue
|
||||
}
|
||||
flagslice = append(flagslice, v)
|
||||
}
|
||||
|
||||
}
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "engineering_center_flag": flagslice}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "engineering_center_flag": flagslice}})
|
||||
|
||||
for _, v1 := range dtag {
|
||||
|
||||
@@ -199,11 +216,14 @@ var DeclareCtr = Ctr{
|
||||
flagslice = Slice{}
|
||||
if flags != nil {
|
||||
for _, v := range flags {
|
||||
if v == "0" {
|
||||
continue
|
||||
}
|
||||
flagslice = append(flagslice, v)
|
||||
}
|
||||
|
||||
}
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "engineering_laboratory_flag": flagslice}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "engineering_laboratory_flag": flagslice}})
|
||||
|
||||
for _, v1 := range dtag {
|
||||
|
||||
@@ -219,11 +239,14 @@ var DeclareCtr = Ctr{
|
||||
flagslice = Slice{}
|
||||
if flags != nil {
|
||||
for _, v := range flags {
|
||||
if v == "0" {
|
||||
continue
|
||||
}
|
||||
flagslice = append(flagslice, v)
|
||||
}
|
||||
|
||||
}
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "key_laboratory_flag": flagslice}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "key_laboratory_flag": flagslice}})
|
||||
for _, v1 := range dtag {
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
declares[v1.GetCeilInt64("declare_id")] = v1
|
||||
@@ -237,11 +260,14 @@ var DeclareCtr = Ctr{
|
||||
flagslice = Slice{}
|
||||
if flags != nil {
|
||||
for _, v := range flags {
|
||||
if v == "0" {
|
||||
continue
|
||||
}
|
||||
flagslice = append(flagslice, v)
|
||||
}
|
||||
|
||||
}
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "industrial_design_center_flag": flagslice}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "industrial_design_center_flag": flagslice}})
|
||||
for _, v1 := range dtag {
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
declares[v1.GetCeilInt64("declare_id")] = v1
|
||||
@@ -265,7 +291,7 @@ var DeclareCtr = Ctr{
|
||||
|
||||
//有无授权发明专利:0-否,1-是
|
||||
if ObjToInt(that.Req.FormValue("invention_patent_flag")) > 0 {
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "invention_patent_flag": ObjToInt(that.Req.FormValue("invention_patent_flag"))}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "invention_patent_flag": ObjToInt(that.Req.FormValue("invention_patent_flag"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -278,7 +304,7 @@ var DeclareCtr = Ctr{
|
||||
|
||||
//有无国际科技合作:0-否,1-是
|
||||
if ObjToInt(that.Req.FormValue("international_cooperation_flag")) > 0 {
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "international_cooperation_flag": ObjToInt(that.Req.FormValue("international_cooperation_flag"))}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "international_cooperation_flag": ObjToInt(that.Req.FormValue("international_cooperation_flag"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -290,7 +316,7 @@ var DeclareCtr = Ctr{
|
||||
}
|
||||
//上年度有无固定资产投入:0-否,1-是
|
||||
if ObjToInt(that.Req.FormValue("investment_fixed_assets_flag")) > 0 {
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "investment_fixed_assets_flag": ObjToInt(that.Req.FormValue("investment_fixed_assets_flag"))}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "investment_fixed_assets_flag": ObjToInt(that.Req.FormValue("investment_fixed_assets_flag"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -301,7 +327,7 @@ var DeclareCtr = Ctr{
|
||||
}
|
||||
}
|
||||
//高层次人才情况:0-否,1-3个及以上博士-1,2-1个及以上博士-2,3-知名企业中高管1个及以上
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "high_level_talents_flag": ObjToInt(that.Req.FormValue("high_level_talents_flag"))}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "high_level_talents_flag": ObjToInt(that.Req.FormValue("high_level_talents_flag"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -312,7 +338,7 @@ var DeclareCtr = Ctr{
|
||||
}
|
||||
//企业股东或成员是否有国内外高校或科研院在编、全职人员:0-否,1-是
|
||||
if ObjToInt(that.Req.FormValue("shareholders_flag")) > 0 {
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "shareholders_flag": ObjToInt(that.Req.FormValue("shareholders_flag"))}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "shareholders_flag": ObjToInt(that.Req.FormValue("shareholders_flag"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -324,7 +350,7 @@ var DeclareCtr = Ctr{
|
||||
}
|
||||
//企业有无从外地引进博士学历人才:0-否,1-是
|
||||
if ObjToInt(that.Req.FormValue("nonlocal_dr_flag")) > 0 {
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "nonlocal_dr_flag": ObjToInt(that.Req.FormValue("nonlocal_dr_flag"))}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "nonlocal_dr_flag": ObjToInt(that.Req.FormValue("nonlocal_dr_flag"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -336,7 +362,7 @@ var DeclareCtr = Ctr{
|
||||
}
|
||||
//上年度是否有贷款/融资或未来有贷款/融资计划:0-否,1-是
|
||||
if ObjToInt(that.Req.FormValue("loan_flag")) > 0 {
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"del_flag": 0, "loan_flag": ObjToInt(that.Req.FormValue("loan_flag"))}})
|
||||
dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "loan_flag": ObjToInt(that.Req.FormValue("loan_flag"))}})
|
||||
for _, v1 := range dtag {
|
||||
|
||||
if declares[v1.GetCeilInt64("declare_id")] == nil {
|
||||
@@ -353,15 +379,46 @@ var DeclareCtr = Ctr{
|
||||
}
|
||||
//获取到排序后的数据
|
||||
sort.Sort(px)
|
||||
res := Slice{}
|
||||
var res []Map
|
||||
for _, v := range px {
|
||||
id := v.GetCeilInt("declare_id")
|
||||
article := that.Db.Get("article", "id,title,description,department_id,click_num+click_num_base AS click_num,"+
|
||||
"favorite_num_base+favorite_num AS favorite_num,dispatch_num,dispatch_name,prepare_date,release_time,expire_date,area_id,status,declare_id,declare_id,declare_id", Map{"declare_id": id})
|
||||
article["declare"] = that.Db.Get("declare", "money_scope_min,money_scope_max,tag,status", Map{"id": id})
|
||||
article["declare"] = that.Db.Get("declare", "money_scope_min,money_scope_max,status", Map{"id": id})
|
||||
|
||||
res = append(res, article)
|
||||
}
|
||||
minMoney := float64(0)
|
||||
maxMoney := float64(0)
|
||||
for _, v := range res {
|
||||
if v.GetMap("declare") != nil {
|
||||
if v.GetMap("declare").GetFloat64("money_scope_min") < minMoney {
|
||||
minMoney = v.GetMap("declare").GetFloat64("money_scope_min")
|
||||
}
|
||||
if v.GetMap("declare").GetFloat64("money_scope_max") > maxMoney {
|
||||
maxMoney = v.GetMap("declare").GetFloat64("money_scope_max")
|
||||
}
|
||||
}
|
||||
}
|
||||
seData := Map{
|
||||
"user_id": that.Session("user_id").Data,
|
||||
"search_company_name": companyName,
|
||||
"policy_match_count": len(res),
|
||||
"json_data": ObjToStr(company),
|
||||
"create_time[#]": "now()",
|
||||
"modify_time[#]": "now()",
|
||||
"del_flag": 0,
|
||||
}
|
||||
if maxMoney != minMoney {
|
||||
seData["money_scope"] = ObjToStr(minMoney) + "-" + ObjToStr(maxMoney) + "万元"
|
||||
} else if maxMoney == 0 {
|
||||
seData["money_scope"] = ""
|
||||
} else {
|
||||
seData["money_scope"] = ObjToStr(maxMoney) + "万元"
|
||||
}
|
||||
|
||||
//匹配记录存储
|
||||
that.Db.Insert("search_record", seData)
|
||||
|
||||
that.Display(0, res)
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ var FavoriteCtr = Ctr{
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
data = Map{"AND": data}
|
||||
data = Map{"AND": data, "ORDER": "modify_time DESC"}
|
||||
}
|
||||
|
||||
count := that.Db.Count("favorite", data)
|
||||
@@ -217,11 +217,11 @@ var FavoriteCtr = Ctr{
|
||||
v["policy"] = that.Db.Get("policy", "id,tag", Map{"id": v.GetCeilInt64("policy_id")})
|
||||
}
|
||||
if v.GetCeilInt64("declare_id") != 0 {
|
||||
v["declare"] = that.Db.Get("declare", "id,money_scope_min,money_scope_max,tag,status", Map{"id": v.GetCeilInt64("policy_id")})
|
||||
v["declare"] = that.Db.Get("declare", "id,money_scope_min,money_scope_max,status", Map{"id": v.GetCeilInt64("declare_id")})
|
||||
}
|
||||
|
||||
if v.GetCeilInt64("notify_id") != 0 {
|
||||
v["notify"] = that.Db.Get("notify", "id,tag", Map{"id": v.GetCeilInt64("policy_id")})
|
||||
v["notify"] = that.Db.Get("notify", "id,tag", Map{"id": v.GetCeilInt64("notify_id")})
|
||||
}
|
||||
|
||||
if v.GetCeilInt64("article_id") != 0 {
|
||||
@@ -231,7 +231,7 @@ var FavoriteCtr = Ctr{
|
||||
|
||||
if v.GetCeilInt64("provider_id") != 0 {
|
||||
v["provider"] = that.Db.Get("provider", "id,name,level,discount,avatar,title,description,"+
|
||||
"click_num_base+click_num AS click_num,handle_num_base+handle_num AS handle_num,favorite_num_base+favorite_num AS favorite_num,modify_time", Map{"id": v.GetCeilInt64("policy_id")})
|
||||
"click_num_base+click_num AS click_num,handle_num_base+handle_num AS handle_num,favorite_num_base+favorite_num AS favorite_num,modify_time", Map{"id": v.GetCeilInt64("provider_id")})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+17
-16
@@ -9,22 +9,23 @@ import (
|
||||
|
||||
// Project 管理端项目
|
||||
var Project = Proj{
|
||||
"article": ArticleCtr,
|
||||
"company": CompanyCtr,
|
||||
"declare": DeclareCtr,
|
||||
"favorite": FavoriteCtr,
|
||||
"lxcx": Lxcx,
|
||||
"matters": MattersCtr,
|
||||
"notify": NotifyCtr,
|
||||
"order": OrderCtr,
|
||||
"policy": PolicyCtr,
|
||||
"provider": ProviderCtr,
|
||||
"sms": Sms,
|
||||
"tag": TagCtr,
|
||||
"user": UserCtr,
|
||||
"websocket": WebsocketCtr,
|
||||
"wechath5": Wechath5,
|
||||
"wechatmini": Wechath5,
|
||||
"article": ArticleCtr,
|
||||
"company": CompanyCtr,
|
||||
"declare": DeclareCtr,
|
||||
"favorite": FavoriteCtr,
|
||||
"lxcx": Lxcx,
|
||||
"matters": MattersCtr,
|
||||
"notify": NotifyCtr,
|
||||
"order": OrderCtr,
|
||||
"policy": PolicyCtr,
|
||||
"provider": ProviderCtr,
|
||||
"search_record": SearchRecordCtr,
|
||||
"sms": Sms,
|
||||
"tag": TagCtr,
|
||||
"user": UserCtr,
|
||||
"websocket": WebsocketCtr,
|
||||
"wechath5": Wechath5,
|
||||
"wechatmini": Wechath5,
|
||||
}
|
||||
|
||||
//生成随机码的6位md5
|
||||
|
||||
@@ -133,7 +133,7 @@ var MattersCtr = Ctr{
|
||||
}
|
||||
|
||||
if tp != "" {
|
||||
data["type"] = ObjToInt("tp")
|
||||
data["type"] = ObjToInt(tp)
|
||||
}
|
||||
|
||||
startTime := that.Req.FormValue("starttime")
|
||||
@@ -147,7 +147,7 @@ var MattersCtr = Ctr{
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
data = Map{"AND": data}
|
||||
data = Map{"AND": data, "ORDER": "modify_time DESC"}
|
||||
}
|
||||
|
||||
count := that.Db.Count("matters", data)
|
||||
|
||||
+24
-12
@@ -32,13 +32,6 @@ var OrderCtr = Ctr{
|
||||
|
||||
tp := that.Req.FormValue("type")
|
||||
|
||||
//是否以前已经创建了该服务商的订单,如果创建了则直接跳转到订单详情中去
|
||||
oldOrder := that.Db.Get("order", "id", Map{"AND": Map{"provider_id": providerId, "user_id": that.Session("user_id").Data, "del_flag": 0, "status": 0}})
|
||||
if oldOrder != nil {
|
||||
that.Display(0, oldOrder.GetCeilInt64("id"))
|
||||
return
|
||||
}
|
||||
|
||||
//新建流程
|
||||
user := that.Db.Get("user", "*", Map{"id": that.Session("user_id").Data})
|
||||
|
||||
@@ -59,6 +52,25 @@ var OrderCtr = Ctr{
|
||||
return
|
||||
}
|
||||
|
||||
//是否以前已经创建了该服务商的订单,如果创建了则直接跳转到订单详情中去
|
||||
oldOrder := that.Db.Get("order", "id", Map{"AND": Map{"provider_id": providerId, "user_id": that.Session("user_id").Data, "del_flag": 0, "status": 0}})
|
||||
if oldOrder != nil {
|
||||
orderRecord := Map{
|
||||
"order_id": oldOrder.GetCeilInt64("id"),
|
||||
"user_id": user.GetCeilInt64("id"),
|
||||
"remarks": user.GetString("nickname") + "向“" + provider.GetString("name") + "”服务商再次发起了订单请求",
|
||||
"create_time[#]": "now()",
|
||||
"modify_time[#]": "now()",
|
||||
"del_flag": 0,
|
||||
}
|
||||
|
||||
orderRecord["id"] = that.Db.Insert("order_record", orderRecord)
|
||||
that.Db.Update("order", Map{"order_record_id": orderRecord.GetCeilInt64("id"), "modify_time[#]": "now()"}, Map{"id": oldOrder.GetCeilInt64("id")})
|
||||
|
||||
that.Display(0, oldOrder.GetCeilInt64("id"))
|
||||
return
|
||||
}
|
||||
|
||||
data := Map{
|
||||
"name": "购买“" + provider.GetString("title") + "”服务",
|
||||
"sn": "SN" + time.Now().Format("20060102150405") + getSn(),
|
||||
@@ -97,7 +109,7 @@ var OrderCtr = Ctr{
|
||||
"del_flag": 0,
|
||||
}
|
||||
|
||||
orderRecord["id"] = that.Db.Insert("order_record", data)
|
||||
orderRecord["id"] = that.Db.Insert("order_record", orderRecord)
|
||||
|
||||
if orderRecord.GetCeilInt64("id") == 0 {
|
||||
that.Display(4, "无法生成订单记录!")
|
||||
@@ -121,14 +133,14 @@ var OrderCtr = Ctr{
|
||||
return
|
||||
}
|
||||
|
||||
res := that.Db.Get("order", "*", Map{"id": id})
|
||||
res := that.Db.Get("order", "*", Map{"AND": Map{"id": id, "user_id": that.Session("user_id").Data}})
|
||||
|
||||
if res == nil {
|
||||
that.Display(4, "找不到对应订单")
|
||||
return
|
||||
}
|
||||
if res.GetCeilInt("provider_id") > 0 {
|
||||
res["provider"] = that.Db.Get("provider", "name,title", Map{"id": res.GetCeilInt("provider_id")})
|
||||
res["provider"] = that.Db.Get("provider", "name,title,phone", Map{"id": res.GetCeilInt("provider_id")})
|
||||
}
|
||||
|
||||
res["order_record"] = that.Db.Select("order_record", "remarks,modify_time", Map{"order_id": res.GetCeilInt("id"), "ORDER": "modify_time DESC"})
|
||||
@@ -154,7 +166,7 @@ var OrderCtr = Ctr{
|
||||
pageSize = 20
|
||||
}
|
||||
|
||||
data := Map{"del_flag": 0}
|
||||
data := Map{"del_flag": 0, "user_id": that.Session("user_id").Data}
|
||||
keywords := that.Req.FormValue("keywords")
|
||||
if keywords != "" {
|
||||
data["OR"] = Map{"sn[~]": keywords, "company_name[~]": keywords, "name[~]": keywords}
|
||||
@@ -171,7 +183,7 @@ var OrderCtr = Ctr{
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
data = Map{"AND": data}
|
||||
data = Map{"AND": data, "ORDER": "modify_time DESC"}
|
||||
}
|
||||
|
||||
count := that.Db.Count("order", data)
|
||||
|
||||
@@ -79,7 +79,7 @@ var ProviderCtr = Ctr{
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
data = Map{"AND": data}
|
||||
data = Map{"AND": data, "ORDER": "id DESC"}
|
||||
}
|
||||
|
||||
count := that.Db.Count("provider", data)
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
)
|
||||
|
||||
var SearchRecordCtr = Ctr{
|
||||
|
||||
"search": func(that *Context) {
|
||||
page := ObjToInt(that.Req.FormValue("page"))
|
||||
pageSize := ObjToInt(that.Req.FormValue("pageSize"))
|
||||
|
||||
if page < 1 {
|
||||
page = 1
|
||||
}
|
||||
|
||||
if pageSize <= 0 {
|
||||
pageSize = 20
|
||||
}
|
||||
|
||||
data := Map{"del_flag": 0}
|
||||
keywords := that.Req.FormValue("keywords")
|
||||
if keywords != "" {
|
||||
data["search_company_name[~]"] = keywords
|
||||
}
|
||||
|
||||
startTime := that.Req.FormValue("starttime")
|
||||
finishTime := that.Req.FormValue("finishtime")
|
||||
|
||||
if startTime != "" {
|
||||
data["create_time[>=]"] = startTime
|
||||
}
|
||||
if finishTime != "" {
|
||||
data["create_time[<=]"] = finishTime
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
data = Map{"AND": data, "ORDER": "create_time DESC"}
|
||||
}
|
||||
|
||||
count := that.Db.Count("search_record", data)
|
||||
|
||||
res := that.Db.Page(page, pageSize).PageSelect("search_record", "id,search_company_name,policy_match_count,money_scope,create_time", data)
|
||||
|
||||
that.Display(0, Map{"total": count, "data": res})
|
||||
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
)
|
||||
|
||||
var VipOrderCtr = Ctr{
|
||||
//创建V订单
|
||||
"create": func(that *Context) {
|
||||
if that.Session("user_id").Data == nil {
|
||||
that.Display(2, "没有登录")
|
||||
return
|
||||
}
|
||||
|
||||
phone := that.Req.FormValue("phone")
|
||||
companyName := that.Req.FormValue("company_name")
|
||||
if len(phone) != 11 || len(companyName) < 4 {
|
||||
that.Display(3, "请求参数异常")
|
||||
return
|
||||
}
|
||||
|
||||
err := auth(that, phone, companyName)
|
||||
if err != nil {
|
||||
that.Display(3, err)
|
||||
return
|
||||
}
|
||||
|
||||
//that.Display(0, Map{"total": count, "data": res})
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user