- 新增账号安全页面及支付密码验证组件 - 新增用户类型选择流程及商家资质管理 - 新增订单资质校验逻辑,师傅需满足订单证书要求 - 新增企业资质认证相关数据库表及接口 - 优化用户列表展示,区分个人与商家用户类型
32 行
1.1 KiB
PHP
32 行
1.1 KiB
PHP
<?php
|
|
namespace app\common\library;
|
|
|
|
use think\Db;
|
|
|
|
class OrderQualification
|
|
{
|
|
public static function certificates($masterId)
|
|
{
|
|
return Db::name('master_cert')->field('cert_name,cert_code,is_custom,status,is_long_term,expire_date')
|
|
->where('master_id', (int)$masterId)->where('status', 'pass')->select();
|
|
}
|
|
|
|
public static function allows($requirement, array $certificates, $today)
|
|
{
|
|
$requirement = trim((string)$requirement);
|
|
if ($requirement === '') return true;
|
|
foreach ($certificates as $cert) {
|
|
if ((string)$cert['status'] !== 'pass' || (int)$cert['is_custom'] !== 0 || (string)$cert['cert_code'] === 'other') continue;
|
|
if (trim((string)$cert['cert_name']) !== $requirement) continue;
|
|
if ((int)$cert['is_long_term'] === 1 || (!empty($cert['expire_date']) && $cert['expire_date'] >= $today)) return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static function forMaster($requirement, $masterId)
|
|
{
|
|
if (trim((string)$requirement) === '') return true;
|
|
return self::allows($requirement, self::certificates($masterId), date('Y-m-d'));
|
|
}
|
|
}
|