feat: 新增账号安全模块及资质校验功能

- 新增账号安全页面及支付密码验证组件
- 新增用户类型选择流程及商家资质管理
- 新增订单资质校验逻辑,师傅需满足订单证书要求
- 新增企业资质认证相关数据库表及接口
- 优化用户列表展示,区分个人与商家用户类型
这个提交包含在:
2026-11-21 15:37:01 +08:00
父节点 8a35d93a15
当前提交 b71980dd6b
共有 58 个文件被更改,包括 1515 次插入 和 169 次删除

查看文件

@@ -7,6 +7,7 @@ use app\common\library\FinanceConfigService;
use app\common\library\OrderStatus;
use app\common\library\OrderServiceSnapshot;
use app\common\library\OrderPaymentResultService;
use app\common\library\MasterOrderCredentials;
use app\common\library\PaymentService;
use app\common\library\TiandituService;
use think\Db;
@@ -640,6 +641,7 @@ class Order extends Base
try {
if ($payType === 'balance') {
$this->requirePaymentPassword();
$res = PaymentService::payOrderByBalance($order, $this->uid(), 'order');
} else {
$res = PaymentService::createOrderJsapiPay($order, $this->uid(), 'order', 0, $wxCode);
@@ -725,6 +727,7 @@ class Order extends Base
try {
if ($payType === 'balance') {
$this->requirePaymentPassword();
$res = PaymentService::payOrderByBalance($order, $this->uid(), 'diff');
} else {
$res = PaymentService::createOrderJsapiPay($order, $this->uid(), 'diff', 0, $wxCode);
@@ -1035,6 +1038,23 @@ class Order extends Base
}
}
// 一次性读取订单关联师傅的公开技能与有效证书,避免报价列表逐人查询。
$credentialMasterIds = array_column($quotes, 'master_id');
if ($master) $credentialMasterIds[] = $master['id'];
$credentialMasterIds = array_values(array_unique(array_filter(array_map('intval', $credentialMasterIds))));
if ($credentialMasterIds) {
$skillRows = Db::name('master_skill')->field('master_id,skill_name,status')
->where('master_id', 'in', $credentialMasterIds)->where('status', 'normal')->select();
$certRows = Db::name('master_cert')->field('master_id,cert_name,status,is_long_term,expire_date')
->where('master_id', 'in', $credentialMasterIds)->where('status', 'pass')->select();
$credentials = MasterOrderCredentials::project($credentialMasterIds, $skillRows, $certRows, date('Y-m-d'));
if ($master) $master = array_merge($master, $credentials[$master['id']]);
foreach ($quotes as &$quote) {
if (isset($credentials[$quote['master_id']])) $quote = array_merge($quote, $credentials[$quote['master_id']]);
}
unset($quote);
}
$creatorUser = Db::name('user')->where('id', (int)$order['user_id'])->find();
$rawCreatorMobile = (string)(($creatorUser && !empty($creatorUser['mobile'])) ? $creatorUser['mobile'] : $order['mobile']);
$maskedCreatorMobile = strlen($rawCreatorMobile) >= 7 ? substr_replace($rawCreatorMobile, '****', 3, 4) : $rawCreatorMobile;
@@ -1224,8 +1244,14 @@ class Order extends Base
$payType = trim((string)$this->request->post('pay_type', 'wechat'));
$order = $this->ownOrder($orderId, 'user');
$quoteMasterId = (int)Db::name('order_quote')->where('id', $quoteId)->where('order_id', $orderId)->value('master_id');
if ($quoteMasterId > 0 && !\app\common\library\OrderQualification::forMaster($order['qual_req'] ?? '', $quoteMasterId)) {
$this->error('该师傅目前没有符合订单要求的有效认证证书,请选择其他师傅');
}
try {
if ($payType === 'balance') {
$this->requirePaymentPassword();
$res = PaymentService::payOrderByBalance($order, $this->uid(), 'quote', $quoteId);
} else {
$res = PaymentService::createOrderJsapiPay($order, $this->uid(), 'quote', $quoteId, $wxCode);