基于微信小程序的婚纱影楼小程序开发笔记
作者:CC同学
- 2022 年 6 月 23 日
本文字数:2061 字
阅读完需:约 7 分钟
业务背景
婚纱影楼小程序提供了一个连接用户与影楼的平台,相当于影楼在微信的官网。它能帮助影楼展示拍摄实力,记录访客数据,宣传优惠活动。使用频率高,方便传播,是影楼在微信端宣传营销的得力助手。其采用腾讯提供的小程序云开发解决方案,无须服务器和域名。 样片页是影楼展示优秀摄影样片提供给用户欣赏并且吸引客户的。套系页是影楼根据市场需求推出的不同套餐,用户可以按照自己的喜好预定套系。个人中心可以查看用户预约的拍摄计划,也可以获取到影楼的联系方式。
功能需求
数据库设计
技术攻关
小程序目前提审是越来越严格,需要 对用户发布的内容,图片,视频等进行安全合规校验,保证不出现不雅的内容。
对此开发了针对图片和文本的校验方法
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}复制代码
前端界面设计
后端界面设计
划线
评论
复制
发布于: 刚刚阅读数: 3
CC同学
关注
CC同学的小程序开发笔记 2021.06.13 加入
大鹅厂的小小程序媛,vx: cclinux0730










评论