refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范

这个提交包含在:
wikiboss
2026-09-20 17:05:22 +08:00
父节点 de3cf8b870
当前提交 9fa1d1fbd0
共有 1679 个文件被更改,包括 204798 次插入 和 16817 次删除

查看文件

@@ -0,0 +1,97 @@
{
"id": "uts-worker-sendable-transfer",
"displayName": "uts-worker-sendable-transfer",
"version": "1.0.0",
"description": "uts-worker-sendable-transfer",
"keywords": [
"uts-worker-sendable-transfer"
],
"repository": "",
"engines": {
"HBuilderX": "^3.6.8",
"uni-app": "^3.1.0",
"uni-app-x": "^3.1.0"
},
"dcloudext": {
"type": "uts",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": "",
"darkmode": "-",
"i18n": "-",
"widescreen": "-"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "-",
"aliyun": "-",
"alipay": "-"
},
"client": {
"uni-app": {
"vue": {
"vue2": "-",
"vue3": "-"
},
"web": {
"safari": "-",
"chrome": "-"
},
"app": {
"vue": "-",
"nvue": "-",
"android": "-",
"ios": "-",
"harmony": "-"
},
"mp": {
"weixin": "-",
"alipay": "-",
"toutiao": "-",
"baidu": "-",
"kuaishou": "-",
"jd": "-",
"harmony": "-",
"qq": "-",
"lark": "-"
},
"quickapp": {
"huawei": "-",
"union": "-"
}
},
"uni-app-x": {
"web": {
"safari": "-",
"chrome": "-"
},
"app": {
"android": "-",
"ios": "-",
"harmony": "-"
},
"mp": {
"weixin": "-"
}
}
}
}
}
}

查看文件

@@ -0,0 +1,7 @@
# uts-worker-sendable-transfer
### 开发文档
[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
[UTS uni-app兼容模式组件](https://uniapp.dcloud.net.cn/plugin/uts-component.html)
[UTS 标准模式组件](https://doc.dcloud.net.cn/uni-app-x/plugin/uts-vue-component.html)
[Hello UTS](https://gitcode.net/dcloud/hello-uts)

查看文件

@@ -0,0 +1,78 @@
import { UTSWorkerAddListenerOptions, UTSWorkerAddListenerOptionsSuccess, UTSWorkerSendWorkerMessageOptions } from './interface.uts';
// #ifdef APP-HARMONY
import { SendableObject } from './sendable.ets';
// #endif
export * from './interface.uts';
type WorkerPostMessageOptions = {
harmonySendable ?: boolean
transfer ?: any[]
}
export class UTSSendableWorkerImpl {
private workerImp : Worker | null = null;
private options : UTSWorkerAddListenerOptions | null = null;
create() {
if (this.workerImp != null) {
console.warn('[UTS Plugin] Worker已存在,先销毁旧的Worker');
this.destroy();
}
console.log('[UTS Plugin] 创建Worker');
const worker = uni.createWorker('workers/sendableTransferWorker.uts');
this.workerImp = worker;
}
sendMessage(options : UTSWorkerSendWorkerMessageOptions) {
if (this.workerImp == null) {
console.error('Worker未创建,无法发送消息');
return;
}
let message = options.message;
const harmonySendable = options.harmonySendable;
const transfer = options.transfer;
console.log(`[UTS Plugin] 向Worker发送消息: ${message}`);
// #ifdef APP-HARMONY
if (harmonySendable) {
message = new SendableObject();
}
// #endif
this.workerImp!.postMessage(message, {
harmonySendable,
transfer
} as WorkerPostMessageOptions);
}
onMessage(options : UTSWorkerAddListenerOptions) {
if (this.workerImp == null) {
console.error('Worker未创建,无法监听消息');
return;
}
this.options = options;
this.workerImp!.onMessage((result) => {
// 处理Worker返回的消息
console.log(`[UTS Plugin] 收到Worker消息:`, result);
if (this.options != null && this.options.success != null) {
let success : UTSWorkerAddListenerOptionsSuccess = {
result: result as UTSJSONObject
}
this.options.success(success);
}
})
}
destroy() {
if (this.workerImp != null) {
console.log('[UTS Plugin] 销毁Worker');
this.workerImp.terminate();
this.workerImp = null;
this.options = null;
}
}
}

查看文件

@@ -0,0 +1,15 @@
export type UTSWorkerAddListenerOptions = {
success ?: UTSWorkerReceiveEventCallback
}
export type UTSWorkerAddListenerOptionsSuccess = {
result : UTSJSONObject
}
export type UTSWorkerSendWorkerMessageOptions = {
message : Object,
harmonySendable ?: boolean
transfer ?: ArrayBuffer[]
}
export type UTSWorkerReceiveEventCallback = (callback : UTSWorkerAddListenerOptionsSuccess) => void

查看文件

@@ -0,0 +1,4 @@
@Sendable
export class SendableObject {
a: number = 45;
}