配置修改
This commit is contained in:
@ -26,7 +26,7 @@ use app\api\logic\ShopGoodsCategoryLogic;
|
|||||||
|
|
||||||
class ShopGoodsCategory extends Api
|
class ShopGoodsCategory extends Api
|
||||||
{
|
{
|
||||||
public $like_not_need_login = ['getShopGoodsCategory'];
|
public $like_not_need_login = ['getShopGoodsCategory','getCityGoodsCategory'];
|
||||||
|
|
||||||
public function getShopGoodsCategory()
|
public function getShopGoodsCategory()
|
||||||
{
|
{
|
||||||
@ -42,4 +42,15 @@ class ShopGoodsCategory extends Api
|
|||||||
return JsonServer::error('请求类型错误');
|
return JsonServer::error('请求类型错误');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCityGoodsCategory()
|
||||||
|
{
|
||||||
|
if($this->request->isGet()) {
|
||||||
|
$city_id = $this->request->get('city_id', 0);
|
||||||
|
$data = ShopGoodsCategoryLogic::getCityGoodsCategory($city_id);
|
||||||
|
return JsonServer::success('获取店铺分类成功', $data);
|
||||||
|
}else{
|
||||||
|
return JsonServer::error('请求类型错误');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
namespace app\api\logic;
|
namespace app\api\logic;
|
||||||
|
|
||||||
use app\common\basics\Logic;
|
use app\common\basics\Logic;
|
||||||
|
use app\common\model\shop\Shop;
|
||||||
use app\common\model\shop\ShopGoodsCategory;
|
use app\common\model\shop\ShopGoodsCategory;
|
||||||
|
|
||||||
class ShopGoodsCategoryLogic extends Logic
|
class ShopGoodsCategoryLogic extends Logic
|
||||||
@ -25,4 +26,32 @@ class ShopGoodsCategoryLogic extends Logic
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getCityGoodsCategory($city_id)
|
||||||
|
{
|
||||||
|
$shop_msg = Shop::where("city_id",$city_id)
|
||||||
|
->where("is_run",1)
|
||||||
|
->where("is_freeze",0)
|
||||||
|
->where("del",0)
|
||||||
|
->find();
|
||||||
|
$c = "";
|
||||||
|
if($shop_msg == null){
|
||||||
|
$shopId = 1;
|
||||||
|
}else{
|
||||||
|
$shopId = $shop_msg['id'];
|
||||||
|
}
|
||||||
|
$where = [
|
||||||
|
'del' => 0,
|
||||||
|
'shop_id' => $shopId,
|
||||||
|
'is_show' => 1
|
||||||
|
];
|
||||||
|
$order = [
|
||||||
|
'sort' => 'asc',
|
||||||
|
'id' => 'desc'
|
||||||
|
];
|
||||||
|
$data = ShopGoodsCategory::field('id,name')
|
||||||
|
->where($where)->order($order)->select()->toArray();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user