Просмотр исходного кода

Merge branch 'develop' of http://git.caihongxingqiu.net/rainbow/community-service into develop

zhangchangchun лет назад: 5
Родитель
Сommit
b15e050c07

+ 39 - 0
app/Http/Controllers/V1/BehaviorController.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: wangzhiqiang
+ * Date: 2019/4/30
+ * Time: 14:27
+ */
+
+namespace App\Http\Controllers\V1;
+
+use App\Http\Controllers\Controller;
+use App\Repositories\BehaviorRepositories;
+use Illuminate\Http\Request;
+use Illuminate\Validation\Validator;
+
+class BehaviorController extends Controller
+{
+    public function __construct(BehaviorRepositories $behaviorRepositories)
+    {
+        $this->behaviorRepositories = $behaviorRepositories;
+    }
+
+    /**
+     * 根据行为标识查询行为信息
+     * @param Request $request
+     * @return array
+     */
+    public function getBehaviorByIdentify(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'identify' => 'required',
+        ]);
+        if ($validator->fails()) {
+            return $this->jsonError($validator->errors()->first());
+        }
+        $row = $this->behaviorRepositories->getBehavior($request['identify']);
+        return jsonSuccess($row);
+    }
+}

+ 0 - 22
app/Http/Controllers/V1/TestController.php

@@ -1,22 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: wangzhiqiang
- * Date: 2019/4/30
- * Time: 14:27
- */
-namespace App\Http\Controllers\V1;
-
-use App\Http\Controllers\Controller;
-
-class TestController extends Controller
-{
-    public function __construct()
-    {
-    }
-
-    public function index()
-    {
-        return 212;
-    }
-}

+ 2 - 1
routes/api.php

@@ -16,7 +16,8 @@ $api = app('Dingo\Api\Routing\Router');
 $api->version('v1', [
     'namespace' => 'App\Http\Controllers\V1',
 ], function ($api) {
-
+    //根据行为标识查询行为
+    $api->get('getBehaviorByIdentify', 'BehaviorController@getBehaviorByIdentify');
     //登录+验签
     $api->group(['middleware' => ['chxq_jwt_auth']], function ($api) {
         //$api->get('test', 'TestController@index');