2018-11-13,升级到 laravel5.7 & easyWeChat 的4.0版本
基于 EasyWeChat进行微信登录的封装
- composer install
- cp .env.example .env , 配置你的数据库信息
- cp config/wechat.example.php config/wechat.php , 配置你的微信信息
- 微信配置文件
- 自定义key说明:
'default_reply' => '默认回复文本',
'auto_reply' => [
[
'request' => ['用户输入的关键词', '关键词'],
'response' => '回复的文本',
'rule' => 'match', // match:关键词必须精准匹配,fuzzy:关键词模糊匹配(尽量不要用单个字)
],
....
],
'subscribe_reply' => '关注回复的文本',
CREATE TABLE `wes_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`openid` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`nickname` varchar(255) CHARACTER SET utf8 DEFAULT '',
`avatar` varchar(255) CHARACTER SET utf8 DEFAULT '',
`gender` tinyint(4) DEFAULT '0',
`ip` varchar(40) CHARACTER SET utf8 DEFAULT '',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `wes_users_openid_unique` (`openid`)
) ENGINE=InnoDB CHARSET=utf8mb4 ROW_FORMAT=COMPACT;