diff --git a/app/Admin/Actions/User/Callback.php b/app/Admin/Actions/User/Callback.php new file mode 100644 index 0000000..c7ad0ee --- /dev/null +++ b/app/Admin/Actions/User/Callback.php @@ -0,0 +1,42 @@ +all(), [ + 'callback' => 'required|url', + ], [ + 'callback.required' => '缺少回调地址', + 'callback.url' => '回调地址不正确,不是有效的url地址', + ]); + + if ($validator->fails()) { + return $this->response()->error($validator->errors()->first()); + } + + $model->callback = $request->callback; + + if ($model->save()) { + return $this->response()->success('设置成功')->refresh(); + } + + return $this->response()->error('设置失败')->refresh(); + + } + + public function form(Model $model) + { + $this->text('callback', '回调地址')->default($model->callback)->required(); + } + +} diff --git a/app/Admin/Controllers/User/IndexController.php b/app/Admin/Controllers/User/IndexController.php index 1878773..2700899 100644 --- a/app/Admin/Controllers/User/IndexController.php +++ b/app/Admin/Controllers/User/IndexController.php @@ -2,6 +2,7 @@ namespace App\Admin\Controllers\User; +use App\Admin\Actions\User\Callback; use App\Admin\Actions\User\Profit; use App\Admin\Actions\User\ReCode; use App\Admin\Actions\User\RefD3Key; @@ -38,9 +39,8 @@ class IndexController extends AdminController if ($actions->row->identity_id == 1) { $actions->add(new RefD3Key); - } - if ($actions->row->identity_id == 1) { $actions->add(new ReCode); + $actions->add(new Callback); } if ($actions->row->type == 'pingan' && $actions->row->identity_id == 1 && $user->id == 1) { @@ -97,6 +97,19 @@ class IndexController extends AdminController return $this->type_text; }); + $grid->column('回调地址')->display(function ($title, $column) { + return '点击查看'; + })->modal(function ($model) { + $data = [ + [ + $this->callback, + ], + ]; + + return new Table(['url'], $data); + + }); + $grid->column('密钥')->display(function ($title, $column) { return '点击查看'; })->modal(function ($model) { @@ -174,14 +187,16 @@ class IndexController extends AdminController $form = new Form(new User); $identity = Identity::find(1); + $form->text('username', '登录账户') ->creationRules(['required', "unique:users", 'max:11'], ['max' => '小于11个字符']) ->updateRules(['required', "unique:users,username,{{id}}"])->required(); - $form->password('password', '登录密码')->creationRules('required|min:6', [ - 'required' => '必填', - 'min' => '密码不能少于6个字符', - ]); + $form->password('password', '登录密码') + ->creationRules('required|min:6', [ + 'required' => '必填', + 'min' => '密码不能少于6个字符', + ]); $form->text('PaOutletId', '平安网点id'); @@ -252,9 +267,9 @@ class IndexController extends AdminController /** * 获取隶属 - * @author 玄尘 2020-03-12 + * @author 玄尘 2020-03-12 * @param Request $request [description] - * @return [type] [description] + * @return [type] [description] */ public function getParent(Request $request) { diff --git a/app/Api/Controllers/UserController.php b/app/Api/Controllers/UserController.php index 97ca704..19105bf 100644 --- a/app/Api/Controllers/UserController.php +++ b/app/Api/Controllers/UserController.php @@ -39,10 +39,12 @@ class UserController extends Controller */ public function grant(Request $request) { - $inputdata = $request->all(); - $res = $this->checkSign($request); + $inputdata = $request->all(); + $res = $this->checkSign($request); + $inputdata['jiemi'] = $res; $log = $this->createLog($request->url(), 'POST', $inputdata, 'grant'); //添加日志 + if (is_string($res)) { return $this->error($res, $log); }