diff --git a/application/admin/view/default/payment/index.html b/application/admin/view/default/payment/index.html index d2cbb7280..c50655bac 100755 --- a/application/admin/view/default/payment/index.html +++ b/application/admin/view/default/payment/index.html @@ -121,7 +121,7 @@
-

1 类名必须于文件名一致(去除 .php ),如 Alipay.php 则取 Alipay
2 类必须定义三个方法
    2.1 Config 配置方法
    2.2 Pay 支付方法
    2.3 Respond 回调方法

PS:以上条件不满足则无法查看插件

diff --git a/application/index/view/default/public/pay_error.html b/application/index/view/default/public/pay_error.html index b2bd260dd..88244b672 100755 --- a/application/index/view/default/public/pay_error.html +++ b/application/index/view/default/public/pay_error.html @@ -25,7 +25,7 @@ {{$msg}}
diff --git a/application/service/AppNavService.php b/application/service/AppNavService.php index edfa9e9df..ddc00313d 100644 --- a/application/service/AppNavService.php +++ b/application/service/AppNavService.php @@ -2,6 +2,7 @@ namespace app\service; use think\Db; +use app\service\ResourcesService; /** * APP导航服务层 diff --git a/application/service/BuyService.php b/application/service/BuyService.php index a1d42e64b..9da91bbdd 100755 --- a/application/service/BuyService.php +++ b/application/service/BuyService.php @@ -813,7 +813,7 @@ class BuyService } // 获取订单商品 - $order_detail = Db::name('OrderDetail')->field('goods_id,buy_number')->where(['order_id'=>$params['order_id']])->select(); + $order_detail = Db::name('OrderDetail')->field('goods_id,buy_number,spec')->where(['order_id'=>$params['order_id']])->select(); if(!empty($order_detail)) { foreach($order_detail as $v) @@ -828,7 +828,21 @@ class BuyService // 扣除操作 if(!Db::name('Goods')->where(['id'=>$v['goods_id']])->setDec('inventory', $v['buy_number'])) { - return DataReturn('库存扣减失败['.$params['order_id'].'-'.$v['goods_id'].']', -10); + return DataReturn('商品库存扣减失败['.$params['order_id'].'-'.$v['goods_id'].'('.$goods['inventory'].'-'.$v['buy_number'].')]', -10); + } + + // 扣除规格库存 + $spec = empty($v['spec']) ? '' : json_decode($v['spec'], true); + $base = GoodsService::GoodsSpecDetail(['id'=>$v['goods_id'], 'spec'=>$spec]); + if($base['code'] == 0) + { + // 扣除规格操作 + if(!Db::name('GoodsSpecBase')->where(['id'=>$base['data']['id'], 'goods_id'=>$v['goods_id']])->setDec('inventory', $v['buy_number'])) + { + return DataReturn('规格库存扣减失败['.$params['order_id'].'-'.$v['goods_id'].'('.$goods['inventory'].'-'.$v['buy_number'].')]', -10); + } + } else { + return $base; } // 扣除日志添加 @@ -894,7 +908,7 @@ class BuyService } // 获取订单商品 - $order_detail = Db::name('OrderDetail')->field('goods_id,buy_number')->where(['order_id'=>$params['order_id']])->select(); + $order_detail = Db::name('OrderDetail')->field('goods_id,buy_number,spec')->where(['order_id'=>$params['order_id']])->select(); if(!empty($order_detail)) { foreach($order_detail as $v) @@ -906,7 +920,21 @@ class BuyService // 回滚操作 if(!Db::name('Goods')->where(['id'=>$v['goods_id']])->setInc('inventory', $v['buy_number'])) { - return DataReturn('库存回滚失败['.$params['order_id'].'-'.$v['goods_id'].']', -10); + return DataReturn('商品库存回滚失败['.$params['order_id'].'-'.$v['goods_id'].']', -10); + } + + // 扣除规格库存 + $spec = empty($v['spec']) ? '' : json_decode($v['spec'], true); + $base = GoodsService::GoodsSpecDetail(['id'=>$v['goods_id'], 'spec'=>$spec]); + if($base['code'] == 0) + { + // 扣除规格操作 + if(!Db::name('GoodsSpecBase')->where(['id'=>$base['data']['id'], 'goods_id'=>$v['goods_id']])->setInc('inventory', $v['buy_number'])) + { + return DataReturn('规格库存回滚失败['.$params['order_id'].'-'.$v['goods_id'].']', -10); + } + } else { + return $base; } // 回滚日志更新 diff --git a/application/service/ExpressService.php b/application/service/ExpressService.php index 5bb9c0d8c..dca9ba2f2 100644 --- a/application/service/ExpressService.php +++ b/application/service/ExpressService.php @@ -2,6 +2,7 @@ namespace app\service; use think\Db; +use app\service\ResourcesService; /** * 快递服务层 diff --git a/application/service/GoodsService.php b/application/service/GoodsService.php index 365a76487..02cc91ec6 100755 --- a/application/service/GoodsService.php +++ b/application/service/GoodsService.php @@ -1661,7 +1661,7 @@ class GoodsService // 获取基础值数据 if(!empty($base_id)) { - $base = Db::name('GoodsSpecBase')->field('goods_id,price,inventory,coding,barcode,original_price')->find($base_id); + $base = Db::name('GoodsSpecBase')->field('id,goods_id,price,inventory,coding,barcode,original_price')->find($base_id); if(!empty($base)) { return DataReturn('操作成功', 0, $base); @@ -1670,7 +1670,7 @@ class GoodsService } } } else { - $base = Db::name('GoodsSpecBase')->field('goods_id,price,inventory,coding,barcode,original_price')->where($where)->find(); + $base = Db::name('GoodsSpecBase')->field('id,goods_id,price,inventory,coding,barcode,original_price')->where($where)->find(); if(!empty($base)) { return DataReturn('操作成功', 0, $base); diff --git a/application/service/OrderService.php b/application/service/OrderService.php index ad143c3a0..e79172dbf 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -358,13 +358,13 @@ class OrderService ]; Db::name('PayLog')->insertGetId($pay_log_data); + // 开启事务 + Db::startTrans(); + // 消息通知 $detail = '订单支付成功,金额'.PriceBeautify($params['order']['total_price']).'元'; MessageService::MessageAdd($params['order']['user_id'], '订单支付', $detail, 1, $params['order']['id']); - // 开启事务 - Db::startTrans(); - // 更新订单状态 $upd_data = array( 'status' => 2, diff --git a/application/service/PaymentService.php b/application/service/PaymentService.php index e1e0b7378..89787c5d3 100644 --- a/application/service/PaymentService.php +++ b/application/service/PaymentService.php @@ -542,6 +542,7 @@ class PaymentService { return DataReturn('资源不存在或已被删除', -2); } + // 权限 if(!is_writable($file)) { @@ -612,6 +613,7 @@ class PaymentService // 批量创建 foreach(self::$payment_business_type_all as $v) { + $name = strtolower($v['name']); // 异步 $notify=<<run()->send(); ?> php; @@ -645,20 +651,24 @@ $respond=<<run()->send(); ?> php; $name = strtolower($v['name']); diff --git a/application/service/ScreeningPriceService.php b/application/service/ScreeningPriceService.php index 4730a35c7..505b77c9a 100644 --- a/application/service/ScreeningPriceService.php +++ b/application/service/ScreeningPriceService.php @@ -2,6 +2,7 @@ namespace app\service; use think\Db; +use app\service\ResourcesService; /** * 筛选价格服务层 diff --git a/application/service/UserService.php b/application/service/UserService.php index 28363a3ce..0d8ae14cb 100755 --- a/application/service/UserService.php +++ b/application/service/UserService.php @@ -2,8 +2,6 @@ namespace app\service; use think\Db; -use app\service\ResourcesService; -use app\service\MessageService; use app\service\RegionService; /** diff --git a/extend/payment/Alipay.php b/extend/payment/Alipay.php index 0fb014369..17a51244e 100755 --- a/extend/payment/Alipay.php +++ b/extend/payment/Alipay.php @@ -42,8 +42,8 @@ class Alipay $base = [ 'name' => '支付宝', // 插件名称 'version' => '0.0.1', // 插件版本 - 'apply_version' => '1.0~1.3', // 适用系统版本描述 - 'apply_terminal'=> ['pc','h5'], // 适用终端 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu'] + 'apply_version' => '不限', // 适用系统版本描述 + 'apply_terminal'=> ['pc','h5'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu'] 'desc' => '适用PC+H5,即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 立即申请', // 插件描述(支持html) 'author' => 'Devil', // 开发者 'author_url' => 'http://shopxo.net/', // 开发者主页 @@ -58,7 +58,7 @@ class Alipay 'name' => 'account', 'placeholder' => '支付宝账号', 'title' => '支付宝账号', - 'is_required' => 1, + 'is_required' => 0, 'message' => '请填写支付宝账号', ], [ @@ -68,7 +68,7 @@ class Alipay 'name' => 'partner', 'placeholder' => '合作者身份 partner ID', 'title' => '合作者身份 partner ID', - 'is_required' => 1, + 'is_required' => 0, 'message' => '请填写合作者身份 partner ID', ], [ @@ -78,7 +78,7 @@ class Alipay 'name' => 'key', 'placeholder' => '交易安全校验码 key', 'title' => '交易安全校验码 key', - 'is_required' => 1, + 'is_required' => 0, 'message' => '请填写交易安全校验码 key', ], // [ diff --git a/extend/payment/AlipayMini.php b/extend/payment/AlipayMini.php index 9f089817d..a6d94e9bb 100755 --- a/extend/payment/AlipayMini.php +++ b/extend/payment/AlipayMini.php @@ -43,7 +43,7 @@ class AlipayMini 'name' => '支付宝', // 插件名称 'version' => '0.0.1', // 插件版本 'apply_version' => '不限', // 适用系统版本描述 - 'apply_terminal'=> ['alipay'], // 适用终端 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu'] + 'apply_terminal'=> ['alipay'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu'] 'desc' => '适用支付宝小程序,即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 立即申请', // 插件描述(支持html) 'author' => 'Devil', // 开发者 'author_url' => 'http://shopxo.net/', // 开发者主页 @@ -58,7 +58,7 @@ class AlipayMini 'name' => 'appid', 'placeholder' => 'appid', 'title' => 'appid', - 'is_required' => 1, + 'is_required' => 0, 'message' => '请填写小程序appid', ], [ @@ -66,24 +66,27 @@ class AlipayMini 'name' => 'rsa_public', 'placeholder' => '应用公钥', 'title' => '应用公钥', - 'is_required' => 1, + 'is_required' => 0, 'rows' => 6, + 'message' => '请填写应用公钥', ], [ 'element' => 'textarea', 'name' => 'rsa_private', 'placeholder' => '应用私钥', 'title' => '应用私钥', - 'is_required' => 1, + 'is_required' => 0, 'rows' => 6, + 'message' => '请填写应用私钥', ], [ 'element' => 'textarea', 'name' => 'out_rsa_public', 'placeholder' => '支付宝公钥', 'title' => '支付宝公钥', - 'is_required' => 1, + 'is_required' => 0, 'rows' => 6, + 'message' => '请填写支付宝公钥', ], ]; diff --git a/public/install/shopxo_tp5.sql b/public/install/shopxo_tp5.sql old mode 100644 new mode 100755 diff --git a/public/payment_order_alipay_notify.php b/public/payment_order_alipay_notify.php new file mode 100644 index 000000000..efcae4f46 --- /dev/null +++ b/public/payment_order_alipay_notify.php @@ -0,0 +1,25 @@ +run()->send(); +?> \ No newline at end of file diff --git a/public/payment_order_alipay_respond.php b/public/payment_order_alipay_respond.php new file mode 100644 index 000000000..23912b727 --- /dev/null +++ b/public/payment_order_alipay_respond.php @@ -0,0 +1,25 @@ +run()->send(); +?> \ No newline at end of file diff --git a/public/payment_order_alipaymini_notify.php b/public/payment_order_alipaymini_notify.php new file mode 100644 index 000000000..1b0859c5b --- /dev/null +++ b/public/payment_order_alipaymini_notify.php @@ -0,0 +1,25 @@ +run()->send(); +?> \ No newline at end of file diff --git a/public/payment_order_alipaymini_respond.php b/public/payment_order_alipaymini_respond.php new file mode 100644 index 000000000..d38206f95 --- /dev/null +++ b/public/payment_order_alipaymini_respond.php @@ -0,0 +1,25 @@ +run()->send(); +?> \ No newline at end of file diff --git a/public/payment_order_cashpayment_respond.php b/public/payment_order_cashpayment_respond.php new file mode 100644 index 000000000..9df2b2598 --- /dev/null +++ b/public/payment_order_cashpayment_respond.php @@ -0,0 +1,25 @@ +run()->send(); +?> \ No newline at end of file diff --git a/public/payment_order_deliverypayment_respond.php b/public/payment_order_deliverypayment_respond.php new file mode 100644 index 000000000..934f477d8 --- /dev/null +++ b/public/payment_order_deliverypayment_respond.php @@ -0,0 +1,25 @@ +run()->send(); +?> \ No newline at end of file diff --git a/public/static/admin/default/css/express.css b/public/static/admin/default/css/express.css old mode 100644 new mode 100755 diff --git a/public/static/upload/images/goods/2018/12/11/1544516462343672.png b/public/static/upload/images/goods/2018/12/11/1544516462343672.png old mode 100644 new mode 100755 diff --git a/public/static/upload/video/goods/2018/12/11/1544497954125888.mp4 b/public/static/upload/video/goods/2018/12/11/1544497954125888.mp4 old mode 100644 new mode 100755 diff --git a/public/static/upload/video/goods/2018/12/11/1544497954486088.ogg b/public/static/upload/video/goods/2018/12/11/1544497954486088.ogg old mode 100644 new mode 100755