提交 75ade42c 编写于 作者: DCloud_JSON's avatar DCloud_JSON

notice 表改为 opendb-notice

上级 0658cba9
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
async getNoticeData() { async getNoticeData() {
console.log('111111111111'); console.log('111111111111');
let res = await db.action('add_view_count') let res = await db.action('add_view_count')
.collection('notice') .collection('opendb-notice')
.field('data,_id,update_time,view_count') .field('data,_id,update_time,view_count')
.get(); .get();
console.log("res: ",res); console.log("res: ",res);
......
...@@ -6,7 +6,7 @@ module.exports = { ...@@ -6,7 +6,7 @@ module.exports = {
}, },
after: async (state, event, error, result) => { after: async (state, event, error, result) => {
await db.collection('notice').update({ await db.collection('opendb-notice').update({
view_count:$cmd.inc(1) view_count:$cmd.inc(1)
}) })
if (error) { if (error) {
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
"data": [{"state":0,"text":"该用户比较懒啥也没写!"}] "data": [{"state":0,"text":"该用户比较懒啥也没写!"}]
}, },
"comment": {}, "comment": {},
"notice": { "opendb-notice": {
"data": [{ "data": [{
"view_count": 0, "view_count": 0,
"data": "这是一个由clientDB实现的留言板示例;权限部分由DBschema和action云函数控制。\n规则如下:\n 1.未登陆的游客,只能看到审核通过的留言。\n 2.登陆的用户还可以:发表留言,会进入审核状态,期间支持查看和删除。审核通过后可以重新编辑留言。但在重新编辑后会自动再次进入审核状态。\n 3.审核员和管理员可以:查看所有状态的留言,操作:审核、编辑、删除。" "data": "这是一个由clientDB实现的留言板示例;权限部分由DBschema和action云函数控制。\n规则如下:\n 1.未登陆的游客,只能看到审核通过的留言。\n 2.登陆的用户还可以:发表留言,会进入审核状态,期间支持查看和删除。审核通过后可以重新编辑留言。但在重新编辑后会自动再次进入审核状态。\n 3.审核员和管理员可以:查看所有状态的留言,操作:审核、编辑、删除。"
......
// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
{
"bsonType": "object",
"required": [],
"permission": {
"read": "action in 'add_view_count'",
"create": false,
"update": false,
"delete": false
},
"properties": {
"_id": {
"description": "ID,系统自动生成",
"foreignKey": "comment.notice_id"
},
"data":{
"bsonType":"string",
"description":"公告内容",
"label":"公告内容",
"maxLength":32,
"errorMessage":{
"maxLength": "{label}不能大于{maxLength}个字符"
}
},
"view_count": {
"bsonType": "int",
"title": "阅读数量",
"description": "阅读数量",
"permission": {
"write": false
}
},
"update_time":{
"bsonType":"timestamp",
"forceDefaultValue":{
"$env":"now"
}
}
}
}
\ No newline at end of file
// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
{
"bsonType": "object",
"required": [],
"permission": {
"read": "action in 'add_view_count'",
"create": false,
"update": false,
"delete": false
},
"properties": {
"_id": {
"description": "ID,系统自动生成",
"foreignKey": "comment.notice_id"
},
"data": {
"bsonType": "string",
"description": "公告内容",
"label": "公告内容",
"maxLength": 32,
"errorMessage": {
"maxLength": "{label}不能大于{maxLength}个字符"
}
},
"view_count": {
"bsonType": "int",
"title": "阅读数量",
"description": "阅读数量",
"permission": {
"write": false
}
},
"create_time": {
"description": "创建时间",
"bsonType": "timestamp",
"forceDefaultValue": {
"$env": "now"
}
},
"update_time": {
"description": "更新时间",
"bsonType": "timestamp",
"forceDefaultValue": {
"$env": "now"
}
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册