当前位置:网站首页>Development notes of wedding studio applet based on wechat applet
Development notes of wedding studio applet based on wechat applet
2022-06-23 19:27:00 【InfoQ】
Business background
functional requirement

Database design

Technical research
UGC Public mode encapsulation
const cloudHelper = require('../helper/cloud_helper.js');
const pageHelper = require('../helper/page_helper.js');
const setting = require('../setting/setting.js');
/**
* Picture type verification
* @param {*} fileName
* @param {*} type
*/
function imgTypeCheck(path, type = ['jpg', 'jpeg', 'png','JPG','JPEG','PNG']) {
let fmt = path.split(".")[(path.split(".")).length - 1];
if (type.indexOf(fmt) > -1)
return true;
else
return false;
}
/**
* Picture size check
* @param {*} size
* @param {*} maxSize
*/
function imgSizeCheck(size, maxSize) {
return size < maxSize;
}
async function imgCheckCloud(path, opt) {
/*
let result = await cloudHelper.callCloudSumbit('check/img', params, opt).then(res => {
return true;
}).catch(err => {
return false;
});
*/
let result = await wx.cloud.callFunction({
name: 'cloud',
data: {
route: 'check/img',
token : '',
params:{img: wx.cloud.CDN( {
type: 'filePath',
filePath: path,
})
}
},
success: function (res) {
console.log(res)
console.log('succ')
return true;
},
fail: function (res) {
console.log(res)
return false;
},
complete: function (res) {
}
});
return result;
}
/**
* Image verification
* @param {*} imgData
*/
async function imgCheck(imgData) {
let result = await wx.serviceMarket.invokeService({
service: 'wxee446d7507c68b11',
api: 'imgSecCheck',
data: {
"Action": "ImageModeration",
"Scenes": ["PORN", "POLITICS", "TERRORISM"],
"ImageUrl": new wx.serviceMarket.CDN({
type: 'filePath',
filePath: imgData,
}),
"ImageBase64": '',
"Config": "",
"Extra": ""
},
}).then(res => {
if (res && res.data && res.data.Response &&
res.data.Response.PornResult && res.data.Response.PornResult.Suggestion === 'PASS' &&
res.data.Response.PoliticsResult && res.data.Response.PoliticsResult.Suggestion === 'PASS' &&
res.data.Response.TerrorismResult && res.data.Response.TerrorismResult.Suggestion === 'PASS')
return true;
else
return false;
}).catch(err => {
console.log(err);
return false;
});
return result;
}
module.exports = {
imgCheck,
imgCheckCloud,
imgTypeCheck,
imgSizeCheck
}Front end interface design




Back end interface design

边栏推荐
- Is it safe to pay new debts
- Idea console displays Chinese garbled code
- Basic knowledge of assembly language (1)
- Robust extraction of specific signals with time structure (Part 1)
- Product feedback mechanism
- Graffiti intelligence passed the hearing: Tencent is an important shareholder planning to return to Hong Kong for listing
- Principles of microcomputer Chapter 5 notes arrangement
- 博睿数据出席阿里云可观测技术峰会,数字体验管理驱动可持续发展
- [cloud trends] the four highlights of Huawei cloud store brand new release are here
- 【One by One系列】IdentityServer4(三)使用用户名和密码
猜你喜欢
Database migration tool flyway vs liquibase (I)

Noah fortune passed the hearing: with an annual revenue of 4.3 billion yuan, Wang Jingbo has 49% voting rights, and Sequoia is a shareholder

Robust extraction of specific signals with time structure (Part 2)

从零开发小程序和公众号【第二期】

直播分享| 腾讯云 MongoDB 智能诊断及性能优化实践

IDEA控制台显示中文乱码

FlagAI飞智:AI基础模型开源项目,支持一键调用OPT等模型
![[noi 2014] 15. Syndrome de difficulté à se lever [binaire]](/img/3a/12e9b2566d3ca3330a3cc6c5eaf135.png)
[noi 2014] 15. Syndrome de difficulté à se lever [binaire]

Nanxin semiconductor rushes to the scientific innovation board: its annual revenue is RMB 980 million. Sequoia Xiaomi oppo is the shareholder

Ready to migrate to the cloud? Please accept this list of migration steps
随机推荐
Noah fortune passed the hearing: with an annual revenue of 4.3 billion yuan, Wang Jingbo has 49% voting rights, and Sequoia is a shareholder
Jerry's seamless looping [chapter]
解读2022年度敏捷教练行业现状报告
Advanced network accounting notes (III)
8、AI医生案例
Une fois que le port série de Jerry est réglé, le Code aléatoire est imprimé, et le cristal interne n'est pas étalonné [chapitre]
Matrix analysis notes (I)
游戏资产复用:更快找到所需游戏资产的新方法
Obtain equipment information
Online text entity extraction capability helps applications analyze massive text data
打新债有条件吗 打新债安全吗
Flagai Feizhi: AI basic model open source project, which supports one click call of OPT and other models
在线文本实体抽取能力,助力应用解析海量文本数据
盘点四种WiFi加密标准:WEP、WPA、WPA2、WPA3
Basic knowledge of assembly language (1)
【One by One系列】IdentityServer4(八)使用EntityFramework Core对数据进行持久化
Jerry's broadcast MP3 prompt sound function [chapter]
qgis导入WMS OR WMTS
Take out Jianghu will change, and meituan "big brother" is hard to be
CV background introduction