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),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
这个提交包含在:
81
yjyf-master-app/utils/system.js
普通文件
81
yjyf-master-app/utils/system.js
普通文件
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* 系统与窗口信息工具
|
||||
* 兼容微信小程序新版规范(废弃 wx.getSystemInfoSync,推荐 getWindowInfo)
|
||||
*/
|
||||
export function getWindowInfoSafe() {
|
||||
try {
|
||||
if (typeof uni.getWindowInfo === 'function') {
|
||||
const win = uni.getWindowInfo();
|
||||
if (win && (win.statusBarHeight !== undefined || win.windowWidth !== undefined)) {
|
||||
return win;
|
||||
}
|
||||
}
|
||||
if (typeof uni.getSystemInfoSync === 'function') {
|
||||
return uni.getSystemInfoSync();
|
||||
}
|
||||
} catch (e) {
|
||||
// 忽略异常,降级兜底
|
||||
}
|
||||
return {
|
||||
statusBarHeight: 20,
|
||||
windowWidth: 375,
|
||||
windowHeight: 667,
|
||||
screenWidth: 375,
|
||||
screenHeight: 667
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一获取自定义导航栏精确尺寸(确保全站 TopBar 与页面吸顶元素 100% 零误差对齐,
|
||||
* 并防御微信开发者工具切换模拟器机型时 statusBarHeight 与胶囊 menu.top 不匹配的异常)
|
||||
*/
|
||||
export function getNavBarMetrics() {
|
||||
let statusBarHeight = 20;
|
||||
let navBarHeight = 44;
|
||||
let rightSpaceWidth = 16;
|
||||
let leftWidth = 50;
|
||||
|
||||
try {
|
||||
const sys = getWindowInfoSafe();
|
||||
const winWidth = (sys && sys.windowWidth) ? sys.windowWidth : 375;
|
||||
if (sys && sys.statusBarHeight) {
|
||||
statusBarHeight = sys.statusBarHeight;
|
||||
}
|
||||
// #ifdef MP-WEIXIN
|
||||
if (typeof uni.getMenuButtonBoundingClientRect === 'function') {
|
||||
const menu = uni.getMenuButtonBoundingClientRect();
|
||||
if (menu && menu.top > 0 && menu.height > 0 && menu.width > 0) {
|
||||
// 校验 statusBarHeight 与胶囊 top 的间距是否在合理范围 (4px~12px)
|
||||
// 若模拟器切换机型导致 statusBarHeight >= menu.top,则以胶囊真实物理位置反推,确保标题与胶囊永远同轴居中且不贴底
|
||||
let gap = menu.top - statusBarHeight;
|
||||
if (gap < 4 || gap > 12) {
|
||||
gap = 6;
|
||||
statusBarHeight = Math.max(20, menu.top - gap);
|
||||
}
|
||||
navBarHeight = menu.height + gap * 2;
|
||||
const rightMargin = (winWidth - menu.right) > 0 ? (winWidth - menu.right) : 7;
|
||||
rightSpaceWidth = menu.width + rightMargin * 2;
|
||||
leftWidth = Math.max(50, rightSpaceWidth);
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
} catch (e) {
|
||||
statusBarHeight = 20;
|
||||
navBarHeight = 44;
|
||||
rightSpaceWidth = 16;
|
||||
leftWidth = 50;
|
||||
}
|
||||
|
||||
return {
|
||||
statusBarHeight,
|
||||
navBarHeight,
|
||||
totalNavHeight: statusBarHeight + navBarHeight,
|
||||
rightSpaceWidth,
|
||||
leftWidth
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
getWindowInfoSafe,
|
||||
getNavBarMetrics
|
||||
};
|
||||
在新工单中引用
屏蔽一个用户