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),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
这个提交包含在:
@@ -88,27 +88,10 @@ class Auth extends Base
|
||||
{
|
||||
$uid = $this->uid();
|
||||
$user = Db::name('user')->field('id,nickname,mobile,email,avatar,money,score,user_type,identity_selected,company_name,company_legal_person,company_legal_mobile,company_tech_mobile,contact_address,createtime')->where('id', $uid)->find();
|
||||
$master = Db::name('master')->where('user_id', $uid)->find();
|
||||
|
||||
$couponCount = Db::name('user_coupon')->where('user_id', $uid)->where('status', 'unused')->count();
|
||||
$unread = Db::name('message')->where('receive_type', 'user')->where('receive_id', $uid)->where('is_read', 0)->count();
|
||||
|
||||
$masterInfo = null;
|
||||
if ($master) {
|
||||
$masterInfo = [
|
||||
'id' => (int)$master['id'],
|
||||
'realname' => $master['realname'],
|
||||
'verify_status' => $master['verify_status'],
|
||||
'audit_msg' => $master['audit_msg'],
|
||||
'work_status' => $master['work_status'],
|
||||
'level' => (int)$master['level'],
|
||||
'score' => (float)$master['score'],
|
||||
'order_count' => (int)$master['order_count'],
|
||||
'money' => (float)$master['money'],
|
||||
'can_take' => $master['verify_status'] === 'pass',
|
||||
];
|
||||
}
|
||||
|
||||
$merchantRel = $this->merchantOf($uid);
|
||||
$merchant = $merchantRel ? $merchantRel['merchant'] : null;
|
||||
$merchantRole = $merchantRel ? $merchantRel['role'] : null;
|
||||
@@ -175,8 +158,6 @@ class Auth extends Base
|
||||
'coupon_count' => (int)$couponCount,
|
||||
'unread_count' => (int)$unread,
|
||||
'order_counts' => $orderCounts,
|
||||
'is_master' => $master ? true : false,
|
||||
'master' => $masterInfo,
|
||||
'is_merchant' => $merchant ? true : false,
|
||||
'merchant' => $merchantInfo,
|
||||
];
|
||||
@@ -382,44 +363,6 @@ class Auth extends Base
|
||||
]);
|
||||
}
|
||||
|
||||
public function switchRole()
|
||||
{
|
||||
$role = $this->request->post('role', 'user');
|
||||
if (!in_array($role, ['user', 'master', 'merchant'], true)) {
|
||||
$this->error('角色参数错误');
|
||||
}
|
||||
|
||||
if ($role === 'master') {
|
||||
$master = $this->masterInfo();
|
||||
if (!$master) {
|
||||
$this->error('请先完成师傅入驻', ['need_apply' => 1], 2001);
|
||||
}
|
||||
}
|
||||
|
||||
if ($role === 'merchant') {
|
||||
$merchantRel = $this->merchantOf($this->uid());
|
||||
$merchant = $merchantRel ? $merchantRel['merchant'] : null;
|
||||
if (!$merchant) {
|
||||
$this->error('请先完成商家入驻', ['need_apply' => 1], 2001);
|
||||
}
|
||||
if ($merchant['verify_status'] === 'pending') {
|
||||
$this->error('商家资质审核中,请耐心等待', ['verify_status' => 'pending'], 2002);
|
||||
}
|
||||
if ($merchant['verify_status'] === 'reject') {
|
||||
$this->error('资质未通过:' . $merchant['audit_msg'], ['verify_status' => 'reject'], 2003);
|
||||
}
|
||||
}
|
||||
|
||||
$redirect = '/pages/index/index';
|
||||
if ($role === 'master') {
|
||||
$redirect = '/pages/master/workbench';
|
||||
} elseif ($role === 'merchant') {
|
||||
$redirect = '/pages/mine/mine';
|
||||
}
|
||||
|
||||
$this->success('切换成功', ['role' => $role, 'redirect' => $redirect]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前用户的商家归属:主账号 / 关联账号
|
||||
* 返回 ['merchant' => 商家行, 'role' => owner|member]
|
||||
|
||||
在新工单中引用
屏蔽一个用户