Browse Source

状态值定义到MasterOrderModel里面

wufeng 2 years ago
parent
commit
79e02b54d5

+ 8 - 8
app/admin/logic/OrderLogic.php

@@ -117,11 +117,11 @@ class OrderLogic extends BaseLogic
             ->cursor();
 
         $status = [
-            CommonModel::$order_status_wait_pay => '待支付',
-            CommonModel::$order_status_pay_fail => '支付失败',
-            CommonModel::$order_status_not_deliver => '待发货',
-            CommonModel::$order_status_deliver => '已发货',
-            CommonModel::$order_status_receipt => '已收货',
+            MasterOrderModel::$order_status_wait_pay => '待支付',
+            MasterOrderModel::$order_status_pay_fail => '支付失败',
+            MasterOrderModel::$order_status_not_deliver => '待发货',
+            MasterOrderModel::$order_status_deliver => '已发货',
+            MasterOrderModel::$order_status_receipt => '已收货',
         ];
         $type = [MasterOrderModel::$type_exchange_good => '兑换商品订单', MasterOrderModel::$type_shopping_good => '商城商品订单', MasterOrderModel::$type_service => '服务订单'];
 
@@ -166,7 +166,7 @@ class OrderLogic extends BaseLogic
         $temp = $db
             ->field('id,orderCode')
             ->where(['is_del' => CommonModel::$del_normal])
-            ->where('status', '<>', CommonModel::$order_status_not_deliver)
+            ->where('status', '<>', MasterOrderModel::$order_status_not_deliver)
             ->whereIn('orderCode', array_column($list, 'orderCode'))
             ->findOrEmpty();
 
@@ -190,9 +190,9 @@ class OrderLogic extends BaseLogic
                 $db->where([
                     'is_del' => CommonModel::$del_normal,
                     'orderCode' => $order['orderCode'],
-                    'status' => CommonModel::$order_status_not_deliver,
+                    'status' => MasterOrderModel::$order_status_not_deliver,
                 ])->save([
-                    'status' => CommonModel::$order_status_deliver,
+                    'status' => MasterOrderModel::$order_status_deliver,
                     'post_name' => $order['post_name'],
                     'post_code' => $order['post_code'],
                     'updater' => self::$uname,

+ 2 - 1
app/mobile/logic/OrderLogic.php

@@ -9,6 +9,7 @@ use app\model\CommonModel;
 use app\model\CompanyGoodModel;
 use app\model\GoodModel;
 use app\model\InventoryExchangeModel;
+use app\model\MasterOrderModel;
 use app\model\OrderModel;
 use think\facade\Db;
 use think\response\Json;
@@ -82,7 +83,7 @@ class OrderLogic extends BaseLogic
                 'addr_id' => $data['addr_id'],
                 'type' => GoodModel::$type_exchange,
                 'remark' => $data['remark'],
-                'status' => CommonModel::$order_status_not_deliver,
+                'status' => MasterOrderModel::$order_status_not_deliver,
                 'is_del' => CommonModel::$del_normal,
                 'creater' => self::$aname,
                 'createrid' => self::$aid,

+ 13 - 12
app/mobile/logic/PayLogic.php

@@ -6,6 +6,7 @@ use app\model\AccountModel;
 use app\model\AddrModel;
 use app\model\CommonModel;
 use app\model\GoodModel;
+use app\model\MasterOrderModel;
 use app\model\PayInfoModel;
 use app\model\ServiceModel;
 use think\facade\Db;
@@ -45,7 +46,7 @@ class PayLogic extends BaseLogic
                 'uid' => self::$aid,
                 'type' => $data['type'],
                 'ids' => json_encode($data['list']),
-                'status' => CommonModel::$order_status_wait_pay,
+                'status' => MasterOrderModel::$order_status_wait_pay,
                 'createrid' => self::$aid,
                 'creater' => self::$aname,
                 'addtime' => $date,
@@ -82,7 +83,7 @@ class PayLogic extends BaseLogic
                         'addr_id' => $data['addr_id'],
                         'price' => $price,
                         'total_price' => $total_price,
-                        'status' => CommonModel::$order_status_wait_pay,
+                        'status' => MasterOrderModel::$order_status_wait_pay,
                         'is_del' => CommonModel::$del_normal,
                         'createrid' => self::$aid,
                         'creater' => self::$aname,
@@ -124,8 +125,8 @@ class PayLogic extends BaseLogic
                         'price' => $item['price'],
                         'total_price' => $total_price,
                         'addr_id' => $data['addr_id'],
-                        'type' => CommonModel::$pay_type_shopping_good,
-                        'status' => CommonModel::$order_status_wait_pay,
+                        'type' => MasterOrderModel::$pay_type_shopping_good,
+                        'status' => MasterOrderModel::$order_status_wait_pay,
                         'is_del' => CommonModel::$del_normal,
                         'createrid' => self::$aid,
                         'creater' => self::$aname,
@@ -188,13 +189,13 @@ class PayLogic extends BaseLogic
             if ($pay_info->isEmpty()) throw new Exception('该支付信息不存在');
 
             //待处理
-            if ($pay_info->status == CommonModel::$order_status_wait_pay) {
+            if ($pay_info->status == MasterOrderModel::$order_status_wait_pay) {
 
                 $updatetime = date('Y-m-d H:i:s');
 
-                PayInfoModel::where(['pay_code' => $notifyInfo['out_trade_no'], 'status' => CommonModel::$order_status_wait_pay, 'id' => $pay_info->id])
+                PayInfoModel::where(['pay_code' => $notifyInfo['out_trade_no'], 'status' => MasterOrderModel::$order_status_wait_pay, 'id' => $pay_info->id])
                     ->save([
-                        'status' => CommonModel::$order_status_not_deliver,
+                        'status' => MasterOrderModel::$order_status_not_deliver,
                         'updaterid' => '0',
                         'updater' => '微信支付',
                         'updatetime' => $updatetime,
@@ -206,24 +207,24 @@ class PayLogic extends BaseLogic
                 if ($pay_info->type == GoodModel::$type_exchange) {
                     //兑换商品订单
                     Db::name('order')
-                        ->where(['is_del' => CommonModel::$del_normal, 'pay_info_id' => $pay_info->id, 'status' => CommonModel::$order_status_wait_pay])
+                        ->where(['is_del' => CommonModel::$del_normal, 'pay_info_id' => $pay_info->id, 'status' => MasterOrderModel::$order_status_wait_pay])
                         ->update([
                             'updaterid' => '0',
                             'updater' => '微信支付',
                             'updatetime' => $updatetime,
-                            'status' => CommonModel::$order_status_not_deliver
+                            'status' => MasterOrderModel::$order_status_not_deliver
                         ]);
 
 
                 } else {
                     //服务订单
                     Db::name('order_service')
-                        ->where(['is_del' => CommonModel::$del_normal, 'pay_info_id' => $pay_info->id, 'status' => CommonModel::$order_status_wait_pay])
+                        ->where(['is_del' => CommonModel::$del_normal, 'pay_info_id' => $pay_info->id, 'status' => MasterOrderModel::$order_status_wait_pay])
                         ->update([
                             'updaterid' => '0',
                             'updater' => '微信支付',
                             'updatetime' => $updatetime,
-                            'status' => CommonModel::$order_status_not_deliver
+                            'status' => MasterOrderModel::$order_status_not_deliver
                         ]);
                 }
 
@@ -253,7 +254,7 @@ class PayLogic extends BaseLogic
             ->findOrEmpty()
             ->toArray();
         if (empty($rs)) return json_show(CommonModel::$error_param, '该支付信息不存在');
-        if ($rs['status'] == CommonModel::$order_status_wait_pay) {
+        if ($rs['status'] == MasterOrderModel::$order_status_wait_pay) {
             //待支付时,手动去微信端查验是否支付完成(有可能异步通知到的晚,尚未更新状态)
             $temp = WechatLogic::checkPayResult($pay_code);
             $rs['status'] = $temp['RESULT_CODE'];//????@todo

+ 0 - 7
app/model/CommonModel.php

@@ -33,13 +33,6 @@ class CommonModel
     public static $source_admin = 1 ;//后台操作
     public static $source_account = 2 ;//客户操作
 
-    //订单状态:0待支付,1支付失败,2支付成功待发货,3已发货,4已收货
-    public static $order_status_wait_pay = 0;
-    public static $order_status_pay_fail = 1;
-    public static $order_status_not_deliver = 2;
-    public static $order_status_deliver = 3;
-    public static $order_status_receipt = 4;
-
 
 
 

+ 8 - 0
app/model/MasterOrderModel.php

@@ -16,5 +16,13 @@ class MasterOrderModel extends Model
     public static $type_shopping_good = 2;
     public static $type_service = 3;
 
+    //订单状态:0待支付,1支付失败,2支付成功待发货,3已发货,4已收货
+    public static $order_status_wait_pay = 0;
+    public static $order_status_pay_fail = 1;
+    public static $order_status_not_deliver = 2;
+    public static $order_status_deliver = 3;
+    public static $order_status_receipt = 4;
+
+
 
 }