shawn 9 rokov pred
rodič
commit
7d0557cf04

+ 5 - 5
app/Http/Controllers/VoteController.php

xqd xqd
@@ -77,13 +77,13 @@ class VoteController extends Controller
         // status=1 : 投票成功
         // status=0 : 今日机会用完
         // status=2 : 未关注公众号
-        /*if($user->subscribe != 1) {
+        if($user->subscribe != 1) {
             echo json_encode(['status'=>'2']);
-            //return;
+            return;
         }elseif($today_count >= 3) {
             echo json_encode(['status'=>'0']);
-            //return;
-        }else {*/
+            return;
+        }else {
             $votes = new Vote;
             $votes->player_id = $player_id;
             $votes->openid = $user->openid;
@@ -92,7 +92,7 @@ class VoteController extends Controller
             $votes->save();
 
             echo json_encode(['status'=>'1']);
-        //}
+        }
 
     }
 }

+ 1 - 1
app/Vote.php

xqd
@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
 
 class Vote extends Model
 {
-    protected $fillable = ['player_id', 'openid', ''];
+
 }

+ 32 - 0
database/migrations/2016_11_02_183650_add_votes_updated_at.php

xqd
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddVotesUpdatedAt extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        //
+        Schema::table('votes', function (Blueprint $table) {
+            $table->timestamp('updated_at')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+        Schema::drop('votes');
+    }
+}