Merge commit '814a488801b328daf67f86c33ac422704303dceb' into pro
# Conflicts: # app/Http/Controllers/Api/SystemController.php # public/site/en/about.html # public/site/en/download.html # public/site/en/help.html # public/site/en/index.html # public/site/en/log.html # public/site/en/price.html # public/site/en/product.html # public/site/en/solutions.html # public/site/zh/about.html # public/site/zh/download.html # public/site/zh/help.html # public/site/zh/index.html # public/site/zh/log.html # public/site/zh/price.html # public/site/zh/product.html # public/site/zh/solutions.html # resources/mobile
This commit is contained in:
@@ -20,6 +20,7 @@ use App\Models\UmengAlias;
|
||||
use App\Models\UserDelete;
|
||||
use App\Models\UserTransfer;
|
||||
use App\Models\AbstractModel;
|
||||
use App\Models\UserCheckinFace;
|
||||
use App\Models\UserCheckinMac;
|
||||
use App\Models\UserDepartment;
|
||||
use App\Models\WebSocketDialog;
|
||||
@@ -775,6 +776,14 @@ class UsersController extends AbstractController
|
||||
}
|
||||
return $user;
|
||||
});
|
||||
// user_face
|
||||
$list->transform(function (User $user) use ($getCheckinMac) {
|
||||
if ($getCheckinMac) {
|
||||
$checkinFace = UserCheckinFace::query()->whereUserid($user->userid)->first();
|
||||
$user->checkin_face = $checkinFace ? Base::fillUrl($checkinFace->faceimg) : '';
|
||||
}
|
||||
return $user;
|
||||
});
|
||||
}
|
||||
//
|
||||
return Base::retSuccess('success', $list);
|
||||
@@ -795,6 +804,7 @@ class UsersController extends AbstractController
|
||||
* - settemp 设为临时帐号
|
||||
* - cleartemp 取消临时身份(取消临时帐号)
|
||||
* - checkin_macs 修改自动签到mac地址(需要参数 checkin_macs)
|
||||
* - checkin_face 修改签到人脸图片(需要参数 checkin_face)
|
||||
* - department 修改部门(需要参数 department)
|
||||
* - setdisable 设为离职(需要参数 disable_time、transfer_userid)
|
||||
* - cleardisable 取消离职
|
||||
@@ -805,6 +815,7 @@ class UsersController extends AbstractController
|
||||
* @apiParam {String} [nickname] 昵称
|
||||
* @apiParam {String} [profession] 职位
|
||||
* @apiParam {String} [checkin_macs] 自动签到mac地址
|
||||
* @apiParam {String} [checkin_face] 人脸图片地址
|
||||
* @apiParam {String} [department] 部门
|
||||
* @apiParam {String} [disable_time] 离职时间
|
||||
* @apiParam {String} [transfer_userid] 离职交接人
|
||||
@@ -869,6 +880,11 @@ class UsersController extends AbstractController
|
||||
}
|
||||
return UserCheckinMac::saveMac($userInfo->userid, $array);
|
||||
|
||||
case 'checkin_face':
|
||||
$faceimg = $data['checkin_face'] ? $data['checkin_face'] : '';
|
||||
|
||||
return UserCheckinFace::saveFace($userInfo->userid, $userInfo->nickname, $faceimg, "管理员上传");
|
||||
|
||||
case 'department':
|
||||
if (!is_array($data['department'])) {
|
||||
$data['department'] = [];
|
||||
@@ -1643,8 +1659,14 @@ class UsersController extends AbstractController
|
||||
$user = User::auth();
|
||||
//
|
||||
$list = UserCheckinMac::whereUserid($user->userid)->orderBy('id')->get();
|
||||
$userface = UserCheckinFace::whereUserid($user->userid)->first();
|
||||
|
||||
$data = [
|
||||
'list' => $list,
|
||||
'faceimg' => $userface ? Base::fillUrl($userface->faceimg) : ''
|
||||
];
|
||||
//
|
||||
return Base::retSuccess('success', $list);
|
||||
return Base::retSuccess('success', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1669,30 +1691,53 @@ class UsersController extends AbstractController
|
||||
if ($setting['open'] !== 'open') {
|
||||
return Base::retError('此功能未开启,请联系管理员开启');
|
||||
}
|
||||
if ($setting['edit'] !== 'open') {
|
||||
if ($setting['edit'] !== 'open' && $setting['faceupload'] !== 'open') {
|
||||
return Base::retError('未开放修改权限,请联系管理员');
|
||||
}
|
||||
//
|
||||
$list = Request::input('list');
|
||||
$array = [];
|
||||
if (empty($list) || !is_array($list)) {
|
||||
return Base::retError('参数错误');
|
||||
}
|
||||
foreach ($list AS $item) {
|
||||
$item = Base::newTrim($item);
|
||||
if (Base::isMac($item['mac'])) {
|
||||
$mac = strtoupper($item['mac']);
|
||||
$array[$mac] = [
|
||||
'mac' => $mac,
|
||||
'remark' => substr($item['remark'], 0, 50),
|
||||
];
|
||||
$faceimg = Request::input('faceimg');
|
||||
// 默认返回值,使用用户传递数据
|
||||
$data = [
|
||||
'list' => $list,
|
||||
'faceimg' => $faceimg
|
||||
];
|
||||
// 当mac允许修改
|
||||
if ($setting['edit' === 'open']) {
|
||||
$array = [];
|
||||
if (empty($list) || !is_array($list)) {
|
||||
return Base::retError('参数错误');
|
||||
}
|
||||
foreach ($list AS $item) {
|
||||
$item = Base::newTrim($item);
|
||||
if (Base::isMac($item['mac'])) {
|
||||
$mac = strtoupper($item['mac']);
|
||||
$array[$mac] = [
|
||||
'mac' => $mac,
|
||||
'remark' => substr($item['remark'], 0, 50),
|
||||
];
|
||||
}
|
||||
}
|
||||
if (count($array) > 3) {
|
||||
return Base::retError('最多只能添加3个MAC地址');
|
||||
}
|
||||
$saveMacRes = UserCheckinMac::saveMac($user->userid, $array);
|
||||
$data['list'] = $saveMacRes['data'];
|
||||
} else {
|
||||
$list = UserCheckinMac::whereUserid($user->userid)->orderBy('id')->get();
|
||||
$data['list'] = $list;
|
||||
}
|
||||
if (count($array) > 3) {
|
||||
return Base::retError('最多只能添加3个MAC地址');
|
||||
|
||||
|
||||
// 当图片允许修改
|
||||
if ($setting['faceupload'] === 'open') {
|
||||
UserCheckinFace::saveFace($user->userid, $user->nickname(), $faceimg, "用户上传");
|
||||
} else {
|
||||
$userface = UserCheckinFace::whereUserid($user->userid)->first();
|
||||
$data['faceimg'] = $userface;
|
||||
}
|
||||
//
|
||||
return UserCheckinMac::saveMac($user->userid, $array);
|
||||
|
||||
return Base::retSuccess('修改成功', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user