进行了一些小优化
This commit is contained in:
@@ -28,7 +28,6 @@ trait DBMigratorIdentity {
|
||||
qr_payload TEXT DEFAULT NULL,
|
||||
status VARCHAR(32) NOT NULL DEFAULT 'created',
|
||||
public_name VARCHAR(64) NOT NULL DEFAULT '',
|
||||
public_desc VARCHAR(300) NOT NULL DEFAULT '',
|
||||
person_name_masked VARCHAR(64) NOT NULL DEFAULT '',
|
||||
id_number_masked VARCHAR(32) NOT NULL DEFAULT '',
|
||||
id_number_hash CHAR(64) NOT NULL DEFAULT '',
|
||||
|
||||
@@ -55,7 +55,6 @@ final class ApplicationRepository {
|
||||
'provider' => '',
|
||||
'status' => 'created',
|
||||
'public_name' => '',
|
||||
'public_desc' => '',
|
||||
'fee_amount' => '0.00',
|
||||
'fee_status' => 'not_required',
|
||||
'created_at' => $now,
|
||||
|
||||
@@ -77,7 +77,6 @@ final class ApplicationService {
|
||||
return new \WP_Error('aksrt_identity_active', __('您已有进行中的认证申请', 'aksrt'), ['status' => 409]);
|
||||
}
|
||||
$public_name = $type === 'enterprise' ? $this->truncate($company_name, 64) : __('个人认证', 'aksrt');
|
||||
$public_desc = '';
|
||||
|
||||
if ($existing) {
|
||||
$application = $existing;
|
||||
@@ -100,7 +99,6 @@ final class ApplicationService {
|
||||
'provider' => $settings['provider'],
|
||||
'provider_flow' => (string) $settings['personal_flow'],
|
||||
'public_name' => $public_name,
|
||||
'public_desc' => $public_desc,
|
||||
'person_name_masked' => SettingsRuntime::mask_name($person_name),
|
||||
'id_number_masked' => SettingsRuntime::mask_id_number($id_number),
|
||||
'id_number_hash' => SettingsRuntime::hmac($id_number),
|
||||
@@ -238,7 +236,6 @@ final class ApplicationService {
|
||||
'stage' => $stage,
|
||||
'next_action' => $next,
|
||||
'public_name' => (string) $application['public_name'],
|
||||
'public_desc' => (string) $application['public_desc'],
|
||||
'result_code' => (string) $application['provider_result_code'],
|
||||
'message' => (string) $application['provider_result_summary'],
|
||||
'redirect_url' => esc_url_raw((string) ($application['redirect_url'] ?? '')),
|
||||
|
||||
+4
-18
@@ -137,7 +137,6 @@ class AuthApply {
|
||||
private static function info_from_application(array $application): array {
|
||||
return [
|
||||
'name' => (string) ($application['public_name'] ?? ''),
|
||||
'desc' => (string) ($application['public_desc'] ?? ''),
|
||||
'type' => (string) ($application['type'] ?? ''),
|
||||
'time' => (string) (($application['completed_at'] ?? '') ?: ($application['updated_at'] ?? '')),
|
||||
];
|
||||
@@ -153,7 +152,6 @@ class AuthApply {
|
||||
'user_id' => (int) ($application['user_id'] ?? 0),
|
||||
'name' => (string) ($application['public_name'] ?? ''),
|
||||
'real_name' => (string) ($application['person_name_masked'] ?? ''),
|
||||
'desc' => (string) ($application['public_desc'] ?? ''),
|
||||
'msg' => (string) ($application['manual_reason'] ?? ''),
|
||||
'type' => (string) ($application['type'] ?? ''),
|
||||
'time' => (string) ($application['created_at'] ?? ''),
|
||||
@@ -172,7 +170,6 @@ class AuthApply {
|
||||
'stage' => $stage,
|
||||
'next_action' => self::next_action($stage),
|
||||
'public_name' => (string) ($application['public_name'] ?? ''),
|
||||
'public_desc' => (string) ($application['public_desc'] ?? ''),
|
||||
'result_code' => (string) ($application['provider_result_code'] ?? ''),
|
||||
'message' => (string) ($application['provider_result_summary'] ?? ''),
|
||||
'redirect_url' => esc_url_raw((string) ($application['redirect_url'] ?? '')),
|
||||
@@ -263,7 +260,7 @@ class AuthApply {
|
||||
return new \WP_Error('aksrt_verify_note', __('请填写处理原因', 'aksrt'));
|
||||
}
|
||||
$fields = [];
|
||||
foreach (['type', 'public_name', 'public_desc'] as $key) {
|
||||
foreach (['type', 'public_name'] as $key) {
|
||||
if (array_key_exists($key, $profile_fields)) {
|
||||
$fields[$key] = (string) $profile_fields[$key];
|
||||
}
|
||||
@@ -310,7 +307,6 @@ class AuthApply {
|
||||
$can_manage = current_user_can('aksrt_review_identity')
|
||||
&& current_user_can('edit_user', $user_id);
|
||||
$public_name = (string) ($application['public_name'] ?? '');
|
||||
$public_desc = (string) ($application['public_desc'] ?? '');
|
||||
$identity_type = in_array((string) ($application['type'] ?? ''), ['personal', 'enterprise'], true)
|
||||
? (string) $application['type']
|
||||
: 'personal';
|
||||
@@ -350,17 +346,11 @@ class AuthApply {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="aksrt_identity_public_name"><?php esc_html_e('认证身份', 'aksrt'); ?></label></th>
|
||||
<th><label for="aksrt_identity_public_name"><?php esc_html_e('姓名 / 主体全称', 'aksrt'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" class="regular-text" id="aksrt_identity_public_name" name="aksrt_identity_public_name" maxlength="64" value="<?php echo esc_attr($public_name); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="aksrt_identity_public_desc"><?php esc_html_e('认证公开说明', 'aksrt'); ?></label></th>
|
||||
<td>
|
||||
<textarea class="large-text" id="aksrt_identity_public_desc" name="aksrt_identity_public_desc" rows="3" maxlength="300"><?php echo esc_textarea($public_desc); ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="aksrt_identity_review_note"><?php esc_html_e('处理说明', 'aksrt'); ?></label></th>
|
||||
<td>
|
||||
@@ -374,8 +364,7 @@ class AuthApply {
|
||||
<td><strong><?php echo esc_html(self::admin_status_label($raw_status)); ?></strong></td>
|
||||
</tr>
|
||||
<tr><th><?php esc_html_e('认证类型', 'aksrt'); ?></th><td><?php echo esc_html(self::admin_type_label($identity_type)); ?></td></tr>
|
||||
<?php if ($public_name !== '') : ?><tr><th><?php esc_html_e('认证身份', 'aksrt'); ?></th><td><?php echo esc_html($public_name); ?></td></tr><?php endif; ?>
|
||||
<?php if ($public_desc !== '') : ?><tr><th><?php esc_html_e('认证公开说明', 'aksrt'); ?></th><td><?php echo nl2br(esc_html($public_desc)); ?></td></tr><?php endif; ?>
|
||||
<?php if ($public_name !== '') : ?><tr><th><?php esc_html_e('姓名 / 主体全称', 'aksrt'); ?></th><td><?php echo esc_html($public_name); ?></td></tr><?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<?php
|
||||
@@ -407,7 +396,6 @@ class AuthApply {
|
||||
}
|
||||
|
||||
$public_name = wp_html_excerpt(sanitize_text_field((string) wp_unslash($_POST['aksrt_identity_public_name'] ?? '')), 64, '');
|
||||
$public_desc = wp_html_excerpt(sanitize_textarea_field((string) wp_unslash($_POST['aksrt_identity_public_desc'] ?? '')), 300, '');
|
||||
$identity_type = sanitize_key((string) wp_unslash($_POST['aksrt_identity_type'] ?? ''));
|
||||
$status = sanitize_key((string) wp_unslash($_POST['aksrt_identity_status'] ?? ''));
|
||||
$note = sanitize_textarea_field((string) wp_unslash($_POST['aksrt_identity_review_note'] ?? ''));
|
||||
@@ -418,7 +406,6 @@ class AuthApply {
|
||||
$fields = [
|
||||
'type' => $identity_type,
|
||||
'public_name' => $public_name,
|
||||
'public_desc' => $public_desc,
|
||||
];
|
||||
|
||||
$current_status = (string) ($application['status'] ?? '');
|
||||
@@ -428,7 +415,7 @@ class AuthApply {
|
||||
}
|
||||
$target_status = $status === '' ? 'cancelled' : $status;
|
||||
if ($target_status === 'verified' && $public_name === '') {
|
||||
$this->set_admin_profile_notice('error', __('设为已认证时请填写认证身份。', 'aksrt'));
|
||||
$this->set_admin_profile_notice('error', __('设为已认证时请填写姓名 / 主体全称。', 'aksrt'));
|
||||
return;
|
||||
}
|
||||
if (in_array($target_status, ['rejected', 'cancelled'], true) && $target_status !== $current_status && $note === '') {
|
||||
@@ -476,7 +463,6 @@ class AuthApply {
|
||||
'provider' => '',
|
||||
'status' => 'created',
|
||||
'public_name' => $fields['public_name'],
|
||||
'public_desc' => $fields['public_desc'],
|
||||
'fee_amount' => '0.00',
|
||||
'fee_status' => 'not_required',
|
||||
'attempt_ordinal' => $repo->count_user_type($user_id, $fields['type']) + 1,
|
||||
|
||||
Reference in New Issue
Block a user