|
@@ -6,7 +6,9 @@ use app\data\model\BaseUserPayment;
|
|
|
use app\data\model\DataUser;
|
|
|
use app\data\model\DataUserPayment;
|
|
|
use app\data\model\DataUserVipOrder;
|
|
|
+use app\data\model\ShopGoods;
|
|
|
use app\data\model\ShopOrder;
|
|
|
+use app\data\model\ShopOrderItem;
|
|
|
use app\data\model\ShopOrderPay;
|
|
|
use app\data\service\payment\AlipayPaymentService;
|
|
|
use app\data\service\payment\BalancePaymentService;
|
|
@@ -359,7 +361,17 @@ abstract class PaymentService
|
|
|
$orderNo = $notify['out_trade_no'];
|
|
|
$order = ShopOrderPay::mk()->where('pay_no',$orderNo)->findOrEmpty();
|
|
|
if ($order->isEmpty()) return false;
|
|
|
+ $order_nos = ShopOrder::mk()->where(['payment_trade'=>$orderNo])->field('order_no')->select();
|
|
|
+ foreach ($order_nos as &$v){
|
|
|
+ $info = ShopOrderItem::mk()->where('order_no',$v['order_no'])->field('goods_code,goods_sku,stock_sales')->find();
|
|
|
+ $goods = ShopGoods::mk()->where('pay_no',$info['goods_code'])->findOrEmpty();
|
|
|
+ $item = ShopGoods::mk()->where('pay_no',$info['goods_sku'])->findOrEmpty();
|
|
|
+ $goods->stock_total -=$info['stock_sales'];
|
|
|
+ $item->stock_total -=$info['stock_sales'];
|
|
|
+ $goods->save();
|
|
|
+ $item->save();
|
|
|
|
|
|
+ }
|
|
|
ShopOrder::mk()->where(['payment_trade'=>$orderNo])->save(['status'=>4,'payment_datetime'=>date('Y-m-d H:i:s'),'payment_status'=>1]);
|
|
|
|
|
|
|