首次完整推送,
V:1.20240808.006
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
"image-captcha":{
|
||||
"width": 150, //图片宽度
|
||||
"height": 44, //图片高度
|
||||
"background": "#FFFAE8", //验证码背景色,设置空字符`''`不使用背景颜色
|
||||
// "size": 4, //验证码长度,最多 6 个字符
|
||||
// "noise": 4, //验证码干扰线条数
|
||||
// "color": false, //字体是否使用随机颜色,当设置`background`后恒为`true`
|
||||
// "fontSize": 40, //字体大小
|
||||
// "ignoreChars": '', //忽略那些字符
|
||||
// "mathExpr": false, //是否使用数学表达式
|
||||
// "mathMin": 1, //表达式所使用的最小数字
|
||||
// "mathMax": 9, //表达式所使用的最大数字
|
||||
// "mathOperator": '' //表达式所使用的运算符,支持 `+`、`-`。不传随机使用
|
||||
// "expiresDate":180 //验证码过期时间(s)
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
// 开发文档: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
|
||||
//导入验证码公共模块
|
||||
const uniCaptcha = require('uni-captcha')
|
||||
//获取数据库对象
|
||||
const db = uniCloud.database();
|
||||
//获取数据表opendb-verify-codes对象
|
||||
const verifyCodes = db.collection('opendb-verify-codes')
|
||||
module.exports = {
|
||||
async getImageCaptcha({
|
||||
scene,isUniAppX
|
||||
}) {
|
||||
//获取设备id
|
||||
let {
|
||||
deviceId,
|
||||
platform
|
||||
} = this.getClientInfo();
|
||||
//根据:设备id、场景值、状态,查找记录是否存在
|
||||
let res = await verifyCodes.where({
|
||||
scene,
|
||||
deviceId,
|
||||
state: 0
|
||||
}).limit(1).get()
|
||||
//如果已存在则调用刷新接口,反之调用插件接口
|
||||
let action = res.data.length ? 'refresh' : 'create'
|
||||
//执行并返回结果
|
||||
let option = {
|
||||
scene, //来源客户端传递,表示:使用场景值,用于防止不同功能的验证码混用
|
||||
uniPlatform: platform
|
||||
}
|
||||
if(isUniAppX){
|
||||
option.mode = "bmp"
|
||||
}
|
||||
return await uniCaptcha[action](option)
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "uni-captcha-co",
|
||||
"dependencies": {
|
||||
"uni-captcha": "file:../common/uni-captcha",
|
||||
"uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
|
||||
},
|
||||
"extensions": {
|
||||
"uni-cloud-jql": {}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user