Commit 13046fa5 by mushishixian

temp

parent 427fcb6b
...@@ -34,39 +34,15 @@ class SkuApiController extends Controller ...@@ -34,39 +34,15 @@ class SkuApiController extends Controller
$this->response(-1, '请选择要操作的SKU', '0'); $this->response(-1, '请选择要操作的SKU', '0');
} }
$status = $request->input('status'); $status = $request->input('status');
$Redis = new RedisModel(); $result = curl(env('FOOTSTONE_URL') . '/fsapi/operation_sku_status', [
$updateData['update_time'] = time(); 'goods_id' => $map,
switch ($status) { 'status' => $status
case 'offshelf': ]);
$updateData['goods_status'] = 3; $result = json_decode($result, true);
$msg = '成功下架'; if ($result['errcode'] == 0) {
break; $this->response(0, '操作成功');
case 'passed': } else {
$msg = '成功上架'; $this->response(-1, '操作失败,原因是 : ' . $result['errmsg']);
$updateData['goods_status'] = 1;
break;
case 'negative':
$updateData['goods_status'] = 2;
$msg = '审核不通过';
break;
} }
$skuService = new SkuService();
$i = 0;
foreach ($map as $k => $v) {
$dbinfo = resolve($v);
$list = DB::connection($dbinfo['db'])->table($dbinfo['table'])->where('goods_id', $v)->update($updateData);
if ($list) {
$info = json_decode($Redis->hget('sku', $v), true);
$info['goods_status'] = $updateData['goods_status'];
$info['goods_id'] = $v;
$info['update_time'] = $updateData['update_time'];
$skuService->HandleSku($info);
$i++;
}
}
//实时推送ES
$skuIds = implode(',', $map);
$skuService->PushSkuUpdate($skuIds);
$this->response(0, '操作成功');
} }
} }
...@@ -297,4 +297,5 @@ class SupplierApiController extends Controller ...@@ -297,4 +297,5 @@ class SupplierApiController extends Controller
} }
$this->response(0, '转正供应商成功'); $this->response(0, '转正供应商成功');
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment