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),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
这个提交包含在:
2026-11-23 15:10:30 +08:00
父节点 d3cd6ba342
当前提交 14533eadb7
共有 270 个文件被更改,包括 9757 次插入 和 1392 次删除

查看文件

@@ -2,6 +2,7 @@
* 接口清单(与后端 application/api/controller 一一对应)
*/
import { get, post, uploadFile } from './request';
import config from '@/config/config.js';
export default {
/* ---------- 公共 / 上传 / 字典 ---------- */
@@ -14,7 +15,6 @@ export default {
login: (data) => post('/auth/login', data, { silent: true }),
wxLogin: (data) => post('/auth/wxlogin', data, { silent: true }),
wxPhoneLogin: (data) => post('/auth/wxPhoneLogin', data, { silent: true }),
switchRole: (data) => post('/auth/switchRole', data),
profile: () => get('/auth/profile'),
selectIdentity: (data) => post('/auth/selectIdentity', data),
securityStatus: () => get('/security/status'),
@@ -83,44 +83,6 @@ export default {
saveRemarkTemplate: (data) => post('/order/saveRemarkTemplate', data),
deleteRemarkTemplate: (data) => post('/order/deleteRemarkTemplate', data),
/* ---------- 师傅端 ---------- */
masterApply: (data) => post('/master/apply', data),
masterOcrIdCard: (data) => post('/master/ocrIdCard', data),
masterInfo: () => get('/master/info'),
masterSaveProfile: (data) => post('/master/saveProfile', data),
masterHall: (data) => get('/master/hall', data),
masterOrderDetail: (id, params) => get('/master/orderDetail', { id: id, ...(params || {}) }),
masterGrab: (data) => post('/master/grab', data),
masterOrders: (data) => get('/master/orders', data),
masterContact: (data) => post('/master/contact', data),
masterSchedule: (data) => post('/master/schedule', data),
masterArrive: (data) => post('/master/arrive', data),
masterStart: (data) => post('/master/startJob', data),
masterFinish: (data) => post('/master/finish', data),
masterVerifyCode: (data) => post('/master/verifyCode', data),
masterRequestDiff: (data) => post('/master/requestDiff', data),
masterIncome: () => get('/master/income'),
masterToggle: (data) => post('/master/toggleWork', data),
masterUpdateLocation: (data) => post('/master/updateLocation', data),
masterSearchLocation: (data) => get('/master/searchLocation', data, { silent: true }),
masterLocationContext: (data) => get('/master/locationContext', data, { silent: true }),
masterLocationStats: (data) => get('/master/locationOrderStats', data, { silent: true }),
masterLocateCity: (data) => get('/master/locateCity', data),
masterCredit: () => get('/master/credit'),
masterAppeals: () => get('/master/appeals'),
masterAppeal: (data) => post('/master/appeal', data),
masterQuotes: () => get('/master/quotes'),
masterQuote: (data) => post('/master/quote', data),
masterWithdraw: (data) => post('/master/withdraw', data),
masterTransferPackage: (data) => post('/master/transferPackage', data),
masterSyncWithdraw: (data) => post('/master/syncWithdraw', data, { silent: true, allowConcurrent: true }),
masterSkillDict: () => get('/master/skillDict'),
masterSaveSkills: (data) => post('/master/saveSkills', data),
masterCerts: () => get('/master/certs'),
masterCertDetail: (params) => get('/master/certDetail', params),
masterSaveCert: (data) => post('/master/saveCert', data),
masterDeleteCert: (data) => post('/master/deleteCert', data),
/* ---------- 评价 ---------- */
reviewCreate: (data) => post('/review/create', data),
reviewList: (masterId) => get('/review/masterList', masterId ? { master_id: masterId } : {}),
@@ -159,6 +121,7 @@ export default {
service_work_time: String(cached.service_work_time || '').trim(),
service_corp_id: String(cached.service_corp_id || '').trim(),
service_kf_url: String(cached.service_kf_url || '').trim(),
master_appid: String(cached.master_appid || '').trim(),
};
}
} catch (e) {}
@@ -168,11 +131,12 @@ export default {
service_work_time: '',
service_corp_id: '',
service_kf_url: '',
master_appid: '',
};
},
getServiceConfig: async function (force = false) {
const cached = this.getCachedServiceConfig();
if (!force && (cached.service_phone || cached.service_corp_id || cached.service_kf_url)) {
if (!force && (cached.service_phone || cached.service_corp_id || cached.service_kf_url) && cached.master_appid) {
return cached;
}
try {
@@ -183,6 +147,7 @@ export default {
service_work_time: String(res.service_work_time || '').trim(),
service_corp_id: String(res.service_corp_id || '').trim(),
service_kf_url: String(res.service_kf_url || '').trim(),
master_appid: String(res.master_appid || '').trim(),
};
uni.setStorageSync('yjyf_service_config', cfg);
if (cfg.service_phone) {
@@ -197,6 +162,42 @@ export default {
}
return cached;
},
openMasterMiniProgram: async function (path = 'pages/master/hall') {
let cfg = await this.getServiceConfig();
if (!cfg.master_appid) {
cfg = await this.getServiceConfig(true);
}
const targetAppId = cfg.master_appid;
// #ifdef MP-WEIXIN
if (!targetAppId) {
uni.showModal({
title: '优匠优服师傅端',
content: '后台暂未配置师傅端小程序 AppID,请在微信搜索打开「优匠师傅端」小程序或联系平台管理员在后台系统配置中完善。',
showCancel: false,
confirmText: '知道了',
confirmColor: '#F0710D'
});
return;
}
uni.navigateToMiniProgram({
appId: targetAppId,
path: path,
fail: (err) => {
if (err && err.errMsg && err.errMsg.indexOf('cancel') !== -1) return;
uni.showToast({ title: '打开师傅端小程序失败,请稍后重试', icon: 'none' });
}
});
// #endif
// #ifndef MP-WEIXIN
uni.showModal({
title: '前往优匠优服师傅端',
content: '请在微信中搜索「优匠优服师傅端」小程序进行师傅实名入驻与接单。',
showCancel: false,
confirmText: '知道了',
confirmColor: '#F0710D'
});
// #endif
},
_contactingService: false,
contactService: async function () {
if (this._contactingService) return;