mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 新增文件上传
This commit is contained in:
parent
90a1b6d034
commit
ea1cae1d54
@ -186,8 +186,6 @@ class User extends Base {
|
|||||||
public function edit() {
|
public function edit() {
|
||||||
$groups = '';
|
$groups = '';
|
||||||
$postData = $this->request->post();
|
$postData = $this->request->post();
|
||||||
$postData['regIp'] = request()->ip(1);
|
|
||||||
$postData['regTime'] = time();
|
|
||||||
if ($postData['password'] === 'ApiAdmin') {
|
if ($postData['password'] === 'ApiAdmin') {
|
||||||
unset($postData['password']);
|
unset($postData['password']);
|
||||||
} else {
|
} else {
|
||||||
@ -220,6 +218,42 @@ class User extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改自己的信息
|
||||||
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
|
* @return array
|
||||||
|
* @throws \think\exception\DbException
|
||||||
|
*/
|
||||||
|
public function own() {
|
||||||
|
$postData = $this->request->post();
|
||||||
|
$headImg = $postData['headImg'];
|
||||||
|
if ($postData['password'] && $postData['oldPassword']) {
|
||||||
|
$oldPass = Tools::userMd5($postData['oldPassword']);
|
||||||
|
unset($postData['oldPassword']);
|
||||||
|
if ($oldPass === $this->userInfo['password']) {
|
||||||
|
$postData['password'] = Tools::userMd5($postData['password']);
|
||||||
|
} else {
|
||||||
|
return $this->buildFailed(ReturnCode::INVALID, '原始密码不正确');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unset($postData['password']);
|
||||||
|
unset($postData['oldPassword']);
|
||||||
|
}
|
||||||
|
$postData['id'] = $this->userInfo['id'];
|
||||||
|
$postData['updateTime'] = time();
|
||||||
|
unset($postData['headImg']);
|
||||||
|
$res = ApiUser::update($postData);
|
||||||
|
if ($res === false) {
|
||||||
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||||
|
} else {
|
||||||
|
$userData = ApiUserData::get(['uid' => $postData['id']]);
|
||||||
|
$userData->headImg = $headImg;
|
||||||
|
$userData->save();
|
||||||
|
|
||||||
|
return $this->buildSuccess([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户
|
* 删除用户
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -55,6 +55,10 @@ return [
|
|||||||
'admin/User/add',
|
'admin/User/add',
|
||||||
['method' => 'post', 'after_behavior' => $afterBehavior]
|
['method' => 'post', 'after_behavior' => $afterBehavior]
|
||||||
],
|
],
|
||||||
|
'User/own' => [
|
||||||
|
'admin/User/own',
|
||||||
|
['method' => 'post', 'after_behavior' => $afterBehavior]
|
||||||
|
],
|
||||||
'User/edit' => [
|
'User/edit' => [
|
||||||
'admin/User/edit',
|
'admin/User/edit',
|
||||||
['method' => 'post', 'after_behavior' => $afterBehavior]
|
['method' => 'post', 'after_behavior' => $afterBehavior]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user