xxxrrrdddd 3 年之前
父节点
当前提交
d0a24cdb44

+ 2 - 2
application/common/command/OrderExpiredCommand.php

@@ -1,7 +1,7 @@
 <?php
 namespace app\common\command;
 
-use app\common\model\UserOrder;
+use app\common\model\MobileOrder;
 use think\console\Command;
 use think\console\Input;
 use think\console\Output;
@@ -16,7 +16,7 @@ class OrderExpiredCommand extends Command{
 
     protected function execute(Input $input, Output $output)
     {
-        $orders= UserOrder::expired()->select();
+        $orders= MobileOrder::expired()->select();
         foreach ($orders as $order){
             try {
                 Db::startTrans();

+ 6 - 2
application/common/model/MobileOrder.php

@@ -3,8 +3,8 @@
 namespace app\common\model;
 
 use app\admin\model\Admin;
+use think\db\Query;
 use think\Model;
-use Yansongda\Supports\Str;
 
 /**
  * 配置模型
@@ -12,7 +12,7 @@ use Yansongda\Supports\Str;
 class MobileOrder extends Model
 {
 
-
+    const STATUS_WAIT_SEND=10;
     public static $status=[
         0=>'待付款',
         10=>'待发货',
@@ -42,4 +42,8 @@ class MobileOrder extends Model
             $mobileOrder['expire_time']=time()+86400;
         });
     }
+
+    public function scopeExpired(Query $query){
+        $query->where('status');
+    }
 }

+ 1 - 0
application/index/controller/Payment.php

@@ -40,6 +40,7 @@ class Payment extends Frontend
             return '订单已支付';
         }
         $order['pay_time']=time();
+        $order['status']=MobileOrder::STATUS_WAIT_SEND;
         if($type=='wechat'){
             $order['pay_type']=1;
             $order['pay_no']=$data['transaction_id'];