This commit is contained in:
yanwenwu 2019-12-20 22:15:45 +08:00
parent 330a19e8c3
commit fc885476ef
3 changed files with 17 additions and 11 deletions

View File

@ -8,6 +8,7 @@ use catchAdmin\user\request\UpdateRequest;
use catcher\base\BaseController; use catcher\base\BaseController;
use catcher\CatchForm; use catcher\CatchForm;
use catcher\CatchResponse; use catcher\CatchResponse;
use think\response\Json;
class User extends BaseController class User extends BaseController
{ {
@ -60,7 +61,7 @@ class User extends BaseController
* *
* @param CreateRequest $request * @param CreateRequest $request
* @time 2019年12月06日 * @time 2019年12月06日
* @return \think\response\Json * @return Json
*/ */
public function save(CreateRequest $request) public function save(CreateRequest $request)
{ {
@ -71,13 +72,18 @@ class User extends BaseController
* *
* @time 2019年12月04日 * @time 2019年12月04日
* @param $id * @param $id
* @return \think\response\Json * @return Json
*/ */
public function read($id) public function read($id)
{ {
return CatchResponse::success($this->user->findBy($id)); return CatchResponse::success($this->user->findBy($id));
} }
/**
* @param $id
* @return string
* @throws \Exception
*/
public function edit($id) public function edit($id)
{ {
$user = $this->user->findBy($id, ['id','username', 'email']); $user = $this->user->findBy($id, ['id','username', 'email']);
@ -101,7 +107,7 @@ class User extends BaseController
* @time 2019年12月04日 * @time 2019年12月04日
* @param $id * @param $id
* @param UpdateRequest $request * @param UpdateRequest $request
* @return \think\response\Json * @return Json
*/ */
public function update($id, UpdateRequest $request) public function update($id, UpdateRequest $request)
{ {
@ -112,7 +118,7 @@ class User extends BaseController
* *
* @time 2019年12月04日 * @time 2019年12月04日
* @param $id * @param $id
* @return \think\response\Json * @return Json
*/ */
public function delete($id) public function delete($id)
{ {
@ -123,9 +129,9 @@ class User extends BaseController
* *
* @time 2019年12月07日 * @time 2019年12月07日
* @param $id * @param $id
* @return \think\response\Json * @return Json
*/ */
public function switchStatus($id): \think\response\Json public function switchStatus($id): Json
{ {
$user = $this->user->findBy($id); $user = $this->user->findBy($id);
return CatchResponse::success($this->user->updateBy($id, [ return CatchResponse::success($this->user->updateBy($id, [
@ -137,12 +143,12 @@ class User extends BaseController
* *
* @time 2019年12月07日 * @time 2019年12月07日
* @param $id * @param $id
* @return \think\response\Json * @return Json
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
*/ */
public function recover($id): \think\response\Json public function recover($id): Json
{ {
$trashedUser = $this->user->findBy($id, ['*'], true); $trashedUser = $this->user->findBy($id, ['*'], true);

View File

@ -14,7 +14,7 @@ form.on('submit(submitUser)', function (data) {
var url = mUser ? '{:url("user")}' : '{:url("user")}'; var url = mUser ? '{:url("user")}' : '{:url("user")}';
$.post(url, data.field, function (response) { $.post(url, data.field, function (response) {
layer.closeAll('loading'); layer.closeAll('loading');
if (response.code == 10000) { if (response.code === 10000) {
layer.msg(response.msg, {icon: 1}); layer.msg(response.msg, {icon: 1});
admin.putLayerData('formOk', true, '#userForm'); // 设置操作成功的标识,#modelUserForm这个只要写弹窗内任意一个元素的id即可 admin.putLayerData('formOk', true, '#userForm'); // 设置操作成功的标识,#modelUserForm这个只要写弹窗内任意一个元素的id即可
admin.closeDialog('#userForm'); // 关闭页面层弹窗 admin.closeDialog('#userForm'); // 关闭页面层弹窗

View File

@ -97,9 +97,9 @@ class InstallCommand extends Command
* 安装第一步 * 安装第一步
* *
* @time 2019年11月29日 * @time 2019年11月29日
* @return bool * @return mixed
*/ */
protected function firstStep(): bool protected function firstStep()
{ {
if (file_exists($this->app->getRootPath() . '.env')) { if (file_exists($this->app->getRootPath() . '.env')) {
return false; return false;