|
@@ -4,6 +4,11 @@ import (
|
|
|
"eta/eta_mini_ht_api/common/exception"
|
|
|
"eta/eta_mini_ht_api/controllers"
|
|
|
productService "eta/eta_mini_ht_api/service/product"
|
|
|
+ "fmt"
|
|
|
+)
|
|
|
+
|
|
|
+var (
|
|
|
+ productMap = map[string]int{}
|
|
|
)
|
|
|
|
|
|
type ProductController struct {
|
|
@@ -72,3 +77,35 @@ func (p *ProductController) RelatePackage(productId int) {
|
|
|
return
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+// ProductSearch 获取商品信息
|
|
|
+// @Summary 获取商品信息
|
|
|
+// @Description 获取商品信息
|
|
|
+// @Success 200 {object} controllers.BaseResponse
|
|
|
+// @router /productSearch [get]
|
|
|
+func (p *ProductController) ProductSearch(productType, key string) {
|
|
|
+ controllers.Wrap(&p.BaseController, func() (result *controllers.WrapData, err error) {
|
|
|
+ result = p.InitWrapData("搜索产品信息失败")
|
|
|
+ //for i := 0; i < len(productMap); i++ {
|
|
|
+ // //if productType == productMap[i] {
|
|
|
+ // // productList, err := productService.ProductSearch(productType, key)
|
|
|
+ // // if err != nil {
|
|
|
+ // // p.FailedResult("搜索产品信息失败", result)
|
|
|
+ // // return
|
|
|
+ // // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ fmt.Printf("productType:%v,key:%v\n", productType, key)
|
|
|
+ if err != nil {
|
|
|
+ p.FailedResult("获取关联套餐信息失败", result)
|
|
|
+ err = exception.New(exception.ProductTypeError)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if err != nil {
|
|
|
+ p.FailedResult("搜索产品信息失败", result)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ p.SuccessResult("搜索产品信息成功", nil, result)
|
|
|
+ return
|
|
|
+ })
|
|
|
+}
|