Silent пре 6 година
родитељ
комит
fd91e91601

+ 1 - 1
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -178,7 +178,7 @@ class ApiController extends Controller
             'province' => $we_chat_user->province,
             'country' => $we_chat_user->country,
             'avatar_url' => $we_chat_user->avatar_url,
-            'remark' => '已绑定'
+            'bind_phone' => 2
         ]);
         if(empty($res)) {
             return response()->json(['status' => 'fail', 'info' => '数据更新失败']);

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

xqd
@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddBindPhoneToStudents extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('students', function (Blueprint $table) {
+            $table->unsignedInteger('bind_phone')->nullable()->after('phone')->comment('绑定手机:1否;2是');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+}

+ 22 - 0
database/seeds/BindPhoneSeeder.php

xqd
@@ -0,0 +1,22 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class BindPhoneSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        $students = \App\Models\Student::all();
+        foreach($students as $student) {
+            if(!empty($student->phone)) {
+                $student->bind_phone = 2;
+                $student->save();
+            }
+        }
+    }
+}