junghwi před 6 roky
rodič
revize
dfcd23d0f9

+ 19 - 0
app/Http/Controllers/Api/NoticeController.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+
+use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+use App\Models;
+class NoticeController extends Controller
+{
+    //公告
+    public function notice(Request $req){
+        $Notice = new Models\Notice;
+        $data = $Notice->notice_info();
+        if(!$data){
+            return toJson(-1);
+        }
+        return toJson(1,'',$data);
+    }
+}

+ 1 - 1
app/Http/Controllers/Api/UserController.php

@@ -21,6 +21,6 @@ class UserController extends Controller
         unset($user['password']);
         unset($user['solt']);
         $userdata = array_merge($user,$userdetails);
-        return toJson($userdata);
+        return toJson(1,1,$userdata);
     }
 }

+ 14 - 0
app/Models/Notice.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Notice extends Model
+{
+    protected $table = 'notice';
+    function notice_info() {
+        $info = $this->select('title','type','content')->get();
+        return $info;
+    }
+}