From 5a18492649abfc4e0833dfed68d5a163eb316439 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 4 Dec 2023 15:53:27 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=AD=E5=8F=B0?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=95=86=E5=9F=8E=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/middle/Merchant.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/controller/middle/Merchant.php b/app/controller/middle/Merchant.php index 0e8c665f..65915b29 100644 --- a/app/controller/middle/Merchant.php +++ b/app/controller/middle/Merchant.php @@ -29,6 +29,25 @@ class Merchant extends BaseController return app('json')->success($select); } + public function get_street(){ + $area_code = $this->request->param('area_code', ''); + $select=Db::name('geo_street')->where('area_code',$area_code)->field('street_id id,street_code code,street_name name')->select(); + $arr=$select?$select->toArray():[]; + foreach ($arr as $k=>$item){ + $first_char = mb_str_split($item['name']); + if($first_char[0]){ + $pinyin=new Pinyin(); + $string=$first_char[0]; + $pinyin = $pinyin->abbr($string); + $arr[$k]['pinyin']=$pinyin; + }else{ + $arr[$k]['pinyin']=''; + } + + } + return app('json')->success($arr); + } + public function count() { $where = $this->request->params(['keyword', 'date', 'status', 'statusTag', 'is_trader', 'category_id', 'type_id']); From 253fe4b904ba697aa017608d6e05759a466913dc Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 4 Dec 2023 15:58:26 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/dataview/Logistics.php | 0 app/controller/api/dataview/Order.php | 0 app/controller/api/store/merchant/Merchant.php | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 app/controller/api/dataview/Logistics.php mode change 100644 => 100755 app/controller/api/dataview/Order.php mode change 100644 => 100755 app/controller/api/store/merchant/Merchant.php diff --git a/app/controller/api/dataview/Logistics.php b/app/controller/api/dataview/Logistics.php old mode 100644 new mode 100755 diff --git a/app/controller/api/dataview/Order.php b/app/controller/api/dataview/Order.php old mode 100644 new mode 100755 diff --git a/app/controller/api/store/merchant/Merchant.php b/app/controller/api/store/merchant/Merchant.php old mode 100644 new mode 100755 From 9080cb12d4c069fef4169627029eeea36a25149b Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 4 Dec 2023 16:00:17 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route/middle.php | 1 + 1 file changed, 1 insertion(+) diff --git a/route/middle.php b/route/middle.php index 5eff9653..d740ffc9 100755 --- a/route/middle.php +++ b/route/middle.php @@ -25,6 +25,7 @@ Route::group('middle/', function () { Route::any('user/lst', 'middle.User/lst'); Route::any('merchant/city/get_area', 'middle.Merchant/get_area'); + Route::any('merchant/city/get_street', 'middle.Merchant/get_street'); Route::any('merchant/count', 'middle.Merchant/count'); Route::any('merchant/category/options', 'middle.MerchantCategory/getOptions'); Route::any('merchant/type/options', 'middle.MerchantType/options'); From 637ada6ffaba3fc368707a0b31b09d7ed46d9b4d Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 4 Dec 2023 16:15:27 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=AD=E5=8F=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/middleware/SignMiddleware.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/common/middleware/SignMiddleware.php b/app/common/middleware/SignMiddleware.php index 7a783ed4..39aad268 100755 --- a/app/common/middleware/SignMiddleware.php +++ b/app/common/middleware/SignMiddleware.php @@ -72,13 +72,13 @@ class SignMiddleware extends BaseMiddleware { // 验证请求, 10秒钟失效 if (time() - ($data['timestamp'] ?? 0) > 10) { - throw new AuthException('签名已失效'); + // throw new AuthException('签名已失效'); } // 比对签名 $clientSign = $data['sign'] ?? ''; $serverSign = $this->makeSign($data, $appSecret); if ($clientSign != $serverSign) { - throw new AuthException('签名校验失败'); + // throw new AuthException('签名校验失败'); } } } \ No newline at end of file From 814e198af25789fea756482c927693158533d715 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Mon, 4 Dec 2023 16:17:10 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=AD=E5=8F=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/middleware/SignMiddleware.php | 4 ++-- app/controller/middle/Merchant.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/common/middleware/SignMiddleware.php b/app/common/middleware/SignMiddleware.php index 39aad268..7a783ed4 100755 --- a/app/common/middleware/SignMiddleware.php +++ b/app/common/middleware/SignMiddleware.php @@ -72,13 +72,13 @@ class SignMiddleware extends BaseMiddleware { // 验证请求, 10秒钟失效 if (time() - ($data['timestamp'] ?? 0) > 10) { - // throw new AuthException('签名已失效'); + throw new AuthException('签名已失效'); } // 比对签名 $clientSign = $data['sign'] ?? ''; $serverSign = $this->makeSign($data, $appSecret); if ($clientSign != $serverSign) { - // throw new AuthException('签名校验失败'); + throw new AuthException('签名校验失败'); } } } \ No newline at end of file diff --git a/app/controller/middle/Merchant.php b/app/controller/middle/Merchant.php index 65915b29..f03e3fa4 100644 --- a/app/controller/middle/Merchant.php +++ b/app/controller/middle/Merchant.php @@ -5,6 +5,7 @@ use crmeb\basic\BaseController; use think\App; use think\facade\Db; use app\common\repositories\system\merchant\MerchantRepository; +use Overtrue\Pinyin\Pinyin; /** * Class Auth From a18877ec461f22a349f2a8d98ea22d197c641dd7 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Mon, 4 Dec 2023 18:42:46 +0800 Subject: [PATCH 6/7] =?UTF-8?q?add=20=E9=A6=96=E9=A1=B5=20=E9=95=87?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E7=BB=9F=E8=AE=A1=E4=BF=A1=E6=81=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E7=AC=AC=E4=BA=8C=E9=A1=B5=20=E7=89=A9?= =?UTF-8?q?=E6=B5=81=E4=BF=A1=E6=81=AF=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/dataview/Logistics.php | 33 +++++++++++++++++++++++ app/controller/api/dataview/Order.php | 16 +++++++++++ route/api.php | 3 +++ 3 files changed, 52 insertions(+) diff --git a/app/controller/api/dataview/Logistics.php b/app/controller/api/dataview/Logistics.php index 06a8790f..7bba9e1b 100644 --- a/app/controller/api/dataview/Logistics.php +++ b/app/controller/api/dataview/Logistics.php @@ -83,4 +83,37 @@ class Logistics extends BaseController $detail['status'] = app()->make(Order::class)->getStatusDesc($detail['status']); return app('json')->success($detail); } + + // 第二页 物流信息统计 + public function logisticsCount() + { + // 查询镇辖区内配送订单最多的配送员 + + // 先从供销系统 查出镇下边的所有配送员-小组服务公司的负责人 + $serviceGroupCompanyIds = Db::connect('work_task')->name('company') + ->where(['street'=> $this->streetCode, 'company_type'=>18]) + ->column('id'); + $userIdList = Db::connect('work_task')->name('user') + ->whereIn('company_id', $serviceGroupCompanyIds) + ->where(['group_id'=>5]) + ->column('id'); + + // 从物流系统 查物流订单排序 确定谁是 镇辖区内配送订单最多的配送员 + $topCourier = Db::connect('logistics')->name('logistics') + ->field(['courier_id','courier_name','COUNT(order_id) AS order_count']) + ->whereIn('courier_id', $userIdList) + ->group('courier_id') + ->order('order_count DESC') + ->find(); + // 返查配送员的物流配送订单统计信息 + // 待取货数 + $topCourier['pending_order_count'] = Db::connect('logistics')->name('logistics')->where(['status'=>0, 'courier_id'=>$topCourier['courier_id']])->count(); + // 配送中数 + $topCourier['delivering_order_count'] = Db::connect('logistics')->name('logistics')->where(['status'=>1, 'courier_id'=>$topCourier['courier_id']])->count(); + // 已完成数 + $topCourier['finished_order_count'] = Db::connect('logistics')->name('logistics')->where([['status', 'in', [2,3]], 'courier_id'=>$topCourier['courier_id']])->count(); + + return app('json')->success($topCourier); + + } } \ No newline at end of file diff --git a/app/controller/api/dataview/Order.php b/app/controller/api/dataview/Order.php index 6100d33a..1a0cc34a 100644 --- a/app/controller/api/dataview/Order.php +++ b/app/controller/api/dataview/Order.php @@ -169,6 +169,7 @@ class Order extends BaseController return $desc[$status]; } + // 配送商品排行榜 public function deliveredProductRanking() { // 查到镇级 @@ -198,4 +199,19 @@ class Order extends BaseController return app('json')->success($list); } + + // 首页 镇地图统计信息 + public function townMapCount() + { + $townList = Db::connect('work_task')->name('geo_street')->field('street_name, street_code, lng, lat')->where('area_code', $this->areaCode)->select()->toArray(); + foreach ($townList as &$town) { + // 店铺数 + $town['mer_count'] = Db::name('merchant')->where('street_id', $town['street_code'])->count(); + // 小组服务团队数 + $town['service_group_count'] = Db::connect('work_task')->name('company')->where(['street'=> $town['street_code'], 'company_type'=>18])->count(); + } + unset($town); + + return app('json')->success(compact('townList')); + } } \ No newline at end of file diff --git a/route/api.php b/route/api.php index 5ece750a..6b0e83f7 100644 --- a/route/api.php +++ b/route/api.php @@ -720,8 +720,11 @@ Route::group('api/', function () { Route::get('curr_order_info', 'Order/currOrderInfo'); Route::get('order_ranking', 'Order/orderRanking'); Route::get('delivered_product_ranking', 'Order/deliveredProductRanking'); + Route::get('town_map_count', 'Order/townMapCount'); Route::get('vehicle_list', 'Logistics/vehicleList'); Route::get('latest_logistics', 'Logistics/latestLogistics'); + Route::get('logistics_count', 'Logistics/logisticsCount'); + })->prefix('api.dataview.'); })->middleware(AllowOriginMiddleware::class) From 38590de7f544c50cd5f28736f927e5bdd3b7b78c Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 5 Dec 2023 12:30:30 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/product/ProductRepository.php | 20 +++++++++++++++---- app/controller/admin/ProductLibrary.php | 12 ++++++++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index d1c0d087..8ab0f376 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -239,7 +239,14 @@ class ProductRepository extends BaseRepository $result = $this->dao->create($product); $settleParams = $this->setAttrValue($data, $result->product_id, $productType, 0, $data['mer_id']); - if (isset($data['mer_cate_id']) && count($data['mer_cate_id']) != 0) { + if (isset($data['mer_cate_id']) && $data['mer_cate_id'] != '') { + if (is_array($data['mer_cate_id'])) { + if (count($data['mer_cate_id']) == 0) { + $data['mer_cate_id'] = []; + } elseif ($data['mer_cate_id'][0] == 0) { + $data['mer_cate_id'] = []; + } + } $settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $result->product_id, $data['mer_id']); } $settleParams['attr'] = $this->setAttr($data['attr'], $result->product_id); @@ -277,10 +284,15 @@ class ProductRepository extends BaseRepository event('product.update.before', compact('id', 'data', 'merId', 'productType', 'conType')); $spuData = $product = $this->setProduct($data); $settleParams = $this->setAttrValue($data, $id, $productType, 1, $merId); - if (isset($data['mer_cate_id']) && count($data['mer_cate_id']) != 0 ) { - if($data['mer_cate_id'][0]!=0){ - $settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId); + if (isset($data['mer_cate_id'])) { + if (is_array($data['mer_cate_id'])) { + if (count($data['mer_cate_id']) == 0) { + $data['mer_cate_id'] = []; + } elseif ($data['mer_cate_id'][0] == 0) { + $data['mer_cate_id'] = []; + } } + $settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId); } $settleParams['attr'] = $this->setAttr($data['attr'], $id); $content = [ diff --git a/app/controller/admin/ProductLibrary.php b/app/controller/admin/ProductLibrary.php index 32ffa8db..319dd69c 100644 --- a/app/controller/admin/ProductLibrary.php +++ b/app/controller/admin/ProductLibrary.php @@ -7,6 +7,7 @@ use think\facade\Db; use think\facade\Log; use crmeb\services\UploadService; use think\api\Client; +use GuzzleHttp\Client as http_client; class ProductLibrary extends BaseController { @@ -129,9 +130,8 @@ class ProductLibrary extends BaseController $data['create_time'] = date('Y-m-d H:i:s'); $data['images'] = ''; $arr=[]; - if ($param['img'] != '') { - $oss = $upload->to($dir)->stream(file_get_contents($param['img'])); + $oss = $upload->to($dir)->stream($this->getPic($param['img'])); $data['image'] = $oss->filePath; $arr[]=$oss->filePath; } else { @@ -139,7 +139,7 @@ class ProductLibrary extends BaseController $data['slider_image'] = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230130/00ebcfdf75684f5494c0193075055d1.png'; } foreach($param['imgList'] as $k=>$v){ - $oss=$upload->to($dir)->stream(file_get_contents($v)); + $oss=$upload->to($dir)->stream($this->getPic($v)); $arr[] = $oss->filePath; } if(count($arr)>0){ @@ -173,4 +173,10 @@ class ProductLibrary extends BaseController throw new \think\exception\ValidateException('一维码商品采集错误:'.$e->getMessage()); } } + + public function getPic($url){ + $client = new http_client(); + $a=$client->get($url); + return $a->getBody()->getContents(); + } }