animeic %!s(int64=2) %!d(string=hai) anos
pai
achega
0932d0806e
Modificáronse 2 ficheiros con 9 adicións e 0 borrados
  1. 4 0
      boxcost/api/pack.go
  2. 5 0
      boxcost/api/plan.go

+ 4 - 0
boxcost/api/pack.go

@@ -81,6 +81,10 @@ func GetPack(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 func GetPacks(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 
 	page, size, query := UtilQueryPageSize(c)
+	if _name, ok := query["name"]; ok {
+		delete(query, "name")
+		query["name"] = bson.M{"$regex": _name.(string)}
+	}
 
 	option := &repo.PageSearchOptions{
 		CollectName: repo.CollectionPack,

+ 5 - 0
boxcost/api/plan.go

@@ -764,6 +764,11 @@ func GetProductPlans(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 		delete(query, "packId")
 	}
 
+	if _name, ok := query["name"]; ok {
+		delete(query, "name")
+		query["name"] = bson.M{"$regex": _name.(string)}
+	}
+
 	option := &repo.PageSearchOptions{
 		CollectName: repo.CollectionProductPlan,
 		Query:       query,