当前位置:网站首页>基于微信小程序的婚纱影楼小程序开发笔记
基于微信小程序的婚纱影楼小程序开发笔记
2022-06-23 18:35:00 【InfoQ】
业务背景
功能需求

数据库设计

技术攻关
UGC公共方式封装
const cloudHelper = require('../helper/cloud_helper.js');
const pageHelper = require('../helper/page_helper.js');
const setting = require('../setting/setting.js');
/**
* 图片类型校验
* @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;
}
/**
* 图片大小校验
* @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;
}
/**
* 图像校验
* @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
}前端界面设计




后端界面设计

边栏推荐
- Nanxin semiconductor rushes to the scientific innovation board: its annual revenue is RMB 980 million. Sequoia Xiaomi oppo is the shareholder
- How long do you need to prepare for the PMP Exam?
- STM32 (VIII) -- PWM output
- 【One by One系列】IdentityServer4(八)使用EntityFramework Core对数据进行持久化
- 考PMP有用吗?
- 打新债有条件吗 打新债安全吗
- 从零开发小程序和公众号【第二期】
- Graffiti intelligence passed the hearing: Tencent is an important shareholder planning to return to Hong Kong for listing
- 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]
- 准备好迁移上云了?请收下这份迁移步骤清单
猜你喜欢

函数的定义和函数的参数

物联网平台搭建设备,附源代码

FlagAI飞智:AI基础模型开源项目,支持一键调用OPT等模型

IDEA控制台显示中文乱码

韬略生物冲刺科创板:年亏损过亿 实控人张大为夫妇为美国籍

如何使用物联网低代码平台进行流程管理?

Dataease template market officially released

IOT platform construction equipment, with source code

杰理之串口设置好以后打印乱码,内部晶振没有校准【篇】

Learn the basic principles of BLDC in Simulink during a meal
随机推荐
Revelation: Bezos' business logic and leadership rules
Matrix analysis notes (III-1)
Advanced network planning notes (IX)
打新债有何要求 打新债安全吗
User analysis aarrr model (pirate model)
Database migration tool flyway vs liquibase (I)
[one by one series] identityserver4 (VIII) uses entityframework core to persist data
#20Set介绍与API
Matrix analysis notes (II)
Jerry's adding timer interrupt [chapter]
不止雷军 iQOO产品经理也称赞高通骁龙8+:焕然一新
Jericho Forced upgrade [chapter]
How can enterprises do business monitoring well?
Principles of microcomputer Chapter 6 notes arrangement
NLP 论文领读|改善意图识别的语义表示:有监督预训练中的各向同性正则化方法
诺亚财富通过聆讯:年营收43亿 汪静波有49%投票权,红杉是股东
【对比学习】koa.js、Gin与asp.net core——中间件
涂鸦智能通过聆讯:拟回归香港上市 腾讯是重要股东
CV image classification
golang set type implementation