当前位置:网站首页>基于微信小程序的婚纱影楼小程序开发笔记
基于微信小程序的婚纱影楼小程序开发笔记
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
}前端界面设计




后端界面设计

边栏推荐
- Design of hardware switch with programmable full function rate limiter
- Docker搭建redis集群
- Learn the basic principles of BLDC in Simulink during a meal
- Robust extraction of specific signals with time structure (Part 2)
- 亚香香料深交所上市:市值40亿 鼎龙博晖与涌耀投资是股东
- Online text entity extraction capability helps applications analyze massive text data
- Js25 topic
- Matrix analysis notes (I)
- 如何使用物联网低代码平台进行流程管理?
- Product design - Requirements Analysis
猜你喜欢

博睿数据出席阿里云可观测技术峰会,数字体验管理驱动可持续发展

Heavyweight: the domestic ide was released, developed by Alibaba, and is completely open source! (high performance + high customization)

Convex optimization notes

亚香香料深交所上市:市值40亿 鼎龙博晖与涌耀投资是股东

Js25 topic

重磅:国产IDE发布,由阿里研发,完全开源!(高性能+高定制性)
Database migration tool flyway vs liquibase (I)

Vprom notes
![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]](/img/6d/96b3326a201bf17d436c1af7834232.png)
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]

直播回顾 | 云原生混部系统 Koordinator 架构详解(附完整PPT)
随机推荐
Jerry's SD card will reset after he enters soft off [chapter]
sed replace \tPrintf to \t//Printf
【One by One系列】IdentityServer4(六)授权码流程原理之SPA
golang set type implementation
STM32 (VIII) -- PWM output
Helix QAC更新至2022.1版本,将持续提供高标准合规覆盖率
盛科通信IPO过会:年营收4.6亿 中国振华与产业基金是股东
Jerry's broadcast MP3 prompt sound function [chapter]
test
The yuan universe killer is coming! Xiao Zha offered 4 VR head displays to challenge the visual Turing test
This year, Anhui master fund exploded
Graffiti intelligence passed the hearing: Tencent is an important shareholder planning to return to Hong Kong for listing
杰理之串口通信 串口接收 IO 需要设置数字功能【篇】
打新债有条件吗 打新债安全吗
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
【NOI2014】15. Difficult to get up syndrome [binary]
Principles of microcomputer Chapter 6 notes arrangement
Use of stream streams
傑理之串口設置好以後打印亂碼,內部晶振沒有校准【篇】
Jerry's dynamic switching vcomo modulation method [chapter]