wesley 7 лет назад
Родитель
Сommit
fc2d27359c

+ 4 - 4
app/Http/Controllers/Api/V1/HomeController.php

xqd xqd
@@ -798,10 +798,12 @@ class HomeController extends Controller
 
         if (request('paytype') == 0) {
             $money = $order->price;
+
         } else {
             $money = $order->deposit;
         }
-        session()->put($order->id . 'paytype', request('paytype'));
+        $order->paytype = request('paytype');
+        $order->save();
 
         if (request('couponid')) {
             $coupon = CouponInfoModel::find(request('couponid'));
@@ -860,9 +862,7 @@ class HomeController extends Controller
                 $data['order_id'] = $order->id;
                 $data['order_price'] = $order->price;
                 $data['paid_price'] = $notify['total_fee'] / 100;
-                $data['type'] = 0;
-                \Log::info($order->id . 'paytype');
-                \Log::info(session()->get($order->id . 'paytype'));
+                $data['type'] = $order->paytype;
 
                 PaidInfoModel::create($data);
 

+ 2 - 1
app/Models/OrderInfoModel.php

xqd
@@ -49,7 +49,8 @@ class OrderInfoModel extends BaseModel
         'product_id',
         'schedule_id',
         'price',
-        'deposit'
+        'deposit',
+        'paytype'
     ];
 
     public function store()

+ 32 - 0
database/migrations/2018_09_05_160409_add_paytype_to_order_info.php

xqd
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddPaytypeToOrderInfo extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('order_info', function (Blueprint $table) {
+            $table->tinyInteger('paytype')->nullable()->comment('支付方式:0:全款;1:定金');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('order_info', function (Blueprint $table) {
+            //
+        });
+    }
+}