整合tpshop微信模块到thinkcmf中

最后更新于:2022-04-01 23:49:17

# 整合tpshop微信模块到thinkcmf中 [TOC] ## 1. 打开Application->Admin->Controller->WechatController.class.php 将此文件放入 NEWthink 中 application->Admin->Controller下 >注意:修改控制器的命名空间和引用 ## 2.将 Application->Home->Controller->WeixinController.class.php 放到NEWthink的Home模块中 >注意:修改控制器的命名空间和引用 ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/fac41cda3e5fc8940822f2f9d867db95_726x285.png) ## 3.将Application->Common->Common->function.php 集成到NEWthink的公共方法库中application->Common->Common->function.php ## 4.导入数据结构表 ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/4313a6c3ca5cf4c7c166953363eb963d_552x750.png) * * * * * 相关的SQL语句如下: ~~~ CREATE TABLE IF NOT EXISTS `new_wx_user` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表id', `uid` int(11) NOT NULL COMMENT 'uid', `wxname` varchar(60) NOT NULL COMMENT '公众号名称', `aeskey` varchar(256) NOT NULL DEFAULT '' COMMENT 'aeskey', `encode` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'encode', `appid` varchar(50) NOT NULL DEFAULT '' COMMENT 'appid', `appsecret` varchar(50) NOT NULL DEFAULT '' COMMENT 'appsecret', `wxid` varchar(20) NOT NULL COMMENT '公众号原始ID', `weixin` char(20) NOT NULL COMMENT '微信号', `headerpic` char(255) NOT NULL COMMENT '头像地址', `token` char(255) NOT NULL COMMENT 'token', `w_token` varchar(150) NOT NULL DEFAULT '' COMMENT '微信对接token', `create_time` varchar(13) NOT NULL COMMENT 'create_time', `updatetime` varchar(13) NOT NULL COMMENT 'updatetime', `tplcontentid` varchar(2) NOT NULL COMMENT '内容模版ID', `share_ticket` varchar(150) NOT NULL COMMENT '分享ticket', `share_dated` char(15) NOT NULL COMMENT 'share_dated', `authorizer_access_token` varchar(200) NOT NULL COMMENT 'authorizer_access_token', `authorizer_refresh_token` varchar(200) NOT NULL COMMENT 'authorizer_refresh_token', `authorizer_expires` char(10) NOT NULL COMMENT 'authorizer_expires', `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '类型', `web_access_token` varchar(200) NOT NULL COMMENT ' 网页授权token', `web_refresh_token` varchar(200) NOT NULL COMMENT 'web_refresh_token', `web_expires` char(10) NOT NULL COMMENT '过期时间', `qr` varchar(200) NOT NULL COMMENT 'qr', `menu_config` text COMMENT '菜单', `wait_access` tinyint(1) DEFAULT '0' COMMENT '微信接入状态,0待接入1已接入', PRIMARY KEY (`id`), KEY `uid` (`uid`) USING BTREE, KEY `uid_2` (`uid`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='微信公共帐号' AUTO_INCREMENT=26 ; ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/46da3fb3096a122b99e77f78a9cbb6bd_496x225.png) * * * * * 相关的SQL语句如下: ~~~ CREATE TABLE IF NOT EXISTS `new_wx_keyword` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表id', `keyword` char(255) NOT NULL COMMENT '关键词', `pid` int(11) NOT NULL COMMENT '对应表ID', `token` varchar(60) NOT NULL COMMENT 'token', `type` varchar(30) DEFAULT 'TEXT' COMMENT '关键词操作类型', PRIMARY KEY (`id`), KEY `pid` (`pid`), KEY `token` (`token`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='微信关键词' AUTO_INCREMENT=329 ; ~~~ * * * * * 相关的SQL语句如下: ~~~ CREATE TABLE IF NOT EXISTS `new_wx_menu` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', `level` tinyint(1) DEFAULT '1' COMMENT '菜单级别', `name` varchar(50) NOT NULL COMMENT 'name', `sort` int(5) DEFAULT '0' COMMENT '排序', `type` varchar(20) DEFAULT '' COMMENT '0 view 1 click', `value` varchar(255) DEFAULT NULL COMMENT 'value', `token` varchar(50) NOT NULL COMMENT 'token', `pid` int(11) DEFAULT '0' COMMENT '上级菜单', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='微信菜单' AUTO_INCREMENT=33 ; ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/4ec27a66d44090d93548884ed73ed387_461x392.png) * * * * * 相关的SQL语句如下: ~~~ CREATE TABLE IF NOT EXISTS `new_wx_text` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表id', `uid` int(11) NOT NULL COMMENT '用户id', `uname` varchar(90) NOT NULL COMMENT '用户名', `keyword` char(255) NOT NULL COMMENT '关键词', `precisions` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'precisions', `text` text NOT NULL COMMENT 'text', `createtime` varchar(13) NOT NULL COMMENT '创建时间', `updatetime` varchar(13) NOT NULL COMMENT '更新时间', `click` int(11) NOT NULL COMMENT '点击', `token` char(30) NOT NULL COMMENT 'token', PRIMARY KEY (`id`), KEY `uid` (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='文本回复表' AUTO_INCREMENT=12 ; ~~~ ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/7c1970ee66cc1210dd5618e69bf30822_497x415.png) * * * * * 相关的SQL语句如下: ~~~ CREATE TABLE IF NOT EXISTS `new_wx_img` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表id', `keyword` char(255) NOT NULL COMMENT '关键词', `desc` text NOT NULL COMMENT '简介', `pic` char(255) NOT NULL COMMENT '封面图片', `url` char(255) NOT NULL COMMENT '图文外链地址', `createtime` varchar(13) NOT NULL COMMENT '创建时间', `uptatetime` varchar(13) NOT NULL COMMENT '更新时间', `token` char(30) NOT NULL COMMENT 'token', `title` varchar(60) NOT NULL COMMENT '标题', `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '商品id', `goods_name` varchar(50) DEFAULT NULL COMMENT '商品名称', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='微信图文' AUTO_INCREMENT=22 ; ~~~ ## 5.创建后台菜单和后台模板 参考TPSHOP后台模板(Application->Admin->View->Wechat)添加后台菜单模板
';