Silent 6 年之前
父節點
當前提交
809bc0273c

+ 4 - 0
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -693,6 +693,10 @@ class ApiController extends Controller
                 if(!empty($order) && $order->money  == $message['total_fee']) {
                     $order->pay_status = 2;
                     $order->save();
+                    if(!empty($order->form_data_id) && !empty($form_data = FormData::find($order->form_data_id))) {
+                        $order->pay_status = 2;
+                        $order->save();
+                    }
                 }
             } else {
                 return $fail('通信失败,请稍后再通知我');

+ 8 - 0
app/Models/FormData.php

xqd
@@ -17,4 +17,12 @@ class FormData extends Model
         }
         return '<span class="label label-success">已读</span>';
     }
+
+    public function getPayStatusLabel()
+    {
+        if($this['pay_status'] == 2) {
+            return '<span class="label label-info">已付款</span>';
+        }
+        return '<span class="label label-default">未付款</span>';
+    }
 }

+ 30 - 0
database/migrations/2018_08_28_232932_add_pay_status_to_form_data.php

xqd
@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddPayStatusToFormData extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('form_data', function (Blueprint $table) {
+            $table->tinyInteger('pay_status')->nullable()->comment('付款状态:1未付款;2已付款');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+}

+ 3 - 1
resources/views/admin/form-data/index.blade.php

xqd xqd
@@ -25,6 +25,7 @@
                                 <tr>
                                     <th>ID</th>
                                     <th>状态</th>
+                                    <th>付款状态</th>
                                     <th>时间</th>
                                     <th>操作</th>
                                 </tr>
@@ -32,13 +33,14 @@
                             <tbody>
                                 @if($list->count() <= 0)
                                     <tr>
-                                        <td colspan="4" style="text-align: center;">暂无{{ $model_name }}</td>
+                                        <td colspan="5" style="text-align: center;">暂无{{ $model_name }}</td>
                                     </tr>
                                 @else
                                     @foreach($list as $item)
                                         <tr>
                                             <td>{{ $item->id }}</td>
                                             <td>{!! $item->getStatusLabel() !!}</td>
+                                            <td>{!! $item->getPayStatusLabel() !!}</td>
                                             <td>{{ $item->created_at }}</td>
                                             <td>
                                                 <div class="btn-group">