|
@@ -9,6 +9,7 @@
|
|
|
namespace App\Http\Controllers\V1;
|
|
|
|
|
|
|
|
|
+use App\Repositories\ProductRepository;
|
|
|
use App\Repositories\ShopRepository;
|
|
|
use App\Shop;
|
|
|
use App\ShopAccount;
|
|
@@ -149,7 +150,11 @@ class ShopController extends Controller {
|
|
|
$data['extra']['columns'] = ['shop_id','shop_name','mobile','province_name','city_name','product_count','proportion','status'];
|
|
|
return $data;
|
|
|
}
|
|
|
- //删除商家
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param Request $request
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
public function isOpen(Request $request){
|
|
|
$data = $request->only('shop_id','status');
|
|
|
$validator = Validator::make($data, [
|
|
@@ -161,8 +166,15 @@ class ShopController extends Controller {
|
|
|
}
|
|
|
$res = Shop::where(['shop_id'=>$data['shop_id']])->update(['status'=>$data['status']]);
|
|
|
if($res){
|
|
|
- //下架商家所有商品,放入队列
|
|
|
- return ['message' => '成功','status_code' => 200];
|
|
|
+ //下架商家所有商品
|
|
|
+ if($data['status'] == 0){
|
|
|
+ $product = new ProductRepository();
|
|
|
+ $upStatus = $product->upProductStatus($data['shop_id']);
|
|
|
+ if($upStatus['status_code'] == 200){
|
|
|
+ return ['message' => '成功','status_code' => 200];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}else{
|
|
|
return $this->response->error("失败", 500);
|
|
|
}
|