|
@@ -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);
|
|
|
|
+ }
|
|
|
|
+}
|