|
@@ -6,6 +6,7 @@ namespace app\api\controller;
|
|
|
|
|
|
use app\admin\model\Attribute;
|
|
|
use app\admin\model\Label;
|
|
|
+use app\api\model\Category;
|
|
|
use app\api\model\ShopUserOld;
|
|
|
use app\api\model\StoreEvaluate;
|
|
|
use app\api\model\StoreOrder;
|
|
@@ -16,7 +17,22 @@ use app\common\controller\Api;
|
|
|
use app\api\model\ShopUser;
|
|
|
class Shop extends Api
|
|
|
{
|
|
|
- protected $noNeedLogin =[ 'attribute','attribute_xh','label'];
|
|
|
+ protected $noNeedLogin =[ 'attribute','attribute_xh','label','category','store_list'];
|
|
|
+
|
|
|
+
|
|
|
+ public function category(){
|
|
|
+ $where = ['status' => 'normal'];
|
|
|
+ $where['pid']=0;
|
|
|
+
|
|
|
+ $list = Category::where($where)
|
|
|
+
|
|
|
+ ->with('catelist')
|
|
|
+ ->field('id,name,pid')
|
|
|
+ ->order('weigh desc,id desc')
|
|
|
+ ->select();
|
|
|
+ $this->result('ok', $list, 1);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* 申请成为商家
|
|
|
*
|
|
@@ -198,13 +214,23 @@ class Shop extends Api
|
|
|
public function store_list(){
|
|
|
$userId = $this->request->post('user_id');
|
|
|
$suser_id= $this->request->post('suser_id');
|
|
|
- $where['suser_id']=$suser_id;
|
|
|
+ $search = $this->request->post('search');
|
|
|
+ $cate_id = $this->request->post('cate_id');
|
|
|
$where['is_del']=array('eq',0);
|
|
|
- $list=StoreProduct::where($where)->field('id,slider_image,image,store_name,deposit_price,price,false as shop_show,cate_top_id ')->select();
|
|
|
+ if (!empty($suser_id)){
|
|
|
+ $where['suser_id']=$suser_id;
|
|
|
+ }
|
|
|
+ if (!empty($search)){
|
|
|
+ $where['store_name']=array('like','%'.$search.'%');
|
|
|
+ }
|
|
|
+ if (!empty($cate_id)){
|
|
|
+ $where['cate_id']=$cate_id;
|
|
|
+ }
|
|
|
+ $list=StoreProduct::where($where)->field('id,slider_image,image,store_name,deposit_price,price,false as shop_show,cate_top_id ')->order('id desc')->select();
|
|
|
foreach ($list as $k=>$v){
|
|
|
$v['shop_show']=false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$this->result('success', $list, 1);
|
|
|
}
|
|
|
|