|
@@ -33,6 +33,7 @@ use app\common\{cache\HandleConcurrencyCache,
|
|
|
model\Goods,
|
|
model\Goods,
|
|
|
logic\BaseLogic,
|
|
logic\BaseLogic,
|
|
|
logic\DiscountLogic,
|
|
logic\DiscountLogic,
|
|
|
|
|
+ model\GoodsCategoryIndex,
|
|
|
model\GoodsItem,
|
|
model\GoodsItem,
|
|
|
model\GoodsServiceGuarantee,
|
|
model\GoodsServiceGuarantee,
|
|
|
model\GoodsVisit,
|
|
model\GoodsVisit,
|
|
@@ -44,7 +45,8 @@ use app\common\{cache\HandleConcurrencyCache,
|
|
|
enum\GoodsCommentEnum,
|
|
enum\GoodsCommentEnum,
|
|
|
model\User,
|
|
model\User,
|
|
|
model\UserAddress,
|
|
model\UserAddress,
|
|
|
- service\FileService};
|
|
|
|
|
|
|
+ service\FileService,
|
|
|
|
|
+ model\GoodsCategory};
|
|
|
use app\common\service\ConfigService;
|
|
use app\common\service\ConfigService;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -171,6 +173,35 @@ class GoodsLogic extends BaseLogic
|
|
|
return $goods->toArray();
|
|
return $goods->toArray();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getshopGoods(){
|
|
|
|
|
+ $goods_cate = GoodsCategory::where(['is_show'=>1])->field('id,name')->order('sort asc')->select()->toArray();
|
|
|
|
|
+
|
|
|
|
|
+ foreach($goods_cate as &$v){
|
|
|
|
|
+ $cate_arr = [];
|
|
|
|
|
+ array_push($cate_arr,$v['id']);
|
|
|
|
|
+ $second = GoodsCategory::where(['is_show'=>1,'pid'=>$v['id']])->field('id,name')->order('sort asc')->select()->toArray();
|
|
|
|
|
+
|
|
|
|
|
+ $second_arr = array_column($second,'id');
|
|
|
|
|
+ $cate_arr = array_merge($cate_arr,$second_arr);
|
|
|
|
|
+
|
|
|
|
|
+ foreach($second as $sv){
|
|
|
|
|
+ $three = GoodsCategory::where(['is_show'=>1,'pid'=>$sv['id']])->field('id,name')->order('sort asc')->select()->toArray();
|
|
|
|
|
+
|
|
|
|
|
+ $three_arr= array_column($three,'id');
|
|
|
|
|
+ $cate_arr = array_merge($cate_arr,$three_arr);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $good_id_list = GoodsCategoryIndex::where(['category_id'=>$cate_arr])->select()->toArray();
|
|
|
|
|
+ $goods_list=[];
|
|
|
|
|
+ if($good_id_list){
|
|
|
|
|
+ $goods_id_arr = array_column($good_id_list,'goods_id');
|
|
|
|
|
+ $goods_list = Goods::where(['id'=>$goods_id_arr,'status'=>1])->field('id,name,min_price,0min_lineation_price,image')->limit(4)->select()->toArray();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return ['goods_list'=>$goods_list];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* @notes 商品搜索记录
|
|
* @notes 商品搜索记录
|
|
|
* @param $userId
|
|
* @param $userId
|