Commit 8009ebed authored by wuxiaoli's avatar wuxiaoli

上传图片到本地

parent 60edcf1a
...@@ -704,18 +704,32 @@ class OrderService { ...@@ -704,18 +704,32 @@ class OrderService {
if(!$order){ if(!$order){
throw new \Exception("订单不存在!", 0); throw new \Exception("订单不存在!", 0);
} }
//判断是否为店主
$level = auth('api')->user()->level()->where('store_id', '=', $order['store_id'])->first(); $item = $order->detail()->where('id', $request->input('detail_id'))->first();
if(!$level || $level['name'] != 'master'){ if(!$item){
throw new \Exception("您不是店主,无权核销!", 0); throw new \Exception("订单详情不存在!", 0);
}
if ($request->is('api/*') && auth('api')->user()){
//判断是否为店主
$store = \Modules\Store\Models\Store::where('id', $item['store_id'])->where('status', 1)->select(['id', 'member_id', 'status'])->first();
if($store->member_id != auth('api')->user()->uid){
throw new \Exception("您不是店主,无权发货!", 0);
}
}else{
throw new \Exception("请先登录!", 0);
} }
$order->status = 3; $order->status = 3;
$order->confirm_time = date('Y-m-d H:i:s'); $order->confirm_time = date('Y-m-d H:i:s');
$order->delivery_time = date('Y-m-d H:i:s');
$order->save(); $order->save();
\Modules\Goods\Events\OrderTake::dispatch($order); $item->status = 3;
$item->delivery_time = date('Y-m-d H:i:s');
$item->delivery_type = $request->input('delivery_type', 'pickup');
$item->save();
\Modules\Order\Events\OrderTake::dispatch($order, $item);
return $order; return $order;
} }
......
...@@ -10,6 +10,7 @@ namespace Modules\System\Controllers\Api; ...@@ -10,6 +10,7 @@ namespace Modules\System\Controllers\Api;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\BaseController; use App\Http\Controllers\BaseController;
use Illuminate\Support\Facades\Storage;
class File extends BaseController { class File extends BaseController {
...@@ -82,6 +83,9 @@ class File extends BaseController { ...@@ -82,6 +83,9 @@ class File extends BaseController {
$path = $file->store('images/'.date('Ymd')); $path = $file->store('images/'.date('Ymd'));
// 保存图片到storage/app/public/images目录
//$bool = Storage::disk('public')->put($path, file_get_contents($file -> getRealPath()));//解决方式 换成 Storage::disk('')->put()
$data = [ $data = [
'path' => $path, 'path' => $path,
'url' => Storage::disk()->url($path), 'url' => Storage::disk()->url($path),
......
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 to comment