Bladeren bron

订单表添加字段

ajun 5 jaren geleden
bovenliggende
commit
5a14c6b59f
2 gewijzigde bestanden met toevoegingen van 36 en 1 verwijderingen
  1. 4 1
      app/Order.php
  2. 32 0
      database/migrations/2020_12_01_134905_add_order_type_to_orders.php

+ 4 - 1
app/Order.php

@@ -14,7 +14,8 @@ class Order extends Model
         'id', 'batch_id',  'owner_id', 'status',
         'created_at', 'code', 'shop_id',  'client_code',
         'logistic_id', 'consignee_name', 'consignee_phone', 'province',
-        'city', 'district', 'address', 'wms_status','warehouse_id','wms_edittime'];
+        'city', 'district', 'address','warehouse_id',
+        'wms_edittime', 'wms_status','order_type'];
 
     /*
      * wms订单号             code=>DOC_ORDER_HEADER[orderno]
@@ -148,6 +149,7 @@ class Order extends Model
             $this['client_code'] = $order['client_code'] &&
             $this['wms_status'] == $order['wms_status'] &&
             $this['wms_edittime'] == $order['wms_edittime'] &&
+            $this['order_type'] == $order['order_type'] &&
             (string)$this['created_at'] == (string)$order['created_at'];
     }
 
@@ -167,6 +169,7 @@ class Order extends Model
         $this['client_code'] = $order['client_code'] ;
         $this['wms_status'] = $order['wms_status'] ;
         $this['wms_edittime'] = $order['wms_edittime'];
+        $this['order_type'] = $order['order_type'];
         $this['created_at'] =$order['created_at'];
     }
 }

+ 32 - 0
database/migrations/2020_12_01_134905_add_order_type_to_orders.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddOrderTypeToOrders extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('orders', function (Blueprint $table) {
+            $table->string('order_type')->index()->nullable()->comment('订单类型')->after('wms_status');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('orders', function (Blueprint $table) {
+            $table->dropColumn('order_type');
+        });
+    }
+}