From f9b10e51ce6f9d72ffc1be6b40917f20e60a949f Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:02:54 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=E4=B8=80=E7=BA=A7=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E6=9F=A5=E8=AF=A2=E5=95=86=E5=93=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/store_product/StoreProductLists.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index 12c737412..360cda901 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -4,6 +4,7 @@ namespace app\admin\lists\store_product; use app\admin\lists\BaseAdminDataLists; +use app\common\model\cate\Cate; use app\common\model\store_product\StoreProduct; use app\common\lists\ListsSearchInterface; use app\common\model\store_category\StoreCategory; @@ -45,6 +46,17 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa */ public function lists(): array { + $class_all = $this->request->get('class_all'); + if ($class_all) { + //查3级别的 + $arr = Cate::where('pid', $class_all)->column('id'); + if ($arr) { + $arr2 = Cate::where('pid', 'in', $arr)->column('id'); + $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)]; + } else { + $this->searchWhere[] = ['cate_id', '=', $class_all]; + } + } return StoreProduct::where($this->searchWhere) ->field(['id', 'image', 'store_name','swap', 'cate_id','batch', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code','manufacturer_information']) ->limit($this->limitOffset, $this->limitLength) From 4cb0f02df1673c680427b92e8f6187fe10e29d21 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:11:56 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B0=83=E8=AF=95=E7=9F=AD=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/SmsService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/service/SmsService.php b/app/common/service/SmsService.php index af0d86ba0..e45c905a6 100644 --- a/app/common/service/SmsService.php +++ b/app/common/service/SmsService.php @@ -75,7 +75,7 @@ class SmsService return false; } }catch(NoGatewayAvailableException $e){ - throw new BusinessException($e->getMessage()); + throw new BusinessException($e->getExceptions()); } } From fc36227b33350ad8d1048dcb49e2bfc93fc7ca53 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:13:47 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/SmsService.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/common/service/SmsService.php b/app/common/service/SmsService.php index e45c905a6..aa18e526a 100644 --- a/app/common/service/SmsService.php +++ b/app/common/service/SmsService.php @@ -47,7 +47,7 @@ class SmsService public function client($phone,$template,$code,$type = 0) { - try{ +// try{ $easySms = new EasySms($this->config); if($type){//预留发送到货短信 @@ -67,16 +67,16 @@ class SmsService 'code' => $code ], ]); - } + }d($res); if($res && $res['aliyun']['status'] == 'success'){ return true; }else{ return false; } - }catch(NoGatewayAvailableException $e){ - throw new BusinessException($e->getExceptions()); - } +// }catch(NoGatewayAvailableException $e){ +// throw new BusinessException($e->getExceptions()); +// } } } From 338354ee774d6b919f389ca94f526bad48b729f9 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:30:06 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=94=B6=E9=93=B6?= =?UTF-8?q?=E5=8F=B0=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/SmsService.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/common/service/SmsService.php b/app/common/service/SmsService.php index aa18e526a..eac0e415e 100644 --- a/app/common/service/SmsService.php +++ b/app/common/service/SmsService.php @@ -47,7 +47,7 @@ class SmsService public function client($phone,$template,$code,$type = 0) { -// try{ + try{ $easySms = new EasySms($this->config); if($type){//预留发送到货短信 @@ -67,16 +67,17 @@ class SmsService 'code' => $code ], ]); - }d($res); + } if($res && $res['aliyun']['status'] == 'success'){ return true; }else{ return false; } -// }catch(NoGatewayAvailableException $e){ -// throw new BusinessException($e->getExceptions()); -// } + }catch(NoGatewayAvailableException $e){ + d($e); + throw new BusinessException($e->getExceptions()); + } } } From fdddbbec51e59e38818529323481f68eae247e4b Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:38:04 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 53 +++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 8c4d47047..cd0862a83 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -14,6 +14,8 @@ use app\common\service\PushService; use app\common\service\wechat\WechatTemplate; use app\statistics\logic\OrderLogic; use Exception; +use Overtrue\EasySms\EasySms; +use Overtrue\EasySms\Exceptions\NoGatewayAvailableException; use support\Cache; use think\facade\Db; use Webman\Config; @@ -29,7 +31,56 @@ class IndexController extends BaseApiController public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config']; public function index() - { $all_where['paid'] = 1; + { + $config = [ + // HTTP 请求的超时时间(秒) + 'timeout' => 5.0, + + // 默认发送配置 + 'default' => [ + // 网关调用策略,默认:顺序调用 + 'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class, + + // 默认可用的发送网关 + 'gateways' => [ + 'yunpian', 'aliyun', + ], + ], + // 可用的网关配置 + 'gateways' => [ + 'errorlog' => [ + 'file' => runtime_path() . '/logs/' . date('Ymd') . '/easy-sms.log', + ], + 'aliyun' => [ + 'access_key_id' => 'LTAI5t7mhH3ij2cNWs1zhPmv', + 'access_key_secret' => 'gqo2wMpvi8h5bDBmCpMje6BaiXvcPu', + 'sign_name' => '里海科技', + ], + //... + ], + ]; + + try { + $easySms = new EasySms($config); + $template = getenv('SMS_TEMPLATE'); + $a = $easySms->send(18715753257, [ + 'content' => '您的验证码为: 6379', + 'template' => $template, + 'data' => [ + 'code' => 6379 + ], + ]); +// d($a); + }catch (NoGatewayAvailableException $exception){ + throw new \Exception($exception->getExceptions()); + } + + d($a,getenv('SMS_TEMPLATE')); + + + + + $all_where['paid'] = 1; d(OrderLogic::dayPayPrice($all_where,date('Y-m-d',time()))); $uid=9; $a= PushService::push('wechat_mmp_'.$uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'支付超时,订单已被取消,请重新提交订单','data'=>['id'=>5]]);