modified 优化细节

This commit is contained in:
zhaoxiang 2018-02-24 00:13:19 +08:00
parent 24675ed93c
commit 4ffb6e954b
2 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,6 @@
<?php
/**
* 登录登出
* @since 2017-11-02
* @author zhaoxiang <zhaoxiang051405@gmail.com>
*/
@ -14,6 +15,12 @@ use app\util\Tools;
class Login extends Base {
/**
* 用户登录
* @author zhaoxiang <zhaoxiang051405@gmail.com>
* @return array
* @throws \think\exception\DbException
*/
public function index() {
$username = $this->request->post('username');
$password = $this->request->post('password');
@ -73,4 +80,4 @@ class Login extends Base {
return $this->buildSuccess(ReturnCode::SUCCESS, [], '登出成功');
}
}
}

View File

@ -96,7 +96,7 @@ class User extends Base {
$postData['regTime'] = time();
$postData['password'] = Tools::userMd5($postData['password']);
if ($postData['groupId']) {
$groups = implode(',', $postData['groupId']);
$groups = trim(implode(',', $postData['groupId']), ',');
}
unset($postData['groupId']);
$res = ApiUser::create($postData);
@ -193,7 +193,7 @@ class User extends Base {
$postData['password'] = Tools::userMd5($postData['password']);
}
if ($postData['groupId']) {
$groups = implode(',', $postData['groupId']);
$groups = trim(implode(',', $postData['groupId']), ',');
}
unset($postData['groupId']);
$res = ApiUser::update($postData);