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}) }, }