{"type":"doc","content":[{"type":"heading","attrs":{"id":"cd72790c-422c-447b-8965-65d62c8d9098","textAlign":"inherit","indent":0,"level":3,"isHoverDragHandle":false},"content":[{"type":"text","text":"一、技术架构核心优势"}]},{"type":"orderedList","attrs":{"id":"ff97d50b-0002-465c-8e49-643382310acb","start":1,"isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"ce8bc454-acc5-4800-b9c1-397f017d7113"},"content":[{"type":"paragraph","attrs":{"id":"f933d076-be2d-4075-b8be-762809837c9a","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":""},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"真·跨端复用"},{"type":"text","text":""},{"type":"hardBreak","attrs":{"id":"cf901981-c8ab-48c0-844f-3a20c6ce1852"}},{"type":"text","text":"UniApp前端代码可一键编译为"},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}}],"text":"微信小程序"},{"type":"text","text":"、"},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}}],"text":"H5网页"},{"type":"text","text":"及"},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}}],"text":"Android/iOS App"},{"type":"text","text":"(需打包),后端ThinkPHP统一提供API接口。无需维护多套代码,大幅降低二开与维护成本。"}]}]},{"type":"listItem","attrs":{"id":"4db0ea70-8eb3-4b17-a9e7-01422ed5ef17"},"content":[{"type":"paragraph","attrs":{"id":"45b0e7d6-d8ab-49e8-86fe-9adcc4456114","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":""},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"成熟生态支持"},{"type":"text","text":""},{"type":"hardBreak","attrs":{"id":"085440a1-b06f-414a-b1d8-fa6dc67333d0"}},{"type":"text","text":"ThinkPHP拥有庞大的中文社区与插件市场,交友系统常用的"},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"即时通讯(IM)"},{"type":"text","text":"、"},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"支付接口"},{"type":"text","text":"、"},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"短信验证"},{"type":"text","text":"等模块均有成熟扩展包,可直接集成,避免重复造轮子。"}]}]},{"type":"listItem","attrs":{"id":"4e3c4cdf-cb83-42b2-8e60-88fd3dbec230"},"content":[{"type":"paragraph","attrs":{"id":"ef5c3af4-ba04-48b3-a022-07c517c05d52","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":""},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"灵活二开能力"},{"type":"text","text":""},{"type":"hardBreak","attrs":{"id":"799af6ad-cabe-4b4a-b1af-44a3878ee492"}},{"type":"text","text":"前后端分离架构使得界面修改与逻辑调整互不干扰。您可以基于开源源码快速定制UI风格、调整匹配算法或增加新的互动玩法(如语音房、直播),满足个性化运营需求。"}]}]}]},{"type":"image","attrs":{"id":"64da93e6-edaa-476e-b4c0-1a777dc382ea","src":"https://developer.qcloudimg.com/http-save/audit-12302740/d3edc1ed14caa3fd38ca5b1e766e410e.png","extension":"png","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":971,"aspectRatio":"1.383191","status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"ec0cbf63-7e97-4720-bbc7-14dbf0f2fc08","textAlign":"inherit","indent":0,"level":3,"isHoverDragHandle":false},"content":[{"type":"text","text":"二、多端发布关键注意点"}]},{"type":"orderedList","attrs":{"id":"fe6d722e-a7f6-492a-a490-a60c45fa5474","start":1,"isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"e814d821-c5e4-4acb-b6ad-6d23b1264be9"},"content":[{"type":"paragraph","attrs":{"id":"b2adfc96-15ce-45b1-acee-cca218022113","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":""},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"小程序审核合规"},{"type":"text","text":""},{"type":"hardBreak","attrs":{"id":"8841f4c5-aea5-4169-a427-4aecf7cfb5e3"}},{"type":"text","text":"微信小程序对“社交交友”类目审核极严,需具备《增值电信业务经营许可证》或相关资质。建议在H5和App端先行测试核心功能,小程序端侧重轻量级互动或作为引流入口。"}]}]},{"type":"listItem","attrs":{"id":"d42e0595-445f-4693-9ac0-503a76ba386e"},"content":[{"type":"paragraph","attrs":{"id":"e9fc772a-894f-4a65-8e44-5498b1f705f9","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":""},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"App打包与上架"},{"type":"text","text":""},{"type":"hardBreak","attrs":{"id":"156750d0-4aa5-4172-bcb4-b31e65548cc5"}},{"type":"text","text":"Android端需注意各大应用市场对“交友”类App的隐私合规要求;iOS端需申请开发者账号并遵循Apple审核指南,避免涉及诱导消费或违规内容,否则易被拒审。"}]}]},{"type":"listItem","attrs":{"id":"4c87bc35-6584-4e2a-a73e-2e445e757aba"},"content":[{"type":"paragraph","attrs":{"id":"9f56d086-d1ee-4e7d-869b-8b4a1118012e","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":""},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"性能优化差异"},{"type":"text","text":""},{"type":"hardBreak","attrs":{"id":"e5c3a01c-9975-47e3-8be6-762f1b5ed54b"}},{"type":"text","text":"H5端需重点优化首屏加载速度;App端需关注音视频通话的稳定性与流量消耗;小程序端需注意包体积限制,合理分包加载。"}]}]}]},{"type":"heading","attrs":{"id":"1dd8a7ef-b478-403a-bba2-22983e251091","textAlign":"inherit","indent":0,"level":3,"isHoverDragHandle":false},"content":[{"type":"text","text":"三、开源源码选型建议"}]},{"type":"bulletList","attrs":{"id":"f17c1ef2-24e2-4704-990f-5b6453885bd2","isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"cfd59f5e-9b8a-49b6-b18b-5fcdcb4ddd9a"},"content":[{"type":"paragraph","attrs":{"id":"18a2a11e-ee03-429c-b7db-af0ab1deb1eb","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":""},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"考察活跃度"},{"type":"text","text":":选择GitHub或Gitee上Star数高、近期仍有更新的仓库,确保Bug能及时修复。"}]}]},{"type":"listItem","attrs":{"id":"25d92872-441e-4ef1-a891-5faff425fdf2"},"content":[{"type":"paragraph","attrs":{"id":"f6457c74-78e4-4d3a-89a0-a50af6e0aa7b","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":""},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"检查完整性"},{"type":"text","text":":确认源码是否包含完整的数据库脚本、安装文档及API接口说明,避免“残缺版”导致无法部署。"}]}]},{"type":"listItem","attrs":{"id":"eb6c2a4e-e0db-4dd9-8b6d-0b2a83a0b0cc"},"content":[{"type":"paragraph","attrs":{"id":"e313c6af-6547-48b8-b8ae-d07190e9e531","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":""},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}},{"type":"bold"}],"text":"版权风险规避"},{"type":"text","text":":仔细查看开源协议(如MIT、Apache2.0允许商用,GPL需谨慎),若用于商业运营,建议购买官方商业授权以获取技术支持和法律保障。"}]}]}]},{"type":"heading","attrs":{"id":"ccd57255-5d97-4009-a190-8762be3b43f5","textAlign":"inherit","indent":0,"level":4,"isHoverDragHandle":false},"content":[{"type":"text","text":"四. 全局跨域处理 (middleware.php)"}]},{"type":"paragraph","attrs":{"id":"44aee31a-9b84-4300-bb8a-d07832888264","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"1.前后端分离开发时,必须处理跨域问题。在"},{"type":"text","marks":[{"type":"code"}],"text":"app/middleware.php"},{"type":"text","text":"中启用内置跨域中间件:"}]},{"type":"paragraph","attrs":{"id":"157c2b8e-6fcc-47d6-acb5-a4dea4aa1298","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"<?php"},{"type":"hardBreak","attrs":{"id":"cd2c1e41-4560-4b28-9176-19ee06d31a8d"}},{"type":"text","text":"//全局中间件定义文件"},{"type":"hardBreak","attrs":{"id":"8d658b14-176f-45e4-a3ce-f77c90e604d8"}},{"type":"text","text":"return["},{"type":"hardBreak","attrs":{"id":"f35ad655-5939-4847-915a-fdbffe263a2b"}},{"type":"text","text":"//全局请求缓存"},{"type":"hardBreak","attrs":{"id":"e2534c7a-ffd2-4c7c-9a4f-ae128913ff80"}},{"type":"text","text":"//thinkmiddlewareCache::class,"},{"type":"hardBreak","attrs":{"id":"84084329-d589-45b8-949d-cb5c23b8ea44"}},{"type":"text","text":"//全局跨域中间件"},{"type":"hardBreak","attrs":{"id":"6b05a32a-e13e-4d8c-bd18-c6a18671b8de"}},{"type":"text","text":"thinkmiddlewareAllowCrossDomain::class,"},{"type":"hardBreak","attrs":{"id":"e0c6bc28-bbb8-4766-a52a-e33d664a3ad2"}},{"type":"text","text":"];"}]},{"type":"paragraph","attrs":{"id":"1e08888a-bebd-440e-be88-5e6601b2d9d1","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"2. API 版本控制与路由分组 (route/app.php)"}]},{"type":"paragraph","attrs":{"id":"8dcd46c1-860a-4bb0-aa17-24c9297dcda9","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}}],"text":"通过 Header 中的"},{"type":"text","marks":[{"type":"code"}],"text":"Api-Version"},{"type":"text","marks":[{"type":"textStyle","attrs":{"color":"","background":""}}],"text":"字段实现接口版本管理,便于后续迭代而不影响旧版 App:"}]},{"type":"paragraph","attrs":{"id":"4517b2c0-4a4d-4652-833a-1a63fde619cc","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"<?php"}]},{"type":"paragraph","attrs":{"id":"b8fbdbfb-b86e-4613-871d-c431869bb89e","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"use thinkfacadeRoute;"}]},{"type":"paragraph","attrs":{"id":"efb83daa-4218-46fd-8c80-b23befeadd8a","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"// 获取请求头中的版本号,默认为 v1"}]},{"type":"paragraph","attrs":{"id":"dcb73226-3520-4c42-8d39-acb0a45d120b","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"$version = request()->header('Api-Version', 'v1');"}]},{"type":"paragraph","attrs":{"id":"0ec780e5-1fbb-4257-a9d8-0acbaca8685c","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Route::group('api', function () {"}]},{"type":"paragraph","attrs":{"id":"eff1824c-029a-4eea-987e-6a88a9cc1c96","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"// 用户模块路由"}]},{"type":"paragraph","attrs":{"id":"6dd8d12e-9391-4d52-9c36-53d297467ff7","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Route::group('user', function () {"}]},{"type":"paragraph","attrs":{"id":"d833dbf5-178c-418f-a774-5b64c65a528e","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Route::post('login', 'Login/login'); // 登录"}]},{"type":"paragraph","attrs":{"id":"c12e490b-ce0b-4502-9b6d-91def1ae9700","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Route::post('register', 'Login/register');// 注册"}]},{"type":"paragraph","attrs":{"id":"9a22697e-27e1-4412-b72a-a27b33428f0b","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Route::get('profile', 'User/profile');// 获取个人信息"}]},{"type":"paragraph","attrs":{"id":"606af2e9-16db-4e47-b982-e56f9081b678","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"})->prefix("appcontroller{$version}");// 根据版本映射到不同控制器目录"}]},{"type":"paragraph","attrs":{"id":"8c30f6d4-f26c-4899-bc5d-66bcaa73bb46","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"// 匹配模块路由"}]},{"type":"paragraph","attrs":{"id":"6f1ae443-f595-4e2b-ae80-233597d6f6e0","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Route::group('match', function () {"}]},{"type":"paragraph","attrs":{"id":"840cda70-6a69-46a8-b5a6-c60d0f9e5eed","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Route::get('recommend', 'Match/recommend'); // 推荐用户列表"}]},{"type":"paragraph","attrs":{"id":"4cf90400-82b9-4a50-a483-f6faa22a07ae","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Route::post('like', 'Match/like');// 喜欢/右滑"}]},{"type":"paragraph","attrs":{"id":"581a4ac2-3503-40f1-b0d1-27ff7ed278c3","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"})->prefix("appcontroller{$version}");"}]},{"type":"paragraph","attrs":{"id":"8a0a1060-ce6f-4589-b3cb-30ce9e91f8a7","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"})->pattern(['id' => 'd ']); // 约束ID参数为数字"}]},{"type":"heading","attrs":{"id":"b4e614a4-1490-4d97-ae82-cb8cb41b72a0","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"部署与调试建议"}]},{"type":"paragraph","attrs":{"id":"c1e558db-a722-4129-a4b0-87447ac22d21","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"本地调试:在 ThinkPHP 根目录执行 php think run 启动内置服务器,默认端口 8000。前端 HBuilderX 运行到浏览器时,需确保后端已正确配置跨域中间件。"}]},{"type":"paragraph","attrs":{"id":"deab6e5d-a829-44fc-8b1e-38a2bb1f6dac","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"生产环境:建议使用 Nginx 反向袋里后端 PHP-FPM,并配置 HTTPS 证书。UniApp 打包 App 时,需在 manifest.json 中配置合法域名列表。"}]},{"type":"paragraph","attrs":{"id":"8f4191e1-3afa-497c-ab4d-af867dadc8cf","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"接口测试:使用 ApiPost 或 Postman 测试后端接口时,记得在 Header 中添加 Api-Version: v1 和 Authorization: Bearer 以模拟真实请求。"}]},{"type":"image","attrs":{"id":"ae8f4c2e-8bc4-4116-9fa4-086f9db2230d","src":"https://developer.qcloudimg.com/http-save/audit-12302740/23ade2b3e6c4a6b20ec3be374b371c1e.png","extension":"png","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":979,"aspectRatio":"1.392603","status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"cc1f7f18-cbe8-4319-9a69-9d75f0b29ab9","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}}]}","createTime":1782962097,"ext":{"closeTextLink":0,"comment_ban":0,"description":"","focusRead":0},"favNum":0,"html":"","isOriginal":0,"likeNum":0,