perf: 人脸打卡配置

This commit is contained in:
yijixx 2024-10-11 11:33:01 +08:00
parent a8361299c7
commit e029b39eb9
4 changed files with 26 additions and 7 deletions

View File

@ -78,17 +78,28 @@ class PublicController extends AbstractController
$key = trim(Request::input('key'));
$mac = trim(Request::input('mac'));
$time = intval(Request::input('time'));
$type = trim(Request::input('type'));
//
$setting = Base::setting('checkinSetting');
if ($setting['open'] !== 'open') {
return 'function off';
}
if (!in_array('auto', $setting['modes'])) {
return 'mode off';
}
if ($key != $setting['key']) {
return 'key error';
if ($type && $type === 'face') {
if (!in_array('face', $setting['modes'])) {
return 'mode off';
}
if ($key != $setting['face_key']) {
return 'key error';
}
} else {
if (!in_array('auto', $setting['modes'])) {
return 'mode off';
}
if ($key != $setting['key']) {
return 'key error';
}
}
if ($error = UserBot::checkinBotCheckin($mac, $time)) {
return $error;
}

View File

@ -402,8 +402,10 @@ class SystemController extends AbstractController
}
if ($all['open'] === 'close') {
$all['key'] = md5(Base::generatePassword(32));
$all['face_key'] = md5(Base::generatePassword(32));
}
$all['modes'] = array_intersect($all['modes'], ['auto', 'manual', 'location']);
$all['modes'] = array_intersect($all['modes'], ['auto', 'manual', 'location', 'face']);
$setting = Base::setting('checkinSetting', Base::newTrim($all));
} else {
$setting = Base::setting('checkinSetting');
@ -413,6 +415,10 @@ class SystemController extends AbstractController
$setting['key'] = md5(Base::generatePassword(32));
Base::setting('checkinSetting', $setting);
}
if (empty($setting['face_key'])) {
$setting['face_key'] = md5(Base::generatePassword(32));
Base::setting('checkinSetting', $setting);
}
//
$setting['open'] = $setting['open'] ?: 'close';
$setting['faceupload'] = $setting['faceupload'] ?: 'close';

View File

@ -23,7 +23,7 @@
</Alert>
<div class="setting-checkin-row">
<Tabs v-model="checkinTabs" style="margin: 0;">
<TabPane :label="$L('mac地址')" name="mac">
<TabPane :label="$L('设备MAC地址')" name="mac">
<Row class="setting-template">
<Col span="12">{{$L('设备MAC地址')}}</Col>
<Col span="12">{{$L('备注')}}</Col>

View File

@ -66,10 +66,12 @@
<CheckboxGroup v-model="formData.modes">
<Checkbox label="auto">{{$L('自动签到')}}</Checkbox>
<Checkbox label="manual">{{$L('手动签到')}}</Checkbox>
<Checkbox label="face">{{$L('人脸签到')}}</Checkbox>
<Checkbox v-if="false" label="location">{{$L('定位签到')}}</Checkbox>
</CheckboxGroup>
<div v-if="formData.modes.includes('auto')" class="form-tip">{{$L('自动签到')}}: {{$L('详情看下文安装说明')}}</div>
<div v-if="formData.modes.includes('manual')" class="form-tip">{{$L('手动签到')}}: {{$L('通过在签到打卡机器人发送指令签到')}}</div>
<div v-if="formData.modes.includes('face')" class="form-tip">{{$L('人脸签到')}}: {{$L('')}}</div>
<div v-if="formData.modes.includes('location')" class="form-tip">{{$L('定位签到')}}: {{$L('通过在签到打卡机器人发送位置签到')}}</div>
</FormItem>
</template>