feat: 用户端与师傅端双小程序架构解耦,新增师傅独立认证及超时自动关单机制
1. 账号体系与数据库解耦: - 师傅表 fa_master 解除对 fa_user.id 的外键依赖,升级为独立认证账号主表; - 新增师傅端独立支撑表:fa_master_security、fa_master_token、fa_master_wechat、fa_master_agreement_read; - 新增工单超时未接单自动关闭与原路退款配置(order_unaccepted_close_days)。 2. 服务端(Server): - 新增师傅端独立 API 控制器与认证库(MasterAuth, MasterBase, MasterMessage, MasterSecurity, MasterToken); - WxLogin 支持双小程序端(user/master)独立换取 session_key、openid 与 access_token; - 新增控制台调度命令 php think order:autoclose,支持订单超时自动关闭与售后退款闭环; - 修复 PHP 8.5 兼容性问题(Request.php 的 (bool) 强制转换); - 系统业务配置全面收敛至数据库 fa_config 及 site.php。 3. 小程序端: - yjyf-app(用户端):彻底剥离师傅端路由、组件及静态资源,增加隐私授权弹窗与评价模块; - yjyf-master-app(师傅端):全新独立微信小程序工程(wx140d90ceda786107),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
这个提交包含在:
@@ -79,6 +79,7 @@ class Withdraw extends Backend
|
||||
}
|
||||
$masterId = (int)$row['master_id'];
|
||||
$master = $masterId > 0 ? Db::name('master')->where('id', $masterId)->find() : null;
|
||||
$wechatBind = $masterId > 0 ? Db::name('master_wechat')->where('master_id', $masterId)->find() : null;
|
||||
$recentSettles = $masterId > 0
|
||||
? Db::name('settle')->alias('s')
|
||||
->join('__ORDER__ o', 'o.id = s.order_id', 'LEFT')
|
||||
@@ -98,12 +99,13 @@ class Withdraw extends Backend
|
||||
: [];
|
||||
|
||||
$this->view->assign([
|
||||
'row' => $row,
|
||||
'master' => $master ?: [],
|
||||
'recentSettles' => $recentSettles,
|
||||
'walletLogs' => $walletLogs,
|
||||
'verifyStatusList' => ['pending' => '审核中', 'pass' => '已认证', 'reject' => '审核未通过'],
|
||||
'walletTypeList' => (new \app\admin\model\WalletLog)->getTypeList(),
|
||||
'row' => $row,
|
||||
'master' => $master ?: [],
|
||||
'wechatBind' => $wechatBind ?: [],
|
||||
'recentSettles' => $recentSettles,
|
||||
'walletLogs' => $walletLogs,
|
||||
'verifyStatusList' => ['draft' => '待完善资料', 'pending' => '审核中', 'pass' => '已认证', 'reject' => '审核未通过'],
|
||||
'walletTypeList' => (new \app\admin\model\WalletLog)->getTypeList(),
|
||||
]);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
@@ -154,9 +156,11 @@ class Withdraw extends Backend
|
||||
}
|
||||
|
||||
if (false === $this->request->isPost()) {
|
||||
$master = Db::name('master')->where('id', (int)$row['master_id'])->field('id,realname,mobile,user_id,money,frozen_money')->find();
|
||||
$master = Db::name('master')->where('id', (int)$row['master_id'])->field('id,realname,mobile,money,frozen_money')->find();
|
||||
$wechatBind = Db::name('master_wechat')->where('master_id', (int)$row['master_id'])->find();
|
||||
$this->view->assign('row', $row);
|
||||
$this->view->assign('master', $master ?: []);
|
||||
$this->view->assign('wechatBind', $wechatBind ?: []);
|
||||
$this->view->assign('flowOptions', $flowOptions);
|
||||
$this->view->assign('useWxApi', $useWxApi);
|
||||
$this->view->assign('transferStateLabel', PaymentService::transferStateLabel($row['transfer_state'] ?? ''));
|
||||
@@ -229,7 +233,7 @@ class Withdraw extends Backend
|
||||
}
|
||||
|
||||
if ($status === 'pass') {
|
||||
$this->sendMasterMessage($masterId, (int)$master['user_id'], '提现审核通过', '您的提现申请 ¥' . $amount . ' 已通过审核,财务将尽快安排打款到银行卡');
|
||||
$this->sendMasterMessage($masterId, '提现审核通过', '您的提现申请 ¥' . $amount . ' 已通过审核,财务将尽快安排打款到银行卡');
|
||||
} elseif ($status === 'done') {
|
||||
Db::name('master')->where('id', $masterId)->update([
|
||||
'frozen_money' => max(0, round((float)$master['frozen_money'] - $amount, 2)),
|
||||
@@ -245,7 +249,7 @@ class Withdraw extends Backend
|
||||
'remark' => '提现打款完成,冻结资金 ¥' . $amount . ' 划出(' . ($row['channel'] === 'bank' ? '银行储蓄卡' : '微信钱包') . ' ' . $row['account'] . ')',
|
||||
'createtime' => time(),
|
||||
]);
|
||||
$this->sendMasterMessage($masterId, (int)$master['user_id'], '提现打款完成', '您的提现 ¥' . $amount . ' 已打款成功,请留意到账通知');
|
||||
$this->sendMasterMessage($masterId, '提现打款完成', '您的提现 ¥' . $amount . ' 已打款成功,请留意到账通知');
|
||||
}
|
||||
Db::commit();
|
||||
} catch (PDOException|\Exception $e) {
|
||||
@@ -301,18 +305,16 @@ class Withdraw extends Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* 向师傅端工作台及所属用户发送站内消息
|
||||
* @param int $masterId 师傅ID
|
||||
* @param int $userId 用户ID
|
||||
* @param string $title 消息标题
|
||||
* @param string $content 消息内容
|
||||
* 向独立师傅端工作台发送站内消息
|
||||
* @param int $masterId 师傅ID
|
||||
* @param string $title 消息标题
|
||||
* @param string $content 消息内容
|
||||
*/
|
||||
protected function sendMasterMessage($masterId, $userId, $title, $content)
|
||||
protected function sendMasterMessage($masterId, $title, $content)
|
||||
{
|
||||
$now = time();
|
||||
$rows = [];
|
||||
if ($masterId > 0) {
|
||||
$rows[] = [
|
||||
if ((int)$masterId > 0) {
|
||||
Db::name('message')->insert([
|
||||
'receive_type' => 'master',
|
||||
'receive_id' => (int)$masterId,
|
||||
'type' => 'audit',
|
||||
@@ -321,22 +323,7 @@ class Withdraw extends Backend
|
||||
'order_id' => 0,
|
||||
'is_read' => 0,
|
||||
'createtime' => $now,
|
||||
];
|
||||
}
|
||||
if ($userId > 0) {
|
||||
$rows[] = [
|
||||
'receive_type' => 'user',
|
||||
'receive_id' => (int)$userId,
|
||||
'type' => 'system',
|
||||
'title' => mb_substr((string)$title, 0, 100),
|
||||
'content' => mb_substr((string)$content, 0, 500),
|
||||
'order_id' => 0,
|
||||
'is_read' => 0,
|
||||
'createtime' => $now,
|
||||
];
|
||||
}
|
||||
if ($rows) {
|
||||
Db::name('message')->insertAll($rows);
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户