...
|
...
|
@@ -4,6 +4,7 @@ namespace app\index\controller; |
|
|
|
|
|
use app\common\controller\HomeBase;
|
|
|
use app\index\model\OrderDetail;
|
|
|
use app\index\model\OrderInfo;
|
|
|
use app\index\model\Store;
|
|
|
use app\index\model\Viporder;
|
|
|
use EasyWeChat\Foundation\Application;
|
...
|
...
|
@@ -162,6 +163,7 @@ class WechatPay extends HomeBase |
|
|
$identification = substr($out_trade_no, -1);
|
|
|
$orderModel = new \app\index\model\Order();
|
|
|
$orderDetailModel = new OrderDetail();
|
|
|
$orderInfoModel = new OrderInfo();
|
|
|
if($identification == 1){
|
|
|
$data = $orderModel->findData(['num'=>$out_trade_no]);
|
|
|
}else{
|
...
|
...
|
@@ -180,12 +182,21 @@ class WechatPay extends HomeBase |
|
|
if($identification == 1){
|
|
|
$orderModel->updateData(['id'=>$data['id']],['paytime'=>time(),'status'=>'2']);
|
|
|
$orderDetailModel->updateData(['order_id'=>$data['id']],['paytime'=>time(),'status'=>'2']);
|
|
|
$order_info = $orderInfoModel->selectData(['order_id'=>$data['id']]);
|
|
|
}else{
|
|
|
$orderDetailModel->updateData(['id'=>$data['id']],['paytime'=>time(),'status'=>'2']);
|
|
|
$order_detail_status1_count = $orderDetailModel->findData(['order_id'=>$data['order_id'],'status'=>'1']);
|
|
|
if($order_detail_status1_count == 0){
|
|
|
$orderModel->updateData(['id'=>$data['order_id']],['paytime'=>time(),'status'=>'2']);
|
|
|
}
|
|
|
$order_info = $orderInfoModel->selectData(['order_detail_id'=>$data['id']]);
|
|
|
}
|
|
|
$goodsModel = new \app\index\model\Goods();
|
|
|
//扣除库存、增销量
|
|
|
foreach($order_info as $key => $o_i){
|
|
|
// $goods = $goodsModel->findData(['g.id'=>$o_i['goods_id']]);
|
|
|
$goodsModel->where(['id'=>$o_i['goods_id']])->setDec('inventory',$o_i['number']);
|
|
|
$goodsModel->where(['id'=>$o_i['goods_id']])->setInc('sale',$o_i['number']);
|
|
|
}
|
|
|
}
|
|
|
return true; // 返回处理完成
|
...
|
...
|
|