|
@@ -12,9 +12,12 @@ func GetGoods(eg *xorm.Engine, arg map[string]string) *[]model.CommunityTeamGood |
|
|
if arg["cid"] != "" { |
|
|
if arg["cid"] != "" { |
|
|
sess.And("cid=?", arg["cid"]) |
|
|
sess.And("cid=?", arg["cid"]) |
|
|
} |
|
|
} |
|
|
|
|
|
if arg["title"] != "" { |
|
|
|
|
|
sess.And("title like ?", "%"+arg["title"]+"%") |
|
|
|
|
|
} |
|
|
limit := utils.StrToInt(arg["size"]) |
|
|
limit := utils.StrToInt(arg["size"]) |
|
|
start := (utils.StrToInt(arg["p"]) - 1) * limit |
|
|
start := (utils.StrToInt(arg["p"]) - 1) * limit |
|
|
err := sess.OrderBy("sale_count desc,id desc").Limit(limit, start).Find(&data) |
|
|
|
|
|
|
|
|
err := sess.OrderBy("sort desc,sale_count desc,id desc").Limit(limit, start).Find(&data) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil |
|
|
return nil |
|
|
} |
|
|
} |
|
@@ -29,3 +32,11 @@ func GetGoodsSess(sess *xorm.Session, id int) *model.CommunityTeamGoods { |
|
|
} |
|
|
} |
|
|
return &data |
|
|
return &data |
|
|
} |
|
|
} |
|
|
|
|
|
func GetGoodsId(eg *xorm.Engine, id string) *model.CommunityTeamGoods { |
|
|
|
|
|
var data model.CommunityTeamGoods |
|
|
|
|
|
get, err := eg.Where("id=?", id).Get(&data) |
|
|
|
|
|
if get == false || err != nil { |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
return &data |
|
|
|
|
|
} |