diff --git a/collection/uni-id-scores/collection.json b/collection/uni-id-scores/collection.json new file mode 100644 index 0000000..b2635ba --- /dev/null +++ b/collection/uni-id-scores/collection.json @@ -0,0 +1,37 @@ +{ + "schema": { + "bsonType": "object", + "required": ["user_id", "score", "balance"], + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "user_id": { + "bsonType": "string", + "description": "用户id,参考uni-id-users表" + }, + "score": { + "bsonType": "int", + "description": "本次变化的积分" + }, + "type": { + "bsonType": "int", + "enum": [1, 2], + "description": "积分类型 1:收入 2:指出" + }, + "balance": { + "bsonType": "int", + "description": "变化后的积分余额" + }, + "comment": { + "bsonType": "string", + "description": "备注,说明积分新增、消费的缘由" + }, + "create_date": { + "bsonType": "timestamp", + "description": "创建时间" + } + } + }, + "index": [] +} diff --git a/collection/uni-id-scores/package.json b/collection/uni-id-scores/package.json new file mode 100644 index 0000000..80b0449 --- /dev/null +++ b/collection/uni-id-scores/package.json @@ -0,0 +1,17 @@ +{ + "name": "@opendb/uni-id-scores", + "version": "0.0.1", + "description": "uni-id-scores", + "keywords": ["积分", "用户积分", "scores"], + "opendb": { + "title": "用户积分", + "type": "collection", + "contributors": [ + { + "name": "DCloud", + "email": "", + "homepage": "https://gitee.com/dcloud/opendb" + } + ] + } +} diff --git a/collection/uni-id-task-log/collection.json b/collection/uni-id-task-log/collection.json new file mode 100644 index 0000000..efb74ca --- /dev/null +++ b/collection/uni-id-task-log/collection.json @@ -0,0 +1,32 @@ +{ + "schema": { + "bsonType": "object", + "required": ["user_id", "task_id"], + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "user_id": { + "bsonType": "string", + "description": "用户id,参考uni-id-users表" + }, + "task_id": { + "bsonType": "string", + "description": "任务ID" + }, + "result": { + "bsonType": "bool", + "description": "任务执行结果,true:成功,false:失败" + }, + "bounty": { + "bsonType": "int", + "description": "奖励积分" + }, + "create_date": { + "bsonType": "timestamp", + "description": "创建时间" + } + } + }, + "index": [] +} diff --git a/collection/uni-id-task-log/package.json b/collection/uni-id-task-log/package.json new file mode 100644 index 0000000..0745e3c --- /dev/null +++ b/collection/uni-id-task-log/package.json @@ -0,0 +1,17 @@ +{ + "name": "@opendb/uni-id-task-log", + "version": "0.0.1", + "description": "uni-id-task-log", + "keywords": ["任务日志", "task-log"], + "opendb": { + "title": "任务日志", + "type": "collection", + "contributors": [ + { + "name": "DCloud", + "email": "", + "homepage": "https://gitee.com/dcloud/opendb" + } + ] + } +} diff --git a/collection/uni-id-task/collection.json b/collection/uni-id-task/collection.json new file mode 100644 index 0000000..22b378c --- /dev/null +++ b/collection/uni-id-task/collection.json @@ -0,0 +1,40 @@ +{ + "schema": { + "bsonType": "object", + "required": ["name", "comment"], + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "name": { + "bsonType": "string", + "description": "任务名称" + }, + "comment": { + "bsonType": "string", + "description": "任务描述" + }, + "bounty": { + "bsonType": "int", + "description": "任务完成后的奖励积分" + }, + "max_per_hour": { + "bsonType": "int", + "description": "每小时允许执行的最大次数" + }, + "max_per_day": { + "bsonType": "int", + "description": "每天允许执行的最大次数" + }, + "max_per_week": { + "bsonType": "int", + "description": "每周允许执行的最大次数" + }, + "create_date": { + "bsonType": "timestamp", + "description": "创建时间" + } + } + }, + "index": [] +} diff --git a/collection/uni-id-task/package.json b/collection/uni-id-task/package.json new file mode 100644 index 0000000..ac2bbcc --- /dev/null +++ b/collection/uni-id-task/package.json @@ -0,0 +1,17 @@ +{ + "name": "@opendb/uni-id-task", + "version": "0.0.1", + "description": "uni-id-task", + "keywords": ["任务", "task"], + "opendb": { + "title": "用户任务", + "type": "collection", + "contributors": [ + { + "name": "DCloud", + "email": "", + "homepage": "https://gitee.com/dcloud/opendb" + } + ] + } +} diff --git a/database/uni-id/db_init.json b/database/uni-id/db_init.json index faa1972..8a263d3 100644 --- a/database/uni-id/db_init.json +++ b/database/uni-id/db_init.json @@ -3,5 +3,8 @@ "uni-id-address": {}, "uni-id-device": {}, "uni-id-log": {}, - "uni-id-base-order":{} + "uni-id-base-order":{}, + "uni-id-scores": {}, + "uni-id-task": {}, + "uni-id-task-log": {} } diff --git a/uni-id-score.md b/uni-id-score.md new file mode 100644 index 0000000..553ec00 --- /dev/null +++ b/uni-id-score.md @@ -0,0 +1,41 @@ + +## 用户积分表 + +表名:uni-id-scores + +| 字段 | 类型 | 必填 | 描述 | +| ---------------- | --------- | ---- | ------------------------------------------- | +| \_id | Object ID | 是 | 存储文档 ID,系统自动生成 | +| user_id | String | 是 | | +| score | Integer | 是 | 本次变化的积分 | +| type | Integer | 否 | 积分类型 1:收入 2:指出 | +| balance | Integer | 是 | 变化后的积分余额 | +| comment | String | 否 | 备注,说明积分新增、消费的缘由 | +| create_date | Timestamp | 否 | 创建时间 | + + +## 用户任务表 + +表名:uni-id-task + +| 字段 | 类型 | 必填 | 描述 | +| ---------------- | --------- | ---- | ------------------------------------------- | +| \_id | Object ID | 是 | 存储文档 ID,系统自动生成 | +| name | String | 是 | 任务名称 | +| comment | String | 是 | 任务描述 | +| bounty | Integer | 否 | 任务完成后的奖励积分 | +| max_per_hour | Integer | 否 | 每小时允许执行的最大次数 | +| max_per_day | Integer | 否 | 每天允许执行的最大次数 | +| max_per_week | Integer | 否 | 每周允许执行的最大次数 | +| create_date | Timestamp | 否 | 创建时间 | + +表名:uni-id-task-log + +| 字段 | 类型 | 必填 | 描述 | +| ---------------- | --------- | ---- | ------------------------------------------- | +| \_id | Object ID | 是 | 存储文档 ID,系统自动生成 | +| user_id | String | 是 | 用户ID | +| task_id | String | 是 | 任务ID | +| result | Boolean | 否 | 任务执行结果,true:成功,false:失败 | +| bounty | Integer | 否 | 奖励积分 | +| create_date | Timestamp | 否 | 创建时间 |