1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 15:10:54 +00:00

Merge pull request #246 from qida/develop

兼容query中的日期、时间参数。
This commit is contained in:
astaxie 2016-08-19 00:11:52 +08:00 committed by GitHub
commit 54229fea6f

View File

@ -1262,7 +1262,7 @@ func (c *{{ctrlName}}Controller) GetAll() {
// query: k:v,k:v // query: k:v,k:v
if v := c.GetString("query"); v != "" { if v := c.GetString("query"); v != "" {
for _, cond := range strings.Split(v, ",") { for _, cond := range strings.Split(v, ",") {
kv := strings.Split(cond, ":") kv := strings.SplitN(cond, ":", 2)
if len(kv) != 2 { if len(kv) != 2 {
c.Data["json"] = errors.New("Error: invalid query key/value pair") c.Data["json"] = errors.New("Error: invalid query key/value pair")
c.ServeJSON() c.ServeJSON()