1 .model路径:ewei_shopv2\core\model
判断用户是否关注,关注返回1
$rs = m("user")->followed($openid);
查询物流信息
m('util')->getExpressList('youshuwuliu','518266033534');
获取快递商列表
m('express')->getExpressList();
生成订单号
$ordersn = m('common')->createNO('order', 'ordersn', 'ME');
成为分销商产品id
$rs = m('common')->getPluginset('commission')['become_goodsid'];
自动定位返回省市县
$rs = json_decode(m('util')->getIpAddress(),1);
Array
(
[ret] => 1
[start] => -1
[end] => -1
[country] => 中国
[province] => 江苏
[city] => 苏州
[district] =>
[isp] =>
[type] =>
[desc] =>
)
根据经纬度计算距离
params :lat1 纬度1; lng1 经度1; lat2 纬度2; lng2 经度2; len_type (1:m or 2:km);
m('util')->GetDistance($lat1, $lng1, $lat2, $lng2, $len_type = 1, $decimal = 2);
返回会员信息,支持传入openid,mid,两个功能一样,无区别
$rs =m('member')->getMember($mid);
$rs =m('member')->getInfo($openid);
$rs =m('member')->getMobileMember('18291448834');只支持手机号,返回同上信息
查询积分与余额,可传入openid,uid
$rs =m('member')->getCredits($openid);
Array
(
[credit1] => 0.00
[credit2] => 9999.00
)
查询积分,只返回一个值,支持openid,uid
m('member')->getCredit($openid,'credit2');
获取用户信息 oauth,snsapi_userinfo 是用户信息
$rs = m('member')->wxuser($appid, $secret, $snsapi = 'snsapi_base', $expired = '600');
查询会员等级,支持openid/mid
m('member')->getLevel($mid);
Array
(
[levelname] => 普通用户
[discount] => 10
)
写入积分或余额,传入openid,要写入的字段,分数,日志
m('member')->setCredit($openid,'credit2',-1,[0,'测试增加1积分']);
发送文本客服消息
$rs =m('message')->sendCustomNotice($openid, '感谢您的关注,恭喜您获得关注奖励');
m('message')->sendCustomNotice($openid, '感谢您的关注,恭喜您获得关注奖励',mobileUrl('task', array('tabpage' => 'runninga'), true));带连接
Array
(
[errcode] => 0
[errmsg] => ok
)
发送图片给用户
m('message')->sendImage($openid, $mediaid);
发送图文信息
$articles[] = [
'title'=>urlencode('图文标题'),
'description'=>urlencode('图文描述'),
'url'=>'',
'picurl'=>''
];
$rs =m('message')->sendNews($openid, $articles);
发送模板消息
$tplid = "oHp99Ox0wF1ipI8-FJ7TDgFfkBbi8MW39u2Ft4jp3bQ";
$url = "";
$arr =[];
$sendarr =['测试通知标题','西安大学','管理员','2018-4-28','商城决定展示关闭','点击查看详情'];
$tpl = '{{first.DATA}}
学校:{{keyword1.DATA}}
通知人:{{keyword2.DATA}}
时间:{{keyword3.DATA}}
通知内容:{{keyword4.DATA}}
{{remark.DATA}}';
preg_match_all('/{{(.*).DATA}}/',$tpl,$rs);
foreach($rs[1] as $k=>$v){
$arr[$v] = array(
'value'=>$sendarr[$k]
);
}
$arr['first']['color']='#04be02';
$arr['remark']['color']='#18b4ed';
$rs = m('Message')->sendTplNotice($openid, $tplid, $arr, $url = '');
获取配置信息
可传入需要的参数值 如pay
$rs= m('common')->getSysset('', $_W['uniacid']);
支付签名,17是支付方式,成功后处理通知文件在ewei_shopv2\payment\wechat\notify.php
$options = array();
$options['appid'] = $user['appid'];
$options['secret'] = $user['secretkey'];
$options['apikey'] = $user['prikey'];
$options['mchid'] = $user['mchid'];
$params = array();
$params['tid'] = $row['os_orderid'];
$params['user'] = $row['openid'];
$params['fee'] =(float)$row['money'];
$params['title'] = '订单标题';
$params['openid'] = $row['openid'];
if (is_weixin()) {
$wechat = m('common')->wechat_build($params, $options,17);
}
生成二维码,返回url
$rs = m('qrcode')->createQrcode("http://www.baidu.com");
文档更新时间: 2020-07-23 22:50 作者:Yoby