no message

This commit is contained in:
kuaifan 2025-05-26 23:04:00 +08:00
parent d73239b274
commit 2a25917e41
3 changed files with 29 additions and 27 deletions

View File

@ -1529,11 +1529,13 @@ class SystemController extends AbstractController
} }
// 添加office资源 // 添加office资源
$officePath = ''; $officePath = '';
$officeApi = 'http://office/web-apps/apps/api/documents/api.js'; if (Apps::isInstalled('office')) {
$content = @file_get_contents($officeApi); $officeApi = 'http://office/web-apps/apps/api/documents/api.js';
if ($content) { $content = @file_get_contents($officeApi);
if (preg_match("/const\s+ver\s*=\s*'\/*([^']+)'/", $content, $matches)) { if ($content) {
$officePath = $matches[1]; if (preg_match("/const\s+ver\s*=\s*'\/*([^']+)'/", $content, $matches)) {
$officePath = $matches[1];
}
} }
} }
if ($officePath) { if ($officePath) {
@ -1549,14 +1551,16 @@ class SystemController extends AbstractController
}); });
} }
// 添加OKR资源 // 添加OKR资源
$okrContent = @file_get_contents("http://nginx/apps/okr/"); if (Apps::isInstalled('okr')) {
preg_match_all('/<script[^>]*src=["\']([^"\']+)["\'][^>]*>/i', $okrContent, $scriptMatches); $okrContent = @file_get_contents("http://nginx/apps/okr/");
foreach ($scriptMatches[1] as $src) { preg_match_all('/<script[^>]*src=["\']([^"\']+)["\'][^>]*>/i', $okrContent, $scriptMatches);
$array[] = $src; foreach ($scriptMatches[1] as $src) {
} $array[] = $src;
preg_match_all('/<link[^>]*rel=["\']stylesheet["\'][^>]*href=["\']([^"\']+)["\'][^>]*>/i', $okrContent, $linkMatches); }
foreach ($linkMatches[1] as $href) { preg_match_all('/<link[^>]*rel=["\']stylesheet["\'][^>]*href=["\']([^"\']+)["\'][^>]*>/i', $okrContent, $linkMatches);
$array[] = $href; foreach ($linkMatches[1] as $href) {
$array[] = $href;
}
} }
} }

View File

@ -942,8 +942,7 @@ class UsersController extends AbstractController
return UserCheckinMac::saveMac($userInfo->userid, $array); return UserCheckinMac::saveMac($userInfo->userid, $array);
case 'checkin_face': case 'checkin_face':
$faceimg = $data['checkin_face'] ? $data['checkin_face'] : ''; $faceimg = $data['checkin_face'] ?: '';
return UserCheckinFace::saveFace($userInfo->userid, $userInfo->nickname, $faceimg, "管理员上传"); return UserCheckinFace::saveFace($userInfo->userid, $userInfo->nickname, $faceimg, "管理员上传");
case 'department': case 'department':

View File

@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use App\Exceptions\ApiException; use App\Exceptions\ApiException;
use App\Module\Apps;
use App\Module\Base; use App\Module\Base;
use App\Module\Ihttp; use App\Module\Ihttp;
@ -37,8 +38,9 @@ use App\Module\Ihttp;
class UserCheckinFace extends AbstractModel class UserCheckinFace extends AbstractModel
{ {
public static function saveFace($userid, $nickname, $faceimg, $remark='') public static function saveFace($userid, $nickname, $faceimg, $remark = '')
{ {
Apps::isInstalledThrow('face');
// 取上传图片的URL // 取上传图片的URL
$faceimg = Base::unFillUrl($faceimg); $faceimg = Base::unFillUrl($faceimg);
$record = ""; $record = "";
@ -59,14 +61,14 @@ class UserCheckinFace extends AbstractModel
} }
$res = Ihttp::ihttp_post($url, json_encode($data), 15); $res = Ihttp::ihttp_post($url, json_encode($data), 15);
if($res['data'] && $data = json_decode($res['data'])){ if ($res['data'] && $data = json_decode($res['data'])) {
if($data->ret != 1 && $data->msg){ if ($data->ret != 1 && $data->msg) {
throw new ApiException($data->msg); throw new ApiException($data->msg);
} }
} }
return AbstractModel::transaction(function() use ($userid, $faceimg, $remark) { return AbstractModel::transaction(function () use ($userid, $faceimg, $remark) {
$checkinFace = self::query()->whereUserid($userid)->first(); $checkinFace = self::query()->whereUserid($userid)->first();
if ($checkinFace) { if ($checkinFace) {
self::updateData(['id' => $checkinFace->id], [ self::updateData(['id' => $checkinFace->id], [
@ -82,16 +84,14 @@ class UserCheckinFace extends AbstractModel
$checkinFace->save(); $checkinFace->save();
} }
if ($faceimg == '') { if ($faceimg == '') {
$res = UserCheckinFace::deleteDeviceUser($userid); UserCheckinFace::deleteDeviceUser($userid);
if ($res) {
return $res;
}
} }
return Base::retSuccess('设置成功'); return Base::retSuccess('设置成功');
}); });
} }
public static function deleteDeviceUser($userid) { private static function deleteDeviceUser($userid)
{
$url = "http://face:7788/user/delete"; $url = "http://face:7788/user/delete";
$data = [ $data = [
'enrollid' => $userid, 'enrollid' => $userid,
@ -99,10 +99,9 @@ class UserCheckinFace extends AbstractModel
]; ];
$res = Ihttp::ihttp_post($url, json_encode($data)); $res = Ihttp::ihttp_post($url, json_encode($data));
if($res['data'] && $data = json_decode($res['data'])){ if ($res['data'] && $data = json_decode($res['data'])) {
if($data->ret != 1 && $data->msg){ if ($data->ret != 1 && $data->msg) {
throw new ApiException($data->msg); throw new ApiException($data->msg);
// return Base::retError($data->msg);
} }
} }
} }