二次开发【?】
WanlShop基于FastAdmin、ThinkPHP、UNI-APP开发,此文档除特殊定义不在叙述
一、客户端全局方法
1.全局使用wanlshop封装方法
this.$wanlshop.方法();
2.全局使用jssdk封装方法
this.$jssdk.方法();
3.常用方法
this.$wanlshop.msg 全局提示
this.$wanlshop.prePage 页面栈
this.$wanlshop.wanlsys 系统配置
this.$wanlshop.title 动态修改标题
this.$wanlshop.appstc 服务器图片地址
this.$wanlshop.toFormat 数字格式化
this.$wanlshop.timeToDate 社交时间友好
this.$wanlshop.timeToChat IM时间友好
this.$wanlshop.timeFormat 时间格式化
this.$wanlshop.guid 生成guid
this.$wanlshop.oss OSS图片处理
this.$wanlshop.to 打开链接
this.$wanlshop.on 打开任意链接
this.$wanlshop.auth 认证页面
this.$wanlshop.back 返回
this.$wanlshop.send 发送消息
this.$wanlshop.phone 拨打电话
this.$wanlshop.con 获取配置
二、回调地址
https://www.你的域名.com/api/wanlshop/callback/kuaidi 快递100
https://www.你的域名.com/api/wanlshop/callback/push 推流状态
https://www.你的域名.com/api/wanlshop/callback/record 推流录制文件url
https://www.你的域名.com/api/wanlshop/callback/detectporn 直播安全审查
https://www.你的域名.com/api/wanlshop/callback/notify 支付回调 ?type= 支付类型
https://www.你的域名.com/api/wanlshop/callback/notify_recharge 充值 ?type= 支付类型
https://www.你的域名.com/api/wanlshop/callback/return 支付成功跳转页
三、新增图标,用于自定义页面
前端引入图标库
1.在客户端App.vue文件中 style中引入自己图标库
2.在到商城装修 - 图标管理添加自己图标
后端引入图标库
wanlshop/icon
...
wanlshop/page
等相关页面也同样需要引入
三、Vue页面中使用ajax上传本地或第三方方法
let files = event.target.files[0]; //获取input的图片file值
let formData = new FormData();
let upload = Config.upload;
if(upload.storage !== 'local'){
let multipart = Object.entries(upload.multipart)[0];
formData.append(multipart[0], multipart[1]);}
formData.append('file', files, files.name);
Fast.api.ajax({
url: upload.uploadurl,
data:formData,
processData:false,
contentType:false,}, function(data, ret){
Vue.set(vm.pageData.page.style, key, data.url);});
五、商城一些常用封装方法
微信小程序、公众号
use addons\wanlshop\library\EasyWeChat\Easywechat;
内容审核 demo
$easywechat = true;
try{
$content = '特3456书yuuo莞6543李zxcz蒜7782法fgnv级';
$security = Easywechat::app()
->content_security
->checkText($content);
if($security['errcode'] == 87014){
$easywechat = false;
}
} catch (\Exception $e) {
$this->error('内容审核失败:可能后台小程序的appid、appsecret配置错误,具体:'. $e->getMessage());
}
if(!$easywechat){
$this->error(__('内容包含敏感词汇'));
}
六、相关资源
链接:https://share.weiyun.com/meBf0HPW 密码:k236b3