目录
注意确保自己的微信公众号插件已经安装,如果删除了想重新
第一步
后台菜单 : 渠道->渠道管理->微信公众号 填入对应的AppId,AppSecret,Token,EncodingAESKey等参数
这里有时候会提示
第二步
微信公众号绑定的服务器地址为 当前域名
html5/wechat/receive-msg/index,完整例子 :www.rageframe.com/html5/wechat/receive-msg/index
如果想修改微信用户session保存信息,在 common\config\main.php 里面修改
/*
*$mall_id 商户ID
*$params[app_id] 应用ID
*$params[secret] 秘钥
*$params[token] token
*$params[name] 公众号名称
*$params[aes_key] access_token
*$params[qrcode] 二维码
*/
$res = Yii::$app->services->setting->mall->set($mall_id, ['wechat' => $params]);
/*
*$mall_id 商户ID
*/
$wechat = Yii::$app->services->setting->mall->get($mall_id, 'wechat');
// 服务器地址(URL)
$web_url = urldecode(Yii::$app->urlManager->createAbsoluteUrl('api/wechat/index&mall_id=' . $mall_id));
$this->success('获取成功', compact('wechat', 'web_url'));