From 6e2a2faa935078419def17964ca3bdebff8be6eb Mon Sep 17 00:00:00 2001 From: liangyuyan <1103300295@qq.com> Date: Tue, 15 Sep 2020 17:19:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BA=97=E9=93=BA=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E8=A3=81=E5=89=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/v3/StoreController.php | 33 +++++++++++++++++--- config/filesystems.php | 1 + resources/lang/zh-CN/store.php | 2 +- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/app/Admin/Controllers/v3/StoreController.php b/app/Admin/Controllers/v3/StoreController.php index 6c5b5d2..8f1917c 100644 --- a/app/Admin/Controllers/v3/StoreController.php +++ b/app/Admin/Controllers/v3/StoreController.php @@ -56,7 +56,7 @@ class StoreController extends AdminController // ->image('',50); $grid->cash_code_img->display(function($appletImg){ $id = $this->id; - $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_pay_img/wx_pay_'.$id.'.jpg'; + $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_pay_img/wx_pay_'.$id.'.jpg'.config('filesystems.disks.oss.store_image_resize'); $path = empty($appletImg) ? $oldPath : config('filesystems.disks.oss.img_host').'/'.$appletImg; $img = ""; @@ -122,6 +122,31 @@ class StoreController extends AdminController $show->width(6)->business_license->image(); $show->width(6)->zm_img->image(); $show->width(6)->fm_img->image(); + + $id = 380; + $storeAppletImg = '380'; + $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_store_img/wx_store_'.$id.'.jpg'; + $path = empty($storeAppletImg) ? $oldPath : config('filesystems.disks.oss.img_host').'/'; + // $img = ""; + $show->store_applet_img->image($path); + // ->as(function($appletImg){ + // $id = $this->id; + // $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_store_img/wx_store_'.$id.'.jpg'; + // $path = empty($appletImg) ? $oldPath : config('filesystems.disks.oss.img_host').'/'.$appletImg; + // $img = ""; + + // return $img; + // }); + $cashCodeImg = ''; + $show->cash_code_img->as(function($appletImg){ + $id = $this->id; + $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_pay_img/wx_pay_'.$id.'.jpg'.config('filesystems.disks.oss.store_image_resize'); + $path = empty($appletImg) ? $oldPath : config('filesystems.disks.oss.img_host').'/'.$appletImg; + $img = ""; + + return $img; + }); + $show->width(6)->tel; $show->width(6)->link_name; $show->width(6)->link_tel; @@ -268,10 +293,10 @@ class StoreController extends AdminController // 保存图片 $store->store_applet_img = $sRes['status'] ? $sRes['path'] : ''; - $store->cash_code_img = $pRes['status'] ? $pRes['path'] : ''; + $cashImg = $pRes['status'] ? $pRes['path'] : ''; + // 保存剪裁图片 + $store->cash_code_img = $cashImg.config('filesystems.disks.oss.store_image_resize'); $store->save(); - // 剪裁图片 - // $form->image('cash_code_img')->crop(270, 270, [5, 5])->uniqueName(); //店长账号 $storeUsersInfo = StoreUsersModel::where('store_id',$id)->where('user_category',1)->first(); diff --git a/config/filesystems.php b/config/filesystems.php index 1f00391..ae8a732 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -73,6 +73,7 @@ return [ 'buckets'=>[ ], 'img_host' => env('OSS_IMG_HOST'), + 'store_image_resize' => '?x-oss-process=image/crop,x_5,y_5,w_270,h_270' ], 's3' => [ diff --git a/resources/lang/zh-CN/store.php b/resources/lang/zh-CN/store.php index 1b47620..c414316 100644 --- a/resources/lang/zh-CN/store.php +++ b/resources/lang/zh-CN/store.php @@ -9,7 +9,7 @@ return [ 'market_name' => '所属市场', 'name' => '商家名称', 'address' => '商家地址', - 'time' => '营业时间', + 'time1' => '营业时间', 'time2' => '营业时间', 'time3' => '营业时间', 'time4' => '营业时间', From b67260cc71606e051104395ec2150b3aacf805df Mon Sep 17 00:00:00 2001 From: liangyuyan <1103300295@qq.com> Date: Tue, 15 Sep 2020 17:35:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=95=86=E6=88=B7=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E8=A3=81=E5=89=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/v3/StoreController.php | 36 ++++---------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/app/Admin/Controllers/v3/StoreController.php b/app/Admin/Controllers/v3/StoreController.php index 8f1917c..6ed6431 100644 --- a/app/Admin/Controllers/v3/StoreController.php +++ b/app/Admin/Controllers/v3/StoreController.php @@ -49,7 +49,7 @@ class StoreController extends AdminController $id = $this->id; $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_store_img/wx_store_'.$id.'.jpg'; $path = empty($appletImg) ? $oldPath : config('filesystems.disks.oss.img_host').'/'.$appletImg; - $img = ""; + $img = ""; return $img; }); @@ -58,7 +58,7 @@ class StoreController extends AdminController $id = $this->id; $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_pay_img/wx_pay_'.$id.'.jpg'.config('filesystems.disks.oss.store_image_resize'); $path = empty($appletImg) ? $oldPath : config('filesystems.disks.oss.img_host').'/'.$appletImg; - $img = ""; + $img = ""; return $img; }); @@ -105,10 +105,6 @@ class StoreController extends AdminController $item = MarketModel::getMarketInfo($marketId,'name'); return empty($item) ? '' : $item->name; }); - $show->width(6)->category_id->as(function ($categoryId){ - $item = CategoryModel::getInfo($categoryId,'title'); - return empty($item) ? '' : $item->title; - }); $show->width(6)->name; $show->width(6)->logo->image(); $show->width(6)->user_id->as(function ($userId){ @@ -123,30 +119,12 @@ class StoreController extends AdminController $show->width(6)->zm_img->image(); $show->width(6)->fm_img->image(); - $id = 380; - $storeAppletImg = '380'; - $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_store_img/wx_store_'.$id.'.jpg'; - $path = empty($storeAppletImg) ? $oldPath : config('filesystems.disks.oss.img_host').'/'; - // $img = ""; - $show->store_applet_img->image($path); - // ->as(function($appletImg){ - // $id = $this->id; - // $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_store_img/wx_store_'.$id.'.jpg'; - // $path = empty($appletImg) ? $oldPath : config('filesystems.disks.oss.img_host').'/'.$appletImg; - // $img = ""; - - // return $img; - // }); - $cashCodeImg = ''; - $show->cash_code_img->as(function($appletImg){ - $id = $this->id; - $oldPath = 'https://img.lanzu.vip/addons/zh_cjdianc/data/code_pay_img/wx_pay_'.$id.'.jpg'.config('filesystems.disks.oss.store_image_resize'); - $path = empty($appletImg) ? $oldPath : config('filesystems.disks.oss.img_host').'/'.$appletImg; - $img = ""; - - return $img; + $show->store_applet_img->width(6)->image(); + $show->cash_code_img->width(6)->image(); + $show->width(6)->category_id->as(function ($categoryId){ + $item = CategoryModel::getInfo($categoryId,'title'); + return empty($item) ? '' : $item->title; }); - $show->width(6)->tel; $show->width(6)->link_name; $show->width(6)->link_tel;