uni-cms-unlock-record.schema数据表中用content_id:{
"bsonType": "object",
"required": [
"user_id",
"trans_id",
"content_id"
],
"permission": {
"read": true,
"create": true,
"update": false,
"delete": false
},
"properties": {
"_id": {
"description": "存储文档 ID(用户 ID),系统自动生成"
},
"unique_id": {
"bsonType": "string",
"description": "用于标识观看广告的唯一标识"
},
"unique_type": {
"bsonType": "string",
"description": "观看广告的唯一标识类型;user 用户;device 设备"
},
"trans_id": {
"bsonType": "string",
"title": "交易ID",
"description": "广告回调传回的交易ID",
"label": "内容id",
"trim": "both"
},
"content_id": {
"bsonType": "string",
"title": "内容id",
"description": "内容(文章)ID",
"label": "内容id",
"trim": "both"
},
"create_date": {
"bsonType": "timestamp",
"title": "创建时间",
"description": "创建时间",
"defaultValue": {
"$env": "now"
}
}
}
}
但是,在uni-cms-unlock-callback的index.js中添加入库字段却没有这一项,用的是article_id,理了一中午,也没有搞定广告解锁功能的云端验证,// 添加解锁记录
await db.collection(unlockRecordDBName).add({
unique_id: extra.unique_id,
unique_type: extra.unique_type,
article_id: extra.article_id,
trans_id,
create_date: Date.now()
})
我是小白,还没有理清楚程序逻辑。不确定是不是bug
5***@qq.com (作者)
是的,通过插件里面看数据库字段content_id和云函数字段article_id,以及通过文档看数据库字段都是content_id,而且文档中提供的数据库字段地址https://gitee.com/dcloud/opendb/tree/master/collection/uni-cms-unlock-record内的数据库字段和插件中的也不一致,不知道使用哪个了,发布内容没有问题,目前就是在激励视频拉取看完关闭入库这里数据库字段和云函数不一致,不知道是不是这里导致的数据入库失败的原因。
2024-08-26 11:25
DCloud_uniCloud_CRL
回复 5***@qq.com: 如果你的配置没错,你可以看下uni-cms-unlock-callback云函数有没有日志来判断广告是否回调到云函数
2024-08-26 11:27
5***@qq.com (作者)
这是插件中的schema字段:{
"bsonType": "object",
"required": [
"user_id",
"trans_id",
"content_id"
],
"permission": {
"read": true,
"create": true,
"update": false,
"delete": false
},
"properties": {
"_id": {
"description": "存储文档 ID(用户 ID),系统自动生成"
},
"unique_id": {
"bsonType": "string",
"description": "用于标识观看广告的唯一标识"
},
"unique_type": {
"bsonType": "string",
"description": "观看广告的唯一标识类型;user 用户;device 设备"
},
"trans_id": {
"bsonType": "string",
"title": "交易ID",
"description": "广告回调传回的交易ID",
"label": "内容id",
"trim": "both"
},
"content_id": {
"bsonType": "string",
"title": "内容id",
"description": "内容(文章)ID",
"label": "内容id",
"trim": "both"
},
"create_date": {
"bsonType": "timestamp",
"title": "创建时间",
"description": "创建时间",
"defaultValue": {
"$env": "now"
}
}
}
}
这里是文档中的:{
"schema": {
"bsonType": "object",
"required": [
"user_id",
"trans_id",
"content_id"
],
"permission": {
"read": true,
"create": false,
"update": false,
"delete": false
},
"properties": {
"_id": {
"description": "存储文档 ID(用户 ID),系统自动生成"
},
"unique_id": {
"bsonType": "string",
"description": "用于标识观看广告的唯一标识"
},
"unique_type": {
"bsonType": "string",
"description": "观看广告的唯一标识类型;user 用户;device 设备"
},
"trans_id": {
"bsonType": "string",
"title": "交易ID",
"description": "广告回调传回的交易ID",
"label": "内容id",
"trim": "both"
},
"content_id": {
"bsonType": "string",
"title": "内容id",
"description": "内容(文章、图片、视频)ID",
"label": "内容id",
"trim": "both"
},
"content_type": {
"bsonType": "string",
"title": "内容类型",
"description": "内容类型,article 文章 image 图片 video 视频",
"label": "内容id",
"trim": "both",
"enum": [
"article",
"image",
"video"
]
},
"create_date": {
"bsonType": "timestamp",
"title": "创建时间",
"description": "创建时间",
"defaultValue": {
"$env": "now"
}
},
"adpid": {
"bsonType": "string",
"description": "广告id"
},
"provider": {
"bsonType": "string",
"description": "广告供应商"
},
"platform": {
"bsonType": "string",
"description": "客户端平台"
}
}
},
"index": [{
"IndexName": "unique_articletrans",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "unique_id",
"Direction": "1"
}, {
"Name": "article_id",
"Direction": "1"
}, {
"Name": "trans_id",
"Direction": "1"
}],
"MgoIsUnique": false
}
}]
},不知道使用哪个来进行修改。
2024-08-26 11:28
5***@qq.com (作者)
回复 DCloud_uniCloud_CRL: 日志中没有日志数据,我在真机测试中测试的没有数据,不知道是不是需要上线
2024-08-26 11:29
DCloud_uniCloud_CRL
回复 5***@qq.com: 这个文件不用管他,没有用到JQL。不用在这个文件上过多纠结,还是检查下广告配置这块,你说你配置好了,你看次广告你看你能在uniCloud控制台上看到请求日志吗?如果有请求日志但是没有解锁成功,你就把日志发我一下,我来检查。如果没有请求日志,你自己再检查下配置操作对不对。
2024-08-26 11:30