From 8c433686d5570db14bfcef566eb85aa4a74bab0d Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 7 May 2018 10:43:41 +0800 Subject: [PATCH 01/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E6=97=A5=E6=9C=9F=E5=8F=8A?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E6=98=BE=E7=A4=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Login.php | 2 +- application/admin/view/user/index.html | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/application/admin/controller/Login.php b/application/admin/controller/Login.php index 25b28d4a8..c133ee7ec 100644 --- a/application/admin/controller/Login.php +++ b/application/admin/controller/Login.php @@ -64,7 +64,7 @@ class Login extends BasicAdmin ($user['password'] !== md5($password)) && $this->error('登录密码与账号不匹配,请重新输入!'); empty($user['status']) && $this->error('账号已经被禁用,请联系管理!'); // 更新登录信息 - $data = ['login_at' => ['exp', 'now()'], 'login_num' => ['exp', 'login_num+1']]; + $data = ['login_at' => Db::raw('now()'), 'login_num' => Db::raw('login_num+1')]; Db::name('SystemUser')->where(['id' => $user['id']])->update($data); session('user', $user); !empty($user['authorize']) && NodeService::applyAuthNode(); diff --git a/application/admin/view/user/index.html b/application/admin/view/user/index.html index 72c79d38b..c76cd98f4 100644 --- a/application/admin/view/user/index.html +++ b/application/admin/view/user/index.html @@ -88,9 +88,7 @@ {$vo.mail|default="还没有设置邮箱"|raw} - - {$vo.login_num|default="从未登录"|raw} - + {$vo.login_num|default=0} {$vo.login_at|format_datetime|default="从未登录"|raw} From 4d52dcfafa9fe6fb8b22c6b3f1030a245f23d831 Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 7 May 2018 17:25:03 +0800 Subject: [PATCH 02/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9soa?= =?UTF-8?q?p=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/SoapService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extend/service/SoapService.php b/extend/service/SoapService.php index 06f94caf4..de6c7fbc5 100644 --- a/extend/service/SoapService.php +++ b/extend/service/SoapService.php @@ -50,6 +50,7 @@ class SoapService * @param string $name SOAP调用方法名 * @param array|string $arguments SOAP调用参数 * @return array|string|bool + * @throws \think\Exception */ public function __call($name, $arguments) { @@ -57,8 +58,8 @@ class SoapService return $this->soap->__soapCall($name, $arguments); } catch (\Exception $e) { Log::error("Soap Error. Call {$name} Method --- " . $e->getMessage()); + throw new Exception($e->getMessage(), $e->getCode()); } - return false; } } From 32aba8703ff48ad81216b91a762841ff6d2f02d4 Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 7 May 2018 17:33:30 +0800 Subject: [PATCH 03/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E9=85=8D=E7=BD=AE=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wechat/controller/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/wechat/controller/Config.php b/application/wechat/controller/Config.php index 625e261d3..dd32ba797 100644 --- a/application/wechat/controller/Config.php +++ b/application/wechat/controller/Config.php @@ -84,7 +84,7 @@ class Config extends BasicAdmin } LogService::write('微信管理', '修改微信接口参数成功'); } catch (\Exception $e) { - $this->error('微信授权保存失败 , 请稍候重试 ! ' . $e->getMessage()); + $this->error('微信授权保存成功, 但授权验证失败 !
' . $e->getMessage()); } $this->success('微信授权数据修改成功!', url('@admin') . "#" . url('@wechat/config/index')); } From b0b583285598f8a24970363ce8cb3d0b7713a942 Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 7 May 2018 17:52:31 +0800 Subject: [PATCH 04/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE=E5=9B=BE=E6=A0=87=E5=88=B6?= =?UTF-8?q?=E4=BD=9C=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/config/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/admin/view/config/index.html b/application/admin/view/config/index.html index 9aec3838a..c2acdaef2 100644 --- a/application/admin/view/config/index.html +++ b/application/admin/view/config/index.html @@ -55,7 +55,7 @@ 上传图片 -

建议上传ICO图标的尺寸为128x128px,此图标用于网站标题前,ICON在线制作

+

建议上传ICO图标的尺寸为128x128px,此图标用于网站标题前,ICON在线制作

From c4636fd9c2fcfaae1da8871a3c532c38d5ee3150 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 8 May 2018 17:44:06 +0800 Subject: [PATCH 05/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]Tp=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.php b/index.php index 07c0a05ed..d0becfbaa 100644 --- a/index.php +++ b/index.php @@ -17,5 +17,8 @@ namespace think; // 加载基础文件 require __DIR__ . '/thinkphp/base.php'; +// 生成think文件检查,防止TP目录计算异常 +file_exists('think') || touch('think'); + // 执行应用并响应 Container::get('app', [__DIR__ . '/application/'])->run()->send(); From 4a9ba108a92283b3255500f191a7bb62551520a3 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 8 May 2018 17:45:11 +0800 Subject: [PATCH 06/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=85=A5=E5=8F=A3think=E7=9B=AE=E5=BD=95=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index d0becfbaa..735a45133 100644 --- a/index.php +++ b/index.php @@ -17,7 +17,7 @@ namespace think; // 加载基础文件 require __DIR__ . '/thinkphp/base.php'; -// 生成think文件检查,防止TP目录计算异常 +// think文件检查,防止TP目录计算异常 file_exists('think') || touch('think'); // 执行应用并响应 From 51c06f19b8bc3d11653495d43ee38d9d1978ba26 Mon Sep 17 00:00:00 2001 From: freechen Date: Tue, 8 May 2018 18:36:33 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=93=81=E7=89=8C?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=92=8C=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=88=90=E5=8A=9F=E5=90=8E=E6=97=A0=E6=B3=95=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=88=97=E8=A1=A8=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/store/controller/GoodsBrand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/store/controller/GoodsBrand.php b/application/store/controller/GoodsBrand.php index 7c6618d70..54e39a05e 100644 --- a/application/store/controller/GoodsBrand.php +++ b/application/store/controller/GoodsBrand.php @@ -104,7 +104,7 @@ class GoodsBrand extends BasicAdmin protected function _form_result($result) { if ($result !== false) { - list($base, $spm, $url) = [url('@admin'), $this->request->get('spm'), url('goods/brand/index')]; + list($base, $spm, $url) = [url('@admin'), $this->request->get('spm'), url('store/goods_brand/index')]; $this->success('数据保存成功!', "{$base}#{$url}?spm={$spm}"); } } From 8904df7cacd97fbfcb9489749b31d9d13b89e792 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 11:03:33 +0800 Subject: [PATCH 08/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=95=86=E5=9F=8E=E8=AE=A2=E5=8D=95=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/store/service/MemberService.php | 37 +++++++++++++++++++++ application/store/service/OrderService.php | 13 ++++---- extend/controller/BasicWechat.php | 25 ++++++++++++++ 3 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 application/store/service/MemberService.php diff --git a/application/store/service/MemberService.php b/application/store/service/MemberService.php new file mode 100644 index 000000000..92c6c77d3 --- /dev/null +++ b/application/store/service/MemberService.php @@ -0,0 +1,37 @@ +where(['id' => $mid])->find())) { return ['code' => 0, 'msg' => '会员数据处理异常,请刷新重试!']; } // 订单数据生成 - list($order_no, $orderList) = [[], DataService::createSequence(10, 'ORDER'), []]; - $order = ['mid' => $mid, 'order_no' => $order_no, 'real_price' => 0, 'total_price' => 0, 'desc' => $orderDesc, 'type' => $orderType, 'from' => $from,]; + list($order_no, $orderList) = [DataService::createSequence(10, 'ORDER'), []]; + $order = ['mid' => $mid, 'order_no' => $order_no, 'real_price' => 0, 'goods_price' => 0, 'desc' => $orderDesc, 'type' => $orderType, 'from' => $from]; foreach (explode(';', trim($params, ',;@')) as $param) { list($goods_id, $goods_spec, $number) = explode('@', "{$param}@@"); - $item = ['mid' => $mid, 'type' => $orderType, 'order_no' => $order_no, 'goods_id' => $goods_id, 'goods_spec' => $goods_spec, 'goods_number' => $number,]; + $item = ['mid' => $mid, 'type' => $orderType, 'order_no' => $order_no, 'goods_id' => $goods_id, 'goods_spec' => $goods_spec, 'goods_number' => $number]; $goodsResult = self::buildOrderData($item, $order, $orderList, 'selling_price'); if (empty($goodsResult['code'])) { return $goodsResult; @@ -132,13 +131,15 @@ class OrderService } // 商品规格信息 $specField = 'goods_id,goods_spec,market_price,selling_price,goods_stock,goods_sale'; - $specWhere = ['status' => '1', 'is_deleted' => '0', 'package_id' => '0', 'goods_id' => $goods_id, 'goods_spec' => $goods_spec]; + $specWhere = ['status' => '1', 'is_deleted' => '0', 'goods_id' => $goods_id, 'goods_spec' => $goods_spec]; if (!($goodsSpec = Db::name('StoreGoodsList')->field($specField)->where($specWhere)->find())) { return ['code' => 0, 'msg' => '无效的商品规格信息!', 'data' => "{$goods_id}, {$goods_spec}, {$number}"]; } + // 商品库存检查 if ($goodsSpec['goods_stock'] - $goodsSpec['goods_sale'] < $number) { return ['code' => 0, 'msg' => '商品库存不足,请更换其它商品!', 'data' => "{$goods_id}, {$goods_spec}, {$number}"]; } + // 订单价格处理 $goodsSpec['price_field'] = $price_field; $orderList[] = array_merge($goods, $goodsSpec, ['mid' => $mid, 'number' => $number, 'order_no' => $order_no, 'type' => $type]); $order['goods_price'] += floatval($goodsSpec[$price_field]) * $number; diff --git a/extend/controller/BasicWechat.php b/extend/controller/BasicWechat.php index 4629488c3..1e81becd9 100644 --- a/extend/controller/BasicWechat.php +++ b/extend/controller/BasicWechat.php @@ -14,8 +14,10 @@ namespace controller; +use app\store\service\MemberService; use service\WechatService; use think\Controller; +use think\Db; /** * 微信基础控制器 @@ -31,6 +33,29 @@ class BasicWechat extends Controller */ protected $openid; + /** + * 当前会员数据记录 + * @var array + */ + protected $member = []; + + /** + * 初始化会员数据记录 + * @throws \think\Exception + * @throws \think\exception\PDOException + * @return array + */ + protected function initMember() + { + $openid = $this->getOpenid(); + $this->member = Db::name('StoreMember')->where(['openid' => $openid])->find(); + if (empty($this->member)) { + MemberService::create(['openid' => $openid]); + $this->member = Db::name('StoreMember')->where(['openid' => $openid])->find(); + } + return $this->member; + } + /** * 获取粉丝用户OPENID * @return bool|string From 4af495ab83196f4c19ccd94488ae84f760be6388 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 11:12:27 +0800 Subject: [PATCH 09/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=95=86=E5=9F=8E=E6=95=B0=E6=8D=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/store/service/GoodsService.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/application/store/service/GoodsService.php b/application/store/service/GoodsService.php index 8d0aa6df8..5ea113cf8 100644 --- a/application/store/service/GoodsService.php +++ b/application/store/service/GoodsService.php @@ -111,11 +111,10 @@ class GoodsService $saleWhere = ['status' => '1', 'is_deleted' => '0', 'goods_id' => $goods_id, 'mch_id' => $mch_id]; $saleList = (array)Db::name('StoreOrderList')->field($saleField)->where($saleWhere)->group('goods_id,goods_spec')->select(); // 库存置零 - list($where, $total_stock, $total_sale) = [['goods_id' => $goods_id], 0, 0]; + list($where, $total_sale) = [['goods_id' => $goods_id], 0]; Db::name('StoreGoodsList')->where($where)->update(['goods_stock' => 0, 'goods_sale' => 0, 'mch_id' => $mch_id]); // 更新商品库存 foreach ($stockList as $stock) { - $total_stock += intval($stock['goods_stock']); $where = ['goods_id' => $goods_id, 'goods_spec' => $stock['goods_spec'], 'mch_id' => $mch_id]; Db::name('StoreGoodsList')->where($where)->update(['goods_stock' => $stock['goods_stock']]); } @@ -125,9 +124,6 @@ class GoodsService $where = ['goods_id' => $goods_id, 'goods_spec' => $sale['goods_spec'], 'mch_id' => $mch_id]; Db::name('StoreGoodsList')->where($where)->update(['goods_sale' => $sale['goods_sale']]); } - // 更新总库存及总销量 - $update = ['package_stock' => $total_stock, 'package_sale' => $total_sale, 'mch_id' => $mch_id]; - Db::name('Goods')->where(['id' => $goods_id])->update($update); return ['code' => 1, 'msg' => '同步商品库存成功!']; } From 6c620c8b0936d32d6d71c1577a7c47288f31cae2 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 11:14:19 +0800 Subject: [PATCH 10/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=95=86=E5=9F=8E=E6=95=B0=E6=8D=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/store/service/GoodsService.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/store/service/GoodsService.php b/application/store/service/GoodsService.php index 5ea113cf8..75c5c07f9 100644 --- a/application/store/service/GoodsService.php +++ b/application/store/service/GoodsService.php @@ -104,24 +104,24 @@ class GoodsService } // 统计入库信息 $stockField = 'goods_id,goods_spec,ifnull(sum(goods_stock), 0) goods_stock'; - $stockWhere = ['status' => '1', 'is_deleted' => '0', 'goods_id' => $goods_id, 'mch_id' => $mch_id]; + $stockWhere = ['status' => '1', 'is_deleted' => '0', 'goods_id' => $goods_id]; $stockList = (array)Db::name('StoreGoodsStock')->field($stockField)->where($stockWhere)->group('goods_id,goods_spec')->select(); // 统计销售信息 $saleField = 'goods_id,goods_spec,ifnull(sum(number), 0) goods_sale'; - $saleWhere = ['status' => '1', 'is_deleted' => '0', 'goods_id' => $goods_id, 'mch_id' => $mch_id]; + $saleWhere = ['status' => '1', 'is_deleted' => '0', 'goods_id' => $goods_id]; $saleList = (array)Db::name('StoreOrderList')->field($saleField)->where($saleWhere)->group('goods_id,goods_spec')->select(); // 库存置零 list($where, $total_sale) = [['goods_id' => $goods_id], 0]; - Db::name('StoreGoodsList')->where($where)->update(['goods_stock' => 0, 'goods_sale' => 0, 'mch_id' => $mch_id]); + Db::name('StoreGoodsList')->where($where)->update(['goods_stock' => 0, 'goods_sale' => 0]); // 更新商品库存 foreach ($stockList as $stock) { - $where = ['goods_id' => $goods_id, 'goods_spec' => $stock['goods_spec'], 'mch_id' => $mch_id]; + $where = ['goods_id' => $goods_id, 'goods_spec' => $stock['goods_spec']]; Db::name('StoreGoodsList')->where($where)->update(['goods_stock' => $stock['goods_stock']]); } // 更新商品销量 foreach ($saleList as $sale) { $total_sale += intval($sale['goods_sale']); - $where = ['goods_id' => $goods_id, 'goods_spec' => $sale['goods_spec'], 'mch_id' => $mch_id]; + $where = ['goods_id' => $goods_id, 'goods_spec' => $sale['goods_spec']]; Db::name('StoreGoodsList')->where($where)->update(['goods_sale' => $sale['goods_sale']]); } return ['code' => 1, 'msg' => '同步商品库存成功!']; From 674792c47c14d3ffed352523a00659bc27d24a11 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 11:16:37 +0800 Subject: [PATCH 11/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=95=86=E5=9F=8E=E5=BA=93=E5=AD=98=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin_v3.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/admin_v3.sql b/admin_v3.sql index 52b6a5b5c..84dfff7ab 100644 --- a/admin_v3.sql +++ b/admin_v3.sql @@ -924,6 +924,19 @@ CREATE TABLE `wechat_news_media` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信素材表'; +CREATE TABLE `store_goods_stock` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `goods_id` bigint(20) unsigned DEFAULT '0' COMMENT '商品ID', + `goods_spec` varchar(255) DEFAULT '' COMMENT '商品属性', + `goods_stock` bigint(20) unsigned DEFAULT '0' COMMENT '商品库存', + `stock_desc` varchar(255) DEFAULT '' COMMENT '商品库存描述', + `sort` bigint(20) unsigned DEFAULT '0' COMMENT '数据排序', + `status` bigint(1) unsigned DEFAULT '1' COMMENT '商品状态(1有效,0无效)', + `is_deleted` bigint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)', + `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COMMENT='商城商品库存'; + -- ---------------------------- -- Records of wechat_news_media -- ---------------------------- From de920ca7d8cb39a96f9a22ba09c5eaf5d49412df Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 11:19:15 +0800 Subject: [PATCH 12/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=95=86=E5=9F=8E=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin_v3.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admin_v3.sql b/admin_v3.sql index 84dfff7ab..1789db95c 100644 --- a/admin_v3.sql +++ b/admin_v3.sql @@ -924,6 +924,11 @@ CREATE TABLE `wechat_news_media` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信素材表'; + +-- ---------------------------- +-- Table structure for store_goods_stock +-- ---------------------------- +DROP TABLE IF EXISTS `store_goods_stock`; CREATE TABLE `store_goods_stock` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `goods_id` bigint(20) unsigned DEFAULT '0' COMMENT '商品ID', From a099bb6e703d18b55061add00d5dce3a7f45c72d Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 11:26:42 +0800 Subject: [PATCH 13/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E5=BE=AE=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E5=BA=93=E5=AD=98=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/store/controller/Goods.php | 39 ++++++++++++++++ application/store/service/GoodsService.php | 4 +- application/store/view/goods/index.html | 5 +++ application/store/view/goods/stock.html | 52 ++++++++++++++++++++++ 4 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 application/store/view/goods/stock.html diff --git a/application/store/controller/Goods.php b/application/store/controller/Goods.php index f9aa540e5..fb8d9b7c4 100644 --- a/application/store/controller/Goods.php +++ b/application/store/controller/Goods.php @@ -223,6 +223,45 @@ class Goods extends BasicAdmin return ['main' => $main, 'list' => $list]; } + /** + * 商品库存信息更新 + * @return string + * @throws \think\Exception + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function stock() + { + if (!$this->request->post()) { + $goods_id = $this->request->get('id'); + $goods = Db::name('StoreGoods')->where(['id' => $goods_id, 'is_deleted' => '0'])->find(); + empty($goods) && $this->error('该商品无法操作入库操作!'); + $where = ['goods_id' => $goods_id, 'status' => '1', 'is_deleted' => '0']; + $goods['list'] = Db::name('StoreGoodsList')->where($where)->select(); + return $this->fetch('', ['vo' => $goods]); + } + // 入库保存 + $goods_id = $this->request->post('id'); + list($post, $data) = [$this->request->post(), []]; + foreach ($post['spec'] as $key => $spec) { + if ($post['stock'][$key] > 0) { + $data[] = [ + 'goods_stock' => $post['stock'][$key], + 'stock_desc' => $this->request->post('desc'), + 'goods_spec' => $spec, 'goods_id' => $goods_id, + ]; + } + } + empty($data) && $this->error('无需入库的数据哦!'); + if (Db::name('StoreGoodsStock')->insertAll($data) !== false) { + GoodsService::syncGoodsStock($goods_id); + $this->success('商品入库成功!', ''); + } + $this->error('商品入库失败,请稍候再试!'); + } + /** * 删除商品 * @throws \think\Exception diff --git a/application/store/service/GoodsService.php b/application/store/service/GoodsService.php index 75c5c07f9..7ef6c6a7f 100644 --- a/application/store/service/GoodsService.php +++ b/application/store/service/GoodsService.php @@ -99,7 +99,7 @@ class GoodsService { // 检查商品是否需要更新库存 $map = ['id' => $goods_id, 'is_deleted' => '0']; - if (!($goods = Db::name('Goods')->where($map)->find())) { + if (!($goods = Db::name('StoreGoods')->where($map)->find())) { return ['code' => 0, 'msg' => '指定商品信息无法同步库存!']; } // 统计入库信息 @@ -109,7 +109,7 @@ class GoodsService // 统计销售信息 $saleField = 'goods_id,goods_spec,ifnull(sum(number), 0) goods_sale'; $saleWhere = ['status' => '1', 'is_deleted' => '0', 'goods_id' => $goods_id]; - $saleList = (array)Db::name('StoreOrderList')->field($saleField)->where($saleWhere)->group('goods_id,goods_spec')->select(); + $saleList = (array)Db::name('StoreOrderGoods')->field($saleField)->where($saleWhere)->group('goods_id,goods_spec')->select(); // 库存置零 list($where, $total_sale) = [['goods_id' => $goods_id], 0]; Db::name('StoreGoodsList')->where($where)->update(['goods_stock' => 0, 'goods_sale' => 0]); diff --git a/application/store/view/goods/index.html b/application/store/view/goods/index.html index b47420777..6b33ced59 100644 --- a/application/store/view/goods/index.html +++ b/application/store/view/goods/index.html @@ -159,6 +159,11 @@ 编辑 + + | + 入库 + + | 下架 diff --git a/application/store/view/goods/stock.html b/application/store/view/goods/stock.html new file mode 100644 index 000000000..d712b1f9b --- /dev/null +++ b/application/store/view/goods/stock.html @@ -0,0 +1,52 @@ + From 0479ce90d43e60f8d920a9dff5abfe7d4fd118ce Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 11:31:09 +0800 Subject: [PATCH 14/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=95=86=E5=9F=8E=E5=BA=93=E5=AD=98=E5=8F=8A?= =?UTF-8?q?=E9=94=80=E5=94=AE=E9=87=8F=E8=87=AA=E5=8A=A8=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/store/service/GoodsService.php | 2 +- application/store/service/OrderService.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/application/store/service/GoodsService.php b/application/store/service/GoodsService.php index 7ef6c6a7f..8873f2f7f 100644 --- a/application/store/service/GoodsService.php +++ b/application/store/service/GoodsService.php @@ -86,7 +86,7 @@ class GoodsService } /** - * 同步更新商品库存及售出(@todo 需要重新做库存统计) + * 同步更新商品库存及售出 * @param int $goods_id 商品ID * @return array * @throws \think\Exception diff --git a/application/store/service/OrderService.php b/application/store/service/OrderService.php index e6d3d4ddd..cb6f84507 100644 --- a/application/store/service/OrderService.php +++ b/application/store/service/OrderService.php @@ -68,7 +68,10 @@ class OrderService Db::name('StoreOrderGoods')->insertAll($orderList); // 订单关联的商品信息 Db::name('storeOrderExpress')->insert($expressResult['data']); // 快递信息 }); - // @todo 同步相关商品库存 + // 同步商品库存列表 + foreach (array_unique(array_column($orderList, 'goods_id')) as $stock_goods_id) { + GoodsService::syncGoodsStock($stock_goods_id); + } } catch (\Exception $e) { return ['code' => 0, 'msg' => '商城订单创建失败,请稍候再试!' . $e->getLine() . $e->getFile() . $e->getMessage()]; } From 7aae42c8c4994c75d3a6812474182f260c38a5f9 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 11:39:09 +0800 Subject: [PATCH 15/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BE=AE=E5=95=86=E5=9F=8E=E5=BA=93=E5=AD=98=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/store/view/goods/stock.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/store/view/goods/stock.html b/application/store/view/goods/stock.html index d712b1f9b..820a42581 100644 --- a/application/store/view/goods/stock.html +++ b/application/store/view/goods/stock.html @@ -3,7 +3,7 @@
- +
From 2a1aff4a8fd423cec368a54e4b50fe0183f57c81 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 12:27:58 +0800 Subject: [PATCH 16/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]ComposerUpdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_real.php | 14 +++++++------- vendor/composer/autoload_static.php | 9 +++++---- vendor/composer/installed.json | 12 ++++++------ .../WeChat/Contracts/BasicWeChat.php | 2 +- vendor/zoujingli/wechat-developer/WeChat/Pay.php | 2 +- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/vendor/autoload.php b/vendor/autoload.php index ce8975bef..f61fd5b49 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c::getLoader(); +return ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 282038a30..76df8b0d8 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -165,6 +165,7 @@ return array( 'app\\store\\controller\\wechat\\Demo' => $baseDir . '/application/store/controller/wechat/Demo.php', 'app\\store\\controller\\wechat\\Index' => $baseDir . '/application/store/controller/wechat/Index.php', 'app\\store\\service\\GoodsService' => $baseDir . '/application/store/service/GoodsService.php', + 'app\\store\\service\\MemberService' => $baseDir . '/application/store/service/MemberService.php', 'app\\store\\service\\OrderService' => $baseDir . '/application/store/service/OrderService.php', 'app\\wechat\\controller\\Config' => $baseDir . '/application/wechat/controller/Config.php', 'app\\wechat\\controller\\Fans' => $baseDir . '/application/wechat/controller/Fans.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 359d7ba98..d609ea5cd 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c +class ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInitf5974243cd36d6c47ccc2deac6411e2c $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequiref5974243cd36d6c47ccc2deac6411e2c($fileIdentifier, $file); + composerRequire718a8d9567dd1edbcfc83169e7de8f66($fileIdentifier, $file); } return $loader; } } -function composerRequiref5974243cd36d6c47ccc2deac6411e2c($fileIdentifier, $file) +function composerRequire718a8d9567dd1edbcfc83169e7de8f66($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 46f8a648e..eb00295a8 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c +class ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66 { public static $files = array ( '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', @@ -248,6 +248,7 @@ class ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c 'app\\store\\controller\\wechat\\Demo' => __DIR__ . '/../..' . '/application/store/controller/wechat/Demo.php', 'app\\store\\controller\\wechat\\Index' => __DIR__ . '/../..' . '/application/store/controller/wechat/Index.php', 'app\\store\\service\\GoodsService' => __DIR__ . '/../..' . '/application/store/service/GoodsService.php', + 'app\\store\\service\\MemberService' => __DIR__ . '/../..' . '/application/store/service/MemberService.php', 'app\\store\\service\\OrderService' => __DIR__ . '/../..' . '/application/store/service/OrderService.php', 'app\\wechat\\controller\\Config' => __DIR__ . '/../..' . '/application/wechat/controller/Config.php', 'app\\wechat\\controller\\Fans' => __DIR__ . '/../..' . '/application/wechat/controller/Fans.php', @@ -274,9 +275,9 @@ class ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitf5974243cd36d6c47ccc2deac6411e2c::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index e9e437143..110a4ca97 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -80,17 +80,17 @@ }, { "name": "zoujingli/wechat-developer", - "version": "v1.1.3", - "version_normalized": "1.1.3.0", + "version": "v1.1.4", + "version_normalized": "1.1.4.0", "source": { "type": "git", "url": "https://github.com/zoujingli/WeChatDeveloper.git", - "reference": "4b1112e8d4723ce5e6ef0d6eee41a02e588b60ab" + "reference": "011e4608726fa83cb495dfa1f4d4f56c154ada21" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/zoujingli/WeChatDeveloper/4b1112e8d4723ce5e6ef0d6eee41a02e588b60ab.zip", - "reference": "4b1112e8d4723ce5e6ef0d6eee41a02e588b60ab", + "url": "https://files.phpcomposer.com/files/zoujingli/WeChatDeveloper/011e4608726fa83cb495dfa1f4d4f56c154ada21.zip", + "reference": "011e4608726fa83cb495dfa1f4d4f56c154ada21", "shasum": "" }, "require": { @@ -98,7 +98,7 @@ "ext-openssl": "*", "php": ">=5.4" }, - "time": "2018-05-03T07:30:54+00:00", + "time": "2018-05-09T04:22:21+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/zoujingli/wechat-developer/WeChat/Contracts/BasicWeChat.php b/vendor/zoujingli/wechat-developer/WeChat/Contracts/BasicWeChat.php index 1af8ceb22..83c9a3d1f 100644 --- a/vendor/zoujingli/wechat-developer/WeChat/Contracts/BasicWeChat.php +++ b/vendor/zoujingli/wechat-developer/WeChat/Contracts/BasicWeChat.php @@ -105,7 +105,7 @@ class BasicWeChat if (!empty($result['access_token'])) { Tools::setCache($cache, $result['access_token'], 7000); } - return $result['access_token']; + return $this->access_token = $result['access_token']; } /** diff --git a/vendor/zoujingli/wechat-developer/WeChat/Pay.php b/vendor/zoujingli/wechat-developer/WeChat/Pay.php index 5b4c6dfff..fddcf1c0a 100644 --- a/vendor/zoujingli/wechat-developer/WeChat/Pay.php +++ b/vendor/zoujingli/wechat-developer/WeChat/Pay.php @@ -300,7 +300,7 @@ class Pay $option = []; if ($isCert) { foreach (['ssl_cer', 'ssl_key'] as $key) { - if (empty($options[$key])) { + if (empty($option[$key])) { throw new InvalidArgumentException("Missing Config -- [{$key}]", '0'); } } From 1666d59e57496e7865898d605bd54be8744131f4 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 9 May 2018 15:16:54 +0800 Subject: [PATCH 17/17] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]ComposerUpdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 +++++++------- vendor/composer/autoload_static.php | 8 ++++---- vendor/composer/installed.json | 8 ++++---- vendor/zoujingli/wechat-developer/WeChat/Pay.php | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/vendor/autoload.php b/vendor/autoload.php index f61fd5b49..11af676cc 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66::getLoader(); +return ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index d609ea5cd..e9e991e87 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66 +class ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit718a8d9567dd1edbcfc83169e7de8f66 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire718a8d9567dd1edbcfc83169e7de8f66($fileIdentifier, $file); + composerRequire7ecf5ded1a6830a1c375fe7293886da9($fileIdentifier, $file); } return $loader; } } -function composerRequire718a8d9567dd1edbcfc83169e7de8f66($fileIdentifier, $file) +function composerRequire7ecf5ded1a6830a1c375fe7293886da9($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index eb00295a8..131da8600 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66 +class ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9 { public static $files = array ( '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', @@ -275,9 +275,9 @@ class ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit718a8d9567dd1edbcfc83169e7de8f66::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 110a4ca97..e601ce3ca 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -85,12 +85,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/WeChatDeveloper.git", - "reference": "011e4608726fa83cb495dfa1f4d4f56c154ada21" + "reference": "e72fb2f166ee1a3b4889845cd932a1ab9d2005ee" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/zoujingli/WeChatDeveloper/011e4608726fa83cb495dfa1f4d4f56c154ada21.zip", - "reference": "011e4608726fa83cb495dfa1f4d4f56c154ada21", + "url": "https://files.phpcomposer.com/files/zoujingli/WeChatDeveloper/e72fb2f166ee1a3b4889845cd932a1ab9d2005ee.zip", + "reference": "e72fb2f166ee1a3b4889845cd932a1ab9d2005ee", "shasum": "" }, "require": { @@ -98,7 +98,7 @@ "ext-openssl": "*", "php": ">=5.4" }, - "time": "2018-05-09T04:22:21+00:00", + "time": "2018-05-09T05:38:00+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/zoujingli/wechat-developer/WeChat/Pay.php b/vendor/zoujingli/wechat-developer/WeChat/Pay.php index fddcf1c0a..b57d43b6a 100644 --- a/vendor/zoujingli/wechat-developer/WeChat/Pay.php +++ b/vendor/zoujingli/wechat-developer/WeChat/Pay.php @@ -299,13 +299,13 @@ class Pay { $option = []; if ($isCert) { + $option['ssl_cer'] = $this->config->get('ssl_cer'); + $option['ssl_key'] = $this->config->get('ssl_key'); foreach (['ssl_cer', 'ssl_key'] as $key) { - if (empty($option[$key])) { + if (empty($option[$key]) || !file_exists($option[$key])) { throw new InvalidArgumentException("Missing Config -- [{$key}]", '0'); } } - $option['ssl_cer'] = $this->config->get('ssl_cer'); - $option['ssl_key'] = $this->config->get('ssl_key'); } $params = $this->params->merge($data); $needSignType && ($params['sign_type'] = strtoupper($signType));