modified 编辑用户添加更新时间

This commit is contained in:
zhaoxiang 2018-03-04 00:56:09 +08:00
parent 6d3c3dc04a
commit 1f48f13b6c

View File

@ -167,7 +167,8 @@ class User extends Base {
$status = $this->request->get('status'); $status = $this->request->get('status');
$res = ApiUser::update([ $res = ApiUser::update([
'id' => $id, 'id' => $id,
'status' => $status 'status' => $status,
'updateTime' => time()
]); ]);
if ($res === false) { if ($res === false) {
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败'); return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
@ -195,19 +196,20 @@ class User extends Base {
if ($postData['groupId']) { if ($postData['groupId']) {
$groups = trim(implode(',', $postData['groupId']), ','); $groups = trim(implode(',', $postData['groupId']), ',');
} }
$postData['updateTime'] = time();
unset($postData['groupId']); unset($postData['groupId']);
$res = ApiUser::update($postData); $res = ApiUser::update($postData);
if ($res === false) { if ($res === false) {
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败'); return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
} else { } else {
$has = ApiAuthGroupAccess::get(['uid' => $postData['id']]); $has = ApiAuthGroupAccess::get(['uid' => $postData['id']]);
if($has){ if ($has) {
ApiAuthGroupAccess::update([ ApiAuthGroupAccess::update([
'groupId' => $groups 'groupId' => $groups
], [ ], [
'uid' => $postData['id'], 'uid' => $postData['id'],
]); ]);
}else{ } else {
ApiAuthGroupAccess::create([ ApiAuthGroupAccess::create([
'uid' => $postData['id'], 'uid' => $postData['id'],
'groupId' => $groups 'groupId' => $groups