Browse Source

留言小程序

Candy 6 years ago
commit
13f9501579
99 changed files with 9992 additions and 0 deletions
  1. 14 0
      messageApplet/.gitignore
  2. 607 0
      messageApplet/README.md
  3. 14 0
      messageApplet/app.js
  4. 42 0
      messageApplet/app.json
  5. 14 0
      messageApplet/app.wxss
  6. BIN
      messageApplet/images/2.jpg
  7. BIN
      messageApplet/images/index.png
  8. BIN
      messageApplet/images/index1.png
  9. BIN
      messageApplet/images/user.png
  10. BIN
      messageApplet/images/user1.png
  11. BIN
      messageApplet/images/zan1.png
  12. BIN
      messageApplet/images/zan2.png
  13. BIN
      messageApplet/images/主页.png
  14. 216 0
      messageApplet/pages/addgong/addgong.js
  15. 7 0
      messageApplet/pages/addgong/addgong.json
  16. 102 0
      messageApplet/pages/addgong/addgong.wxml
  17. 22 0
      messageApplet/pages/addgong/addgong.wxss
  18. 248 0
      messageApplet/pages/artical/artical.js
  19. 7 0
      messageApplet/pages/artical/artical.json
  20. 22 0
      messageApplet/pages/artical/artical.wxml
  21. 63 0
      messageApplet/pages/artical/artical.wxss
  22. 198 0
      messageApplet/pages/check/check.js
  23. 7 0
      messageApplet/pages/check/check.json
  24. 19 0
      messageApplet/pages/check/check.wxml
  25. 181 0
      messageApplet/pages/check/check.wxss
  26. 386 0
      messageApplet/pages/index/index.js
  27. 7 0
      messageApplet/pages/index/index.json
  28. 53 0
      messageApplet/pages/index/index.wxml
  29. 176 0
      messageApplet/pages/index/index.wxss
  30. 170 0
      messageApplet/pages/inform/inform.js
  31. 8 0
      messageApplet/pages/inform/inform.json
  32. 6 0
      messageApplet/pages/inform/inform.wxml
  33. 25 0
      messageApplet/pages/inform/inform.wxss
  34. 777 0
      messageApplet/pages/lookmessage/lookmessage.js
  35. 7 0
      messageApplet/pages/lookmessage/lookmessage.json
  36. 83 0
      messageApplet/pages/lookmessage/lookmessage.wxml
  37. 244 0
      messageApplet/pages/lookmessage/lookmessage.wxss
  38. 373 0
      messageApplet/pages/message/message.js
  39. 9 0
      messageApplet/pages/message/message.json
  40. 70 0
      messageApplet/pages/message/message.wxml
  41. 212 0
      messageApplet/pages/message/message.wxss
  42. 244 0
      messageApplet/pages/myartical/myartical.js
  43. 7 0
      messageApplet/pages/myartical/myartical.json
  44. 21 0
      messageApplet/pages/myartical/myartical.wxml
  45. 61 0
      messageApplet/pages/myartical/myartical.wxss
  46. 465 0
      messageApplet/pages/mycenter/mycenter.js
  47. 8 0
      messageApplet/pages/mycenter/mycenter.json
  48. 129 0
      messageApplet/pages/mycenter/mycenter.wxml
  49. 431 0
      messageApplet/pages/mycenter/mycenter.wxss
  50. 119 0
      messageApplet/pages/select/select.js
  51. 8 0
      messageApplet/pages/select/select.json
  52. 27 0
      messageApplet/pages/select/select.wxml
  53. 93 0
      messageApplet/pages/select/select.wxss
  54. 343 0
      messageApplet/pages/userinfo/userinfo.js
  55. 7 0
      messageApplet/pages/userinfo/userinfo.json
  56. 41 0
      messageApplet/pages/userinfo/userinfo.wxml
  57. 198 0
      messageApplet/pages/userinfo/userinfo.wxss
  58. 282 0
      messageApplet/pages/write/write.js
  59. 7 0
      messageApplet/pages/write/write.json
  60. 48 0
      messageApplet/pages/write/write.wxml
  61. 117 0
      messageApplet/pages/write/write.wxss
  62. 77 0
      messageApplet/project.config.json
  63. 7 0
      messageApplet/sitemap.json
  64. 19 0
      messageApplet/utils/util.js
  65. 5 0
      messageApplet/weui.wxss
  66. BIN
      messageApplet/wxSearch/images/wxSearch-icon-delete.png
  67. 226 0
      messageApplet/wxSearch/wxSearch.js
  68. 38 0
      messageApplet/wxSearch/wxSearch.wxml
  69. 92 0
      messageApplet/wxSearch/wxSearch.wxss
  70. 4 0
      serviceApi/.gitignore
  71. 42 0
      serviceApi/.travis.yml
  72. 1236 0
      serviceApi/CHANGELOG.md
  73. 32 0
      serviceApi/LICENSE.txt
  74. 133 0
      serviceApi/README.md
  75. 1 0
      serviceApi/application/.htaccess
  76. 12 0
      serviceApi/application/command.php
  77. 12 0
      serviceApi/application/common.php
  78. 243 0
      serviceApi/application/config.php
  79. 55 0
      serviceApi/application/database.php
  80. 14 0
      serviceApi/application/extra/queue.php
  81. 58 0
      serviceApi/application/index/controller/AccessToken.php
  82. 80 0
      serviceApi/application/index/controller/Article.php
  83. 44 0
      serviceApi/application/index/controller/Index.php
  84. 293 0
      serviceApi/application/index/controller/Message.php
  85. 44 0
      serviceApi/application/index/controller/Weichatcallbackapi.php
  86. 21 0
      serviceApi/application/route.php
  87. 28 0
      serviceApi/application/tags.php
  88. 25 0
      serviceApi/build.php
  89. 34 0
      serviceApi/composer.json
  90. 2 0
      serviceApi/extend/.gitignore
  91. 8 0
      serviceApi/public/.htaccess
  92. BIN
      serviceApi/public/favicon.ico
  93. 17 0
      serviceApi/public/index.php
  94. 2 0
      serviceApi/public/robots.txt
  95. 20 0
      serviceApi/public/router.php
  96. 2 0
      serviceApi/public/static/.gitignore
  97. 2 0
      serviceApi/runtime/.gitignore
  98. 17 0
      serviceApi/think
  99. 2 0
      serviceApi/vendor/.gitignore

+ 14 - 0
messageApplet/.gitignore

@@ -0,0 +1,14 @@
+# Windows
+[Dd]esktop.ini
+Thumbs.db
+$RECYCLE.BIN/
+
+# macOS
+.DS_Store
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+
+# Node.js
+node_modules/

+ 607 - 0
messageApplet/README.md

@@ -0,0 +1,607 @@
+# 微信小程序留言助手使用指南
+
+## 前言
+
+由于之前前段时间比较忙,没有对上传的代码进行详细的注释。非常抱歉,所以今天利用一天的时间,把前后台的代码项目结构做了一个整体的简介。
+
+很多小伙伴加我微信问我关于这个小程序的问题,我在这里也统一说一下。如果只想单单的给公众号加一个留言功能,我建议没必要自己去做了,因为很多热你都没有编程基础,要想做出来,必须从基础开始看,这个过程非常考验你的学习能力的。因为我的《小鹿留言助手》已经发布,可以关联多个公众号,前提是粉丝量大于 1000 可以关联哦!因为服务器费用都是小鹿自己掏腰包,我还是个学生,没什么收入来源,小程序也是免费关联的,所以粉丝不多的前期留言不怎么重要,还是好好做内容吧。
+
+另一方面就是,如果你想用小程序留言来学习小程序,可以亲自动手根据小鹿提供的源码自己写一个,说实话,我是从零开始学习小程序的,包括后台的代码都是自学的,因为现在所在的大学是三流大学,只能靠自己去学习研究,服务器、数据库需要自己配置。所以说,如果能够自己做出来,我相信你会在编程技术上会有很大的收获的。
+
+如果有问题,可以加我微信,拉你进群,可能白天给企业做项目,我会在晚上统一在群里解决各位小伙伴遇到的问题的,好的,谢谢各位对项目的支持!再次感谢!
+
+
+
+※ 体验留言小程序,即可搜索:<u>小鹿留言助手</u>
+
+
+
+## 小程序端
+
+### 1、小程序端目录结构
+
+> 下面是留言小程序的主要目录结构,目录中的具体结构和代码以及对应的页面示意图会在下方详细标记。
+
+- `images: ` 此目录下为小程序中所用到的图片文件。
+
+  - `artical:` 用户文章列表页面。
+  - `index: `主页面。
+  - `lookmessage:` 留言筛选、回复、删除页面。
+  - `message:` 留言显示页面。
+  - `myartical: `后台筛选文章的列表页面。
+  - `mycenter:` 后台文章发布、编辑、删除页面。
+  - `select:` 后台留言管理、文章管理选择页面。
+  - `write: ` 写留言页面。
+
+- `pages:` 此路径下存放的为小程序的页面文件(每个页面对应一个文件夹)。
+
+- `serverAPI:` 服务器端 API ,配置好数据库,放入服务器即可运行。
+
+- `wxSearch:` 页面搜索框的组件。
+
+  
+
+### 2、具体页面
+
+> 下面详细介绍各个页面以及对应的目录文件,下面的页面都存在于 `pages` 文件夹中。
+
+
+
+#### 2.1 主页面(index)
+
+> 此页面是小程序两个入口之一的主页面。该页面的功能主要显示关联小程序的公众号信息,图中的右下角的对勾是进入后台管理,每个公众号主都有超级管理员设置的唯一密码,输入密码即可进入。点击页面中的公众号信息,即可进入该公众号的文章列表页面(`artical` 页面)。
+
+
+
+##### ▉ 示意图:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/index.jpg)
+
+
+
+##### ▉ 页面逻辑:
+
+> 这里涉及到一个页面用户授权登录,具体逻辑参照根据微信小程序文档。
+>
+> 1)该页面的 js 中 `postOpenid` 函数作用为上传用户的 openID。
+
+
+
+##### ▉ API 接口:
+
+> 该页面共有三个 API 接口:
+>
+> 1、验证后台登录密码;
+>
+> 2、从服务器获取关联的公众号信息;
+>
+> 3、上传用户的 `openID`(如果不知道这个是什么,可以去微信小程序官网了解,这里不详细说了)。
+
+```javascript
+ // 验证登录密码(只有关联的公众号主才能进行登录)
+  getIdentifyId: function () {
+    var that = this;
+    wx.request({
+      url: '自己服务器API', //f服务器验证密码的 API
+      data: {
+        password: that.data.inputContent //获取输入框中的密码
+      },
+      ......
+        
+// 获取公众号信息显示到页面
+  getGongInfo: function () {
+    var that = this;
+    wx.request({
+      url: '自己服务器API', //获取公众号信息的 API
+      data: {
+      },      
+      ......
+        
+// 上传管理员 openid
+  postOpenid: function () {
+    var that = this;
+    wx.request({
+      url: '自己服务器API', // 上传 openid 的 API
+      data: {
+        openid: wx.getStorageSync('openid'),
+        id: that.data.id
+      },
+```
+
+
+
+#### 2.2 文章列表(artical)
+
+> 该页面主要显示进入该公众号的历史文章列表。
+
+
+
+##### ▉ 示意图:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/articel.jpg)
+
+
+
+##### ▉ 页面逻辑:
+
+> 该页面是用户点击主页面的某个公众号跳转进来的,主要显示该公众号的历史文章列表,点击某一文章即可查看该篇文章的已筛选的留言内容(`message` 页面)。
+
+
+
+##### ▉ API 接口:
+
+> 该页面的接口只有一个:
+>
+> 1、获取该公众号的历史文章列表。
+
+```javascript
+// 获取文章列表
+wx.request({
+    url: '自己服务器API', //获取文章列表API
+    data: {
+        type: '1',//获取列表标识
+        id: g_id //公众号id
+    },
+    ......
+```
+
+
+
+#### 2.3  留言显示页面(message)
+
+> 主要呈现给用户某篇文章已经筛选过的留言内容。
+>
+> **注意:**这个页面也是用户进入小程序留言的第二个页面入口,因为我们的小程序留言会嵌入在公众号文章中,然后用户点击某篇文章的内的小程序链接,页面直接跳转到用户留言显示页面。而不是从主页面进入,提高交互体验。
+
+
+
+##### ▉ 示意图:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/messages.jpg)
+
+
+
+##### ▉ 页面逻辑:
+
+> 该页面是用户点击某篇文章跳转进来的,用于显示某篇文章的留言。可以点击该页面的右上角的写留言,即可进入写留言的页面(`write` 页面)。
+
+
+
+##### ▉ API 接口:
+
+> 该页面共有两个 API 接口:
+>
+> 1、获取服务器的精选留言。
+>
+> 2、上传点赞的数量。
+
+```javascript
+//获取已精选留言内容
+  getChooseCotent: function (){
+    var that = this;
+    wx.request({
+      url: '自己服务器API', //获取已精选留言内容
+      data: {
+        no: that.data.no,  //文章编号 
+        ischeckmessage: '1', //留言是否经过筛选
+        g_id: that.data.g_id,  //公众号 id
+        openid: wx.getStorageSync('openid'), //用户唯一标识
+      },
+       ......
+        
+ // 获得一个赞
+      that.getChooseCotent();
+      wx.request({
+        url: '自己服务器API', //url
+        data: {
+          p_id: that.data.messages[u_index].p_id,//用户的 id
+          openid: wx.getStorageSync('openid'),//点赞用户
+          status: 1, //获得一个赞
+          no: that.data.no,  //文章编号 
+          g_id: that.data.g_id,  //公众号 id
+        },
+        ......
+```
+
+
+
+#### 2.4  写留言页面(write)
+
+> 用户留言上传服务器,该公众号主可以在后台对用户留言进行筛选,防止不文明留言显示给用户
+
+
+
+##### ▉ 示意图:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/write.jpg)
+
+
+
+##### ▉ 页面逻辑:
+
+> 通过获取到用户输入框内的留言内容,在页面退出的时候上传服务器,如果用户在本页面删除了该留言,退出页面不会上传服务器。
+
+
+
+##### ▉ API 接口:
+
+> 该页面只有一个上传的 API 接口:
+>
+> 1、上传留言内容,以及用户的相关信息。
+
+```javascript
+ /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+    var that = this;
+    if(that.data.messages==""){
+      console.log("没有留言数据!")
+    }else{
+      console.log("formid" + that.data.formId)
+      wx.request({
+        url: '自己服务器API', //上传留言内容API
+        data: {
+          username: wx.getStorageSync('username'),//用户名
+          avatarUrl: wx.getStorageSync('headpath'),//头像
+          messages: that.data.messages,//留言内容
+          title: that.data.title,// 标题
+          ischeck: '0', //作者是否已回复
+          no: that.data.no,  //文章编号
+          openid: wx.getStorageSync('openid'), //用户唯一标识
+          g_id: that.data.g_id,   //公众号标识
+          form_id: that.data.formId,//表单id
+          token: wx.getStorageSync('token')//token
+        },
+        ......
+```
+
+
+
+#### 2.5 后台管理界面
+
+> 当已关联的公众号主输入密码进入后台管理界面,可以进行一些文章的发布、编辑以及留言筛选、回复、置顶等操作。
+
+基本的逻辑就是在主界面右下角输入密码。如图:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/houtai.jpg)
+
+
+
+##### ▉ API 接口:
+
+> 只有一个 API 接口:
+>
+> 1、上传密码在服务器进行验证(在主界面已经介绍过了)。
+
+
+
+服务器验证通过后,进入操作选择界面(`select `页面)。
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/select.jpg)
+
+进入文章管理页面(`mycenter` 页面),可以进行发布文章,发布文章按钮是可以折叠的。如下:
+
+
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/writeArticel.jpg)
+
+
+
+##### ▉ API 接口:
+
+> 该页面只有两个 API:
+>
+> 1、上传文章相关信息的 API
+>
+> 2、上传照片的 API
+
+```javascript
+ //上传照片
+  post_image: function () {
+    var that = this;
+    console.log("照片路径"+that.data.tempFilePath)
+    //上传服务器
+    wx: wx.showToast({
+      title: '上传中',
+      icon: 'loading'
+    })
+    wx.uploadFile({
+      url: '自己服务器API',
+    ......
+ // 上传文章信息的 API
+ wx.request({
+        url: '自己服务器API', //url
+        data: {
+          title: this.data.title,   //标题
+          describe: this.data.describe, //描述
+          id: that.data.id,//公众号id
+          isheck: 0 //标识
+        },
+  .......
+```
+
+
+
+文章的配图、标题、描述,然后即可上传服务器。收起发布文章的折叠按钮,下方即将显示已经发布的历史文章。如下:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/articelList.jpg)
+
+我们通过长按路径,在公众号发表文章的时候即可将路径填入小程序的链接中,用户点击留言,直接跳转到该文章的留言页面进行留言。
+
+返回我们选择进入留言管理页面,进入留言筛选,首先要知道你要筛选那个文章下的留言,所以先出现一个筛选文章列表,点击该列表进入对该文章的留言筛选,(`myartical `页面为文章筛选列表)。如图:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/selectArticel.jpg)
+
+
+
+##### ▉ API 接口:
+
+> 该页面只有一个 API:
+>
+> 1、获取该公众号的文章列表
+
+```javascript
+ wx.request({
+      url: '自己服务器API', //获取文章列表
+      data: {
+        type: '1', //操作类型
+        id: that.data.id //公众号id
+      },
+ ......
+```
+
+
+
+其实该页面和用户想进入哪篇文章进行留言的页面是一样的,知识后台管理人员进入某篇文章下进行留言筛选、回复、置顶等功能操作。
+
+下面进入某篇文章下的留言筛选页面(`lookmessage` 页面)。如图:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/liuyanshaixuan.jpg)
+
+管理员可以在页面进行筛选、置顶、回复等操作了。
+
+
+
+##### ▉ API 接口:
+
+> 该页面只有四个 API:
+>
+> 1、获取留言列表
+>
+> 2、回复留言 API 
+>
+> 3、设置精选留言 API (取消精选同一 API)
+>
+> 4、删除留言 API
+>
+> 5、留言置顶 API (取消置顶同一 API)
+
+```javascript
+// 在已进入页面就获取留言列表
+onLoad: function (options) {
+    var that = this;
+    var title = options.title;//文章标题
+    var nos = options.no;   //文章编号
+    var ids = options.id;//公众号id
+    that.setData({
+      no: nos,
+      title: title,
+      id: ids
+    })
+    wx: wx.showToast({
+      title: '正在获取数据',
+      icon: 'loading'
+    })
+    wx.request({
+      url: '自己服务器API', //获取留言列表
+      data: {
+        ischeckmessage: 0,
+        no: that.data.no,
+        id: that.data.id
+      },
+	......
+
+//作者回复API
+  replay: function () {
+    var that = this;
+    var l = '自己服务器API';//信息用户自己接收
+    console.log("更新forim"+that.data.formId)
+    var d = {
+      p_id: that.data.messages[that.data.index2].p_id,//用户留言编号
+      page: '/pages/message/message?g_id=' + that.data.messages[that.data.index2].g_id + '&no=' + that.data.messages[that.data.index2].no + '&title=' + that.data.title,//跳转页面
+      title: that.data.messages[that.data.index2].title,//文章标题
+      message: that.data.messages[that.data.index2].userMesContent,//留言内容
+      replyMes: that.data.inputContent,//回复内容
+      formid: that.data.formId, //更新formid
+      g_id: that.data.id //公众号id
+    }
+    wx: wx.showToast({
+      title: '正在回复中',
+      icon: 'loading'
+    })
+    wx.request({
+      url: '自己服务器API', //作者回复
+      data: {
+        id: that.data.messages[that.data.index2].p_id,//用户编号
+        replyContent: that.data.inputContent,   //回复内容
+        isCheckChoess: '0'  //是否筛选(否)
+      },
+     ......
+        
+  //精选留言 API
+  choose: function (event) {
+    var that = this;
+    var j_index = event.currentTarget.dataset.index;
+    console.log("精选索引:" + event.currentTarget.dataset.index)
+    wx: wx.showToast({
+      title: '正在设置中',
+      icon: 'loading'
+    })
+    wx.request({
+      url: '自己服务器API', //设置为精选留言
+      data: {
+        id: that.data.messages[j_index].p_id,//留言用户id
+        type: '1' //精选留言标识 
+      },
+   ......
+ 
+        
+ //删除留言 API
+  deleteMessage: function (event) {
+    var that = this;
+    var j_index = event.currentTarget.dataset.index;
+    console.log("精选索引:" + event.currentTarget.dataset.index)
+    wx: wx.showToast({
+      title: '正在删除',
+      icon: 'loading'
+    })
+    wx.request({
+      url: '自己服务器API', //删除留言
+      data: {
+        id: that.data.messages[j_index].p_id,//留言用户id
+        type: '0' //精选留言标识 
+      },      
+ ......
+ 
+  // 置顶留言 API
+  settop: function (event) {
+    var that = this;
+    var j_index = event.currentTarget.dataset.index;
+    console.log("置顶索引:" + event.currentTarget.dataset.index)
+    wx: wx.showToast({
+      title: '正在设置中',
+      icon: 'loading'
+    })
+    wx.request({
+      url: '自己服务器API', //留言置顶
+      data: {
+        id: that.data.messages[j_index].p_id,//留言用户id
+        type: '1' //置顶留言标识 
+      },
+   ......
+```
+
+
+
+## 服务器端
+
+> 因为我的专业方向是前端,所以后台接触的不是很深,也没有用到框架去开发,所以无论是在设计数据库上还是在代码逻辑上多多少少很多欠缺,所以说有能力的小伙伴可以后台很久我提供的逻辑,重新把表和后台代码逻辑梳理一遍。
+
+
+
+### 一、数据库表
+
+> 共有五张数据库表,分别如此下:
+
+- **articel**
+- **gonginfo**
+- **messages**
+- **zan**
+
+
+
+#### 1、gonginfo (公众号信息表)
+
+> 该表存储的是公众号关联的相关信息表,字段包括 id(主键ID)、name(公众号名)、headpath(公众号头像路径)、describes(公众号描述)、password(后台密码)、openid(公众号主的openID唯一标识)、fromid(模板ID)、token(token 验证字段)。表的设计结构如下:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/gonginfoTable.png)
+
+
+
+#### 2、articel (文章信息表)
+
+> 该表主要存储的是每篇文章的相关信息,字段包括 no(主键,文章编号)、title(文章标题)、describ(文章描述)、imageTitle(文章配图)、date(文章日期)、g_id(公众号id)——这里没有关联两个表,重新创建的与另一个表的 ID。表的设计结构如下:
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/articelTable.png)
+
+
+
+#### 3、messages (留言信息表)
+
+> **特别注意:**该表主要存储留言相关信息。由于起初没有学习过后台,所以在建表的时候,没有将表分离关联,所以用户信息和留言信息直接写到一个表中了。后期也没有改,所以回后台的小伙伴可以自己更改过来。
+
+字段包括 p_id(主键)、title(文章标题)、username(用户名)、headimage(用户头像路径)、userMesContent(用户留言内容)、authorMesContent(作者回复内容)、no(文章编号)、isCheck(是否精选)、goodnum(可去掉)、ispraise(可去掉)、isTop(置顶标识)、g_id(公众号id)、zanCount(点赞数量)、fromid(模板id)、token(token验证值)。
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/messgaesTable.png)
+
+
+
+### 二、接口 API
+
+#### 1、后台接口目录
+
+> `com.xiaolu` 下的包命名介绍:
+>
+> - bean:实体类
+> - dao: dao 层
+> - servlet:接口类,所有对外小程序的接口。
+> - ThreadGetdata: 线程类,获取 token
+> - util:工具类,链接数据库之类的。
+
+![](https://github.com/luxiangqiang/WeiXin_MessageApplet/blob/master/printScreen/houtaimulu.png)
+
+
+
+> **注意:** 在 servlet 中每个接口的功能在这里不做介绍了,都在每个代码的开头标记清除了,可自行查看。
+
+
+
+#### 2、连接数据库
+
+> 在后台代码中的 `util` 包中的 `Util.java` 类中配置连接数据库的相关信息。
+
+```java
+public class Util {
+	//jdbc:mysql://这里写上你服务器的 IP 地址和端口号/数据库名?useUnicode=true&characterEncoding=UTF-8
+	private static final String URL = "...";
+	private static final String DRIVER = "com.mysql.jdbc.Driver";
+	private static final String USER = "...";// 数据库用户名
+	private static final String PASS = "...";// 数据库密码
+	private static Connection conn = null;
+
+	public static Connection getConnection() {
+		try {
+			if (conn == null || conn.isClosed()) {
+				Class.forName(DRIVER);
+				conn = DriverManager.getConnection(URL, USER, PASS);
+			}
+		} catch (SQLException e) {
+			e.printStackTrace();
+		} catch (ClassNotFoundException e) {
+			e.printStackTrace();
+		}
+		return conn;
+	}
+}
+```
+
+
+
+#### 2、配置小程序的 APPID
+
+> 在 `servlet` 包中的 `AppIDCodeServlet.java` 类中配置小程序的 `APPID` 和 `AppScret`(小程序官网后台获取)。
+
+```java
+@WebServlet("/AppIDCodeServlet")
+public class AppIDCodeServlet extends HttpServlet {
+	private static final long serialVersionUID = 1L;
+	public static final String appID = ""; // 填写你小程序的 APPid
+	public static final String appScret = "";// 你小程序的 AppScret(微信小程序官网获取)
+	public static String  openid = ""; // 空
+	public static String  token = ""; // 空
+       
+    public AppIDCodeServlet() {
+        super();
+    }
+    ......
+```
+
+
+
+
+
+ 
+
+
+

+ 14 - 0
messageApplet/app.js

@@ -0,0 +1,14 @@
+//app.js
+
+App({
+  onLaunch: function () {
+    // 展示本地存储能力
+    
+
+  },
+
+  globalData: {
+    userInfo: null,
+    apiUrl:"https://applet.yull.top"
+  }
+})

+ 42 - 0
messageApplet/app.json

@@ -0,0 +1,42 @@
+{
+  "pages": [
+    "pages/index/index",
+    "pages/mycenter/mycenter",
+    "pages/select/select",
+    "pages/lookmessage/lookmessage",
+    "pages/myartical/myartical",
+    "pages/message/message",
+    "pages/write/write",
+    "pages/artical/artical",
+    "pages/inform/inform",
+    "pages/userinfo/userinfo",
+    "pages/addgong/addgong",
+    "pages/check/check"
+  ],
+  "window": {
+    "backgroundTextStyle": "light",
+    "navigationBarBackgroundColor": "#2c2d31",
+    "navigationBarTitleText": "留言板",
+    "navigationBarTextStyle": "black"
+  },
+  "tabBar": {
+    "color": "#a9b7b7",
+    "selectedColor": "#11cd6e",
+    "borderStyle": "white",
+    "list": [
+      {
+        "selectedIconPath": "images/index1.png",
+        "iconPath": "images/index.png",
+        "pagePath": "pages/index/index",
+        "text": "首页"
+      },
+      {
+        "selectedIconPath": "images/user1.png",
+        "iconPath": "images/user.png",
+        "pagePath": "pages/userinfo/userinfo",
+        "text": "我的"
+      }
+    ]
+  },
+  "sitemapLocation": "sitemap.json"
+}

+ 14 - 0
messageApplet/app.wxss

@@ -0,0 +1,14 @@
+/**app.wxss**/
+@import 'weui.wxss';
+
+.container {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
+  padding: 200rpx 0;
+  box-sizing: border-box;
+} 
+
+

BIN
messageApplet/images/2.jpg


BIN
messageApplet/images/index.png


BIN
messageApplet/images/index1.png


BIN
messageApplet/images/user.png


BIN
messageApplet/images/user1.png


BIN
messageApplet/images/zan1.png


BIN
messageApplet/images/zan2.png


BIN
messageApplet/images/主页.png


+ 216 - 0
messageApplet/pages/addgong/addgong.js

@@ -0,0 +1,216 @@
+// pages/addgong/addgong.js
+var app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    image:"",
+    gongname:"",
+    subscribe:"",
+    imagePath:"",
+    password:""
+  },
+
+  chooseImage: function(){
+    var that = this;
+    wx.chooseImage({
+      count: 1, // 默认9
+      sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
+      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
+      success: function (res) {
+        console.log(res);
+        var tempFilePaths = res.tempFilePaths
+
+        that.setData({
+          image: tempFilePaths[0]
+        })
+
+      }
+    })
+  },
+
+
+  //上传照片
+  post_image: function () {
+    var that = this;
+    console.log("照片路径" + that.data.image)
+    //上传服务器
+    wx: wx.showToast({
+      title: '上传中',
+      icon: 'loading'
+    })
+    wx.uploadFile({
+      url: app.globalData.apiUrl + '/index/index/uploadImg',
+      filePath: that.data.image,
+      name: 'file',
+      header: {
+        'content-type': 'multipart/form-data'
+      },
+      method: 'post', //上传方式s
+      success: function (res) {
+        console.log(res.data)
+        if (res.statusCode == 200) {
+        
+            
+          wx.showToast({
+            title: '上传成功',
+            icon: 'success',
+          })
+        } else {
+          console.log(res.data)
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'fail',
+          })
+        }
+      },
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '服务器错误',
+          icon: 'fail',
+        })
+      }
+    })
+  },
+
+//获取密码
+  bindpassword: function(e){
+    this.setData({
+
+      password:e.detail.value
+    })
+  },
+//获取公众号名字
+  bindgongname: function(e){
+
+    this.setData({
+      gongname: e.detail.value
+    });
+
+  },
+
+//获取公众号描述
+  bindsubscribe: function(e){
+
+    this.setData({
+      subscribe:e.detail.value
+    })
+  },
+
+  submit:function(){
+    var that = this;
+
+    if (that.data.image == "" || that.data.gongname =="" || that.data.subscribe == "" || that.data.password == ""){
+      wx.showToast({
+        title: '公众号、简介、密码、公众号头像不能为空',
+        icon: 'none'
+      })
+    }else{
+
+      wx.request({
+        url: app.globalData.apiUrl + '/index/index/addgong', //url
+        data: {
+          name: that.data.gongname,   //公众号名字
+          describe: that.data.subscribe, //描述
+          password:that.data.password,
+          openid:wx.getStorageSync("openid")
+        },
+        header: {
+          'content-type': 'application/json' // 数据格式(默认值)
+        },
+        method: 'post', //上传方式
+        success: function (res) {   //回调成功
+          console.log(res.data)
+          if (res.statusCode == 200) {
+            if (res.data.result == '1') {
+              that.setData({
+                gongname: '',
+                subscribe: "",
+                password:""
+              })
+              that.post_image();
+            } else {
+              wx.showToast({
+                title: '上传失败',
+                icon: 'fail',
+              })
+            }
+          } else {
+            wx.showToast({
+              title: '服务器错误',
+              icon: 'none',
+            })
+          }
+        },
+        //回调失败
+        fail: function (res) {
+          console.log(res)
+          wx.showToast({
+            title: '请检查网络',
+            icon: 'fail',
+          })
+        },
+      })
+
+    }
+    
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 7 - 0
messageApplet/pages/addgong/addgong.json

@@ -0,0 +1,7 @@
+{
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "填写资料",
+  "navigationBarTextStyle": "black",
+  "enablePullDownRefresh": true
+}

+ 102 - 0
messageApplet/pages/addgong/addgong.wxml

@@ -0,0 +1,102 @@
+<view class="page" xmlns:wx="http://www.w3.org/1999/xhtml">
+
+  <view class="page__hd">
+
+    <view class="page__title">填写资料</view>
+
+  </view>
+
+  <view class="page__bd">
+
+    <view class="weui-toptips weui-toptips_warn" wx:if="{{showTopTips}}">错误提示</view>
+    
+    <view class="weui-cells weui-cells_after-title">
+
+      <view class="weui-cell weui-cell_input">
+
+        <view class="weui-cell__hd">
+          <view class="weui-label">公众号</view>
+        </view>
+
+        <view class="weui-cell__bd">
+          <input class="weui-input" value="{{gongname}}" bindchange="bindgongname" placeholder="填写公众号名称"  />
+        </view>
+
+      </view>
+       <view class="weui-cell weui-cell_input">
+
+        <view class="weui-cell__hd">
+
+          <view class="weui-label jianjie">简介</view>
+
+        </view>
+
+        <view class="weui-cell__bd">
+
+          
+          <input class="weui-input" value="{{subscribe}}" bindchange="bindsubscribe" placeholder="填写公众号简介" />
+          
+          
+        </view>
+
+        
+      
+
+      </view>
+
+
+
+
+      <view class="weui-cell weui-cell_input">
+
+        <view class="weui-cell__hd">
+
+          <view class="weui-label jianjie">密码</view>
+
+        </view>
+
+        <view class="weui-cell__bd">
+
+          
+          <input class="weui-input" type="password" value="{{password}}" bindchange="bindpassword" placeholder="填写后台登录密码" />
+          
+          
+        </view>
+
+        
+      
+
+      </view>
+    
+               </view>
+      
+
+      
+                   <view class="weui-uploader">
+                       <view class="weui-uploader__hd">
+                           <view class="weui-uploader__title">图片上传</view>
+                           
+                       </view>
+                       <view class="weui-uploader__bd">
+                           <view class="weui-uploader__files" id="uploaderFiles">
+           
+                           </view>
+                           <view class="weui-uploader__input-box">
+                           <view class="weui-uploader__file" bindtap="previewImage" id="{{item}}">
+                                       <image class="weui-uploader__img" src="{{image}}" mode="aspectFill" />
+                                   </view>
+                               <view class="weui-uploader__input" bindtap="chooseImage">
+                               
+                               </view>
+                           </view>
+                       </view>
+                   </view>
+    <view class="weui-btn-area">
+
+      <button class="weui-btn" type="primary" bindtap="submit">确定</button>
+
+    </view>
+
+  </view>
+  注:后台管理在当前微信号登录
+</view>

+ 22 - 0
messageApplet/pages/addgong/addgong.wxss

@@ -0,0 +1,22 @@
+/* pages/addgong/addgong.wxss */
+.weui-label{
+  font-size: 15px;
+  width: 70px;
+}
+.jianjie{
+  width: 50px;
+}
+.weui-input{
+  font-size: 15px;
+}
+
+.weui-uploader__title{
+  padding-left: 15px;
+}
+
+.weui-uploader__bd{
+  padding-left: 15px;
+}
+
+
+

+ 248 - 0
messageApplet/pages/artical/artical.js

@@ -0,0 +1,248 @@
+// pages/artical/artical.js
+var app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    posts_key: [],
+    num: '',
+    id: ''
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (option) {
+    var that = this;
+    var g_id = option.g_id;
+    that.setData({
+      id: g_id
+    })
+    
+    // 获取文章列表
+    wx.request({
+      url: app.globalData.apiUrl+'/index/article/listdata', //获取文章列表
+      data: {
+        type: '1',//获取列表标识
+        id: g_id //公众号id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            var posts_content = res.data;
+            
+            console.log('onLoad文章信息为:' + res.data.content)
+            for (let i in posts_content.content){
+              posts_content.content[i].month = posts_content.content[i].date.substring(5,7);
+              posts_content.content[i].day = posts_content.content[i].date.substring(8, 10);
+              console.log(posts_content.content[i].month);
+              console.log(posts_content.content[i].day);
+            }
+            that.setData({
+              posts_key: posts_content.content
+            })
+          } else {
+            wx.showToast({
+              title: '作者还没有发表文章哦',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  //跳转留言页面
+  to_message: function (event) {
+    var that = this;
+    console.log(event.currentTarget.dataset.index)
+    var index = event.currentTarget.dataset.index
+    console.log(that.data.posts_key[index])
+    var title = that.data.posts_key[index].title
+    var no = that.data.posts_key[index].no
+    console.log('标题:'+ index + title+" "+ no)
+    console.log('g_id为:' + that.data.id);
+    wx:wx.navigateTo({
+      url: '../../pages/message/message?title=' + title + '&no=' + no + '&g_id=' + that.data.id,
+      success: function(res) {},
+      fail: function(res) {},
+      complete: function(res) {},
+    })
+  },
+
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    wx.showNavigationBarLoading(); //在标题栏中显示加载图标 
+    var that = this;
+    wx.request({
+      url: app.globalData.apiUrl+'/index/article/listdata', //获取文章列表
+      data: {
+        type: '1',//获取列表标识
+        id: that.data.id //公众号id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            console.log(res.data)
+            var posts_content = res.data;
+            for (let i in posts_content.content) {
+              posts_content.content[i].month = posts_content.content[i].date.substring(5, 7);
+              posts_content.content[i].day = posts_content.content[i].date.substring(8, 10);
+             
+            }
+            console.log("文章信息为:" + posts_content.content)
+            that.setData({
+              posts_key: posts_content.content,
+              num: posts_content.content.length
+            })
+          } else {
+            wx.showToast({
+              title: '作者还没有发表文章哦',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showModal({
+            title: '服务器错误',
+            content: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+      complete: function () {
+        wx.hideNavigationBarLoading();          //完成停止加载 
+        // 动态设置导航条标题 
+        wx.stopPullDownRefresh();            //停止下拉刷新 
+      }
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+    wx.showNavigationBarLoading(); //在标题栏中显示加载图标 
+    var that = this;
+    wx.request({
+      url: app.globalData.apiUrl +'/index/article/listdata', //获取文章列表
+      data: {
+        type: '1',//获取列表标识
+        id: that.data.id //公众号id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            var posts_content = res.data;
+            console.log(posts_content)
+            for (let i in posts_content.content) {
+              posts_content.content[i].month = posts_content.content[i].date.substring(5, 7);
+              posts_content.content[i].day = posts_content.content[i].date.substring(8, 10);
+              console.log(posts_content.content[i].month);
+              console.log(posts_content.content[i].day);
+            }
+            that.setData({
+              posts_key: posts_content.content
+            })
+          } else {
+            wx.showToast({
+              title: '作者还没有发表文章哦',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showModal({
+            title: '服务器错误',
+            content: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+      complete: function () {
+        wx.hideNavigationBarLoading();          //完成停止加载 
+        // 动态设置导航条标题 
+        wx.stopPullDownRefresh();            //停止下拉刷新 
+      } 
+    })
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 7 - 0
messageApplet/pages/artical/artical.json

@@ -0,0 +1,7 @@
+{
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "文章列表",
+  "navigationBarTextStyle": "black",
+  "enablePullDownRefresh": true
+}

+ 22 - 0
messageApplet/pages/artical/artical.wxml

@@ -0,0 +1,22 @@
+<!--pages/artical/artical.wxml-->
+
+<!-- 文章列表 -->
+<block wx:for="{{posts_key}}" wx:for-item="item" >
+  <view data-index="{{index}}"  bindtap='to_message'>
+    <!-- 文章发表时间 -->
+    <view class='wite-space'></view>
+    <view class='artical-time'>{{item.month}}月{{item.day}}日</view>
+    <!-- 文章图片、标题、描述 -->
+    <view class='artical-container'>
+      <!-- 文章图片 -->
+      <view class='artical-img-container'>
+        <image class='artical-img' src="{{item.imageTitle}}"></image>
+      </view>
+      <!-- 文章标题 -->
+      <view class='artical-title'>{{item.title}}</view>
+      <!-- 文章描述 -->
+      <view class='artical-describe'>{{item.describ}}</view>
+    </view>
+  </view>
+</block>
+

+ 63 - 0
messageApplet/pages/artical/artical.wxss

@@ -0,0 +1,63 @@
+/* pages/artical/artical.wxss */
+
+page{
+  width: 100%;
+  height: 100%;
+  background-color: #F5F5F5;
+}
+
+.wite-space{
+  width: 100%;
+  height: 40rpx;
+  background-color: rgba(238, 238, 238, 0.281);
+}
+
+/* 文章发表时间 */
+.artical-time{
+  display: flex;
+  flex-direction: column;
+  width: 100%;
+  font-size: 28rpx;
+  padding-bottom: 15rpx;
+  align-items: center;
+  color: rgb(201, 200, 200);
+  background-color: #F5F5F5;
+}
+
+/* 文章容器container */
+.artical-container{
+  width: 100%;
+  background-color: #fff;
+}
+
+/* 文章插图容器 */
+.artical-img-container{
+   width: 100%;
+}
+
+/* 图片内容 */
+.artical-img{
+  width: 100%;  
+  height: 450rpx;
+}
+
+/* 文章标题 */
+.artical-title{
+  width: 90%;
+  font-size: 36rpx;
+  font-family: '微软雅黑';
+  color: black;
+  padding-left: 20rpx;
+  padding-top: 10rpx;
+}
+
+/* 文章描述 */
+.artical-describe{
+  width: 90%;
+  font-size: 30rpx;
+  font-family: '微软雅黑';
+  color: rgb(199, 198, 198);
+  padding-top: 20rpx;
+  padding-left: 20rpx;
+  padding-bottom: 20rpx;
+}

+ 198 - 0
messageApplet/pages/check/check.js

@@ -0,0 +1,198 @@
+// pages/check/check.js
+var app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    gongMessage:[],
+    check:[]
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.getGongInfo();
+  },
+
+  bindcheck: function (event) {
+    var that = this;
+    var index = event.currentTarget.dataset.index;
+    //console.log(event.detail.value);
+    //this.data.check[index] = event.detail.value;
+    console.log(this.data.gongMessage[index].id);
+    var check = 0;
+    if (event.detail.value){
+      check = 1;
+    }
+   
+    wx.request({
+      url: app.globalData.apiUrl + '/index/index/check', //url
+      data: {
+        id: that.data.gongMessage[index].id,//用户的 id
+        check: check, 
+       
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            that.getGongInfo();
+          } else {
+            that.getGongInfo();
+            //点赞失败(回复原来未点赞状态)
+            // that.data.status[u_index] = !that.data.status[u_index]
+            // that.data.goodarray[u_index] = that.data.goodarray[u_index] - 1
+            // that.setData({
+            //   status: that.data.status,
+            //   goodarray: that.data.goodarray
+            // })
+            wx.showToast({
+              title: '点赞失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          that.getChooseCotent();
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        
+        that.data.check[index] = !that.data.check[index]
+        
+        wx.showToast({
+          title: '请检查网络连接',
+          icon: 'fail',
+        })
+      },
+    })
+
+  },
+  //获取公众号信息
+  getGongInfo: function () {
+    var that = this;
+    wx.request({
+      url: 'https://applet.yull.top/index/index/getGongMessage', //获取公众号信息
+      data: {
+        type:2
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data.result)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            var posts_content = res.data.content;
+            console.log(posts_content);
+           
+          
+            var ischeck = new Array(res.data.content.length);
+            for (var i = 0; i < res.data.content.length; i++) {
+             
+              if (posts_content[i].check == "1") {
+                //判断是否置顶
+
+                ischeck[i] = true
+              } else {
+                ischeck[i] = false
+              }
+             
+            }
+
+            that.setData({
+              gongMessage: res.data.content,
+              check: ischeck
+            })
+          } else {
+            wx.showToast({
+              title: '获取失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showModal({
+            title: '服务器错误',
+            content: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res.errMsg)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    this.getGongInfo();
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+    var that = this;
+    // 获取文章列表
+    that.getGongInfo();
+
+    //完成停止加载
+    wx.hideNavigationBarLoading();
+
+    //停止下拉刷新 
+    wx.stopPullDownRefresh();
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 7 - 0
messageApplet/pages/check/check.json

@@ -0,0 +1,7 @@
+{
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "文章管理",
+  "navigationBarTextStyle": "black",
+  "enablePullDownRefresh": true
+}

+ 19 - 0
messageApplet/pages/check/check.wxml

@@ -0,0 +1,19 @@
+<!--pages/check/check.wxml-->
+
+    <block wx:for="{{gongMessage}}" wx:for-item="item">
+      <view class='center-space-gong'></view>
+      <!-- 公众号信息 -->
+      <view class='gong-content' bindtap='to_articel_list' data-index="{{index}}" bindlongtap='copy' bindtouchend="touchend">
+        <view>
+          <image class='gong-img' src="{{item.headpath}}"></image>
+        </view>
+        <view class='gong-message'>
+          <view class='gong-name'>{{item.name}}</view>
+          <view class='gong-describe'>{{item.describes}}</view>
+          <text selectable='true'></text>
+          <view class="weui-cell__ft">
+                    <switch type="switch" data-index="{{index}}" checked="{{check[index]}}" bindchange="bindcheck"></switch>
+                </view>
+        </view>
+      </view>
+    </block>

+ 181 - 0
messageApplet/pages/check/check.wxss

@@ -0,0 +1,181 @@
+/* pages/check/check.wxss */
+/**index.wxss**/
+@import "/wxSearch/wxSearch.wxss";
+
+page{
+  width: 100%;
+  height: 100%;
+  background-color: #F5F5F5;
+}
+
+/* .userinfo {
+  display: flex;
+  flex-direction: row;
+  height: 180rpx;
+  line-height: 180rpx;
+  background-color: #fff;
+   align-items: center; 
+} */
+
+/* 提醒复制文字 */
+.remind-copy{
+  height: 20rpx;
+  text-align: center;
+  line-height: 30rpx;
+  padding-top: 10rpx;
+  padding-bottom: 10rpx;
+  font-size:30rpx;
+  color: #cccccc;
+}
+
+/* 复制 ID */
+.copy-nickName{
+  width: 100%;
+  font-size: 32rpx;
+  color: #ccc;
+  margin-left: 350rpx;
+}
+
+/* 悬浮图标样式 */
+.post {
+  float: right;
+  position: fixed;
+  bottom: 40px;
+  right: 40px;  
+  border: 0 solid #ffffff;
+  border-radius: 500px;
+  box-shadow: 4px 1px 1px #cccccc;
+}
+
+/* .userinfo-avatar {
+  width: 128rpx;
+  height: 128rpx;
+  margin: 30rpx;
+  border-radius: 50%;
+}
+
+.userinfo-nickname {
+  color: #aaa;
+} */
+
+.center-space{
+  height: 20rpx;
+  background: #F5F5F5;
+}
+
+.center-space-gong{
+  height: 10rpx;
+  background: #F5F5F5;
+}
+
+/* 公众号所有信息 */
+.gong-content{
+  height: 160rpx;
+  display: flex;
+  flex-direction: row;
+  padding-left: 10rpx;
+  padding-top: 10rpx;
+  vertical-align: middle;
+  background-color: #fff;
+}
+
+/* 公众号头像 */
+.gong-img{
+  width: 120rpx;
+  height: 120rpx;
+  border-radius: 50%;
+  margin-top: 14rpx;
+}
+
+/* 公众号文本信息 */
+.gong-message{
+  padding-left: 40rpx;
+  padding-top: 24rpx;
+}
+
+/* 公众号名称 */
+.gong-name{
+  font-size: 34rpx;
+  font-family: '微软雅黑';
+}
+
+/* 公众号描述 */
+.gong-describe{
+  font-size: 28rpx;
+  margin-top: 10rpx;
+  width: 500rpx;
+  /* 超出文本隐藏 */
+  overflow:hidden;
+  /* 并显示省略号 */
+  text-overflow: ellipsis;
+  /* 不换行 */
+  white-space:nowrap;
+  color: rgb(179, 177, 177);
+  font-family: '微软雅黑';
+}
+
+/* 背景 */
+.background-color{
+  width: 100%;
+  height: 800rpx;
+  line-height: 800rpx;
+  display: flex;
+  position: fixed;  
+  align-items: center;
+  justify-content: center;  
+  background-color: #F5F5F5;
+}
+
+/* admin */
+.admin{
+  height: 50rpx;
+  font-size: 32rpx;
+  color: rgb(5, 1, 252);
+}
+
+.reply-input{
+  width: 500rpx;
+  height: 60rpx;
+  font-size: 32rpx;
+  color: #000;
+  margin-top: 20rpx;
+  border: #ccc solid 2rpx;
+}
+
+
+.header {
+    margin: 90rpx 0 90rpx 50rpx;
+    border-bottom: 1px solid #ccc;
+    text-align: center;
+    width: 650rpx;
+    height: 300rpx;
+    line-height: 450rpx;
+}
+ 
+.header image {
+    width: 200rpx;
+    height: 200rpx;
+}
+ 
+.content {
+    margin-left: 50rpx;
+    margin-bottom: 90rpx;
+}
+ 
+.content text {
+    display: block;
+    color: #9d9d9d;
+    margin-top: 40rpx;
+}
+ 
+.bottom {
+    border-radius: 80rpx;
+    margin: 70rpx 50rpx;
+    font-size: 35rpx;
+    color: #fff;
+    background-color: rgb(52, 214, 3);
+}
+.weui-cell__ft{
+  margin-top: -30px;
+
+}

+ 386 - 0
messageApplet/pages/index/index.js

@@ -0,0 +1,386 @@
+//index.js
+//获取应用实例
+const app = getApp()
+
+Page({
+  data: {
+    buttonDisabled: false, 
+    modalHidden: true,
+    userInfo: {},
+    hasUserInfo: false,
+    canIUse: wx.canIUse('button.open-type.getUserInfo'),
+    gongMessage: [], //存储公众号所有信息
+    inputContent: '',
+    inputContentxml: '',
+    id:'',
+    lock: false,
+  },
+
+
+  //事件处理函数 登录日志
+  bindViewTap: function() {
+    wx.navigateTo({
+      
+    })
+  },
+
+  //跳转文章页面
+  to_articel_list: function (event) {
+    //检查锁
+    if (this.data.lock) {
+      return;
+    }
+    var that = this;
+    var index = event.currentTarget.dataset.index;
+    var g_id = that.data.gongMessage[index].id
+    console.log("公众号id为:" + g_id)
+    wx.navigateTo({
+      url: '../../pages/artical/artical?g_id=' + g_id
+    })
+  },
+
+  touchend: function () {
+    var that = this;
+    if (that.data.lock) {
+      //开锁
+      console.log("离开")
+      that.setData({ 
+        lock: false 
+      });
+    }
+  },
+
+  // 长按复制公众号名称
+  copy: function (event) {
+    //锁住
+    this.setData({ lock: true });
+    var that = this;
+    var index = event.currentTarget.dataset.index;
+    console.log(event);
+    wx.setClipboardData({
+      data: that.data.gongMessage[index].name,
+      success: function (res) {
+        wx.showToast({
+          title: '复制成功',
+        });
+      }
+    });
+  },
+
+  onLoad: function () {
+    var that = this;
+    /*// 如果获取到用户信息就存储
+    if (app.globalData.userInfo) {
+      this.setData({
+        userInfo: app.globalData.userInfo,
+        hasUserInfo: true
+      })
+      wx.setStorageSync('username', that.data.userInfo.nickName)
+      wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+      console.log("在index页面全局app1中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+    } else if (this.data.canIUse){
+      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
+      // 所以此处加入 callback 以防止这种情况
+      app.userInfoReadyCallback = res => {
+        // console.log("用户名2:" + res.userInfo.nickName + " " + res.userInfo.avatarUrl)
+        // wx.setStorageSync('username', res.userInfo.nickName)
+        // wx.setStorageSync('headpath', res.userInfo.avatarUrl)
+        this.setData({
+          userInfo: res.userInfo,
+          hasUserInfo: true
+        })
+        wx.setStorageSync('username', that.data.userInfo.nickName)
+        wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+        console.log("在index页面全局app2中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+      }
+    } else {
+      // 没有获取到用户信息就发起授权窗口
+
+      wx.getSetting({
+        success: function (res) {
+          if (res.authSetting['scope.userInfo']) {
+            wx.getUserInfo({
+              success: function (res) {
+                // 用户已经授权过,不需要显示授权页面,所以不需要改变 isHide 的值
+                // 根据自己的需求有其他操作再补充
+                // 我这里实现的是在用户授权成功后,调用微信的 wx.login 接口,从而获取code
+                app.globalData.userInfo = res.userInfo
+                wx.request({
+                  url: 'https://applet.yull.top/index/index/login',//获取唯一标识 openId
+                  data: {
+                    code: res.code
+                  },
+                  header: {
+                    'content-type': 'application/json' // 数据格式(默认值)
+                  },
+                  method: 'post', //上传方式
+                  success: function (res) {
+                    console.log("openid" + res.data.openid);
+                    // wx.setStorageSync('token', res.data.token)//消息模板会用到
+                    wx.setStorageSync('openid', res.data.openid);//存储openid
+                  }
+                });
+              }
+            });
+          } else {
+            // 用户没有授权
+            // 改变 isHide 的值,显示授权页面
+            that.setData({
+              hasUserInfo: true
+            });
+          }
+        }
+      });
+      wx.getUserInfo({
+        success: res => {
+          // console.log("用户名3:" + res.userInfo.nickName + " " + res.userInfo.avatarUrl)
+          app.globalData.userInfo = res.userInfo
+          this.setData({
+            userInfo: res.userInfo,
+            hasUserInfo: true
+          })
+          wx.setStorageSync('username', that.data.userInfo.nickName)
+          wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+          console.log("在index页面全局app3中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+        },
+      })
+    }*/
+  
+
+   //获取公众号信息
+    that.getGongInfo();
+  },
+
+  //点击按钮授权
+  getUserInfo: function (e) {
+    var that = this;
+    if (e.detail.userInfo) {
+      console.log(e)
+      app.globalData.userInfo = e.detail.userInfo
+      this.setData({
+        userInfo: e.detail.userInfo,
+        hasUserInfo: true
+      })
+      wx.setStorageSync('username', that.data.userInfo.nickName)
+      wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+      console.log("在index页面临时授权中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+    } else {
+      wx.showModal({
+        title: '警告',
+        content: '您点击了拒绝授权,将无法进入小程序,请授权之后再进入!!!',
+        showCancel: false,
+        confirmText: '返回授权',
+        success: function (res) {
+          // 用户没有授权成功,不需要改变 isHide 的值
+          if (res.confirm) {
+            console.log('用户点击了“返回授权”');
+          }
+        }
+      });
+    }
+  },
+
+  //获取公众号信息
+  getGongInfo: function () {
+    var that = this;
+    wx.request({
+      url: 'https://applet.yull.top/index/index/getGongMessage', //获取公众号信息
+      data: {
+        type:1
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data.result)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            var posts_content = res.data;
+            console.log(posts_content)
+            that.setData({
+              gongMessage: res.data.content,
+            })
+          } else {
+            wx.showToast({
+              title: '获取失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showModal({
+            title: '服务器错误',
+            content: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res.errMsg)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  //弹出回复框
+  showModal: function (event) {
+    this.setData({
+      modalHidden: !this.data.modalHidden,
+    })
+  },
+
+  // 获取弹出框密码
+  getInputContent: function (e) {
+    console.log(e.detail.value)
+    this.setData({
+      inputContent: e.detail.value
+    })
+  },
+
+  //确定
+  modalBindaconfirm: function () {
+    var that = this;
+    console.log(that.data.inputContent)
+    if (that.data.inputContent == "") {
+      wx.showToast({
+        title: '秘钥不能为空!',
+        icon: 'none',
+      })
+    } else {
+      //通过秘钥换取公众号 id
+      that.getIdentifyId();
+    }
+  },
+  
+  //取消
+  modalBindcancel: function () {
+    this.setData({
+      modalHidden: !this.data.modalHidden,
+    })
+  },
+
+  //通过后台秘钥获取公众号 id
+  getIdentifyId: function () {
+    var that = this;
+    wx.request({
+      url: app.globalData.apiUrl +'/index/index/identify', //获取公众号信息
+      data: {
+        password: that.data.inputContent //登录后台密码
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+              //弹出框消失
+              that.setData({
+                modalHidden: !that.data.modalHidden,
+                buttonDisabled: !that.data.buttonDisabled,
+                id: res.data.content[0].id,
+              })
+            //上传openid
+              // that.postOpenid();
+             //跳转后台管理界面
+              wx.navigateTo({
+                url: '../../pages/select/select?id=' + that.data.id + "&avatarUrl=" + that.data.userInfo.avatarUrl + "&nickName=" + that.data.userInfo.nickName + "&headpath=" + res.data.content[0].headpath + "&name=" + res.data.content[0].name + "&describe=" + res.data.content[0].describes
+              })
+          } else {
+            wx.showToast({
+              title: '你不是管理员或者密码错误',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showModal({
+            title: '服务器错误',
+            content: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res.errMsg)
+        wx.showToast({
+          title: '联网失败 ',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  // 上传管理员openid
+  postOpenid: function () {
+    var that = this;
+    wx.request({
+      url: '自己服务器API', //获取公众号信息
+      data: {
+        openid: wx.getStorageSync('openid'),
+        id: that.data.id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data.result)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            console.log("openid加入成功!")
+          } else {
+            console.log("openid加入失败!")
+          }
+        } else {
+          wx.showModal({
+            title: '服务器错误',
+            content: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res.errMsg)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  //下拉刷新
+  onPullDownRefresh: function () {
+    var that = this;
+
+    //在标题栏中显示加载图标 
+    wx.showNavigationBarLoading(); 
+
+    //获取公众号信息
+    that.getGongInfo();
+
+    //完成停止加载
+    wx.hideNavigationBarLoading();
+    
+    //停止下拉刷新 
+    wx.stopPullDownRefresh();           
+  },
+
+  //wx.showNavigationBarLoading(); //在标题栏中显示加载图标 
+  // wx.hideNavigationBarLoading();          //完成停止加载 
+  // 动态设置导航条标题 
+  // wx.stopPullDownRefresh();            //停止下拉刷新 
+
+  //后天切换到前台调用 onShow
+  onShow:function () {
+  
+  },
+
+  onShareAppMessage:function(){
+
+  }
+})

+ 7 - 0
messageApplet/pages/index/index.json

@@ -0,0 +1,7 @@
+{
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "公众号",
+  "navigationBarTextStyle": "black",
+  "enablePullDownRefresh": true
+}

+ 53 - 0
messageApplet/pages/index/index.wxml

@@ -0,0 +1,53 @@
+<!--index.wxml-->
+<import src="/wxSearch/wxSearch.wxml"/>
+<template is="wxSearch" data="{{wxSearchData}}"/>
+<import src="../../wxSearch/wxSearch.wxml"  />
+
+
+
+<template is="wxSearch" data="{{wxSearchData}}"  />
+
+<!--<view wx:if="{{!hasUserInfo && canIUse}}">
+  <view class='header'>
+      <image src='../../images/2.jpg'></image>
+  </view>
+  <view class='content'>
+      <view>申请获取以下权限</view>
+      <text>获得你的公开信息(昵称,头像等)</text>
+  </view>--!>
+    <!-- <button class='bottom' type='primary' open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="bindGetUserInfo"> -->
+  <!-- <button class='bottom' wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo">登录授权    </button>
+</view> -->
+ 
+<!-- <block wx:else> -->
+
+
+<view class="remind-copy">长按复制公众号,可以去微信搜索关注</view>
+    
+    <view class='center-space'></view>
+
+    <block wx:for="{{gongMessage}}" wx:for-item="item">
+      <view class='center-space-gong'></view>
+      <!-- 公众号信息 -->
+      <view class='gong-content' bindtap='to_articel_list' data-index="{{index}}" bindlongtap='copy' bindtouchend="touchend">
+        <view>
+          <image class='gong-img' src="{{item.headpath}}"></image>
+        </view>
+        <view class='gong-message'>
+          <view class='gong-name'>{{item.name}}</view>
+          <view class='gong-describe'>{{item.describes}}</view>
+          <text selectable='true'></text>
+        </view>
+      </view>
+    </block>
+    <!-- 悬浮后台图标 -->
+    
+    <!-- <view class='background-color'>
+      <view class='admin' bindtap='showModal'>留言板后台管理中心</view>
+    </view> -->
+  <!-- </block> -->
+<view>
+  <modal title="后台登录" style='color: #000;font-size: 32rpx;' hidden="{{modalHidden}}" confirm-text="确定" cancel-text="取消" bindconfirm="modalBindaconfirm" bindcancel="modalBindcancel">
+  <view class='reply-content' >只有管理员才能进行登录,您的ip地址已记录。</view>
+  <input bindinput='getInputContent' class='reply-input' placeholder='请输入密码' value='{{inputContent}}' placeholder-style='font-size: 32rpx;'></input></modal>
+</view>

+ 176 - 0
messageApplet/pages/index/index.wxss

@@ -0,0 +1,176 @@
+/**index.wxss**/
+@import "/wxSearch/wxSearch.wxss";
+
+page{
+  width: 100%;
+  height: 100%;
+  background-color: #F5F5F5;
+}
+
+/* .userinfo {
+  display: flex;
+  flex-direction: row;
+  height: 180rpx;
+  line-height: 180rpx;
+  background-color: #fff;
+   align-items: center; 
+} */
+
+/* 提醒复制文字 */
+.remind-copy{
+  height: 20rpx;
+  text-align: center;
+  line-height: 30rpx;
+  padding-top: 10rpx;
+  padding-bottom: 10rpx;
+  font-size:30rpx;
+  color: #cccccc;
+}
+
+/* 复制 ID */
+.copy-nickName{
+  width: 100%;
+  font-size: 32rpx;
+  color: #ccc;
+  margin-left: 350rpx;
+}
+
+/* 悬浮图标样式 */
+.post {
+  float: right;
+  position: fixed;
+  bottom: 40px;
+  right: 40px;  
+  border: 0 solid #ffffff;
+  border-radius: 500px;
+  box-shadow: 4px 1px 1px #cccccc;
+}
+
+/* .userinfo-avatar {
+  width: 128rpx;
+  height: 128rpx;
+  margin: 30rpx;
+  border-radius: 50%;
+}
+
+.userinfo-nickname {
+  color: #aaa;
+} */
+
+.center-space{
+  height: 20rpx;
+  background: #F5F5F5;
+}
+
+.center-space-gong{
+  height: 10rpx;
+  background: #F5F5F5;
+}
+
+/* 公众号所有信息 */
+.gong-content{
+  height: 160rpx;
+  display: flex;
+  flex-direction: row;
+  padding-left: 10rpx;
+  padding-top: 10rpx;
+  vertical-align: middle;
+  background-color: #fff;
+}
+
+/* 公众号头像 */
+.gong-img{
+  width: 120rpx;
+  height: 120rpx;
+  border-radius: 50%;
+  margin-top: 14rpx;
+}
+
+/* 公众号文本信息 */
+.gong-message{
+  padding-left: 40rpx;
+  padding-top: 24rpx;
+}
+
+/* 公众号名称 */
+.gong-name{
+  font-size: 34rpx;
+  font-family: '微软雅黑';
+}
+
+/* 公众号描述 */
+.gong-describe{
+  font-size: 28rpx;
+  margin-top: 10rpx;
+  width: 500rpx;
+  /* 超出文本隐藏 */
+  overflow:hidden;
+  /* 并显示省略号 */
+  text-overflow: ellipsis;
+  /* 不换行 */
+  white-space:nowrap;
+  color: rgb(179, 177, 177);
+  font-family: '微软雅黑';
+}
+
+/* 背景 */
+.background-color{
+  width: 100%;
+  height: 800rpx;
+  line-height: 800rpx;
+  display: flex;
+  position: fixed;  
+  align-items: center;
+  justify-content: center;  
+  background-color: #F5F5F5;
+}
+
+/* admin */
+.admin{
+  height: 50rpx;
+  font-size: 32rpx;
+  color: rgb(5, 1, 252);
+}
+
+.reply-input{
+  width: 500rpx;
+  height: 60rpx;
+  font-size: 32rpx;
+  color: #000;
+  margin-top: 20rpx;
+  border: #ccc solid 2rpx;
+}
+
+
+.header {
+    margin: 90rpx 0 90rpx 50rpx;
+    border-bottom: 1px solid #ccc;
+    text-align: center;
+    width: 650rpx;
+    height: 300rpx;
+    line-height: 450rpx;
+}
+ 
+.header image {
+    width: 200rpx;
+    height: 200rpx;
+}
+ 
+.content {
+    margin-left: 50rpx;
+    margin-bottom: 90rpx;
+}
+ 
+.content text {
+    display: block;
+    color: #9d9d9d;
+    margin-top: 40rpx;
+}
+ 
+.bottom {
+    border-radius: 80rpx;
+    margin: 70rpx 50rpx;
+    font-size: 35rpx;
+    color: #fff;
+    background-color: rgb(52, 214, 3);
+}

+ 170 - 0
messageApplet/pages/inform/inform.js

@@ -0,0 +1,170 @@
+// pages/inform/inform.js
+var app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    g_id:'',
+    inform:0
+  },
+
+  inform: function (event){
+    var that = this;
+    wx.requestSubscribeMessage({
+      tmplIds: ['wa33Bvm6r-zeIMOM6p4pr0Tmpwwwm6abEj3t2870WWY'],
+      success(res) { 
+        that.setData({
+          inform: that.data.inform + 1,
+        });
+      }
+    })
+   
+   
+    
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    var that = this;
+   
+      that.setData({
+        g_id:options.id
+      });
+   
+    wx.request({
+      url: app.globalData.apiUrl + '/index/message/countInform', //获取文章列表
+      data: {
+        type: '0',//获取列表标识
+        id: that.data.g_id //公众号id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+           
+            that.setData({
+              inform: res.data.content,
+              
+            })
+          } else {
+            wx.showToast({
+              title: '没有设置通知次数',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+    var that = this;
+    console.log("公众号ID" + that.data.g_id);
+   console.log("公众号通知次数"+that.data.inform);
+    wx.request({
+      url: app.globalData.apiUrl + '/index/message/countInform', //获取文章列表
+      data: {
+        type: '1',//获取列表标识
+        id: that.data.g_id, //公众号id
+        inform: that.data.inform
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+
+            
+          } else {
+            wx.showToast({
+              title: '没有设置通知次数',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 8 - 0
messageApplet/pages/inform/inform.json

@@ -0,0 +1,8 @@
+{
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "文章列表",
+  "navigationBarTextStyle": "black",
+  "enablePullDownRefresh": true
+  
+}

+ 6 - 0
messageApplet/pages/inform/inform.wxml

@@ -0,0 +1,6 @@
+
+<view class="page list-title">
+<text class="left">留言通知次数: {{inform}}</text>
+<view class="right"><button class="weui-btn mini-btn" type="primary" size="mini" bindtap="inform">点击 +1</button></view>
+  
+</view>

+ 25 - 0
messageApplet/pages/inform/inform.wxss

@@ -0,0 +1,25 @@
+/* pages/inform/inform.wxss */
+list-title{
+
+  display: flex;
+
+flex-flow:row;
+
+}
+
+.list-title view{
+
+width:50%;
+top: 10rem;
+display:inline-block;
+
+}
+
+
+.right{
+
+text-align:right;
+top: 10rem;
+padding-right:30rpx;
+
+}

+ 777 - 0
messageApplet/pages/lookmessage/lookmessage.js

@@ -0,0 +1,777 @@
+// pages/mycenter/mycenter.js
+const app = getApp();
+Page({
+
+  data: {
+    title: '',
+    no: '',
+    tempFilePath: [],
+    authormessages: new Array(),//作者回复信息
+    authormessage: new Array(),
+    messages: [],
+    // 用户留言设置
+    show: false,
+    tip: '',
+    inputContent: '',//获取的回复信息
+    inputContentxml: '',
+    buttonDisabled: false,
+    modalHidden: true,
+    replyContent: '',
+    authorBool: new Array(),//显示回复数组
+    authorbool: new Array(),
+    index2: '',//回复索引
+    chooseIndex: '',//精选索引
+    isChoose: new Array(),//是否设置为精选
+    isTop: new Array(),//是否设置置顶留言
+  
+    id: '' //公众号id
+  },
+
+  //悬浮按钮(回到主页)
+  onPostClick: function () {
+    wx: wx.navigateTo({
+      url: '../../pages/index/index'
+    })
+  },
+
+/**
+* 长按复制
+*/
+  copy: function (e) {
+    var that = this;
+    console.log(e);
+    wx.setClipboardData({
+      data: 'pages/message/message?title=' + that.data.title + '& no=' + that.data.no,
+      success: function (res) {
+        wx.showToast({
+          title: '复制成功',
+        });
+      }
+    });
+  },
+
+  //弹出回复框
+  showModal: function (event) {
+    // console.log(event.currentTarget.dataset.index)
+    var u_index = event.currentTarget.dataset.index;
+    console.log("回复索引:" + event.currentTarget.dataset.index)
+    this.setData({
+      modalHidden: !this.data.modalHidden,
+      index2: u_index
+    })
+  },
+
+  //获取输入框(作者回复)内容
+  getInputContent: function (e) {
+    console.log(e.detail.value)
+    this.setData({
+      inputContent: e.detail.value
+    })
+  },
+
+  //确定
+  modalBindaconfirm: function () {
+    var that = this;
+    that.getInputContent
+    console.log(that.data.inputContent)
+    if (that.data.inputContent == "") {
+      wx.showToast({
+        title: '回复内容不能为空!',
+        icon: 'none',
+      })
+    } else {
+      this.setData({
+        modalHidden: !this.data.modalHidden,
+        buttonDisabled: !this.data.buttonDisabled,
+        inputContentxml: that.data.inputContent,
+      })
+      console.log(that.data.authormessages)
+      //回复内容上传服务器
+      that.replay()
+    }
+  },
+
+  //作者回复
+  replay: function () {
+    var that = this;
+    var l = app.globalData.apiUrl +'/index/message/messagesModel';//信息用户自己接收
+  
+    var d = {
+      p_id: that.data.messages[that.data.index2].p_id,//用户留言编号
+      page: '/pages/message/message?g_id=' + that.data.messages[that.data.index2].g_id + '&no=' + that.data.messages[that.data.index2].no + '&title=' + that.data.title,//跳转页面
+      title: that.data.messages[that.data.index2].title,//文章标题
+      message: that.data.messages[that.data.index2].userMesContent,//留言内容
+      replyMes: that.data.inputContent,//回复内容
+      g_id: that.data.id //公众号id
+    }
+    wx: wx.showToast({
+      title: '正在回复中',
+      icon: 'loading'
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/authorReply', //作者回复
+      data: {
+        id: that.data.messages[that.data.index2].p_id,//用户编号
+        replyContent: that.data.inputContent,   //回复内容
+        isCheckChoess: '0'  //是否筛选(否)
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          that.data.authorBool[that.data.index2] = true
+          that.data.authormessages[that.data.index2] = that.data.inputContent
+          that.setData({
+            authormessages: that.data.authormessages,
+            authorBool: that.data.authorBool,
+          })
+          if (res.data.result == '1') {
+            //通过消息推送到用户微信
+            wx.request({
+              url: l,
+              data: d,
+              method: 'POST',
+              success: function (res) {
+                that.data.authorBool[that.data.index2] = true
+                that.data.authormessages[that.data.index2] = that.data.inputContent
+                that.setData({
+                  authormessages: that.data.authormessages,
+                  authorBool: that.data.authorBool,
+                })
+                wx.showToast({
+                  title: '已回复',
+                  icon: 'none',
+                })
+              },
+              fail: function (err) {
+                wx.showToast({
+                  title: '网络连接失败',
+                  icon: 'none',
+                })
+              }
+            });
+
+          } else {
+            wx.showToast({
+              title: '回复失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '回复失败',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '服务器错误',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  //服务推送通知
+  orderSign: function (e) {
+    var that = this;
+  
+  },
+  // 取消
+  modalBindcancel: function () {
+    this.setData({
+      modalHidden: !this.data.modalHidden,
+      inputContent: ''
+    })
+  },
+
+  //精选留言
+  choose: function (event) {
+    var that = this;
+    var j_index = event.currentTarget.dataset.index;
+    console.log("精选索引:" + event.currentTarget.dataset.index)
+    wx: wx.showToast({
+      title: '正在设置中',
+      icon: 'loading'
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/chooseDeleteMessage', //设置为精选留言
+      data: {
+        id: that.data.messages[j_index].p_id,//留言用户id
+        type: '1' //精选留言标识 
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值) 
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            wx.showToast({
+              title: '已设为精选留言',
+              icon: 'none',
+            })
+            that.data.isChoose[j_index] = true
+            that.setData({
+              isChoose: that.data.isChoose
+            })
+          } else {
+            wx.showToast({
+              title: '设置精选留言失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '网络连接失败',
+          icon: 'none',
+        })
+      },
+    })
+  },
+
+  //取消精选
+  cancelChoose: function (event) {
+    var that = this;
+    var j_index = event.currentTarget.dataset.index;
+    console.log("精选索引:" + event.currentTarget.dataset.index)
+    wx: wx.showToast({
+      title: '正在设置中',
+      icon: 'loading'
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/chooseDeleteMessage', //设置为精选留言
+      data: {
+        id: that.data.messages[j_index].p_id,//留言用户id
+        type: '2' //精选留言标识 
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值) 
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            wx.showToast({
+              title: '已取消精选留言',
+              icon: 'none',
+            })
+            that.data.isChoose[j_index] = false
+            that.setData({
+              isChoose: that.data.isChoose
+            })
+          } else {
+            wx.showToast({
+              title: '取消精选留言失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '网络连接失败',
+          icon: 'none',
+        })
+      },
+    })
+  },
+
+  // 置顶留言
+  settop: function (event) {
+    var that = this;
+    var j_index = event.currentTarget.dataset.index;
+    console.log("置顶索引:" + event.currentTarget.dataset.index)
+    wx: wx.showToast({
+      title: '正在设置中',
+      icon: 'loading'
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/topMessages', //留言置顶
+      data: {
+        id: that.data.messages[j_index].p_id,//留言用户id
+        type: '1' //置顶留言标识 
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值) 
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          console.log("置顶留言状态"+res.data.result);
+          if (res.data.result == '1') {
+            wx.showToast({
+              title: '已置顶留言',
+              icon: 'none',
+            })
+            that.data.isTop[j_index] = true;//!that.data.isTop[j_index];
+            that.setData({
+              isTop: that.data.isTop
+            })
+          } else {
+            wx.showToast({
+              title: '取消置顶留言失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '网络连接失败',
+          icon: 'none',
+        })
+      },
+    })
+  },
+
+  // 取消置顶
+  canceltop: function (event) {
+    var that = this;
+    var j_index = event.currentTarget.dataset.index;
+    console.log("取消置顶索引:" + event.currentTarget.dataset.index)
+    wx: wx.showToast({
+      title: '正在设置中',
+      icon: 'loading'
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/topMessages', //取消留言置顶
+      data: {
+        id: that.data.messages[j_index].p_id,//留言用户id
+        type: '2' //置顶留言标识 
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值) 
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          console.log("置顶留言状态" + res.data.result);
+          if (res.data.result == '1') {
+            wx.showToast({
+              title: '已取消置顶留言',
+              icon: 'none',
+            })
+            that.data.isTop[j_index] = false;//!that.data.isTop[j_index];
+            that.setData({
+              isTop: that.data.isTop
+            })
+          } else {
+            wx.showToast({
+              title: '取消置顶留言失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '网络连接失败',
+          icon: 'none',
+        })
+      },
+    })
+  },
+
+  //删除留言
+  deleteMessage: function (event) {
+    var that = this;
+    var j_index = event.currentTarget.dataset.index;
+    console.log("精选索引:" + event.currentTarget.dataset.index)
+    wx: wx.showToast({
+      title: '正在删除',
+      icon: 'loading'
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/chooseDeleteMessage', //删除留言
+      data: {
+        id: that.data.messages[j_index].p_id,//留言用户id
+        type: '0' //精选留言标识 
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值) 
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            wx.showToast({
+              title: '已删除该留言',
+              icon: 'none',
+            })
+            //刷新页面
+            var messlist = that.data.messages;
+            messlist.splice(j_index, 1);
+            //隐藏作者回复
+            that.data.authorBool[j_index] = false
+            that.setData({
+              messages: messlist,
+              authorBool: that.data.authorBool
+            })
+          } else {
+            wx.showToast({
+              title: '删除留言失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '网络连接失败',
+          icon: 'none',
+        })
+      },
+    })
+  },
+
+  /**
+   * 生命周期函数 -- 监听页面加载
+   *  功能:获取已留言未回复用户。
+   */
+  onLoad: function (options) {
+    var that = this;
+    var title = options.title;// 文章标题
+    var nos = options.no;   // 文章编号
+    var ids = options.id;// 公众号id
+    that.setData({
+      no: nos,
+      title: title,
+      id: ids
+    })
+    wx: wx.showToast({
+      title: '正在获取数据',
+      icon: 'loading'
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/realyMessagesList', //url
+      data: {
+        ischeckmessage: 0,
+        no: that.data.no,
+        id: that.data.id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            console.log(res.data.count)
+            var isReplyArray = new Array(res.data.count);
+            var isChoosem = new Array(res.data.count);
+            var arraymessage = new Array(res.data.count);
+            var top = new Array(res.data.count);
+            for (var i = 0; i < res.data.count; i++) {
+              if (res.data.content[i].authorMesContent != "") {
+                isReplyArray[i] = true;
+                arraymessage[i] = res.data.content[i].authorMesContent;
+              } else {
+                isReplyArray[i] = false;
+              }
+              if (res.data.content[i].isTop != 1) {
+                top[i] = false
+              } else {
+                top[i] = true
+              }
+              if (res.data.content[i].isCheck != 1) {
+                isChoosem[i] = false;
+              } else {
+                isChoosem[i] = true;
+              }
+            }
+
+           
+            that.setData({
+              authormessages: arraymessage,
+              isChoose: isChoosem,//精选留言文字的切换
+              isTop: top,//置顶留言文字的切换
+              authorBool: isReplyArray,//显示作者留言
+              messages: res.data.content
+            })
+            for (var i = 0; i < res.data.count; i++) {
+              console.log("authorBool:" + that.data.authorBool[i])
+            }
+          } else {
+            wx.showToast({
+              title: '无用户留言',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'fail',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '连接失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    wx.showNavigationBarLoading(); //在标题栏中显示加载图标 
+    var that = this;
+    wx: wx.showToast({
+      title: '正在获取数据',
+      icon: 'loading'
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/realyMessagesList', //url
+      data: {
+        ischeckmessage: 0,
+        no: that.data.no,
+        id: that.data.id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            console.log(res.data.count)
+            var isReplyArray = new Array(res.data.count);
+            var isChoosem = new Array(res.data.count);
+            var arraymessage = new Array(res.data.count);
+            var top = new Array(res.data.count);
+            for (var i = 0; i < res.data.count; i++) {
+              if (res.data.content[i].authorMesContent != "") {
+                isReplyArray[i] = true;
+                arraymessage[i] = res.data.content[i].authorMesContent;
+              } else {
+                isReplyArray[i] = false;
+              }
+              if (res.data.content[i].isTop != 1) {
+                top[i] = false
+              } else {
+                top[i] = true
+              }
+              if (res.data.content[i].isCheck != 1) {
+                isChoosem[i] = false;
+              } else {
+                isChoosem[i] = true;
+              }
+            }
+            that.setData({
+              authormessages: arraymessage,
+              isChoose: isChoosem,//精选留言文字的切换
+              isTop: top,//置顶留言文字的切换
+              authorBool: isReplyArray,//显示作者留言
+              messages: res.data.content
+            })
+            for (var i = 0; i < res.data.count; i++) {
+              console.log("authorBool:" + that.data.authorBool[i])
+            }
+          } else {
+            wx.showToast({
+              title: '无用户留言',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'fail',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '连接失败',
+          icon: 'fail',
+        })
+      },
+      complete: function () {
+        wx.hideNavigationBarLoading();          //完成停止加载 
+        // 动态设置导航条标题 
+        wx.stopPullDownRefresh();            //停止下拉刷新 
+      }
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+    wx.showNavigationBarLoading(); //在标题栏中显示加载图标 
+    var that = this;
+    wx: wx.showToast({
+      title: '正在获取数据',
+      icon: 'loading'
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/realyMessagesList', //url
+      data: {
+        ischeckmessage: 0,
+        no: that.data.no,
+        id: that.data.id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            console.log(res.data.count)
+            var isReplyArray = new Array(res.data.count);
+            var isChoosem = new Array(res.data.count);
+            var arraymessage = new Array(res.data.count);
+            var top = new Array(res.data.count);
+            for (var i = 0; i < res.data.count; i++) {
+              if (res.data.content[i].authorMesContent != "") {
+                isReplyArray[i] = true;
+                arraymessage[i] = res.data.content[i].authorMesContent;
+              } else {
+                isReplyArray[i] = false;
+              }
+              if (res.data.content[i].isTop != 1) {
+                top[i] = false
+              } else {
+                top[i] = true
+              }
+              if (res.data.content[i].isCheck != 1) {
+                isChoosem[i] = false;
+              } else {
+                isChoosem[i] = true;
+              }
+            }
+            that.setData({
+              authormessages: arraymessage,
+              isChoose: isChoosem,//精选留言文字的切换
+              isTop: top,//置顶留言文字的切换
+              authorBool: isReplyArray,//显示作者留言
+              messages: res.data.content
+            })
+            for (var i = 0; i < res.data.count; i++) {
+              console.log("authorBool:" + that.data.authorBool[i])
+            }
+          } else {
+            wx.showToast({
+              title: '无用户留言',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'fail',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '连接失败',
+          icon: 'fail',
+        })
+      },
+      complete: function () {
+        wx.hideNavigationBarLoading();          //完成停止加载 
+        // 动态设置导航条标题 
+        wx.stopPullDownRefresh();            //停止下拉刷新 
+      }
+    })
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 7 - 0
messageApplet/pages/lookmessage/lookmessage.json

@@ -0,0 +1,7 @@
+  {
+    "backgroundTextStyle": "light",
+    "navigationBarBackgroundColor": "#ffffff",
+    "navigationBarTitleText": "留言筛选",
+    "navigationBarTextStyle": "black",
+    "enablePullDownRefresh": true
+  }

+ 83 - 0
messageApplet/pages/lookmessage/lookmessage.wxml

@@ -0,0 +1,83 @@
+<!--pages/lookmessage/lookmessage.wxml-->
+
+<view class='title-style'>{{title}}</view>
+<!-- 空白 -->
+<view class='space'></view>
+ <!-- 悬浮图标主页 -->
+ <icon type="waiting" size="50" class="post" bindtap="onPostClick"/>
+<!-- 复制小程序文章路径 -->
+<!-- <view class='path'  bindlongtap='copy'>
+  <text>长按该区域复制文章路径</text>
+  <text selectable='true'></text>
+</view> -->
+<!-- pages/message/message?title={{title}}&no={{pathNo}} -->
+
+<!-- 空白 -->
+<!-- <view class='space'></view> -->
+
+<!-- “用户留言文字” -->
+<view class='user-message'>用户留言</view>
+
+<!-- 空白 -->
+<view class='space'></view>
+
+<!-- 留言内容 作者回复  {{item.headimage}} {{item.username}} {{item.userMesContent}}-->
+<block wx:for="{{messages}}" wx:key="key" wx:for-item="item" wx: for-index="index">
+  <view class='backgroundcolor'>
+    <view class='message-content'>
+      <!-- 用户头像 -->
+      <view class='head-container'>
+        <image class='user-hear-style'  src=' {{item.headimage}}'></image>
+      </view>
+
+      <!-- 用户名与留言内容 -->
+      <view class='username-message' >
+        <view class='username'>{{item.username}}</view>
+        <view class='message'> {{item.userMesContent}}</view>
+        <!-- 作者回复 -->
+      <block wx:if="{{authorBool[index]}}">
+        <view>
+          <!-- 回复图标 -->
+          <view class='reply-container'>
+            <view class='autor-reply-line'></view>
+            <view class='author-text'>作者</view>
+          </view>
+          <!-- 作者回复内容  -->
+          <view class='author-reply-message'>{{authormessages[index]}}</view>
+        </view>
+      </block>
+      </view> 
+
+      <!-- 作者回复提交 -->
+      <view class='reply_container'>
+        <block wx:if="{{!authorBool[index]}}">
+          <form name='pushMsgFm' report-submit bindsubmit='orderSign'>
+            <button form-type="submit" class='btn_reply' bindtap="showModal" data-index="{{index}}">回复</button>
+            <!-- <button form-type="submit" bindtap="showModal" data-index="{{index}}">回复</buttton> -->
+          </form>
+        </block>
+        <block wx:if="{{!isChoose[index]}}">
+        <view bindtap='choose' class='jinxuanblue' data-index='{{index}}'>设置精选</view>
+        </block>
+        <block wx:if="{{isChoose[index]}}">
+          <view bindtap='cancelChoose' class='jinxuanred' data-index='{{index}}'>取消精选</view>
+        </block>
+        <!-- 置顶 -->
+        <block wx:if="{{!isTop[index]}}">
+        <view bindtap='settop' class='jinxuanblue' data-index='{{index}}'>留言置顶</view>
+        </block>
+        <!-- 取消置顶 -->
+        <block wx:if="{{isTop[index]}}">
+        <view bindtap='canceltop' class='jinxuanred' data-index='{{index}}'>取消置顶</view>
+        </block>
+        <view bindtap='deleteMessage' class='delete' data-index='{{index}}'>删除</view>
+      </view>
+    </view>
+  </view>
+</block>
+
+<view>
+  <modal title="回复 读者" style='color: #000;font-size: 32rpx;' hidden="{{modalHidden}}" confirm-text="确定" cancel-text="取消" bindconfirm="modalBindaconfirm" bindcancel="modalBindcancel">
+  <view class='reply-content'>回复的内容将通过服务通知发送给读者</view>
+  <input bindinput='getInputContent' class='reply-input' placeholder='请输入点什么...' value='{{inputContentxml}}' placeholder-style='font-size: 28rpx;'></input></modal>
+</view>

+ 244 - 0
messageApplet/pages/lookmessage/lookmessage.wxss

@@ -0,0 +1,244 @@
+/* pages/mycenter/mycenter.wxss */
+
+/* 文章题目 */
+.title-style{
+  font-size: 38rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 35rpx;
+  padding-bottom: 40rpx;
+}
+
+.post {
+  float: right;
+  position: fixed;
+  bottom: 30px;
+  left: 30px;  
+  border: 0 solid #ffffff;
+  border-radius: 500px;
+  box-shadow: 4px 1px 1px #cccccc;
+}
+
+/* 长按复制 */
+.path{
+  display: flex;
+  width: 100%;
+  height: 150rpx;
+  font-size: 38rpx;
+  font-weight: bold;
+  justify-content:center; 
+  align-items:center;
+  color: rgba(71, 69, 69, 0.26);
+  font-family: Arial, Helvetica, sans-serif;
+}
+
+/* 下划线 */
+.line{
+  width: 90%;
+  margin-left: 20rpx;
+  border-bottom: 2rpx solid #000;
+}
+
+/* 空格 */
+.space{
+  width: 100%;
+  height: 20rpx;
+  background-color:  rgba(238, 238, 238, 0.281);
+}
+
+
+/* 标签 */
+.title-container{
+  display: flex;
+  width: 100%;
+  height: 100rpx;
+  font-size: 40rpx;
+  align-items: center;
+  padding-left: 20rpx;
+  background-color:  rgba(238, 238, 238, 0.281);
+}
+
+/* 输入框 */
+.input-style1{
+  width: 90%;
+  height: 90rpx;
+  padding-left: 20rpx;
+}
+
+/* 上间隔 */
+.top-20{
+  margin-top: 20rpx;
+}
+
+/* 上传公众号图片 */
+.post-image{
+  width: 400rpx;
+  height: 80rpx;
+  font-size: 34rpx;
+  margin-top: 50rpx;
+  color: #fff;
+  background-color: rgb(8, 43, 196);
+}
+
+/* 图片容器 */
+.img-container{
+  width: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  margin-top: 30rpx;
+}
+
+/* 显示图片 */
+.display-img{
+  width: 80%;  
+  height: 400rpx;
+}
+
+/* 提交文章信息 */
+.post-atical-messages{
+  width: 98%;
+  height: 90rpx;
+  color: #fff;
+  background-color: rgb(67, 196, 8);
+  margin-top: 40rpx;
+}
+
+/* 背景颜色 */
+.backgroundcolor{
+  background: rgba(238, 238, 238, 0.281);
+}
+
+/* 留言内容container */
+.message-content{
+  display: flex;
+  flex-direction: row;
+  width: 97%;
+  padding-top: 40rpx;
+}
+
+/* 头像container */
+.head-container{
+  padding-left: 20rpx;
+}
+
+/* 用户名+留言内容 container */
+.username-message{
+  width: 450rpx;
+}
+
+/* 用户名style */
+.username{
+  font-size: 32rpx;
+  color: #ccc;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 20rpx;
+}
+
+/* 用户留言内容 */
+.message{
+  font-size: 33rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 6rpx;
+}
+
+/* 用户头像style */
+.user-hear-style{
+  width: 100rpx;
+  height: 100rpx;
+}
+
+/* “用户留言”文字 */
+.user-message{
+  width: 100%;
+  height: 50rpx;
+  font-size: 34rpx;
+  color: #ccc;
+  padding: 40rpx 0 20rpx 20rpx;
+}
+
+/* 精选和回复 */
+.reply_container{
+  font-size: 32rpx;
+  color: rgb(0, 60, 255);
+  padding-top: 15rpx;
+}
+
+/* 精选 */
+.jinxuanblue{
+    padding-top: 10rpx;
+}
+
+.jinxuanred{
+    padding-top: 10rpx;
+    color: red;
+}
+
+/* 回复输入框样式 */
+.reply-input{
+  width: 500rpx;
+  font-size: 32rpx;
+  color: #000;
+  margin-top: 20rpx;
+  border: #ccc solid 2rpx;
+}
+
+/* 回复提示文字 */
+.reply-content{
+  width: 700rpx;
+  padding-top: 10rpx;
+  padding-left: 10rpx;
+  font-size: 30rpx;
+}
+
+/* 作者回复container */
+.reply-container{
+  display: flex;
+  flex-direction: row;
+  margin-left: 20rpx;
+  margin-top: 20rpx;
+}
+
+/* 作者回复图标 */
+.autor-reply-line{
+  width: 6rpx;
+  height: 26rpx;
+  background-color: rgb(76, 250, 7);
+  padding-top: 9rpx;
+}
+
+/* 回复按钮 */
+.btn_reply{
+  width: 100rpx;
+  height: 60rpx;
+  font-size: 22rpx;
+  background: rgb(54, 173, 6);
+  color: #fff;
+}
+
+/* “作者”字体style */
+.author-text{
+  font-size: 32rpx;
+  color: #ccc;
+  font-family: '微软雅黑';
+  padding-left: 10rpx;
+}
+
+/* 作者回复内容信息 */
+.author-reply-message{
+  width: 510rpx;
+  font-size: 34rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 6rpx;
+}
+
+/* 删除 */
+.delete{
+  padding-top: 10rpx;
+}

+ 373 - 0
messageApplet/pages/message/message.js

@@ -0,0 +1,373 @@
+// pages/message/message.js
+var app = getApp();
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    buttonDisabled: false,
+    modalHidden: true,
+    userInfo: {},
+    hasUserInfo: false,
+    //判断小程序的组件在当前版本是否可用
+    canIUse: wx.canIUse('button.open-type.getUserInfo'),
+    messages: [],
+    no: '',
+    title: '',
+    authormessages: new Array(),//作者回复信息
+    authorBool: new Array(),//显示回复数组
+    ishave: false , //是否有筛选留言(是否显示赞)
+    status: new Array(),//点赞的状态
+    goodarray: new Array(),//所有点赞数
+    isTop: new Array(),//置顶留言
+    g_id: '' //公众号id
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (option) {
+    var that = this;
+    console.log("留言页面的公众号编号为:" + option.g_id);
+   
+    that.setData({
+      title: option.title,
+      no: option.no,
+      g_id: option.g_id
+    })
+    
+    //获取已精选留言内容
+    that.getChooseCotent();
+    console.log(app.globalData);
+    // 如果获取到用户信息就存储
+    if (app.globalData.userInfo) {
+      console.log("message");
+      this.setData({
+        userInfo: app.globalData.userInfo,
+        hasUserInfo: true
+      })
+      wx.setStorageSync('username', that.data.userInfo.nickName)
+      wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+      console.log("在index页面全局app1中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+    } else if (this.data.canIUse) {
+      // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
+      // 所以此处加入 callback 以防止这种情况
+      app.userInfoReadyCallback = res => {
+        // console.log("用户名2:" + res.userInfo.nickName + " " + res.userInfo.avatarUrl)
+        // wx.setStorageSync('username', res.userInfo.nickName)
+        // wx.setStorageSync('headpath', res.userInfo.avatarUrl)
+        this.setData({
+          userInfo: res.userInfo,
+          hasUserInfo: true
+        })
+        wx.setStorageSync('username', that.data.userInfo.nickName)
+        wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+        console.log("在index页面全局app2中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+      }
+    }else{
+      wx.getUserInfo({
+        success: res=>{
+          app.globalData.userInfo = res.userInfo;
+          this.setData({
+            userInfo: res.userInfo,
+            hasUserInfo: true
+          })
+        }
+      })
+    } 
+  },
+
+  //授权弹窗
+  //点击按钮授权
+  bindGetUserInfo: function (e) {
+    var that = this;
+    var openid = wx.getStorageSync("openid");
+    if (e.detail.userInfo) {
+      if (!openid) {
+        wx.login({
+          success: function (res) {
+            // 用户已经授权过,不需要显示授权页面,所以不需要改变 isHide 的值
+            // 根据自己的需求有其他操作再补充
+            // 我这里实现的是在用户授权成功后,调用微信的 wx.login 接口,从而获取code
+            app.globalData.userInfo = res.userInfo
+            console.log('openid');
+            wx.request({
+              url: 'https://applet.yull.top/index/index/login',//获取唯一标识 openId
+              data: {
+                code: res.code
+              },
+              header: {
+                'content-type': 'application/json' // 数据格式(默认值)
+              },
+              method: 'post', //上传方式
+              success: function (res) {
+                console.log("openid" + res.data.openid);
+                // wx.setStorageSync('token', res.data.token)//消息模板会用到
+                wx.setStorageSync('openid', res.data.openid);//存储openid
+              }
+            });
+          }
+        });
+      }
+      app.globalData.userInfo = e.detail.userInfo
+      this.setData({
+        userInfo: e.detail.userInfo,
+        hasUserInfo: true
+      })
+      wx.setStorageSync('username', that.data.userInfo.nickName)
+      wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+      console.log("在index页面临时授权中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+    } else {
+
+      wx.showToast({
+        title: '未授权无法查看留言',
+        icon: 'none',
+      })
+      return;
+    }
+  },
+
+  //获取已精选留言内容
+  getChooseCotent: function (){
+    var that = this;
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/realyMessagesList', //获取已精选留言内容
+      data: {
+        no: that.data.no,  //文章编号 
+        ischeckmessage: '1', //留言是否经过筛选
+        g_id: that.data.g_id,  //公众号 id
+        openid: wx.getStorageSync('openid'), //用户唯一标识
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            var posts_message = res.data.content;
+            console.log(posts_message)
+            if (posts_message.length == 0) {
+              wx.showToast({
+                title: '还没有用户留言',
+                icon: 'none',
+              })
+            } else {
+              var arraymessage = new Array(res.data.content.length);
+              var isReplyArray = new Array(res.data.content.length);
+              var isstatus = new Array(res.data.content.length);
+              var goodarr = new Array(res.data.content.length);
+              var istop = new Array(res.data.content.length);
+              for (var i = 0; i < res.data.content.length; i++) {
+                goodarr[i] = posts_message[i].zanCounts
+                if (posts_message[i].isTop == "1") {
+                  //判断是否置顶
+                  
+                  istop[i] = true
+                } else {
+                  istop[i] = false
+                }
+                if (posts_message[i].iszan == "1") {
+                  
+                  isstatus[i] = false;
+                } else {
+                  isstatus[i] = true;
+                }
+                if (posts_message[i].authorMesContent != "") {
+                  isReplyArray[i] = true;
+                  arraymessage[i] = posts_message[i].authorMesContent;
+                } else {
+                  isReplyArray[i] = false;
+                }
+              }
+              that.setData({
+                ishave: true,
+                status: isstatus,//是否已经点赞
+                messages: posts_message,//所有留言信息
+                authormessages: arraymessage,//作者回复内容
+                authorBool: isReplyArray,//作者是否回复
+                goodarray: goodarr,//赞的总数
+                isTop: istop //是否置顶
+              })
+            }
+          } else {
+            wx.showToast({
+              title: '获取失败',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  //写留言
+  writemessage: function () {
+    var that = this;
+    wx: wx.navigateTo({//this.data.title  this.data.no
+      url: '../../pages/write/write?title=' + that.data.title + '&no=' + that.data.no + '&g_id=' + that.data.g_id,
+    })
+  },
+
+  //悬浮按钮(回到主页)
+  onPostClick:function (){
+    wx: wx.navigateTo({
+      url: '../../pages/index/index'
+    })
+  },
+
+  // 实现点赞功能
+  setGood: function (event) {
+    var that = this;
+    console.log(event.currentTarget.dataset.index)
+    var u_index = event.currentTarget.dataset.index;
+    console.log(this.data.messages[0].p_id)
+    console.log("点赞状态"+this.data.status);
+    //判断如果没有点赞
+    if (this.data.status[u_index] == true){
+      //转换成已点赞状态
+      that.data.status[u_index] = !that.data.status[u_index]
+      // //计数+1
+      // that.data.goodarray[u_index] = that.data.goodarray[u_index] + 1
+      // //更新数据
+      that.setData({
+        status: that.data.status,
+      })
+      //获得一个赞
+      that.getChooseCotent();
+      wx.request({
+        url: app.globalData.apiUrl +'/index/message/zanCount', //url
+        data: {
+          p_id: that.data.messages[u_index].p_id,//用户的 id
+          openid: wx.getStorageSync('openid'),//点赞用户
+          status: 1, //获得一个赞
+          no: that.data.no,  //文章编号 
+          g_id: that.data.g_id,  //公众号 id
+        },
+        header: {
+          'content-type': 'application/json' // 数据格式(默认值)
+        },
+        method: 'post', //上传方式
+        success: function (res) {   //回调成功
+          console.log(res.data)
+          if (res.statusCode == 200) {
+            if (res.data.result == '1') {
+              that.getChooseCotent();
+            } else {
+              that.getChooseCotent();
+              //点赞失败(回复原来未点赞状态)
+              // that.data.status[u_index] = !that.data.status[u_index]
+              // that.data.goodarray[u_index] = that.data.goodarray[u_index] - 1
+              // that.setData({
+              //   status: that.data.status,
+              //   goodarray: that.data.goodarray
+              // })
+              wx.showToast({
+                title: '点赞失败',
+                icon: 'none',
+              })
+            }
+          } else {
+            that.getChooseCotent();
+            wx.showToast({
+              title: '服务器错误',
+              icon: 'none',
+            })
+          }
+        },
+        //回调失败
+        fail: function (res) {
+          console.log(res)
+          that.data.status[u_index] = !that.data.status[u_index]
+          that.data.goodarray[u_index] = that.data.goodarray[u_index] - 1
+          that.setData({
+            status: that.data.status,
+            goodarray: that.data.goodarray
+          })
+          wx.showToast({
+            title: '请检查网络连接',
+            icon: 'fail',
+          })
+        },
+      })
+    }else{
+      wx.showToast({
+        title: '您已经点过赞哦',
+        icon: 'none',
+      })
+    }
+  },
+  
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    var that = this;
+    that.getChooseCotent();
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+    var that = this;
+    that.getChooseCotent();
+
+    //完成停止加载
+    wx.hideNavigationBarLoading();
+
+    //停止下拉刷新 
+    wx.stopPullDownRefresh();    
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 9 - 0
messageApplet/pages/message/message.json

@@ -0,0 +1,9 @@
+{
+
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "留言区",
+  "navigationBarTextStyle": "black",
+  "enablePullDownRefresh": true
+
+}

+ 70 - 0
messageApplet/pages/message/message.wxml

@@ -0,0 +1,70 @@
+<!--pages/message/message.wxml-->
+  <!-- <view>
+    <image bindtap='adddetial'  class="add_icon" src="../../images/主页.png"></image>
+  </view> -->
+
+  <view class='title-style'>{{title}}</view>
+   <view wx:if="{{!hasUserInfo && canIUse}}">
+   <button class='bottom' wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权后才能查看留言</button>
+  </view>
+<block wx:else>
+ <!-- 悬浮图标主页 -->
+ <icon type="waiting" size="50" class="post" bindtap="onPostClick"/>
+  <view class='messages-container'>
+  <!-- 精选留言 写留言 -->
+    <view class='head-contain'>
+      <view class='select-message'>精选留言</view>
+      <view class='write-message' bindtap='writemessage'>写留言</view>
+    </view>
+    <view class='message-top'></view>
+    <block wx:for="{{messages}}" wx:key="key" wx:for-item="item" wx:for-index="index">
+      <view class='jiange'>
+        <!-- 留言内容 作者回复 -->
+        <view class='message-content'>
+          <!-- 用户头像 -->
+          <view class='head-container'> 
+            <image class='user-hear-style'  src='{{item.headimage}}'></image>
+          </view>
+          <!-- 用户名与留言内容 -->
+          <view class='username-message'>
+            <view class='clumen'>
+              <view class='username'>{{item.username}}</view>
+              <block wx:if="{{isTop[index]}}">
+                <view  class='set-top'>置顶</view>
+              </block>
+            </view>
+            <view>
+              <view class='message'>{{item.userMesContent}}</view>
+            </view>
+          </view>
+          <!-- 点赞 -->
+          <block wx:if="{{ishave}}">
+            <view class='ico_zan'>
+              <view wx:if="{{status[index]}}"><image data-index="{{index}}" class='zan' bindtap='setGood' src='../../images/zan1.png'></image></view>
+              <view wx:else><image data-index="{{index}}" class='zan' bindtap='setGood' src='../../images/zan2.png'></image></view>
+            </view>
+            <!-- 点赞计数 -->
+            <view class='ico_num' >
+              <view wx:if="{{goodarray[index]!=0}}">{{goodarray[index]}}</view>
+              <view wx:else></view>
+            </view>
+          </block>
+        </view>
+        <!-- 作者回复 -->
+        <block wx:if="{{authorBool[index]}}">
+          <view>
+              <!-- 回复图标 -->
+              <view class='reply-container'>
+                <view class='autor-reply-line'></view>
+                <view class='author-text'>作者</view>
+              </view>
+              <!-- 作者回复内容 -->
+              <view class='reply-message'>{{authormessages[index]
+      }}</view>
+          </view>
+        </block>
+      </view>
+    </block>
+  </view>
+</block>
+

+ 212 - 0
messageApplet/pages/message/message.wxss

@@ -0,0 +1,212 @@
+/* pages/message/message.wxss */
+
+.post {
+  float: right;
+  position: fixed;
+  bottom: 40px;
+  right: 40px;  
+  border: 0 solid #ffffff;
+  border-radius: 500px;
+  box-shadow: 4px 1px 1px #cccccc;
+}
+.bottom{
+  width: 80%;
+  color: #fff;
+  margin-top: 40rpx;
+  background: rgb(1, 199, 1);
+}
+page{
+  width: 100%;
+  height: 100%;
+  background-color: #eee;
+}
+
+/* 文章题目 */
+.title-style{
+  font-size: 38rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 35rpx;
+  padding-bottom: 40rpx;
+  background-color: #fff;
+}
+
+/* 精选留言背景 */
+.messages-container{
+  width: 100%;
+  /* background: #eee; */
+  margin-top: 40rpx;
+  padding-bottom: 100rpx;
+}
+
+/* 精选留言头部 */
+.head-contain{
+  display: flex;    /*设置布局为flex*/
+  flex-direction: row;/*设置布局方向为row*/
+  width: 100%;
+  height: 100rpx;
+}
+
+/* 精选留言style */
+.select-message{
+  font-size: 34rpx;
+  color: rgb(201, 201, 201);
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 50rpx;
+}
+
+/* 写留言style */
+.write-message{
+  font-size: 34rpx;
+  color: rgb(64, 212, 6);
+  font-family: '微软雅黑';
+  padding-left: 465rpx;
+  padding-top: 40rpx;
+}
+
+/* 留言内容container */
+.message-content{
+  display: flex;
+  flex-direction: row;
+  width: 97%;
+  margin-top: 10rpx;
+}
+
+.jiange{
+  padding-bottom: 50rpx;
+}
+
+/* 头像container */
+.head-container{
+  padding-left: 20rpx;
+  padding-top: 10rpx;
+}
+
+/* 用户头像style */
+.user-hear-style{
+  width: 80rpx;
+  height:80rpx;
+}
+
+/* 用户名+留言内容 container */
+.username-message{
+  width: 1000rpx;
+}
+
+/* 横排列 */
+.clumen{
+   display: flex;
+   flex-direction: row;
+}
+
+/* 点赞图标 */
+.ico_zan{
+  width: 120rpx;
+  padding-top: 7rpx;
+}
+
+/* 点赞数 */
+.ico_num{
+  width: 40rpx;
+  padding-right: 25rpx;
+  font-size: 34rpx;
+  padding-top: 2rpx;
+  color: #6688b8;
+}
+
+/* 点赞图标 */
+.zan{
+  width: 65rpx;
+  height: 37rpx;
+}
+
+/* 用户名style */
+.username{
+  font-size: 34rpx;
+  color: rgb(170, 170, 170);
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+}
+
+/* 置顶 */
+.set-top{
+  width: 60rpx;
+  height: 45rpx;
+  color: #fff;
+  font-size: 28rpx;
+  padding: 0 15rpx 0 15rpx;
+  border-radius: 5rpx;
+  margin-left: 10rpx;
+  margin-top: 8rpx;
+  background-color: rgba(168, 165, 165, 0.61);
+}
+
+/* 用户留言内容 */
+.message{
+  font-size: 34rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 6rpx;
+}
+
+/* 作者回复container */
+.reply-container{
+  display: flex;
+  flex-direction: row;
+  margin-left: 115rpx;
+  margin-top: 10rpx;
+}
+
+/* 作者回复图标 */
+.autor-reply-line{
+  width: 6rpx;
+  height: 26rpx;
+  background-color: rgb(76, 250, 7);
+  padding-top: 12rpx;
+}
+
+/* “作者”字体style */
+.author-text{
+  font-size: 32rpx;
+  color: #ccc;
+  font-family: '微软雅黑';
+  padding-left: 10rpx;
+}
+
+/* 作者回复内容信息 */
+.reply-message{
+  width: 80%;
+  font-size: 34rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  padding-left: 115rpx;
+  padding-top: 6rpx;
+}
+
+/* 上间隔10px */
+.top{
+  margin-top: 60rpx;
+}
+
+.message-top{
+  margin-top: 20rpx;
+}
+
+/* 留言信息与底部的距离 */
+.message-bottom{
+  margin-bottom: 100rpx;
+}
+
+/* 悬浮按钮 */
+/* .add_icon{
+  float: right;
+  position: fixed;
+  z-index:9999;
+  width:84rpx;
+  height:84rpx;
+  bottom: 100rpx;
+  right: 80rpx;
+} */

+ 244 - 0
messageApplet/pages/myartical/myartical.js

@@ -0,0 +1,244 @@
+// pages/myartical/myartical.js
+const app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    posts_key: [],
+    num: '',
+    id: '' //公众号id
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (option) {
+    var that = this;
+
+    that.setData({
+      type: '1',//获取列表标识
+      id: option.id
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/article/listdata', //获取文章列表
+      data: {
+        type: '1', //操作类型
+        id: that.data.id //公众号id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            var posts_content = res.data;
+            console.log('onLoad文章信息为:' + res.data.content)
+            for (let i in posts_content.content) {
+              posts_content.content[i].month = posts_content.content[i].date.substring(5, 7);
+              posts_content.content[i].day = posts_content.content[i].date.substring(8, 10);
+
+            }
+            that.setData({
+              posts_key: posts_content.content
+            })
+          } else {
+            wx.showToast({
+              title: '您还没有发表文章哦',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  //跳转留言页面
+  to_message_lists: function (event) {
+    var that = this;
+    console.log(event.currentTarget.dataset.index)
+    var index = event.currentTarget.dataset.index
+    console.log(that.data.posts_key[index])
+    var title = that.data.posts_key[index].title
+    var no = that.data.posts_key[index].no
+    console.log('标题:' + index + title + " " + no)
+    wx: wx.navigateTo({
+      url: '../../pages/lookmessage/lookmessage?title=' + title + '&no=' + no + '&id=' + that.data.id,
+      success: function (res) { },
+      fail: function (res) { },
+      complete: function (res) { },
+    })
+  },
+
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    wx.showNavigationBarLoading(); //在标题栏中显示加载图标 
+    var that = this;
+    wx.request({
+      url: app.globalData.apiUrl + '/index/article/listdata', //获取文章列表
+      data: {
+        type: '1',//获取列表标识
+        id: that.data.id //公众号id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            console.log(res.data)
+            var posts_content = res.data;
+            for (let i in posts_content.content) {
+              posts_content.content[i].month = posts_content.content[i].date.substring(5, 7);
+              posts_content.content[i].day = posts_content.content[i].date.substring(8, 10);
+
+            }
+            console.log("文章信息为:" + posts_content.content)
+            that.setData({
+              posts_key: posts_content.content,
+              num: posts_content.content.length
+            })
+          } else {
+            wx.showToast({
+              title: '您还没有发表文章哦',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showModal({
+            title: '服务器错误',
+            content: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+      complete: function () {
+        wx.hideNavigationBarLoading();          //完成停止加载 
+        // 动态设置导航条标题 
+        wx.stopPullDownRefresh();            //停止下拉刷新 
+      }
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+    wx.showNavigationBarLoading(); //在标题栏中显示加载图标 
+    var that = this;
+    wx.request({
+      url: app.globalData.apiUrl + '/index/article/listdata', //获取文章列表
+      data: {
+        type: '1',//获取列表标识
+        id: that.data.id //公众号id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            var posts_content = res.data;
+            console.log(posts_content)
+            for (let i in posts_content.content) {
+              posts_content.content[i].month = posts_content.content[i].date.substring(5, 7);
+              posts_content.content[i].day = posts_content.content[i].date.substring(8, 10);
+
+            }
+            that.setData({
+              posts_key: posts_content.content
+            })
+          } else {
+            wx.showToast({
+              title: '您还没有发表任何文章哦',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showModal({
+            title: '服务器错误',
+            content: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+      complete: function () {
+        wx.hideNavigationBarLoading();          //完成停止加载 
+        // 动态设置导航条标题 
+        wx.stopPullDownRefresh();            //停止下拉刷新 
+      }
+    })
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 7 - 0
messageApplet/pages/myartical/myartical.json

@@ -0,0 +1,7 @@
+  {
+    "backgroundTextStyle": "light",
+    "navigationBarBackgroundColor": "#ffffff",
+    "navigationBarTitleText": "筛选留言文章",
+    "navigationBarTextStyle": "black",
+    "enablePullDownRefresh": true
+  }

+ 21 - 0
messageApplet/pages/myartical/myartical.wxml

@@ -0,0 +1,21 @@
+<!--pages/myartical/myartical.wxml-->
+
+<!-- 文章列表 -->
+<block wx:for="{{posts_key}}" wx:for-item="item" >
+  <view bindtap='to_message_lists' data-index="{{index}}">
+    <!-- 文章发表时间 -->
+    <view class='wite-space'></view>
+    <view class='artical-time'>{{item.month}}月{{item.day}}日</view>
+    <!-- 文章图片、标题、描述 -->
+    <view class='artical-container'>
+      <!-- 文章图片 -->
+      <view class='artical-img-container'>
+        <image class='artical-img' src="{{item.imageTitle}}"></image>
+      </view>
+      <!-- 文章标题 -->
+      <view class='artical-title'>{{item.title}}</view>
+      <!-- 文章描述 -->
+      <view class='artical-describe'>{{item.describ}}</view>
+    </view>
+  </view>
+</block>

+ 61 - 0
messageApplet/pages/myartical/myartical.wxss

@@ -0,0 +1,61 @@
+/* pages/myartical/myartical.wxss */
+
+page{
+  width: 100%;
+  height: 100%;
+  background-color: #F5F5F5;
+}
+.wite-space{
+  width: 100%;
+  height: 40rpx;
+  background-color: rgba(238, 238, 238, 0.281);
+}
+
+/* 文章发表时间 */
+.artical-time{
+  display: flex;
+  flex-direction: column;
+  width: 100%;
+  font-size: 28rpx;
+  padding-bottom: 15rpx;
+  align-items: center;
+  color: rgb(201, 200, 200);
+  background-color: rgba(238, 238, 238, 0.281);
+}
+
+/* 文章容器container */
+.artical-container{
+  width: 100%;
+  background-color: #fff;
+}
+
+/* 文章插图容器 */
+.artical-img-container{
+   width: 100%;
+}
+
+/* 图片内容 */
+.artical-img{
+  width: 100%;  
+  height: 450rpx;
+}
+
+/* 文章标题 */
+.artical-title{
+  width: 90%;
+  font-size: 36rpx;
+  font-family: '微软雅黑';
+  color: black;
+  padding-left: 20rpx;
+  padding-top: 10rpx;
+}
+
+/* 文章描述 */
+.artical-describe{
+  width: 90%;
+  font-size: 30rpx;
+  font-family: '微软雅黑';
+  padding-top: 20rpx;
+  padding-left: 20rpx;
+  padding-bottom: 20rpx;
+}

+ 465 - 0
messageApplet/pages/mycenter/mycenter.js

@@ -0,0 +1,465 @@
+// pages/mycenter/mycenter.js
+// var banner = require("../../src/js/banner.js");
+const app = getApp();
+Page({
+  data: {
+    isShowFrom1: false,
+    // isShowFrom2: false,
+    // isShowFrom3: false,
+    indicatorDots: true,
+    vertical: false,
+    autoplay: true,
+    interval: 3000,
+    duration: 800,
+    // banner_url: banner.bannerList
+    // 折叠结束
+    pathNo: '',
+    title: '',//题目
+    describe: '',//描述
+    tempFilePath: [],
+    authormessages: new Array(),//作者回复信息
+    authormessage: new Array(),
+    messages: [],
+    // 用户留言设置
+    show: false,
+    tip: '',
+    inputContent: '',//获取的回复信息
+    inputContentxml: '',
+    buttonDisabled: false,
+    modalHidden: true,
+    replyContent: '',
+    authorBool: new Array(),//显示回复数组
+    authorbool: new Array(),
+    index2: '',//回复索引
+    chooseIndex: '',//精选索引
+    isChoose: new Array(),//是否设置为精选
+    isTop: new Array(),//是否设置置顶留言
+    formId: '',
+    id: '',//公众号id
+    name: '',
+    headpath: '',
+    describes: '',
+    posts_key: [], //所有文章内容
+    title: ' ',
+    no: '',
+    inputValue:'',
+  },
+
+  // 长按复制
+  copy: function (e) {
+    var that = this;
+    var index = e.currentTarget.dataset.index
+    console.log();
+    that.setData({
+      title: that.data.posts_key[index].title,
+      no: that.data.posts_key[index].no
+    })
+
+    wx.setClipboardData({
+      data: 'pages/message/message?title=' + that.data.title + '&g_id=' + that.data.id+ '&no=' + that.data.no,
+      success: function (res) {
+        wx.showToast({
+          title: '复制成功',
+        });
+      }
+    });
+  },
+
+  // 折叠显示
+  showFrom(e) {
+    var param = e.target.dataset.param;
+    this.setData({
+      isShowFrom1: param == 1 ? (!this.data.isShowFrom1) : false,
+      // isShowFrom2: param == 2 ? (!this.data.isShowFrom2) : false,
+      // isShowFrom3: param == 3 ? (!this.data.isShowFrom3) : false
+    });
+  },
+
+  //获取标题文本值
+  titleInput: function (e) {
+    console.log(e.detail.value);
+    this.setData({
+      title: e.detail.value
+    })
+  },
+  //获取描述文本值
+  describeInput: function (e) {
+    console.log(e.detail.value);
+    this.setData({
+      describe: e.detail.value
+    })
+  },
+
+  //选择照片 
+  chooseimage: function () {
+    var that = this;
+    wx.chooseImage({
+      count: 1, // 默认9  
+      sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有  
+      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有  
+      success: function (res) {
+        console.log(res.tempFilePaths)
+        // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片  
+        that.setData({
+          tempFilePath: res.tempFilePaths[0]
+        })
+      }
+    })
+  },
+
+  //上传照片
+  post_image: function () {
+    var that = this;
+    console.log("照片路径"+that.data.tempFilePath)
+    //上传服务器
+    wx: wx.showToast({
+      title: '上传中',
+      icon: 'loading'
+    })
+    wx.uploadFile({
+      url: app.globalData.apiUrl +'/index/article/uploadImg',
+      filePath: that.data.tempFilePath,
+      name: 'file',
+      header: {
+        'content-type': 'multipart/form-data'
+      },
+      method: 'post', //上传方式s
+      success: function (res) {
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          // 获取文章列表
+          that.getArticelList();
+          //上传formid
+          that.postFormid();
+          
+          wx.showToast({
+            title: '上传成功',
+            icon: 'success',
+          })
+        } else {
+          console.log(res.data)
+          wx.showToast({
+            title: '服务器错误1',
+            icon: 'fail',
+          })
+        }
+      },
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '服务器错误',
+          icon: 'fail',
+        })
+      }
+    })
+  },
+
+  //提交数据
+  submitdata: function () {
+    var that = this;
+    //判断数据不能为空
+    if (this.data.title == "" || this.data.describe == "" || that.data.tempFilePath == ""){
+      wx.showToast({
+        title: '标题、描述、文章配图不能为空',
+        icon: 'none'
+      })
+    }else{
+      //上传服务器
+      wx:wx.showToast({
+        title: '上传中',
+        icon: 'loading'
+      })
+      wx.request({
+        url: app.globalData.apiUrl +'/index/article/message', //url
+        data: {
+          title: this.data.title,   //标题
+          describe: this.data.describe, //描述
+          id: that.data.id,//公众号id
+          isheck: 0 //标识
+        },
+        header: {
+          'content-type': 'application/json' // 数据格式(默认值)
+        },
+        method: 'post', //上传方式
+        success: function (res) {   //回调成功
+          console.log(res.data)
+          if (res.statusCode == 200) {
+            if (res.data.result == '1'){
+              that.setData({
+                inputValue: '',
+                isShowFrom1: false,
+              })
+
+              
+
+              that.post_image();
+            }else{
+              wx.showToast({
+                title: '上传失败',
+                icon: 'fail',
+              })
+            }
+          }else{
+            wx.showToast({
+              title: '服务器错误',
+              icon: 'none',
+            })
+          }
+        },
+        //回调失败
+        fail: function (res) {
+          console.log(res)
+          wx.showToast({
+            title: '请检查网络',
+            icon: 'fail',
+          })
+        },
+      })
+    }
+  },
+
+  //服务推送通知
+  orderSign: function (e) {
+    var that = this;
+   
+  },
+
+  //上传Formid
+  postFormid: function() {
+    var that =this;
+    console.log("formid="+that.data.formId)
+    wx.request({
+      url: app.globalData.apiUrl +'/index/index/admin', //获取文章列表
+      data: {
+        id: that.data.id,
+       
+        //token: wx.getStorageSync('token'),
+        openid: wx.getStorageSync('openid')
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            var posts_content = res.data;
+           
+          } else {
+            wx.showToast({
+              title: 'formid上传出错',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  // 删除文章
+  delete: function (event){
+    var that = this;
+    var index = event.currentTarget.dataset.index;
+    console.log(index);
+    var nos = that.data.posts_key[index].no;
+    console.log(that.data.posts_key[index]);
+    console.log("文章编辑"+index + nos)
+
+    wx.showModal({
+      title: '提示',
+      content: '是否也将本文章的留言内容也删除?',
+      success: function (res) {
+        if (res.confirm) {
+          wx: wx.showToast({
+            title: '正在删除',
+            icon: 'loading',
+          })
+          wx.request({
+            url: app.globalData.apiUrl +'/index/article/listdata', 
+            data: {
+              type: '2',
+              id: that.data.id, //公众号id
+              no: nos //文章id
+            },
+            header: {
+              'content-type': 'application/json' // 数据格式(默认值)
+            },
+            method: 'post', //上传方式
+            success: function (res) {   //回调成功
+              console.log(res.data)
+              if (res.statusCode == 200) {
+                if (res.data.result == '1') {
+                  // 重新获取文章列表
+                  that.getArticelList();
+                  wx: wx.showToast({
+                    title: '删除成功',
+                    icon: 'success',
+                  })
+                } else {
+                  wx.showToast({
+                    title: '删除失败!',
+                    icon: 'none',
+                  })
+                }
+              } else {
+                wx.showToast({
+                  title: '服务器错误',
+                  icon: 'none',
+                })
+              }
+            },
+            //回调失败
+            fail: function (res) {
+              console.log(res)
+              wx.showToast({
+                title: '联网失败',
+                icon: 'fail',
+              })
+            },
+          })
+        } else if (res.cancel) {
+          console.log('用户点击取消')
+        }
+      }
+    })
+  },
+
+  // 获取文章列表
+  getArticelList: function(){
+    var that = this;
+    wx.request({
+      url: app.globalData.apiUrl +'/index/article/listdata', //获取文章列表
+      data: {
+        type: '1',//获取列表标识
+        id: that.data.id //公众号id
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            var posts_content = res.data;
+            console.log('onLoad文章信息为:' + res.data.content)
+            that.setData({
+              posts_key: posts_content.content
+            })
+          } else {
+            that.setData({
+              posts_key: ''
+            })
+            wx.showToast({
+              title: '您还没有发布文章哦,请先发布文章',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '联网失败',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   *  功能:获取已留言未回复用户。
+   */
+  onLoad: function (options) {
+    var that = this;
+    that.setData({
+      id: options.id,
+      name: options.name,
+      headpath: options.headpath,
+      describes: options.describe
+    })
+    // 获取文章列表
+    that.getArticelList();
+  },
+  
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    var that = this;
+    // 获取文章列表
+    that.getArticelList();
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+    var that = this;
+    // 获取文章列表
+    that.getArticelList();
+
+    //完成停止加载
+    wx.hideNavigationBarLoading();
+
+    //停止下拉刷新 
+    wx.stopPullDownRefresh();
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 8 - 0
messageApplet/pages/mycenter/mycenter.json

@@ -0,0 +1,8 @@
+{
+
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "文章管理",
+  "navigationBarTextStyle": "black",
+  "enablePullDownRefresh": true
+}

+ 129 - 0
messageApplet/pages/mycenter/mycenter.wxml

@@ -0,0 +1,129 @@
+<!--pages/mycenter/mycenter.wxml-->
+
+
+<view class='gong-content' >
+  <view>
+    <image class='gong-img' src="{{headpath}}"></image>
+  </view>
+  <view class='gong-message'>
+    <view class='gong-name'>{{name}}</view>
+    <view class='gong-describe'>{{describes}}</view>
+  </view>
+</view>
+<view class="remind-copy">长按已发表文章,复制文章路径</view>
+<!-- 公众号文章信息填写 -->
+<!-- <view class='title-container'>  
+  <view>发布文章</view>
+</view> -->
+
+<view class="tui-accordion-content">
+  <view class="tui-menu-list {{isShowFrom1 ? 'tui-shangjiantou' : 'tui-xiajiantou'}}">
+    <view class='from-bg' bindtap="showFrom" data-param="1"><text style='margin-left:20rpx;'>发布新文章</text></view>
+    <view class="tui-accordion-from {{isShowFrom1 ? 'tui-show' : 'tui-hide'}}">
+      <view class="tui-menu-list tui-clear">
+        <view class='img-container' bindtap='chooseimage'>
+          点击该区域上传文章图片
+          <image class='display-img' src='{{tempFilePath}}'></image>
+        </view>
+      </view> 
+
+      <view class="tui-menu-list tui-clear">
+        <view class='articel-messages'>
+          <view class='title'><label>标题:</label></view>
+          <view class='top-20'>
+            <input class='input-style1'
+              placeholder="请输入文章标题" 
+              placeholder-style='color:#eee; font-size: 32rpx;'
+              maxlength='30'
+              name="title"
+              value='{{inputValue}}'
+              bindinput='titleInput'/>
+          </view>
+      </view> 
+      
+      <view class="tui-menu-list tui-clear">
+        <view class='articel-messages'>
+            <view class='des'><label>简介:</label></view>
+            <view class='descrbe'>
+              <input class='input-style1'
+                placeholder="请输入文章简介" 
+                placeholder-style='color:#eee; font-size: 32rpx;'
+                name="describe"
+                bindinput='describeInput'
+                value='{{inputValue}}'
+                maxlength='50'/>
+            </view>
+          </view>
+      </view> 
+      <view class="tui-menu-list tui-clear" style="text-align:center;padding-top:20rpx;">
+          <view>
+          <form name='pushMsgF' report-submit bindsubmit='orderSign'>
+            <button form-type="submit" class='post-atical-messages' bindtap='submitdata'>提交文章</button>
+          </form>
+          </view>
+      </view>
+    </view>
+  </view>
+</view>
+
+
+<!-- 显示图片 -->
+<!-- <view class='img-container' bindtap='chooseimage'>
+  点击该区域上传文章图片
+  <image class='display-img' src='{{tempFilePath}}'></image>
+</view> -->
+<!-- <view class='articel-messages'>
+  <view class='top-20'>
+    <input class='input-style1'
+      placeholder="请输入文章标题" 
+      placeholder-style='color:#eee; font-size: 32rpx;'
+      maxlength='30'
+      name="title"
+      bindinput='titleInput'/>
+  </view> -->
+
+  <!-- 文章描述输入框 -->
+  <!-- <view class='top-20'>
+    <input class='input-style1'
+      placeholder="请输入文章简介" 
+      placeholder-style='color:#eee; font-size: 32rpx;'
+      name="describe"
+      bindinput='describeInput'
+      maxlength='50'/>
+  </view> -->
+
+  <!-- 分隔符 -->
+  <view class='line'></view>
+
+  <!-- <view>
+    <button class='post-atical-messages' bindtap='submitdata'>提交文章</button>
+  </view> -->
+</view>
+
+
+<!-- 已发表文章 -->
+<view class="article">文章列表</view>
+<block wx:for="{{posts_key}}" wx:for-item="item" >
+  <view class='article-container' bindlongtap='copy' data-index="{{index}}">
+    <!-- 图片 -->
+    <view>
+      <image class='article-img' src='{{item.imageTitle}}'></image>
+    </view>
+
+    <!-- 文章信息 -->
+    <view class='articelinfo'>
+      <view class='articel-title'>{{item.title}}</view>
+      <view class='articel-descript'>{{item.describ}}</view>
+    </view>
+
+    <!-- 编辑和删除 -->
+    <view class='articel-opertor'>
+      <!--<button class='complie' bindtap='bianji'>编辑</button>-->
+      <button class='delete' bindtap='delete' data-index="{{index}}">删除</button>
+    </view>
+    <text selectable='true'></text>
+  </view>
+</block>
+
+
+

+ 431 - 0
messageApplet/pages/mycenter/mycenter.wxss

@@ -0,0 +1,431 @@
+/* pages/mycenter/mycenter.wxss */
+
+page{
+  width: 100%;
+  height: 100%;
+  background-color: #F5F5F5;
+}
+.article{
+  padding-left: 10px;
+}
+/* 提醒复制路径 */
+.remind-copy{
+  height: 30rpx;
+  text-align: center;
+  line-height: 30rpx;
+  padding-top: 10rpx;
+  padding-bottom: 10rpx;
+  font-size:30rpx;
+  color: #cccccc;
+}
+
+/* 公众号所有信息 */
+.gong-content{
+  height: 160rpx;
+  display: flex;
+  flex-direction: row;
+  padding-left: 10rpx;
+  padding-top: 10rpx;
+  vertical-align: middle;
+  background-color: #fff;
+}
+
+/* 公众号头像 */
+.gong-img{
+  width: 120rpx;
+  height: 120rpx;
+  border-radius: 50%;
+  margin-top: 14rpx;
+}
+
+/* 公众号文本信息 */
+.gong-message{
+  padding-left: 40rpx;
+  padding-top: 24rpx;
+}
+
+/* 公众号名称 */
+.gong-name{
+  font-size: 34rpx;
+  font-family: '微软雅黑';
+}
+
+/* 公众号描述 */
+.gong-describe{
+  font-size: 28rpx;
+  margin-top: 10rpx;
+  width: 500rpx;
+  /* 超出文本隐藏 */
+  overflow:hidden;
+  /* 并显示省略号 */
+  text-overflow: ellipsis;
+  /* 不换行 */
+  white-space:nowrap;
+  color: rgb(179, 177, 177);
+  font-family: '微软雅黑';
+}
+
+/* .from-bg{
+  background: rgb(67, 196, 8);
+} */
+
+.tui-accordion-content{
+  margin: 10px;
+  border: 1px solid #c8c7cc;
+  border-radius: 5px;
+  overflow: hidden;
+}
+
+.tui-accordion-from{
+  padding-left: 0;
+}
+
+.tui-accordion-from input{
+  height: 80rpx;
+  line-height: 80rpx;
+}
+
+/* .tui-input-name{
+  height: 80rpx;
+  float: left;
+  width: 200rpx;
+} */
+
+/*文字列表样式  */
+
+.tui-menu-list{
+  line-height: 80rpx;
+  color: #555;
+  font-size: 35rpx;
+  /* padding: 0 0rpx 0 10px; */
+  position: relative;
+}
+.tui-menu-list:before{
+  content: '';
+  display: block;
+  /* height: 1px; */
+  width: 100%;
+  background-color: #c8c7cc;
+  position: absolute;
+  bottom: 0;
+  left: 10px;
+}
+.tui-menu-list:last-child:before{
+  height: 0;
+}
+/* 
+.tui-shangjiantou:after{
+  font-family:"iconfont" !important;
+  content: '\e734';
+  font-size: 40rpx;
+  position: absolute;
+  top: 50%;
+  display: inline-block;
+  -webkit-transform: translateY(-50%);
+  transform: translateY(-50%);
+  text-decoration: none;
+  right: 10rpx;
+} */
+
+/*清除浮动  */
+.tui-clear:after{
+  content:".";
+  display:block;
+  height:0;
+  clear:both;
+  visibility:hidden;
+}
+
+.tui-show{display: block;}
+.tui-hide{display: none;}
+
+/* 标签 */
+.title-container{
+  display: flex;
+  width: 100%;
+  height: 100rpx;
+  font-size: 40rpx;
+  align-items: center;
+  padding-left: 20rpx;
+  background-color:  #fff;
+}
+
+.title{
+  font-size: 32rpx;
+  margin-top: 30rpx;
+  margin-left: 20rpx;
+  font-weight: bold;
+}
+
+.des{
+  font-size: 32rpx;
+  margin-top: 10rpx;
+  margin-left: 20rpx;
+  font-weight: bold;
+}
+
+/* 输入框 */
+.input-style1{
+  width: 90%;
+  height: 90rpx;
+  margin-left: 30rpx;
+  border-bottom: 1px solid #ccc;
+}
+
+/* 上间隔 */
+.top-20{
+  margin-top: 20rpx;
+  width: 80%;
+}
+
+.descrbe{
+  width: 80%;
+}
+
+.articel-messages{
+  display: flex;
+  flex-direction: row;
+  padding-left: 20rpx;
+  padding-right: 20rpx;
+  /* background: #fff; */
+  padding-bottom: 30rpx;
+}
+
+/* 上传公众号图片 */
+.post-image{
+  width: 400rpx;
+  height: 80rpx;
+  font-size: 34rpx;
+  margin-top: 50rpx;
+  color: #fff;
+  background-color: rgb(8, 43, 196);
+}
+
+/* 图片容器 */
+.img-container{
+  width: 90%;
+  display: flex;
+  margin-left: 40rpx;
+  margin-top: 10rpx;
+  padding-bottom: 40rpx;
+  flex-direction: column;
+  align-items: center;
+  color: #fff;
+  background: rgb(255, 213, 124);
+}
+
+/* 显示图片 */
+.display-img{
+  width: 80%;  
+  height: 400rpx;
+}
+
+/* 提交文章信息 */
+.post-atical-messages{
+  width: 80%;
+  font-size: 38rpx;
+  height: 100rpx;
+  color: #fff;
+  background-color: rgb(67, 196, 8);
+  padding: 5rpx;
+  margin-top: 20rpx;
+  margin-bottom: 20rpx;
+}
+
+/* 留言内容container */
+.message-content{
+  display: flex;
+  flex-direction: row;
+  width: 97%;
+  margin-top: 40rpx;
+}
+
+/* 头像container */
+.head-container{
+  padding-left: 20rpx;
+}
+
+/* 用户名+留言内容 container */
+.username-message{
+  width: 450rpx;
+}
+
+/* 用户名style */
+.username{
+  font-size: 32rpx;
+  color: #ccc;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 20rpx;
+}
+
+/* 用户留言内容 */
+.message{
+  font-size: 33rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 6rpx;
+}
+
+/* 用户头像style */
+.user-hear-style{
+  width: 100rpx;
+  height: 100rpx;
+}
+
+/* “用户留言”文字 */
+.user-message{
+  font-size: 34rpx;
+  padding-left: 20rpx;
+  padding-top: 40rpx;
+  color: #ccc;
+}
+
+/* 精选和回复 */
+.reply_container{
+  font-size: 32rpx;
+  color: rgb(0, 60, 255);
+  padding-top: 15rpx;
+}
+
+/* 精选 */
+.jinxuan{
+    padding-top: 10rpx;
+}
+
+/* 回复输入框样式 */
+.reply-input{
+  width: 500rpx;
+  font-size: 32rpx;
+  color: #000;
+  margin-top: 20rpx;
+  border: #ccc solid 2rpx;
+}
+
+/* 回复提示文字 */
+.reply-content{
+  width: 700rpx;
+  padding-top: 10rpx;
+  padding-left: 10rpx;
+  font-size: 30rpx;
+}
+
+/* 作者回复container */
+.reply-container{
+  display: flex;
+  flex-direction: row;
+  margin-left: 20rpx;
+  margin-top: 20rpx;
+}
+
+/* 作者回复图标 */
+.autor-reply-line{
+  width: 6rpx;
+  height: 26rpx;
+  background-color: rgb(76, 250, 7);
+  padding-top: 6rpx;
+}
+
+/* 回复按钮 */
+.btn_reply{
+  width: 100rpx;
+  height: 60rpx;
+  font-size: 22rpx;
+}
+
+/* “作者”字体style */
+.author-text{
+  font-size: 32rpx;
+  color: #ccc;
+  font-family: '微软雅黑';
+  padding-left: 10rpx;
+}
+
+/* 作者回复内容信息 */
+.author-reply-message{
+  width: 510rpx;
+  font-size: 34rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 6rpx;
+}
+
+/* 删除 */
+.delete{
+  padding-top: 10rpx;
+}
+
+.pathText{
+  height: 100rpx;
+}
+
+.article-container{
+  width: 99%;
+  height: 200rpx;
+  display: flex;
+  flex-direction: row;
+  margin-top: 40rpx;
+  /* border: 2rpx solid #000; */
+  background: #fff;
+}
+
+.article-img{
+  width: 200rpx;
+  height: 200rpx;
+  padding-left: 10rpx;
+  /* border: 2rpx solid #000; */
+}
+
+
+.articel-title{
+  display: -webkit-box;
+  font-size: 30rpx;
+  margin-top: 20rpx;
+  -webkit-line-clamp: 2;
+  /* 超出文本隐藏 */
+  overflow:hidden;
+  /* 并显示省略号 */
+  text-overflow: ellipsis;
+  -webkit-box-orient: vertical;
+}
+
+.articelinfo{
+  width: 370rpx;
+  height: 200rpx;
+  padding-left: 20rpx;
+  /* border: 1px solid #000; */
+}
+
+.articel-descript{
+  display: -webkit-box;
+  width: 90%;
+  font-size: 30rpx;
+  margin-top: 10rpx;
+  color: rgb(199, 198, 198);
+  -webkit-line-clamp: 2;
+  /* 超出文本隐藏 */
+  overflow:hidden;
+  /* 并显示省略号 */
+  text-overflow: ellipsis;
+  -webkit-box-orient: vertical;
+  
+}
+
+.complie{
+  width: 150rpx; 
+  height: 75rpx; 
+  font-size: 30rpx;
+  margin-top: 20rpx;
+  border-radius: 10rpx;
+  color: #1457d4;
+}
+
+.delete{
+  width: 150rpx; 
+  height: 75rpx; 
+  font-size: 30rpx;
+  margin-top: 10rpx;
+  color: #1457d4;
+}

+ 119 - 0
messageApplet/pages/select/select.js

@@ -0,0 +1,119 @@
+// pages/select/select.js
+const app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    id: '',//公众号 id
+    avatarUrl:'',//管理员头像
+    nickName:'',//管理员网名
+    title: '',
+    name: '',
+    headpath: '',
+    describe: '',
+    formId: '',
+    check:false
+  },
+
+  checkOpertor:function(){
+    wx.navigateTo({
+      url: '../../pages/check/check?id=' + this.data.id
+    })
+  },
+  informOpertor:function(){
+    wx.navigateTo({
+      url: '../../pages/inform/inform?id=' + this.data.id
+    })
+  },
+
+  //文章管理
+  articelOpertor: function () {
+    wx.navigateTo({
+      url: '../../pages/mycenter/mycenter?id=' + this.data.id + "&headpath=" + this.data.headpath + "&name=" + this.data.name + "&describe=" + this.data.describe
+    })
+  },
+  
+  //跳转留言页面
+  messagesOpertor: function() {
+    wx.navigateTo({
+      url: '../../pages/myartical/myartical?id=' + this.data.id
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    var that = this;
+    var optionId = options.id;
+    var avatarUrls = options.avatarUrl;
+    var nickNames = options.nickName;
+    var names = options.name;
+    var headpaths = options.headpath;
+    var describes = options.describe
+    if (optionId == 1){
+        that.setData({
+          check:true
+        })
+    }
+    that.setData({
+      id: optionId,
+      nickName: nickNames,
+      avatarUrl: avatarUrls,
+      name: names,
+      headpath: headpaths,
+      describe: describes
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 8 - 0
messageApplet/pages/select/select.json

@@ -0,0 +1,8 @@
+
+{
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "后台管理",
+  "navigationBarTextStyle": "black"
+  
+}

+ 27 - 0
messageApplet/pages/select/select.wxml

@@ -0,0 +1,27 @@
+<!--pages/select/select.wxml-->
+
+<!-- <view class='bg'>
+  <button class='post-actical' bindtap='postArtical'>发表文章</button>
+  <button class='look-message' bindtap='lookMessage'>筛选留言</button>
+</view> -->
+
+<view class='userinfo'>
+  <image bindtap="bindViewTap" class="userinfo-avatar" src="{{avatarUrl}}" background-size="cover"></image>
+  <view>
+    <text class="userinfo-nickname">{{nickName}}</text>
+  </view>
+</view> 
+<view class='center-space'></view>
+
+<view class='opertor'>
+  <view class='article-opertor' bindtap='articelOpertor'>文章管理</view>
+  <view class='messages-opertor' bindtap='messagesOpertor'>留言管理</view>
+  <view class='inform-opertor' bindtap='informOpertor'>留言通知</view>
+  <block wx:if="{{check}}">
+    <view class='check-opertor' bindtap='checkOpertor'>公众号审核</view>
+  </block>
+  
+</view>
+
+
+

+ 93 - 0
messageApplet/pages/select/select.wxss

@@ -0,0 +1,93 @@
+/* pages/select/select.wxss */
+
+page{
+  width: 100%;
+  height: 100%;
+  background-color: #F5F5F5;
+}
+
+
+.bg{
+  margin-top: 40rpx;
+}
+
+.center-space{
+  height: 30rpx;
+  background: #F5F5F5;
+}
+
+.userinfo {
+  display: flex;
+  flex-direction: row;
+  height: 180rpx;
+  line-height: 180rpx;
+  background-color: #fff;
+  /* align-items: center; */
+}
+
+.userinfo-avatar {
+  width: 128rpx;
+  height: 128rpx;
+  margin: 30rpx;
+  border-radius: 50%;
+}
+
+.userinfo-nickname {
+  color: #aaa;
+}
+
+.post-actical{
+  width: 70%;
+  height: 100rpx;
+  font-size: 40rpx;
+  color: #fff;
+  background: rgb(33, 110, 211);
+}
+
+.look-message{
+  width: 70%;
+  height: 100rpx;
+  font-size: 40rpx;
+  margin-top: 40rpx;
+  color: #fff;
+  background: rgb(33, 110, 211);
+}
+
+.article-opertor{
+  width: 100%;
+  background: #fff;
+  padding-left: 20rpx;
+  padding-top: 30rpx;
+  padding-bottom: 30rpx;
+  font-size: 36rpx;
+  border-bottom: 2rpx #F5F5F5 solid;
+}
+
+.messages-opertor{
+  width: 100%;
+  background: #fff;
+  padding-left: 20rpx;
+  padding-top: 30rpx;
+  padding-bottom: 30rpx;
+  font-size: 36rpx;
+  border-bottom: 2rpx #F5F5F5 solid;
+}
+.inform-opertor{
+  width: 100%;
+  background: #fff;
+  padding-left: 20rpx;
+  padding-top: 30rpx;
+  padding-bottom: 30rpx;
+  font-size: 36rpx;
+  border-bottom: 2rpx #F5F5F5 solid;
+}
+
+.check-opertor{
+  width: 100%;
+  background: #fff;
+  padding-left: 20rpx;
+  padding-top: 30rpx;
+  padding-bottom: 30rpx;
+  font-size: 36rpx;
+  border-bottom: 2rpx #F5F5F5 solid;
+}

+ 343 - 0
messageApplet/pages/userinfo/userinfo.js

@@ -0,0 +1,343 @@
+// pages/userinfo/userinfo.js
+const app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    buttonDisabled: false,
+    modalHidden: true,
+    userInfo: {},
+    hasUserInfo: false,
+    canIUse: wx.canIUse('button.open-type.getUserInfo'),
+    inputContent: '',
+    inputContentxml: '',
+    id: '',
+    lock: false,
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    var that = this;
+    console.log(app.globalData.userInfo);
+
+    if(app.globalData.userInfo){
+      that.setData({
+        hasUserInfo: true,
+        userInfo: res.userInfo
+      });
+      wx.login({
+        success: function (res) {
+          // 用户已经授权过,不需要显示授权页面,所以不需要改变 isHide 的值
+          // 根据自己的需求有其他操作再补充
+          // 我这里实现的是在用户授权成功后,调用微信的 wx.login 接口,从而获取code
+
+          wx.request({
+            url: 'https://applet.yull.top/index/index/login',//获取唯一标识 openId
+            data: {
+              code: res.code
+            },
+            header: {
+              'content-type': 'application/json' // 数据格式(默认值)
+            },
+            method: 'post', //上传方式
+            success: function (res) {
+              console.log("openid" + res.data.openid);
+              // wx.setStorageSync('token', res.data.token)//消息模板会用到
+              wx.setStorageSync('openid', res.data.openid);//存储openid
+            }
+          });
+        }
+      });
+    }else{
+      that.setData({
+        hasUserInfo: false
+      });
+    }
+    // wx.getSetting({
+    //   success: function (res) {
+    //     if (res.authSetting['scope.userInfo']) {
+    //       wx.getUserInfo({
+    //         success: function (res) {
+    //           // 用户已经授权过,不需要显示授权页面,所以不需要改变 isHide 的值
+    //           // 根据自己的需求有其他操作再补充
+    //           // 我这里实现的是在用户授权成功后,调用微信的 wx.login 接口,从而获取code
+    //           console.log(res);
+    //           that.setData({
+    //             hasUserInfo: true,
+    //             userInfo:res.userInfo
+    //           });
+    //           wx.login({
+    //             success: function (res) {
+    //               // 用户已经授权过,不需要显示授权页面,所以不需要改变 isHide 的值
+    //               // 根据自己的需求有其他操作再补充
+    //               // 我这里实现的是在用户授权成功后,调用微信的 wx.login 接口,从而获取code
+
+    //               wx.request({
+    //                 url: 'https://applet.yull.top/index/index/login',//获取唯一标识 openId
+    //                 data: {
+    //                   code: res.code
+    //                 },
+    //                 header: {
+    //                   'content-type': 'application/json' // 数据格式(默认值)
+    //                 },
+    //                 method: 'post', //上传方式
+    //                 success: function (res) {
+    //                   console.log("openid" + res.data.openid);
+    //                   // wx.setStorageSync('token', res.data.token)//消息模板会用到
+    //                   wx.setStorageSync('openid', res.data.openid);//存储openid
+    //                 }
+    //               });
+    //             }
+    //           });
+    //         }
+    //       });
+    //     } else {
+    //       // 用户没有授权
+    //       // 改变 isHide 的值,显示授权页面
+    //       that.setData({
+    //         hasUserInfo: false
+    //       });
+    //     }
+    //   }
+    // });
+
+    // // 如果获取到用户信息就存储
+    // if (app.globalData.userInfo) {
+    //   console.log('用户信息');
+    //   this.setData({
+    //     userInfo: app.globalData.userInfo,
+    //     hasUserInfo: true
+    //   })
+    //   wx.setStorageSync('username', that.data.userInfo.nickName)
+    //   wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+    //   console.log("在index页面全局app1中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+    // } else if (this.data.canIUse) {
+    //   // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
+    //   // 所以此处加入 callback 以防止这种情况
+    //   app.userInfoReadyCallback = res => {
+    //     // console.log("用户名2:" + res.userInfo.nickName + " " + res.userInfo.avatarUrl)
+    //     // wx.setStorageSync('username', res.userInfo.nickName)
+    //     // wx.setStorageSync('headpath', res.userInfo.avatarUrl)
+    //     this.setData({
+    //       userInfo: res.userInfo,
+    //       hasUserInfo: true
+    //     })
+    //     wx.setStorageSync('username', that.data.userInfo.nickName)
+    //     wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+    //     console.log("在index页面全局app2中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+    //   }
+    // }
+  },
+
+  //点击按钮授权
+  getUserInfo: function (e) {
+    var that = this;
+    
+    var openid = wx.getStorageSync("openid");
+    
+    if (e.detail.userInfo) {
+      if (!openid) {
+        wx.login({
+          success: function (res) {
+            // 用户已经授权过,不需要显示授权页面,所以不需要改变 isHide 的值
+            // 根据自己的需求有其他操作再补充
+            // 我这里实现的是在用户授权成功后,调用微信的 wx.login 接口,从而获取code
+           
+            wx.request({
+              url: 'https://applet.yull.top/index/index/login',//获取唯一标识 openId
+              data: {
+                code: res.code
+              },
+              header: {
+                'content-type': 'application/json' // 数据格式(默认值)
+              },
+              method: 'post', //上传方式
+              success: function (res) {
+                console.log("openid" + res.data.openid);
+                // wx.setStorageSync('token', res.data.token)//消息模板会用到
+                wx.setStorageSync('openid', res.data.openid);//存储openid
+              }
+            });
+          }
+        });
+      }
+      app.globalData.userInfo = e.detail.userInfo
+      console.log(app.globalData.userInfo);
+      this.setData({
+        userInfo: e.detail.userInfo,
+        hasUserInfo: true
+      })
+      wx.setStorageSync('username', that.data.userInfo.nickName)
+      wx.setStorageSync('headpath', that.data.userInfo.avatarUrl)
+      console.log("在index页面临时授权中获取到的用户信息为:" + that.data.userInfo.nickName + " " + that.data.userInfo.avatarUrl);
+    } else {
+      wx.showToast({
+        title: '未授权',
+        icon: 'none',
+      })
+    }
+  },
+
+  addgong: function (e) {
+    if (this.data.hasUserInfo != true) {
+      wx.showToast({
+        title: '请点击获取头像',
+        icon: 'none',
+      })
+      return;
+    }
+    wx.navigateTo({
+      url: '../../pages/addgong/addgong'
+    })
+  }, 
+  //弹出回复框
+  showModal: function (event) {
+    if (this.data.hasUserInfo != true){
+      wx.showToast({
+        title: '请点击获取头像',
+        icon: 'none',
+      })
+      return;
+    }
+    this.setData({
+      modalHidden: !this.data.modalHidden,
+    })
+  },
+
+  // 获取弹出框密码
+  getInputContent: function (e) {
+    console.log(e.detail.value)
+    this.setData({
+      inputContent: e.detail.value
+    })
+  },
+
+  //确定
+  modalBindaconfirm: function () {
+    var that = this;
+    console.log(that.data.inputContent)
+    if (that.data.inputContent == "") {
+      wx.showToast({
+        title: '秘钥不能为空!',
+        icon: 'none',
+      })
+    } else {
+      //通过秘钥换取公众号 id
+      that.getIdentifyId();
+    }
+  },
+
+  //取消
+  modalBindcancel: function () {
+    this.setData({
+      modalHidden: !this.data.modalHidden,
+    })
+  },
+
+  //通过后台秘钥获取公众号 id
+  getIdentifyId: function () {
+    var that = this;
+    wx.request({
+      url: app.globalData.apiUrl + '/index/index/identify', //获取公众号信息
+      data: {
+        password: that.data.inputContent, //登录后台密码
+        openid: wx.getStorageSync('openid')
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        if (res.statusCode == 200) {
+          if (res.data.result == '1') {
+            //弹出框消失
+            that.setData({
+              modalHidden: !that.data.modalHidden,
+              buttonDisabled: !that.data.buttonDisabled,
+              id: res.data.content[0].id,
+            })
+            //上传openid
+            // that.postOpenid();
+            //跳转后台管理界面
+            wx.navigateTo({
+              url: '../../pages/select/select?id=' + that.data.id + "&avatarUrl=" + that.data.userInfo.avatarUrl + "&nickName=" + that.data.userInfo.nickName + "&headpath=" + res.data.content[0].headpath + "&name=" + res.data.content[0].name + "&describe=" + res.data.content[0].describes
+            })
+          } else {
+            wx.showToast({
+              title: '你不是管理员或者密码错误',
+              icon: 'none',
+            })
+          }
+        } else {
+          wx.showModal({
+            title: '服务器错误',
+            content: 'none',
+          })
+        }
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res.errMsg)
+        wx.showToast({
+          title: '联网失败 ',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 7 - 0
messageApplet/pages/userinfo/userinfo.json

@@ -0,0 +1,7 @@
+{
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "个人中心",
+  "navigationBarTextStyle": "black",
+  "enablePullDownRefresh": true
+}

+ 41 - 0
messageApplet/pages/userinfo/userinfo.wxml

@@ -0,0 +1,41 @@
+<!--index.wxml-->
+<import src="/wxSearch/wxSearch.wxml"/>
+<template is="wxSearch" data="{{wxSearchData}}"/>
+<import src="../../wxSearch/wxSearch.wxml"  />
+
+
+
+<template is="wxSearch" data="{{wxSearchData}}"  />
+
+<view wx:if="{{!hasUserInfo && canIUse}}">
+ 
+    <!-- <button class='bottom' type='primary' open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="bindGetUserInfo"> -->
+  <button class='bottom' wx:if="{{!hasUserInfo && canIUse}}"  open-type="getUserInfo" bindgetuserinfo="getUserInfo">获取头像昵称    </button>
+</view>
+ 
+<block wx:else>
+    <view class='userinfo'>
+      <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" background-size="cover"></image>
+      <view>
+        <text class="userinfo-nickname">{{userInfo.nickName}}</text>
+      </view>
+    </view> 
+    <view class='center-space'></view>
+    
+    
+  </block>
+<view>
+<view class='opertor'>
+  
+      <view class='admin-opertor' bindtap='showModal'>后台管理</view>
+      <view class='addgong-opertor' bindtap='addgong'>公众号入驻</view>
+      
+    </view>
+
+   
+    
+<button open-type="contact" class="bottom kefu">联系我</button>
+  <modal title="后台登录" style='color: #000;font-size: 32rpx;' hidden="{{modalHidden}}" confirm-text="确定" cancel-text="取消" bindconfirm="modalBindaconfirm" bindcancel="modalBindcancel">
+  <view class='reply-content' >只有管理员才能进行登录,您的ip地址已记录。</view>
+  <input bindinput='getInputContent' class='reply-input' placeholder='请输入密码' value='{{inputContent}}' placeholder-style='font-size: 32rpx;'></input></modal>
+</view>

+ 198 - 0
messageApplet/pages/userinfo/userinfo.wxss

@@ -0,0 +1,198 @@
+/* pages/userinfo/userinfo.wxss */
+page{
+  width: 100%;
+  height: 100%;
+  background-color: #F5F5F5;
+}
+
+.userinfo {
+  display: flex;
+  flex-direction: row;
+  height: 180rpx;
+  line-height: 180rpx;
+  background-color: #fff;
+  /* align-items: center; */
+}
+
+/* 提醒复制文字 */
+.remind-copy{
+  height: 30rpx;
+  text-align: center;
+  line-height: 30rpx;
+  padding-top: 10rpx;
+  padding-bottom: 10rpx;
+  font-size:30rpx;
+  color: #cccccc;
+}
+
+/* 复制 ID */
+.copy-nickName{
+  width: 100%;
+  font-size: 32rpx;
+  color: #ccc;
+  margin-left: 350rpx;
+}
+
+/* 悬浮图标样式 */
+.post {
+  float: right;
+  position: fixed;
+  bottom: 40px;
+  right: 40px;  
+  border: 0 solid #ffffff;
+  border-radius: 500px;
+  box-shadow: 4px 1px 1px #cccccc;
+}
+
+.userinfo-avatar {
+  width: 128rpx;
+  height: 128rpx;
+  margin: 30rpx;
+  border-radius: 50%;
+}
+
+.userinfo-nickname {
+  color: #aaa;
+}
+
+.center-space{
+  height: 20rpx;
+  background: #F5F5F5;
+}
+
+.center-space-gong{
+  height: 10rpx;
+  background: #F5F5F5;
+}
+
+/* 公众号所有信息 */
+.gong-content{
+  height: 160rpx;
+  display: flex;
+  flex-direction: row;
+  padding-left: 10rpx;
+  padding-top: 10rpx;
+  vertical-align: middle;
+  background-color: #fff;
+}
+
+/* 公众号头像 */
+.gong-img{
+  width: 120rpx;
+  height: 120rpx;
+  border-radius: 50%;
+  margin-top: 14rpx;
+}
+
+/* 公众号文本信息 */
+.gong-message{
+  padding-left: 40rpx;
+  padding-top: 24rpx;
+}
+
+/* 公众号名称 */
+.gong-name{
+  font-size: 34rpx;
+  font-family: '微软雅黑';
+}
+
+/* 公众号描述 */
+.gong-describe{
+  font-size: 28rpx;
+  margin-top: 10rpx;
+  width: 500rpx;
+  /* 超出文本隐藏 */
+  overflow:hidden;
+  /* 并显示省略号 */
+  text-overflow: ellipsis;
+  /* 不换行 */
+  white-space:nowrap;
+  color: rgb(179, 177, 177);
+  font-family: '微软雅黑';
+}
+
+/* 背景 */
+.background-color{
+  width: 100%;
+  height: 800rpx;
+  line-height: 800rpx;
+  display: flex;
+  position: fixed;  
+  align-items: center;
+  justify-content: center;  
+  background-color: #F5F5F5;
+}
+
+/* admin */
+.admin{
+  height: 50rpx;
+  font-size: 32rpx;
+  color: rgb(5, 1, 252);
+}
+
+.reply-input{
+  width: 500rpx;
+  height: 60rpx;
+  font-size: 32rpx;
+  color: #000;
+  margin-top: 20rpx;
+  border: #ccc solid 2rpx;
+}
+.admin-opertor{
+  width: 100%;
+  background: #fff;
+  padding-left: 20rpx;
+  padding-top: 30rpx;
+  padding-bottom: 30rpx;
+  font-size: 36rpx;
+  border-bottom: 2rpx #F5F5F5 solid;
+}
+
+.addgong-opertor{
+  width: 100%;
+  background: #fff;
+  padding-left: 20rpx;
+  padding-top: 30rpx;
+  padding-bottom: 30rpx;
+  font-size: 36rpx;
+  border-bottom: 2rpx #F5F5F5 solid;
+}
+.header {
+    margin: 90rpx 0 90rpx 50rpx;
+    border-bottom: 1px solid #ccc;
+    text-align: center;
+    width: 650rpx;
+    height: 300rpx;
+    line-height: 450rpx;
+}
+ 
+.header image {
+    width: 200rpx;
+    height: 200rpx;
+}
+ 
+.content {
+    margin-left: 50rpx;
+    margin-bottom: 90rpx;
+}
+ 
+.content text {
+    display: block;
+    color: #9d9d9d;
+    margin-top: 40rpx;
+}
+ 
+.bottom {
+    border-radius: 20rpx;
+    margin: 50rpx 25%;
+    width: 50%;
+    font-size: 35rpx;
+    color: #fff;
+    background-color: rgb(52, 214, 3);
+}
+
+.kefu{
+  margin: 200px 25%;
+}
+
+

+ 282 - 0
messageApplet/pages/write/write.js

@@ -0,0 +1,282 @@
+// pages/write/write.js
+const app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    nickName: '',
+    avatarUrl: '',
+    g_id: '',
+    no: '',
+    title: '',
+    messages: '',
+    message: '',
+    condition: false,
+    repeatcondition: true,
+   
+    messagesnull: ''
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (option) {
+    this.setData({
+      nickName: wx.getStorageSync('username'), 
+      avatarUrl: wx.getStorageSync('headpath'),
+      title: option.title,
+      no: option.no,
+      g_id: option.g_id,
+    })
+  },
+
+  //获取留言本文域信息
+  getmessages: function (e) {
+    this.setData({
+      messages: e.detail.value,
+    }) 
+  },
+
+  //服务推送通知
+  orderSign: function (e) {
+    var that = this;
+   
+   
+  },
+
+  //点击提交留言
+  btnmessage: function (e) {
+    var that = this;
+    console.log("提交的留言信息为"+that.data.messages)
+    if (that.data.messages == ""){
+      wx: wx.showToast({
+        title: '请输入留言内容...',
+        icon: 'none',
+      })
+    }else{
+      if (that.data.repeatcondition == true) {
+        wx: wx.showToast({
+          title: '正在发布',
+          icon: 'loading',
+        })
+        that.setData({
+          message: that.data.messages
+        })
+        //显示留言内容
+        that.setData({
+          condition: true,
+          repeatcondition: false,
+          messagesnull: ''
+        })
+        wx: wx.showToast({
+          title: '留言成功',
+          icon: 'success',
+        })
+
+        wx.requestSubscribeMessage({
+          tmplIds: ['IRajoxei3GCAo8xCFsK5emOUo4mhLedsnwAChfFCBDM'],
+           success(res) {
+             console.log(res);
+           }
+        });
+
+      } else {
+        wx: wx.showToast({
+          title: '您已经留过言了',
+          icon: 'none',
+        })
+      }
+    }
+  },
+
+  //删除留言
+  deleter_message: function () {
+    var that = this;
+    wx: wx.showToast({
+      title: '正在删除',
+      icon: 'loading',
+    })
+    wx.request({
+      url: app.globalData.apiUrl +'/index/message/userDeleteMessage', //删除留言内容
+      data: {
+        username: that.data.nickName,//用户名
+        messages: that.data.message,//留言内容
+        title: that.data.title,// 标题
+        no: that.data.no  //文章编号
+      },
+      header: {
+        'content-type': 'application/json' // 数据格式(默认值)
+      },
+      method: 'post', //上传方式
+      success: function (res) {   //回调成功
+        console.log(res.data)
+        wx: wx.showToast({
+          title: '删除成功',
+          icon: 'success',
+        })
+        //隐藏留言内容
+        that.setData({
+          condition: false,
+          repeatcondition: true,
+          message: '',
+          messages:''
+        })
+      },
+      //回调失败
+      fail: function (res) {
+        console.log(res)
+        wx.showToast({
+          title: '服务器错误',
+          icon: 'fail',
+        })
+      },
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+    var that = this;
+    if(that.data.messages==""){
+      console.log("没有留言数据!")
+    }else{
+     
+     
+      wx.request({
+        url: app.globalData.apiUrl +'/index/message/submit', //上传留言内容
+        data: {
+          username: wx.getStorageSync('username'),//用户名
+          avatarUrl: wx.getStorageSync('headpath'),//头像
+          messages: that.data.messages,//留言内容
+          title: that.data.title,// 标题
+          ischeck: '0', //作者是否已回复
+          no: that.data.no,  //文章编号
+          openid: wx.getStorageSync('openid'), //用户唯一标识
+          g_id: that.data.g_id,   //公众号标识
+         
+          //token: wx.getStorageSync('token')//token
+        },
+        header: {
+          'content-type': 'application/json' // 数据格式(默认值)
+        },
+        method: 'post', //上传方式
+        success: function (res) {   //回调成功
+          console.log(res.data)
+          if (res.statusCode == 200) {
+            // wx: wx.showToast({
+            //   title: '留言成功',
+            //   icon: 'success',
+            // })
+              wx.request({
+                url: app.globalData.apiUrl +'/index/message/userModel',//给公众号主发送消息
+              data: {
+                g_id: that.data.g_id,   //公众号标识
+                messages: that.data.messages,//留言内容
+                title: that.data.title,// 标题
+                username: wx.getStorageSync('username'),//用户名
+                page: 'pages/lookmessage/lookmessage?title=' + that.data.title + '&no=' + that.data.no + '&id=' + that.data.g_id
+              },
+              method: 'POST',
+              success: function (res) {
+                console.log("留言成功!")
+              },
+              fail: function (err) {
+                wx.showToast({
+                  title: '网络连接失败',
+                  icon: 'none',
+                })
+              }
+            });
+          } else {
+            wx: wx.showToast({
+              title: '留言失败',
+              icon: 'none',
+            })
+          }
+        },
+        //回调失败
+        fail: function (res) {
+          console.log(res)
+          wx.showToast({
+            title: '服务器错误',
+            icon: 'fail',
+          })
+        },
+      })
+    }
+  },
+      //通过消息推送到用户微信
+    //   var l = '自己服务器API';//消息模板路径
+    //   var d = {
+    //     form_id: that.data.formId,//表单id
+    //     type: '2'
+    //     // touser: that.data.g_id,//公众号id
+    //     // page: '/pages/index/index',//跳转页面
+    //     // form_id: that.data.formId,//表单id
+    //     // title: that.data.title,//文章标题
+    //     // message: that.data.message,//留言内容
+    //     // person: wx.getStorageSync('username')//留言者
+    //   }
+    //   console.log('formid提交:' + that.data.formId)
+    //   wx.request({
+    //     url: l,
+    //     data: d,
+    //     method: 'POST',
+    //     success: function (res) {
+    //       console.log("留言成功!")
+    //     },
+    //     fail: function (err) {
+    //       wx.showToast({
+    //         title: '网络连接失败',
+    //         icon: 'none',
+    //       })
+    //     }
+    //   });
+    // }
+  // },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 7 - 0
messageApplet/pages/write/write.json

@@ -0,0 +1,7 @@
+{
+  "backgroundTextStyle": "light",
+  "navigationBarBackgroundColor": "#ffffff",
+  "navigationBarTitleText": "写留言",
+  "navigationBarTextStyle": "black",
+  "enablePullDownRefresh": true
+}

+ 48 - 0
messageApplet/pages/write/write.wxml

@@ -0,0 +1,48 @@
+<!--pages/write/write.wxml-->
+
+<!-- 文章标题 -->
+<view class='title-container'>
+  <view class='title-style'>{{title}}</view>
+</view>
+
+<!-- 留言文本域 -->
+<view class='text-message-container'>
+  <textarea class='textarea-style'
+    bindinput='getmessages'
+    placeholder='留言将由作者筛选后,对所有人可见。'
+    placeholder-style='font-size: 32rpx; background-color: #ccc;'
+    maxlength='500'
+    value='{{messagesnull}}'
+    auto-focus='true'>
+  </textarea>
+</view>
+
+<!--留言提交区域 -->
+<view class='submit-area'>
+  <!-- 留言按钮 -->
+  <view class='btn-container'>
+    <form name='pushMsgF' report-submit bindsubmit='orderSign'>
+      <button form-type="submit" class='btn-message' bindtap='btnmessage'>留言</button>
+    </form>
+  </view>
+
+  <!-- 提交信息 -->
+  <block wx:if="{{condition}}">
+    <view class='submit-messages'>
+      <view class='liuyan-text'>我的留言</view>
+      <!-- 提交留言相关信息 -->
+        <view class='message-content'>
+          <view class='head-container'>
+            <image class='user-hear-style'  src='{{avatarUrl}}'></image>
+          </view>
+          <!-- 用户名与留言内容 -->
+          <view class='username-message'>
+            <view class='username'>{{nickName}}</view>
+            <view class='message'>{{message}}</view>
+            <view class='delete-message' bindtap='deleter_message'>删除</view>
+          </view>
+        </view>
+    </view>
+  </block>
+</view>
+

+ 117 - 0
messageApplet/pages/write/write.wxss

@@ -0,0 +1,117 @@
+/* pages/write/write.wxss */
+
+page{
+  width: 100%;
+  height: 100%;
+  background-color: #eee;
+}
+
+/* 头部contain */
+.title-container{
+  width: 100%;
+}
+
+/* 文章标题 */
+.title-style{
+  font-size: 38rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  margin-left: 20rpx;
+  padding-top: 35rpx;
+  padding-bottom: 40rpx;
+}
+
+/* 留言文本域container */
+.text-message-container{
+  width: 100%;
+  height: 250rpx;
+  padding-left: 20rpx;
+  padding-top: 20rpx;
+  background-color: #fff;
+}
+
+/* 文本框style */
+.textarea-style{
+  height: 200rpx;
+  font-size: 34rpx;
+  font-family: '微软雅黑';
+}
+
+/* 留言提交区域 */
+.submit-area{
+  width: 100%;
+}
+
+/* 按钮容器 */
+.btn-container{
+  padding-top: 40rpx;
+}
+
+/* 留言按钮 */
+.btn-message{
+  width: 600rpx;
+  height: 90rpx;
+  font-size: 34rpx;
+  color: #fff;
+  background-color: rgb(104, 192, 4);
+}
+
+/* “我的留言”文字 */
+.liuyan-text{
+  font-size: 32rpx;
+  color: #ccc;
+  padding-left: 20rpx;
+  padding-top: 40rpx;
+}
+
+/* 留言内容container */
+.message-content{
+  display: flex;
+  flex-direction: row;
+  width: 90%;
+}
+
+/* 头像container */
+.head-container{
+  padding-left: 20rpx;
+  margin-top: 20rpx;
+}
+
+/* 用户头像style */
+.user-hear-style{
+  width: 100rpx;
+  height: 100rpx;
+}
+
+/* 用户名+留言内容 container */
+.username-message{
+  width: 500rpx;
+  padding-top: 14rpx;
+}
+
+/* 用户名style */
+.username{
+  font-size: 30rpx;
+  color: #ccc;
+  font-family: '微软雅黑';
+  padding-left: 20rpx;
+  padding-top: 20rpx;
+}
+
+/* 用户留言内容 */
+.message{
+  font-size: 32rpx;
+  color: #000;
+  font-family: '微软雅黑';
+  padding-left: 10px;
+  padding-top: 6rpx;
+}
+
+/* 删除留言 */
+.delete-message{
+  font-size: 30rpx;
+  padding-left: 20rpx;
+  padding-top: 8rpx;
+  font-family: '微软雅黑';
+  color: rgba(10, 113, 231, 0.685);
+}

+ 77 - 0
messageApplet/project.config.json

@@ -0,0 +1,77 @@
+{
+	"description": "项目配置文件。",
+	"setting": {
+		"urlCheck": true,
+		"es6": true,
+		"postcss": true,
+		"minified": true,
+		"newFeature": true,
+		"coverView": true,
+		"nodeModules": true,
+		"autoAudits": false,
+		"showShadowRootInWxmlPanel": true,
+		"scopeDataCheck": false,
+		"checkInvalidKey": true,
+		"checkSiteMap": true,
+		"uploadWithSourceMap": true,
+		"babelSetting": {
+			"ignore": [],
+			"disablePlugins": [],
+			"outputPath": ""
+		}
+	},
+	"compileType": "miniprogram",
+	"libVersion": "2.9.4",
+	"appid": "wx3636f10fcd0790ff",
+	"projectname": "%E5%B0%8F%E9%B9%BF%E5%85%AC%E4%BC%97%E5%8F%B7%E7%95%99%E8%A8%80%E6%9D%BF",
+	"isGameTourist": false,
+	"simulatorType": "wechat",
+	"simulatorPluginLibVersion": {},
+	"condition": {
+		"search": {
+			"current": -1,
+			"list": []
+		},
+		"conversation": {
+			"current": -1,
+			"list": []
+		},
+		"plugin": {
+			"current": -1,
+			"list": []
+		},
+		"game": {
+			"currentL": -1,
+			"list": []
+		},
+		"gamePlugin": {
+			"current": -1,
+			"list": []
+		},
+		"miniprogram": {
+			"current": -1,
+			"list": [
+				{
+					"id": -1,
+					"name": "pages/check/check",
+					"pathName": "pages/check/check",
+					"query": "",
+					"scene": null
+				},
+				{
+					"id": -1,
+					"name": "pages/select/select",
+					"pathName": "pages/select/select",
+					"query": "",
+					"scene": null
+				},
+				{
+					"id": -1,
+					"name": "pages/mycenter/mycenter",
+					"pathName": "pages/mycenter/mycenter",
+					"scene": null
+				}
+			]
+		}
+	}
+}

+ 7 - 0
messageApplet/sitemap.json

@@ -0,0 +1,7 @@
+{
+  "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
+  "rules": [{
+  "action": "allow",
+  "page": "*"
+  }]
+}

+ 19 - 0
messageApplet/utils/util.js

@@ -0,0 +1,19 @@
+const formatTime = date => {
+  const year = date.getFullYear()
+  const month = date.getMonth() + 1
+  const day = date.getDate()
+  const hour = date.getHours()
+  const minute = date.getMinutes()
+  const second = date.getSeconds()
+
+  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
+}
+
+const formatNumber = n => {
+  n = n.toString()
+  return n[1] ? n : '0' + n
+}
+
+module.exports = {
+  formatTime: formatTime
+}

File diff suppressed because it is too large
+ 5 - 0
messageApplet/weui.wxss


BIN
messageApplet/wxSearch/images/wxSearch-icon-delete.png


+ 226 - 0
messageApplet/wxSearch/wxSearch.js

@@ -0,0 +1,226 @@
+// 定义数据格式
+
+/***
+ * 
+ * "wxSearchData":{
+ *  configconfig:{
+ *    style: "wxSearchNormal"
+ *  },
+ *  view:{
+ *    hidden: true,
+ *    searchbarHeght: 20
+ *  }
+ *  keys:[],//自定义热门搜索
+ *  his:[]//历史搜索关键字
+ *  value
+ * }
+ * 
+ * 
+ */
+var __keysColor = [];
+
+var __mindKeys = [];
+
+function initColors(colors){
+    __keysColor = colors;
+}
+
+function initMindKeys(keys){
+    __mindKeys = keys;
+}
+
+function init(that, barHeight, keys, isShowKey, isShowHis, callBack) {
+    var temData = {};
+    var view = {
+        barHeight: barHeight,
+        isShow: false
+    }
+    
+    if(typeof(isShowKey) == 'undefined'){
+        view.isShowSearchKey = true;
+    }else{
+        view.isShowSearchKey = isShowKey;
+    }
+
+    if(typeof(isShowHis) == 'undefined'){
+        view.isShowSearchHistory = true;
+    }else{
+        view.isShowSearchHistory = isShowHis;
+    }
+    temData.keys = keys;
+    wx.getSystemInfo({
+        success: function(res) {
+            var wHeight = res.windowHeight;
+            view.seachHeight = wHeight-barHeight;
+            temData.view = view;
+            that.setData({
+                wxSearchData: temData
+            });
+        }
+    })
+    
+    if (typeof (callBack) == "function") {
+        callBack();
+    }
+    
+    getHisKeys(that);
+}
+
+function wxSearchInput(e, that, callBack){
+    var temData = that.data.wxSearchData;
+    var text = e.detail.value;
+    var mindKeys = [];
+    if(typeof(text) == "undefined" || text.length == 0){
+        
+    }else{
+        for(var i = 0; i < __mindKeys.length; i++){
+            var mindKey = __mindKeys[i];
+            if(mindKey.indexOf(text) > -1){
+                mindKeys.push(mindKey);
+            }
+        }
+    }
+    temData.value = text;
+    temData.mindKeys = mindKeys;
+    that.setData({
+        wxSearchData: temData
+    });
+}
+
+function wxSearchFocus(e, that, callBack) {
+    var temData = that.data.wxSearchData;
+    temData.view.isShow = true;
+    that.setData({
+        wxSearchData: temData
+    });
+    //回调
+    if (typeof (callBack) == "function") {
+        callBack();
+    }
+    // if(typeof(temData) != "undefined"){
+    //   temData.view.hidden= false;
+    //   that.setData({
+    //     wxSearchData:temData
+    //   });
+    // }else{
+
+    // }
+}
+function wxSearchBlur(e, that, callBack) {
+    var temData = that.data.wxSearchData;
+    temData.value = e.detail.value;
+    that.setData({
+        wxSearchData: temData
+    });
+    if (typeof (callBack) == "function") {
+        callBack();
+    }
+}
+
+function wxSearchHiddenPancel(that){
+    var temData = that.data.wxSearchData;
+    temData.view.isShow = false;
+    that.setData({
+        wxSearchData: temData
+    });
+}
+
+function wxSearchKeyTap(e, that, callBack) {
+    //回调
+    var temData = that.data.wxSearchData;
+    temData.value = e.target.dataset.key;
+    that.setData({
+        wxSearchData: temData
+    });
+    if (typeof (callBack) == "function") {
+        callBack();
+    }
+}
+function getHisKeys(that) {
+    var value = [];
+    try {
+        value = wx.getStorageSync('wxSearchHisKeys')
+        if (value) {
+            // Do something with return value
+            var temData = that.data.wxSearchData;
+            temData.his = value;
+            that.setData({
+                wxSearchData: temData
+            });
+        }
+    } catch (e) {
+        // Do something when catch error
+    }
+    
+}
+function wxSearchAddHisKey(that) {
+    wxSearchHiddenPancel(that);
+    var text = that.data.wxSearchData.value;
+    if(typeof(text) == "undefined" || text.length == 0){return;}
+    var value = wx.getStorageSync('wxSearchHisKeys');
+    if(value){
+        if(value.indexOf(text) < 0){
+            value.unshift(text);
+        }
+        wx.setStorage({
+            key:"wxSearchHisKeys",
+            data:value,
+            success: function(){
+                getHisKeys(that);
+            }
+        })
+    }else{
+        value = [];
+        value.push(text);
+        wx.setStorage({
+            key:"wxSearchHisKeys",
+            data:value,
+            success: function(){
+                getHisKeys(that);
+            }
+        })
+    }
+    
+    
+}
+function wxSearchDeleteKey(e,that) {
+    var text = e.target.dataset.key;
+    var value = wx.getStorageSync('wxSearchHisKeys');
+    value.splice(value.indexOf(text),1);
+    wx.setStorage({
+        key:"wxSearchHisKeys",
+        data:value,
+        success: function(){
+            getHisKeys(that);
+        }
+    })
+}
+function wxSearchDeleteAll(that){
+    wx.removeStorage({
+        key: 'wxSearchHisKeys',
+        success: function(res) {
+            var value = [];
+            var temData = that.data.wxSearchData;
+            temData.his = value;
+            that.setData({
+                wxSearchData: temData
+            });
+        } 
+    })
+}
+
+
+
+module.exports = {
+    init: init,
+    initColor: initColors,
+    initMindKeys: initMindKeys,
+    wxSearchInput: wxSearchInput,
+    wxSearchFocus: wxSearchFocus,
+    wxSearchBlur: wxSearchBlur,
+    wxSearchKeyTap: wxSearchKeyTap,
+    wxSearchAddHisKey:wxSearchAddHisKey,
+    wxSearchDeleteKey:wxSearchDeleteKey,
+    wxSearchDeleteAll:wxSearchDeleteAll,
+    wxSearchHiddenPancel:wxSearchHiddenPancel
+}

+ 38 - 0
messageApplet/wxSearch/wxSearch.wxml

@@ -0,0 +1,38 @@
+<template name="wxSearch">
+  <view class="wxSearch" bindtap="wxSearchTap"  style="display:{{wxSearchData.view.isShow ? 'block':'none'}};height:{{wxSearchData.view.seachHeight}}px;top:{{wxSearchData.view.barHeight}}px;">
+    <view  class="wxSearchInner">
+
+        <view class="wxSearchMindKey">
+            <view class="wxSearchMindKeyList">
+                <block wx:for="{{wxSearchData.mindKeys}}">
+                    <view class="wxSearchMindKeyItem" bindtap="wxSearchKeyTap" data-key="{{item}}">{{item}}</view>
+                </block>
+            </view>
+        </view>
+
+        <view class="wxSearchKey" style="display:{{wxSearchData.view.isShowSearchKey ? 'block':'none'}}">
+            <text class="wxSearchTitle">热门搜索</text>
+            <view class="wxSearchKeyList">
+                <block wx:for="{{wxSearchData.keys}}">
+                    <view class="wxSearchKeyItem" bindtap="wxSearchKeyTap" data-key="{{item}}">{{item}}</view>
+                </block>
+            </view>
+        </view>
+        <view class="wxSearchHistory" style="display:{{wxSearchData.view.isShowSearchHistory ? 'block':'none'}}">
+            <text class="wxSearchTitle">搜索历史</text>
+            <view wx:if="{{wxSearchData.his[0]}}" class="wxSearchHistoryList">
+                <block wx:for="{{wxSearchData.his}}">
+                    <view class="wxSearchHistoryItem">
+                        <text class="wxSearchHistoryItemText" bindtap="wxSearchKeyTap" data-key="{{item}}">{{item}}</text> 
+                        <text class="wxSearchHistoryItemDel" bindtap="wxSearchDeleteKey" data-key="{{item}}" data-key="{{item}}">删除</text>
+                    </view>
+                </block>
+                <view class="wxSearchDeleteAllBtn" bindtap="wxSearchDeleteAll">清除历史</view>
+            </view>
+            <view wx:else>
+                <view class="wxSearchHistoryEmpty">搜索历史为空</view>
+            </view>
+        </view>
+    </view>
+  </view>
+</template>

+ 92 - 0
messageApplet/wxSearch/wxSearch.wxss

@@ -0,0 +1,92 @@
+.wxSearch{
+  position: absolute;
+  top: 43px;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  border-top: 1px #eee solid;
+  background-color: rgba(0, 0, 0, 0.2);
+}
+.wxSearchInner{
+  background-color: #fff;
+}
+.wxSearch-section{
+  background-color: #fff;
+  padding: 5px 10px;
+  border: 1px #eee solid;
+}
+.wxSearch-pancel{
+  display: flex;
+  flex-direction: row;
+}
+.wxSearch-input{
+  flex: 8; 
+  background-color: #eee;
+  padding: 5px 10px;
+}
+.wxSearch-button{
+  flex: 1;
+  border: none !important;
+  color: cornflowerblue !important;
+}
+
+.wxSearchTitle{
+  display: block;
+  padding: 10px 5px 5px 10px;
+  font-size: 12px;
+  text-align: center;
+}
+
+
+.wxSearchMindKeyItem{
+  padding: 10px 5px;
+  border-bottom: 1px solid #eee;
+  display: flex;
+  font-size: 14px;
+  color: cornflowerblue;
+}
+
+.wxSearchKeyList{
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+}
+
+.wxSearchKeyItem{
+  flex: 0 0 20%;
+  font-size: 14px;
+  text-align: center;
+  border: 1px solid #eee;
+  margin: 5px;
+  padding: 5px 10px;
+  border-radius: 5px;
+}
+.wxSearchHistoryItem{
+  padding: 10px 5px;
+  border-bottom: 1px solid #eee;
+  display: flex;
+}
+.wxSearchHistoryItemText{
+  flex: 8;
+  font-size: 14px;
+}
+.wxSearchHistoryItemDel{
+  flex: 1;
+  font-size: 12px;
+  text-align: center;
+  padding: 3px 5px;
+  border: 1px solid #eee;
+  border-radius: 5px;
+}
+.wxSearchHistoryEmpty{
+  text-align: center;
+  height: 50px;
+  line-height: 50px;
+  font-size: 12px;
+}
+.wxSearchDeleteAllBtn{
+  height: 50px;
+  line-height: 50px;
+  text-align: center;
+  font-size: 12px;
+}

+ 4 - 0
serviceApi/.gitignore

@@ -0,0 +1,4 @@
+.idea
+composer.lock
+*.log
+thinkphp

+ 42 - 0
serviceApi/.travis.yml

@@ -0,0 +1,42 @@
+sudo: false
+
+language: php
+
+branches:
+  only:
+    - stable
+
+cache:
+  directories:
+    - $HOME/.composer/cache
+
+before_install:
+  - composer self-update
+
+install:
+  - composer install --no-dev --no-interaction --ignore-platform-reqs
+  - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
+  - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
+  - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
+  - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
+  - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
+
+script:
+  - php think unit
+
+deploy:
+  provider: releases
+  api_key:
+    secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
+  file:
+    - ThinkPHP_Core.zip
+    - ThinkPHP_Full.zip
+  skip_cleanup: true
+  on:
+    tags: true

+ 1236 - 0
serviceApi/CHANGELOG.md

@@ -0,0 +1,1236 @@
+## 2019-1-11 V5.0.24
+
+本次更新包含了一个安全更新,建议更新
+
+- 改进关联的save方法
+- 改进模型数据验证
+- Collection增加values方法
+- 改进unique验证方法
+- 改进Request类的method方法
+
+## 2018-12-9 V5.0.23
+
+本次版本更新主要涉及一个安全更新,推荐尽快更新到最新版本。
+
+* Query支持调用模型的查询范围
+* 聚合查询字段支持`DISTINCT`
+* 改进闭包验证的参数
+* 多对多关联支持指定中间表数据名称
+* after/before验证支持指定字段验证
+* 改进多对多关联
+* 改进验证类
+* 增加`afterWith`和`beforeWith`验证规则 用于比较日期字段
+* 完善规则提示
+* 改进断线重连
+* 修正软删除的`destroy`方法
+* 修复模型的`save`方法当`data`变量为空 数据不验证
+* 模型增加`replace`方法
+* MorphOne 增加 make 方法创建关联对象实例
+* 改进`count`方法返回值类型
+* 改进聚合查询方法的正则判断
+* 改进`sqlsrv`驱动
+* 完善关联的`save`方法
+* 修正控制器名获取
+
+
+## 2018-10-22 V5.0.22
+
+该版本主要增加了JSON日志格式的支持,并且包含了一个安全更新。
+
+* 调试模式下关闭路由解析缓存
+* 改进Log类支持`json`日志格式
+* 改进聚合查询的安全性
+* 改进`count`查询的返回值类型
+
+## 2018-9-7 V5.0.21
+
+该版本主要做了一些已知问题的修正,改进了对Swoole的支持,以及增加路由解析缓存功能。
+
+* 增加路由解析缓存功能
+* 改进url生成的端口问题
+* 改进缓存驱动
+* 改进value方法的缓存处理
+* 修正Builder类的insertAll方法
+* 改进对Swoole的支持(使用参考:[xavier-swoole](https://github.com/xavieryang007/xavier-swoole))
+
+## 2018-5-11 V5.0.20
+
+该版本为修正版本,修正了一些已知的问题。
+
+* `join`方法的条件支持传入`Expression`对象
+* 改进驱动的`parseKey`方法
+* 改进Request类的`host`方法
+* 使用`exp`表达式更新数据的异常提示
+* 修正查询
+* 改进多对多关联的中间表模型更新
+
+## 2018-4-25 V5.0.19
+
+该版本属于改进版本,主要改进了composer自动加载及内置模板引擎的一处可能的安全隐患。
+
+* 改进composer自动加载
+* 改进模板引擎一处安全隐患
+* 改进`comment`方法解析
+* 改进分布式写入数据后及时读取的问题
+* 改进url操作方法的自动转换
+* 改进分页类魔术方法的返回值
+* SQL日志增加主从标记
+
+## 2018-4-14 V5.0.18
+
+该版本主要修正上一个发布的一些BUG,并且改进了`exp`表达式查询/写入的严谨性。
+
+* 修正`field`方法`*`兼容问题;
+* 修正`inc/dec`方法;
+* 修正`setInc/setDec`方法;
+* 改进`insertAll`方法;
+* 改进`parseTime`方法;
+* 改进`exp`表达式查询/写入的严谨性;
+
+## 2018-4-12 V5.0.17
+
+该版本主要是一些修正和改进,并且包含了一个安全更新。
+
+* 改进Response类`create`方法
+* 改进`inc/dec`查询
+* 默认模板渲染规则支持直接使用操作方法名
+* 改进视图驱动
+* 改进Request类ip方法 支持代理设置
+* 修正request类的`create`方法
+* 闭包查询使用`cache(true)`抛出异常
+* 改进composer自动加载文件
+* 增加`Expression`类及相关方法
+
+## 2018-3-26 V5.0.16
+
+该版本主要做了一些修正和改进,由于包含了一个安全更新,是一个推荐更新的版本。
+
+* 改进Url生成
+* 改进composer自动加载性能
+* 改进一对一查询
+* 改进查询缓存
+* 改进field方法
+* 优化Template类
+* 修正分页参数
+* 改进默认模板的自动识别
+* 改进Query类查询
+* Collection类改进
+* 改进模型类`readTransform`方法对序列化类型的处理
+* 改进trace显示
+* 文件日志支持自动清理
+* 改进断线重连的判断
+* 改进验证方法
+* 修正Query类view方法的数组表名定义
+* 改进参数绑定
+* 改进文件缓存的并发删除
+* 改进`inc/dec/exp`更新的安全性
+* 增加控制台配置
+
+## 2018-1-31 V5.0.15
+
+该版本主要进行了一些修正和完善
+
+* 改进View类
+* 改进chunk方法
+* 改进模板引擎的表达式语法
+* 改进自关联查询多级调用问题
+* 关联定义增加`selfRelation`方法用于设置是否自关联
+* 改进file类型的缓存`inc`和`dec`方法不改变缓存有效期
+* 改进软删除 支持设置`deleteTime`属性关闭
+* 改进`union`查询
+* 改进查询缓存
+* 优化File缓存自动生成空目录的问题
+* 改进日志写入并发问题
+* 修正`MorphTo`关联
+* 改进`join`自关联查询
+* 改进`case`标签解析
+* 改进Url类对`url_convert`配置的支持
+
+
+## 2018-1-1 V5.0.14
+
+V5.0.14版本主对复合主键进行了更多支持,改进了PHP7的兼容性,并且对数据库的一些问题做了改进。
+
+主要更新如下:
+
+* 改进Validate类的unique验证
+* Validate类增加checkRule方法用于静态验证多个规则
+* 改进多对多关联的save方法
+* 改进多对多的pivot对象
+* 修正setDec方法的延迟写入
+* max和min方法增加第二个参数用于设置是否强制转换数字
+* 改进View类
+* 改进join关联自身的问题
+* 改进union查询
+* 改进Url类
+* 改进同名路由不同请求的注册
+* 改进Builder类parseData对空数组的判断
+* 改进模板替换
+* 调整BelongsTo的hasWhere方法
+* 改进模板的编译缓存命名规则 增加布局模板的标识
+* 改进insertall方法
+* 改进chunk方法支持复合主键
+* 改进Error类的一个兼容问题
+* 改进model类的save方法的复合主键包含自增的情况
+* save方法改进复合主键的支持
+* 改进mysql的insertAll方法
+* 改进redis长连接多编号库的情况
+
+## 2017-12-12 V5.0.13
+
+`V5.0.13`主要是对模型和日志方面做了一些改进
+
+### [数据库和模型]
+
+* 改进Model类`save`方法对`oracle`的支持
+* 改进中间表模型的实例化
+* 改进`Pivot`类
+* 模型`saveall`方法支持配合`isUpdate`方法
+* 模型类增加`force`方法设置是否强制更新所有数据
+* 关联自动删除增加一对多关联删除支持
+* 改进`hasWhere`查询的数据重复问题
+* 改进一对多`with`关联查询的`field`支持
+* 模型`saveall`方法支持返回数据集 读取`resultSetType`属性
+* 改进废弃字段判断
+* 模型的`hasWhere`方法增加`fields`参数
+* 改进断线重连异常捕获机制
+* 修正Query类的`inc`和`dec`方法的Mysql关键词问题
+* 修正数据集对象的BUG
+
+### [其它]
+
+* 增加`app_dispatch`钩子位置
+* cookie类`httponly`参数默认改为false
+* File日志驱动增加`single`参数配置是否记录单个文件日志
+* 单个日志文件支持大小设置
+* 改进日志记录的ip地址
+* Redis缓存驱动改用`serialize`序列化替代json序列化
+* 改进异常捕获
+* 改进上传文件验证
+* 修正redis驱动
+* 改进File缓存的`clear`方法
+* 代码格式化规范
+* 改进一处PHP7.2的兼容问题
+* 调试模式下不读取字段缓存文件
+* `default_filter`支持在模块中配置生效
+
+## 2017-11-06 V5.0.12
+
+5.0.12是一个修正版本,包含了上个版本发布以来的一些修正和完善,主要包括:
+
+* 上传类和验证类的多语言支持;
+* 模型增加排除和废弃字段支持;
+* 改进insertAll方法的分批处理;
+* 改进对枚举类型的参数绑定支持;
+* 修正社区反馈的问题;
+
+
+### [数据库和模型]
+
+* 改进Connection类的getRealSql方法
+* 改进append方法支持一对一关联的bind设置
+* 改进whereTime查询
+* 改进model类的`destroy`方法
+* 修正softdelete
+* 修正`chunk`方法对时间字段的支持
+* Collection类增加`push`方法
+* 改进alias方法 
+* 修正模型类的`append`处理
+* 改进`appendRelationAttr`方法
+* 改进HasManyThrough关联
+* 改进MorphTo关联
+* 模型增加废除字段`disuse`定义
+* 增加排除字段方法`except`
+* 修正`has`方法 
+* 改进参数绑定类型对枚举类型的支持
+* 改进`insertAll`方法的分批处理
+
+
+### [其它]
+
+* 改进Loader类`controller`和`validate`方法支持多层
+* 验证提示信息支持多语言
+* File类错误信息支持多语言 
+* 模板渲染异常处理
+* 修正rest控制器
+* 改进trace驱动
+* 改进Cache类的`remember`方法 
+* 改进`url_common_param`的情况下urlencode的问题
+* 改进Url类
+* 改进`exception_handle`配置参数对闭包的支持 
+* 执行路由缓存命令前检测RUNTIME_PATH是否存在 
+* 调整部分`CacheDriver::dec`在为空的时候递减的行为
+* 优化移动端的显示
+* 改进对JSON-Handle插件的支持
+* 改进redis的`get`方法
+* 改进Request类的`host`方法
+
+
+## 2017-09-08 V5.0.11
+
+5.0.11是一个安全及修正版本,包含了上个版本发布以来的一些修正和完善,更新了几处可能的安全问题,主要包括:
+
+* 完善缓存驱动;
+* 改进数据库查询;
+* 改进URL生成类;
+* 缓存有效期支持指定过期时间;
+
+### [数据库和模型]
+
+* 改进数据库驱动类
+* 改进`group`方法的字段关键字冲突
+* 修正聚合查询返回null的问题
+* 改进Db类的强制重连
+* 改进关联的属性绑定
+* 修正事务的断线重连
+* 修正对象的条件查询
+* Db类增加`clear`方法
+* 改进数组查询条件中的`null`查询
+* 改进Query类的`chunk`方法支持排序设置
+* 改进HasOne和HasMany关联的`has`方法
+* 改进软删除的关联删除
+* 改进一个字段多次查询条件
+
+### [其它]
+
+* 缓存有效期支持指定过期时间(`DateTime`);
+* 改进Url生成对端口号的支持
+* 改进`RouteNotFound`异常提示
+* 改进路由分组的全局完整路由匹配
+* 修正部分验证规则的错误提示问题
+* 支持数据集和模型的XML响应输出
+* 改进模板的三元运算标签
+* 改进控制器不存在的错误提示
+* input助手函数支持`route`变量获取
+* 支持在配置文件中读取额外配置参数
+* 完善分页类
+* 修复Trait命名空间重复问题
+* 修正Request类的env方法
+* 优先使用Cookie中的多语言设置
+* 获取缓存标签的时候过滤无效的缓存标识
+* 修正路由批量注册的一个BUG
+* `exception_handle`配置参数支持使用闭包定义`render`处理
+* 请求缓存支持缓存标签设置
+* 缓存类`remember`方法增加并发锁定机制
+* 改进上传类对`swf`的支持
+* 改进Session类的`prefix`方法
+
+## 2017-07-04 V5.0.10
+
+5.0.10是一个修正版本,并包含了一个安全更新,推荐更新,主要包含:
+
+* 数据库和模型的多处改进
+* 添加新的行为监听
+* 路由支持Response设置
+* 改进调试模式下数据库敏感信息暴露
+
+### [数据库和模型]
+
+* 修正join其他表时生成的delete语句错误
+* 修正远程一对多
+* insertall支持replace
+* 修正多对多默认的中间表获取
+* 改进更新后的模型`update_time`数据更新
+* model类增加`removeRelation`方法
+* 模型类增加`setInc`和`setDec`方法
+* 模型类增加`autoWriteTimestamp`方法动态设置时间字段写入
+* 改进驱动类方法的断线重连判断
+* 改进多对多的数据更新
+* 改进BelongsToMany关联查询
+* 修正Query类的value和column方法
+* 改进in查询的去重问题
+* 修正模型类的scope方法传值问题
+* 调整模型的save方法`before_update`检查位置
+* 修改器和获取器方法支持第三个关联数据参数
+
+### [其它]
+
+* 默认关闭调试模式
+* 修复配置extra目录临时文件的错误加载
+* 添加log存储完成行为监听 `log_write_done`
+* 改进Build类生成公共文件的目录判断
+* 增加`response_send`行为监听 
+* 路由增加response参数用于绑定response处理行为
+* 改进redirect的参数传入
+* 改进环境变量的布尔值读取
+* 改进Url类的域名传入
+* 修正命令行文件生成
+* 改进命令行下面的URL生成
+* 添加`app_host`参数设置默认的URL根地址
+* 改进`Request`类`isSsl`方法判断支持CDN
+* 增加`record_trace`配置参数用于日志记录trace信息
+
+## 2017-05-20 V5.0.9
+
+5.0.9是一个修正版本,推荐更新,主要更新包含:
+
+### [数据库和模型]
+
+* 修正关联自动写入
+* 修正模型数据变化判断对为空数据的支持
+* 修正Query类的useSoftDelete方法返回值
+* 修正一对一嵌套关联数组定义的问题
+* 修正使用了手动参数绑定的时候的缓存BUG
+* 改进数据库类的一处不能嵌套查询的缺陷
+* 改进数据库断线重连判断
+* 改进模型的appendRelationAttr方法
+* 改进模型类destroy方法传入空数组的时候不进行任何删除操作
+* 改进一对多关联数据的输出
+* 改进模型的save方法对allowField方法的支持
+* 改进分页类的toarray方法 增加总页数
+* 比较运算增加闭包子查询支持
+* db助手函数默认不再强制重新连接
+* 改进belongsToMany的查询字段指定
+* 分页类增加each方法
+
+### [其它]
+
+* 修正路由分组的路由规则大小写识别问题
+* 修正命令行的日志切割生成
+* 修复URL生成时路由规则中的参数没有进行 urlencode
+* 改进Request类的filter过滤机制 支持正则
+* 改进Response类支持手动设置contentType
+* 修正异常模板中助手函数未定义错误
+
+## 2017-04-28 V5.0.8
+
+### 主要调整
+
+* 改进关联模型
+* 改进日志记录
+* 增加多态一对一关联
+* 修正社区反馈的一些BUG
+
+### [ 请求和路由 ]
+
+* 修正Request类`cookie`方法对前缀的支持
+* 改进全局请求缓存的缓存标识
+* 改进Request类`param`方法
+* 修正别名路由
+
+### [ 模型和数据库 ]
+
+* 改进模型数据的更新检查
+* 改进Query类的`column`方法
+* 改进软删除条件在使用闭包查询情况下多次生成的问题
+* belongsToMany增加数据同步方法
+* 查询范围支持静态调用
+* 增加多态一对一(MorphOne)关联
+* 改进BelongsTo关联
+* 改进多态关联支持关联数据添加和注销
+* 改进多对多关联,支持中间表模型自定义 并且定义的时候不需要使用完整表名
+* 改进浮点数类型转换避免出现逗号
+* 调整关联模型的save方法返回值
+* 模型类的get方法第一个参数必须 如果传入null则返回null
+* model的save方法改进如果数据没有更新不执行
+* Query增加`useSoftDelete`方法可以单独设置软删除条件
+* 重载BelongsToMany的`selectOrFail`和`findOrFail`方法
+* 重载BelongsToMany的`select` 、`find`和 `paginate`方法
+* 增加模型和`Pivot`对象的`parent`属性
+* 多对多关联支持设置中间表模型
+* 改进Query类的`view`方法中字段的关键字问题
+* 主从数据库的时候开启事务始终操作主库
+
+### [ 其它 ]
+
+* 改进Cookie类的`get`方法支持获取全部
+* `schema`指令增加`config`参数,支持传入数据库连接配置
+* 改进cache类的`store`方法为当次有效
+* 修正cache助手函数对`option`传参的支持
+* 修复`optimize:autoload`命令在`EXTEND_PATH`目录不存在的情况下,类库映射生成错误问题
+* 支持自定义的根命名空间也可以生成类库映射缓存
+* 验证字段比较支持对比其他字段
+* 修复`Session::prefix('xxx');`设置当前作用域BUG
+* 改进`optimize::schema`指令
+* 修复`clear`指令无法删除多级目录下文件的问题
+* 改进默认语言读取和自动侦测
+* 改进日志记录格式 并且命令行下面日志改为实时写入
+* 修正模板标签默认值某些情况无效bug
+* 改进Url生成对完整域名的支持
+* 改进`Clear`指令不删除`.gitignore` 文件
+* 修复Memcache缓存驱动的`inc`方法
+
+### 调整
+
+* 如果自定义了应用的命名空间的话,原来的`app_namespace`配置参数改为`APP_NAMESPACE`常量在入口文件中定义
+* 多对多关联的中间表名称不需要添加表前缀
+* 模型的scope方法之后只能使用数据库查询方法而不能使用模型的方法
+
+## 2017-02-24 V5.0.7
+
+### 主要调整
+
+本次更新主要为BUG修正和改进,主要改进如下:
+
+* 改进全局请求缓存对子域名的支持;
+* 改进数据缓存自动更新机制;
+* 关联统计支持指定统计属性名;
+* 模型嵌套关联支持数组方式;
+* HasOne关联支持`has`和`hasWhere`方法;
+* 路由的`ext`和`deny_ext`参数允许设置为空(表示不允许任何后缀或者必须使用后缀访问);
+
+### 修正如下
+
+* 修正 IN / NOT IN 型查询条件为空导致的 sql 语法错误
+* 修正分页类的`toArray`方法对简洁模式的支持
+* 修正Model类`delete`方法对多主键的处理
+* 修正软删除对`Mongodb`的支持
+* 修正`Connection`类一处可能的错误
+* 改进Query类的find方法的缓存机制
+* 修正BelongsTo关联
+* 修正JOIN方式一对一关联预载入闭包查询
+* 修正Query类的`insert`方法一处可能存在的警告错误
+* 修正Model类一处Collection的`use`冲突
+* 修正Model类`hasWhere`方法
+* 修正URl生成对`ext`参数的支持
+* 文件缓存`clear`方法会删除空目录
+* 修正Route类的`parseUrlPath`方法一处问题
+
+### 调整如下
+
+* 默认关闭session的安全参数`secure`,此选项仅能在HTTPS下设置开启
+
+## 2017-02-07 V5.0.6
+
+### 主要调整:
+
+本次更新主要为BUG修正及优化(可无缝升级):
+
+* 数据库支持断线重连机制;
+* 改进查询事件的回调参数;
+* 改进数据自动缓存机制;
+* 增加时间字段自动格式转换设置;
+* `MongoDb`和`Oracle`扩展更新至最新核心框架;
+
+### [数据库和模型]
+
+* 修正hasMany关联的`has`方法
+* 去除一些数据库惯例配置 避免使用数据库扩展的时候影响
+* 改进多对多的`attach`方法的返回值
+* 增加Mysql的断线重连机制和开关
+* 改进Query类的`find`方法数据缓存机制
+* 改进Query类查询事件的回调参数
+* 改进Query类的自动缓存更新
+* Model类增加`readonly`方法
+* 改进Model类的`has`和`hasWhere`方法
+* 改进模型类的`get`和`all`方法 第二个参数为true或者数字表示缓存参数
+* 修复闭包查询条件为空导致的 sql 语法错误
+* 改进Query类的`setBuilder`方法 避免因自定义连接器类后找不到生成器类
+* 删除Connection类废弃属性`resultSetType`
+* 优化Connection类`close`方法
+* 修正Connection类的`bindParam`方法对存储过程的支持
+* 数据库配置参数`datetime_format` 设置为`false`表示关闭时间字段自动转换输出
+* 改进软删除的数据库兼容性问题 支持`Mongodb`
+
+### [其它]
+
+* 改进Url类生成 `root`为`/`的情况
+* redirect助手函数和controller类的redirect方法增加with参数
+* 全局请求缓存添加排除规则 添加request_cache_except配置参数
+* Cache类store方法参数允许为空 表示获取当前缓存驱动句柄
+* 改进Validate类的ip验证规则
+
+## 2017-01-23 V5.0.5
+### 主要调整:
+
+本次更新主要改进了数据访问层和模型关联:
+
+* 增加快捷查询及设置方法;
+* 增加关联统计功能;
+* 增加关联查询延迟预载入功能;
+* 增加关联一对一自动写入和删除;
+* 改进存储过程查询;
+* 改进关联数据输出;
+* 优化查询性能;
+* 模型时间字段自动格式化输出;
+
+### [请求和路由]
+
+* 改进路由定义的后缀检测
+* Route类的`rest`方法支持覆盖定义
+* 改进Request类的`put`和`post`方法对`json`格式参数的接收
+* Request类增加`contentType`方法
+* 改进Route类`setRule`方法 
+* 改进Request类的`create`方法
+* 改进路由到控制器类的方法对默认渲染模板的影响
+* 修正Url类`build`方法定义路由别名后的BUG
+
+### [数据库和模型]
+
+* 增加关联统计功能
+* 增加一对一关联自动写入功能
+* 修正聚合模型的`delete`方法
+* 改进Model类的`useGlobalScope`方法
+* Model类的日期类型支持设置为类名
+* Query类增加`data`/`inc`/`dec`/`exp`方法用于快捷设置数据 `insert`和`update`方法参数可以为空 读取`data`设置数据
+* 优化Connection的查询性能
+* 修正Builder类的`parseOrder`方法
+* 修正BelongsToMany类的`attach`方法
+* BelongsToMany类的`attach`方法改进 支持批量写入
+* 改进BelongsToMany类的`saveall`方法 增加第三个参数 用于指定额外参数是否一致
+* Query类的`order`方法支持多次调用合并
+* 改进`count`方法对`group`查询的支持
+* 增加时间戳自动写入的判断
+* 改进Model类`writeTransform`方法
+* 改进Model的时间戳字段写入和读取
+* 写入数据为对象的时候检测是否有`__toString`方法
+* 改进Mysql驱动的`getFields`方法
+* 改进自动时间字段的输出
+* `like`查询条件支持数组
+* 自动时间字段的获取自动使用时间格式化
+* 改进单个字段多次Or查询情况的查询
+* 修正`null`查询的条件合并
+* 改进Query类`paginate`方法第一个参数可以使用数组参数
+* 改进数据集对象的返回,由Query类的select方法进行数据集转换,原生查询不再支持返回数据集对象
+* 增加`whereNull`、`whereIn`等一系列快捷查询方法
+* `fetchPdo`方法调整
+* 改进对存储过程调用的支持 改进`getRealSql`的调用机制 改进数据表字段使用中划线的参数绑定支持
+* 数据库配置参数增加`result_type` 用于设置数据返回类型 方法参数名称调整
+* 改进Query类的`whereTime`方法支持更多的时间日期表达式(默认查询条件为大于指定时间表达式)
+* 取消`min`/`max`/`sum`/`avg`方法的参数默认值
+* Query类增加`getPdo`方法用于返回`PDOStatement`对象
+* 改进`today`的日期表达式查询
+* 改进关联属性的获取
+* 改进关联定义中包含查询条件后重复执行的问题
+* 改进参数绑定支持中文字段自动绑定
+* 改进Builder类的`insertall`方法 增加对null和对象数据的处理
+* 改进参数绑定类型 支持`bit`类型自动绑定
+* Connection类`model`方法更改为`getQuery`
+* 优化Connection类`__call`方法
+* 修正聚合模型
+* 一对一关联预载入默认改为IN查询方式
+* 增加`collection`助手函数用于数据集转换
+* 增加`load_relation`助手函数用于数组的延迟预载入
+* 改进Model类的`has`方法第二个参数支持使用数组和闭包,无需再使用`hasWhere`
+* `relation`方法支持嵌套关联查询
+* 增加`think\model\Collection`作为模型的数据集查询集合对象
+* 取消关联定义的`alias`参数(仅`morphTo`保留)
+* Model类的`delete`方法,支持没有主键的情况
+* Model类的`allowField`方法支持逗号分割的字符串
+* 改进写入数据的自动参数绑定的参数名混淆问题
+* 关联预载入查询的属性名默认使用小写+下划线命名
+* Query类的`with`和`relation`方法支持多次调用
+* Collection类增加`hidden`、`visible`和`append`方法
+* 修正软删除的强制删除方法
+
+### [其它]
+
+* `unique`验证规则支持指定完整模型类 并且默认会优先检测模型类是否存在 不存在则检测数据表
+* 改进`Loader`类的`model`、`controller` 和 `validate`方法 支持直接传入类名实例化
+* `Session`类增加安全选项`httponly`和`secure`
+* 可以允许自定义`Output`的driver,以适应命令行模式下调用其它命令行指令 
+* 改进`loader`类`action`的参数污染问题
+* Validate类的`confirm`验证改为恒等判断
+* 改进`Validate`类的错误信息处理
+* 修正`Validate`类的布尔值规则验证
+* 改进`cookie`助手函数对前缀的支持
+* 文件缓存默认开启子目录缓存避免文件过多导致性能问题
+
+### [调整]
+* Connection类`model`方法更改为`getQuery`
+* 原生查询不再支持返回数据集对象
+* 分页查询返回类型变成`think\Paginator`(用法不变)
+* 模型的时间日期字段会自动进行格式化输出,不需要进行额外处理。
+* Session类添加了`secure`和`httponly`参数,并且默认是true
+
+## 2016-12-20 V5.0.4
+### 主要调整:
+
+* 关联模型重构并增加多态一对多关联;
+* 数据库支持一个字段多次调用不同查询条件;
+* 增加数据库CURD事件支持;
+* 路由到类和控制器的方法支持传入额外参数;
+* 支持全局模板变量赋值;
+* 模型支持独立设置查询数据集对象;
+* 日志针对命令行及调试做出改进;
+* 改进Hook类的行为方法调用
+
+### [请求和路由]
+* 请求缓存支持模块单独开启
+* Request类`post`方法支持获取`json`方式的请求数据
+* 路由到类的方法和控制器方法 支持传入额外参数,用于方法的参数
+* 改进控制器自动搜索的目录规范
+* 改进请求缓存
+* 改进自动参数绑定
+* 修正路由的请求缓存设置
+* 改进Route类name方法
+
+### [数据库和模型]
+* 增加数据库查询(CURD)事件
+* 改进多表更新的字段不存在问题
+* 改进Model类的`useGlobalScope`方法
+* 修正子查询作为表名查询的问题
+* Model类增加`resultSetType`属性 用于指定模型查询的数据集对象(默认为空返回数组) 
+* Model类增加`toCollection`方法(自动调用)
+* 关联模型架构调整
+* 改进预载入`with`方法的参数支持小写和下划线定义
+* 修正关联多对多一处错误
+* 改进关联多对多的查询
+* 关联模型支持多态一对多关联
+* 预载入关联查询支持关联对象属性绑定到当前模型
+* 支持追加关联对象的属性到当前模型数据
+* 一对一关联预载入支持JOIN和IN两种方式(默认为JOIN)
+* 改进多对多查询
+* 改进模型更新的数据变化比较规则
+* 查询支持一个字段多次查询条件
+* 改进sql日志的sql语句
+* 修正`join`自身表的别名覆盖问题
+* 模型类的`connection`属性和数据库默认配置合并
+* 改进`in`和`between`查询条件的自动参数绑定
+* 改进Query类对数据集对象以及关联字段排序的支持
+* 增加模型的快捷事件方法
+* 改进Query类的`getTableInfo`方法缓存读取
+* model类的`saveAll`方法支持调用`allowField`方法进行字段过滤
+* 修正关联查询的时候 `whereTime`方法的bug
+* 改进Query类的聚合查询
+* table方法支持字符串方式的子查询
+* 修正`count` `avg`方法使用`fetchsql`无法正确返回sql的问题
+
+### [其它]
+* 改进命令行下的日志记录
+* 部署模式下简化日志记录
+* 增加debug日志类型 仅限调试模式记录
+* 改进Template类`parseTemplateFile`方法
+* 改进Validate类的`getRuleMsg`方法
+* 控制器的`error`方法在AJAX请求默认返回url为空
+* Validate类架构方法增加`field`参数 用于设置验证字段的描述
+* 改进App类`invokeMethod`方法对架构函数依赖注入的支持
+* 增加RedirectResponse的`restore`方法返回值
+* View类增加`share`静态方法 用于静态赋值模板变量
+* 验证类增加`hasScene`方法判断是否存在某个场景的验证配置
+* 修正redis和session驱动的`destroy`方法返回值
+* 空操作方法的参数传入去掉操作方法后缀
+* 在控制器中调用request和view增加类型提示
+* 改进`input`助手函数支持多维数据获取
+* Cache类增加`pull`和`remember`方法
+* 改进验证类的`confirm`验证规则 支持自动规则识别
+* 改进验证类的错误信息定义
+* 增加Validate类自定义验证错误信息的替换规则
+* Cookie类增加`forever`方法用于永久保存
+* 模板渲染支持从视图根目录读取模板
+* 改进Hook类的exec方法
+
+### [调整]
+* Db类查询不再支持设置自定义数据集对象
+* 废除Query类的`fetchClass`方法
+* 控制器的`error`方法在AJAX请求默认返回的url为空
+* 关联方法定义不支持使用小写下划线,必须使用驼峰法
+* 行为类的方法必须使用驼峰法命名
+
+## 2016-11-11 V5.0.3
+### 主要调整:
+* 请求缓存增强;
+* 路由增强;
+* 数据库和模型完善;
+* 支持反射的异常捕获;
+* File类改进;
+* 修正社区反馈的一些BUG;
+
+### [ 请求和路由 ]
+
+* 资源路由自动注册的路由规则的时候会记录当前使用的资源标识;
+* 增强请求缓存功能和规则定义,支持全局自动缓存
+* 修正控制器自动搜索的大小写问题
+* 修正路由绑定到命名空间后 类的自动定位
+* 改进Route类的parseRule方法 路由地址中的变量替换不自动去除路由变量
+* 改进控制器自动搜索
+* Route类增加setOption和getOption方法 用于记录当前路由执行过程中的参数信息
+* 优化路由分组方法
+* 改进分组路由的url生成
+
+### [ 数据库和模型 ]
+
+* 一对一关联查询方法支持定义`field`方法
+* 聚合模型支持设置`field`属性
+* 改进Query类的`alias`方法
+* 改进Query类`join`和`view`方法的table参数
+* 改进Query类`where`方法
+* 改进Query类的`paginate`方法,支持`order`方法
+* 改进Query类的`min`和`max`方法支持日期类型
+* 修正软删除`withTrashed`方法
+* 优化Connection类的`getRealSql`方法生成的sql
+
+### [ 其它 ]
+* 增加request_cache和request_cache_expire配置参数用于配置全局请求缓存;
+* 修正input助手函数的数组过滤
+* cache助手函数支持清空操作
+* 改进Config类load方法 一级配置名称强制转为小写
+* 修正Url多次生成的问题
+* File类修正某些环境下面无法识别上传文件的问题
+* 改进App类的空操作方法调用
+* 域名部署URL生成不依赖 url_domain_deploy 配置参数
+* 修正Url类域名部署的问题
+* 视图文件目录支持集中式存放 不放入模块目录
+* cache助手函数支持 remember方法
+* Request类的input方法或者input助手函数的`filter`参数支持传入null 表示不过滤
+
+## 2016-10-24 V5.0.2
+### 主要调整:
+
+* 数据库和模型完善;
+* 路由功能完善;
+* 增加`yaml`配置格式支持;
+* 依赖注入完善;
+* Session类完善;
+* Cookie类完善;
+* Validate类完善;
+* 支持反射类的异常捕获;
+* 修正社区反馈BUG;
+
+### [ 请求和路由 ]
+* 依赖注入的类如果定义了`invoke`方法则自动调用
+* Request类的`header`方法增加自定义header支持
+* Request类禁止直接实例化调用
+* 改进Request类ip方法
+* 路由变量规则支持闭包定义
+* 路由参数增加`ajax`和`pjax`判断
+* 别名路由增加允许和排除操作
+* 改进路由域名绑定后的url生成
+* 路由生成改进对路由到类的支持
+* 路由生成支持`url_param_type`配置参数
+* 路由生成支持别名路由
+* Route重定向规则支持更多` schema`
+* 别名路由支持定义单独方法的请求类型
+* 改进路由分组的url生成
+* 路由规则的组合变量支持可选分隔符定义
+* 改进路由合并参数的获取
+* 路由规则支持单独设置url分隔符,路由参数为 `param_depr`
+* 自动搜索控制器支持自定义访问控制器层的情况
+* 改进路由标识不区分大小写
+* 改进路由地址是否定义过路由规则的检测
+
+### [ 数据库和模型 ]
+* 改进Query类的join方法
+* 改进Query类分页方法的参数绑定
+* 修正软删除方法
+* 修正Query类parseOrder方法一处错误
+* 修正sqlsrv驱动parseOrder方法
+* 修正Query类setInc和setDec方法
+* 改进Model类的save方法支持非自增主键的处理
+* 整型字段的参数绑定如果为空写入默认值0
+* 改进Model类has和hasWhere方法
+* 改进Query类的value方法缓存判断
+* 改进Query类join方法对子查询支持
+* 改进Query类的table方法和alias方法用法
+* 关联预载入支持`hasOne`自关联
+* 改进Builder类的parseKey方法
+* 改进Builder类的join/alias/table方法的解析
+* 改进全局查询范围
+* 改进Query类的聚合查询方法的返回值
+* 改进关联属性的读取
+* 改进聚合模型主键和关联键相同的情况
+* 改进模型在开启`class_suffix`参数情况下的name属性的识别
+
+### [ 其它 ]
+* Cache类增加`remember`方法 用于当获取的缓存不存在的时候自动写入
+* Session类增加`flash`方法用于设置下一次请求有效的值 
+* Session类增加`flush`方法用于清空当前请求有效的值 
+* Session类增加`push`方法用于更新数组数据
+* 增加yaml配置格式支持
+* 改进App类的反射异常无法捕获问题
+* 修正session助手函数的清空操作
+* 改进验证类的`image`方法
+* 改进验证类的`activeUrl`方法 
+* 改进自定义验证规则的使用
+* 改进控制器自动搜索后的控制器名获取
+* 修正import方法加载extend目录类库
+* 修正json_encode时 "Failed calling XXX::jsonSerialize()" 的异常
+* 改进Loader类model和validate方法的单例问题
+* 改进方法执行的日志记录
+* 改进模板引擎的Think变量解析
+* 改进Lang类`load`方法
+* 验证错误信息支持多语言读取
+* 改进ROOT_PATH常量
+* 改进语言包加载
+* 改进模板session和cookie变量获取,自动判断前缀
+* 缓存驱动统一增加handler方法用于获取操作对象的句柄(某些缓存类型可能为null)
+* File类增加`__call`方法用于兼容5.0版本的`md5`和 `sha1`方法
+* 改进文件缓存驱动的`clear`方法
+* Lang类增加`setLangCookieExpire`方法设置多语言cookie过期时间
+* 增加`route_complete_match`配置参数
+
+### [ 调整 ]
+下列模型属性和方法由原来的静态(static)定义改为动态定义:
+* 聚合模型的`relationModel`属性
+* Model类的`useGlobalScope `属性
+* 全局查询范围方法`base`改为动态方法
+* 软删除属性 `deleteTime`属性
+
+
+## 2016-9-28 V5.0.1
+### 主要调整:
+* [依赖注入](215849)完善;
+* [扩展配置](118027)文件位置调整;
+* 新增数据表[字段缓存命令](211524);
+* 支持设置当前的查询对象;
+* 支持[请求和路由缓存](215850);
+
+### [ 请求和路由 ]
+* 改进Controller类的`success`和`error`方法的跳转地址识别 支持更多Scheme
+* 操作方法和架构方法支持任何对象自动注入
+* Requesst类增加`getInput`方法 用于获取` php://input`值
+* 路由到方法的时候 支持架构方法注入请求对象
+* 改进Route类路由到类的判断
+* Request增加`cache`方法,支持请求缓存
+* 绑定到模块后 路由依然优先检查
+* 路由增加请求缓存参数
+* 修正路由组合变量的可选变量的BUG
+
+### [ 数据库 ]
+* 修正`pgsql`数据库驱动的数据表字段信息读取
+* 改进Query类的`view`方法 第二个参数默认值更改为true 获取全部的字段
+* 数据库配置信息增加`query`参数用于配置查询对象名称
+* 型类增加`query`属性用于配置模型需要的查询对象名称
+* 改进数据表字段缓存读取
+* 改进数据表字段缓存生成 模型为抽象类或者 没有继承Model类 不生成字段缓存
+* 改进模型的字段缓存 虚拟模型不生成字段缓存
+* 改进数据表字段缓存生成 支持读取模块的模型生成
+* 改进聚合模型的`save`方法 主键写入
+* 模型类的field属性定义简化 取消`Query`类的`allowField`和`setFieldType`方法及相关属性
+* 改进数据表字段缓存生成 支持生成多个数据库的
+* 更新数据库驱动类 改进`getTables`方法
+* 增加` optimize:schema` 命令 用于生成数据表字段信息缓存
+* 修正一个查询条件多个条件的时候的参数绑定BUG
+* 分页查询方法`paginate`第二个参数传入数字表示总记录数
+* 修正mysql的`JSON`字段查询
+* 改进Query类的getOptions方法 当name参数不存在的时候返回null
+
+### [ 模型和关联 ]
+* 模型类的field属性不需要添加字段类型定义
+* 改进Model类 添加`getDb`静态方法获取db查询对象
+* 改进聚合模型`save`方法返回值
+* 改进Relation类`save`方法
+* 修正关联模型 多对多`save`方法一处问题
+* 改进Model类的save方法 修正不按主键查询的更新问题
+* 时间字段获取器获取的时候为NULL则不做转换
+
+### [ 其它 ]
+
+* 改进配置缓存生成 支持扩展配置
+* 取消`extra_config_list`配置参数 扩展配置文件直接放到 `extra`目录下面即可自动加载(数据库配置文件位置不变)
+* cache助手函数支持判断缓存是否有效
+* 修正 模板引擎驱动类的`config`方法
+* 修复在配置Model属性field=true情况下,通过`__call`调用db()引发的BUG
+* 改进模板引擎驱动的config方法 支持获取配置参数值
+* 改进redirct的url地址解析
+* 删除`File`类的`md5`和`sha1`方法 改为`hash`方法 支持更多的散列值类型生成
+* 增加`response_end`行为标签
+* 改进默认语言的加载
+
+## 2016-9-15 V5.0
+
+### [ 请求和路由 ]
+
+* Request对象支持动态绑定属性
+* 定义了路由规则的URL原地址禁止访问
+* 改进路由规则存储结构
+* 路由分组功能增强,支持嵌套和虚拟分组
+* 路由URL高效反解
+* 改进Request对象param方法获取优先级
+* 路由增加name方法设置和获取路由标识
+* 增加MISS和AUTO路由规则
+* Route类增加auto方法 支持注册一个自动解析URL的路由
+* 路由规则支持模型绑定
+* 路由变量统一使用param方法获取
+* 路由规则标识功能和自动标识
+* 增加生成路由缓存指令 optimize:route
+* Request对象增加route方法单独获取路由变量
+* Request对象的param get post put request delete server cookie env方法的第一个参数传入false 则表示获取原始数据 不进行过滤
+* 改进自动路由标识生成 支持不同的路由规则 指向同一个路由标识,改进Url自动生成对路由标识的支持
+* 改进Request类 filter属性的初始化
+* 改进Request类的isAjax和isPjax方法
+* Request类增加token方法
+* 路由配置文件支持多个 使用 route_config_file 配置参数配置
+* 域名绑定支持https检测
+* 改进域名绑定 支持同时绑定模块和其他 支持绑定到数组定义的路由规则,取消域名绑定到分组
+* 路由规则增加PATCH请求类型支持
+* 增加route_complete_match配置参数设置全局路由规则定义是否采用完整匹配 可以由路由规则的参数complete_match 进行覆盖
+* 改进路由的 后缀参数识别 优先于系统的伪静态后缀参数
+* Url类增加root方法用于指定当前root地址(不含域名)
+* 改进Url生成对可选参数的支持
+
+### [ 数据库 ]
+
+* 查询条件自动参数绑定
+* 改进分页方法支持参数绑定
+* Query类的cache方法增加缓存标签参数
+* Query类的update和delete方法支持调用cache方法 会自动清除指定key的缓存 配合查询方法的cache方法一起使用 
+* 改进Query类的延迟写入方法
+* Query类的column和value方法支持fetchsql
+* 改进日期查询方法
+* 改进存储过程方法exec的支持
+* 改进Connection类的getLastInsID方法获取
+* 记录数据库的连接日志(连接时间和DSN)
+* 改进Query类的select方法的返回结果集判断  
+* Connection类增加getNumRows方法
+* 数据库事务方法取消返回值
+* 改进Query类的chunk方法对主键的获取
+* 改进当数据库驱动类型使用完整命名空间的时候 Query类的builder方法的问题
+
+### [ 模型 ]
+
+* 增加软删除功能
+* 关联模型和预载入改进
+* 关联预载入查询闭包支持更多的连贯操作
+* 完善savell方法支持更新和验证
+* 关联定义统一返回Relation类
+* Model类的has和hasWhere方法对join类型的支持
+* Model类的data方法 批量赋值数据的时候 清空原始数据
+* Model类的get方法第三个参数传入true的时候会自动更新缓存
+* Model类增加只读字段支持
+* Model类增加useGlobalScope方法设置是否启用全局查询范围
+* Model类的base方法改为静态定义 全局多次调用有效
+* Model类支持设定主键、字段信息和字段类型,不依赖自动获取,提高性能
+* Model类的data方法 支持修改器
+* 改进Relation类对非数字类型主键的支持
+* 改进Relation类的一对多删除
+* 修正Relation类的一对多关联预载入查询
+
+### [ 日志和缓存 ]
+
+* 支持日志类型分离存储
+* 日志允许设置记录级别
+* 增加缓存标签功能
+* 缓存类增加pull方法用于获取并删除
+* cache助手函数增加tag参数
+* 简化日志信息,隐藏数据库密码
+* 增加cache/session redis驱动的库选择逻辑;
+* memcached驱动的配置参数支持option参数
+* 调试模式下面 日志记录增加页面的header和param参数记录
+* memcached缓存驱动增加连接账号密码参数
+* 缓存支持设置complex类型 支持配置多种缓存并用store切换
+* 缓存类增加tag方法 用于缓存标签设置 clear方法支持清除某个缓存标签的数据
+* File类型日志驱动支持设置单独文件记录不同的日志级别
+* 改进文件缓存和日志的存储文件名命名规范
+* 缓存类增加inc和dec方法 针对数值型数据提供自增和自减操作
+* Cache类增加has方法 get方法支持默认值
+
+### [ 其它 ]
+
+* 视图类支持设置模板引擎参数
+* 增加表单令牌生成和验证
+* 增加中文验证规则
+* 增加image和文件相关验证规则
+* 重定向Response对象支持with方法隐含传参
+* 改进Session类自动初始化
+* session类增加pull方法用于获取并删除
+* 增加Env类用于获取环境变量
+* Request类get/post/put等更改赋值后param方法依然有效
+* 改进Jump跳转地址支持Url::build 解析
+* 优化Hook类
+* 应用调试模式和页面trace支持环境变量设置
+* config助手函数支持 config('?name') 用法
+* 支持使用BIND_MODULE常量的方式绑定模块
+* 入口文件自动绑定模块功能
+* 改进验证异常类的错误信息和模板输出,支持批量验证的错误信息抛出
+* 完善console 增加output一些常用的方法
+* 增加token助手函数 用于在页面快速显示令牌
+* 增加halt方法用于变量调试并中断输出
+* 改进Validate类的number验证规则 和 integer区分开
+* optimize:autoload增加对extend扩展目录的扫描
+* 改进Validate类的boolean验证规则 支持表单数据
+* 改进cookie助手函数支持 判断是否存在某个cookie值
+* 改进abort助手函数 支持抛出HttpResponseException异常
+* 改进File类增加对上传错误的处理
+* 改进File类move方法的返回对象增加上传表单信息,增加获取文件散列值的方法
+* 改进File类的move方法的返回对象改为返回File对象实例
+* 增加clear和optimize:config 指令
+* 改进File类和Validate类的图像文件类型验证
+* 控制器的操作方法支持注入Request之外的对象实例
+* Request类 param(true) 支持获取带文件的数据
+* input助手函数第一个参数增加默认值
+* Validate类增加image验证规则 并改进max min length支持多种数据类型
+* json输出时数据编码失败后抛出异常
+
+### [ 调整 ]
+* 废除路由映射(静态路由)定义
+* 取消url_deny_suffix配置 改由路由的deny_ext参数设置
+* 模型save方法返回值改为影响的记录数,取消getId参数
+* Request对象controller方法返回驼峰控制器名
+* 控制器前置操作方法不存在则抛出异常
+* Loader类db方法增加name标识参数
+* db助手函数增加第三个参数用于指定连接标识
+* Sqlsrv驱动默认不对数据表字段进行小写转换
+* 移除sae驱动 改为扩展包
+* Oracle驱动移出核心包
+* Firebird驱动移出核心包
+* 取消别名定义文件alias.php
+* 配置参数读取的时候取消环境变量判断 需要读取环境变量的时候使用Env类
+* 环境变量定义文件更改为 .env 由原来的PHP数组改为ini格式定义(支持数组方式)
+* 状态配置和扩展配置的加载顺序调整 便于状态配置文件中可以更改扩展配置的参数
+* 取消域名绑定到路由分组功能
+* 控制器类的success和error方法url参数支持传入空字符串,则不做任何处理
+* 控制器的error success result redirect方法均不需要使用return
+* 创建目录的权限修改为0644
+
+
+## 2016-7-1 RC4版本
+### [ 底层架构 ]
+* 增加Request类 并支持自动注入
+* 统一Composer的自动加载机制
+* 增加Response类的子类扩展
+* 增加File类用于上传和文件操作
+* 取消模式扩展 SAE支持降权
+* 优化框架入口文件
+* 改进异常机制
+* App类输入/输出调整
+* 单元测试的完美支持
+* 增加新的控制台指令
+* 取消系统路径之外的大部分常量定义
+* 类库映射文件由命令行动态生成 包含应用类库
+
+### [ 数据库 ]
+
+* 增加分表规则方法
+* 增加日期和时间表达式查询方法
+* 增加分页查询方法
+* 增加视图查询方法
+* 默认保持数据表字段大小写
+* 数据缓存自动更新机制
+* 完善事务嵌套支持
+* 改进存储过程数据读取
+* 支持设置数据库查询数据集返回类型
+
+### [ 模型 ]
+* 增加Merge扩展模型
+* 模型支持动态查询
+* 增加更多的类型自动转换支持
+* 增加全局查询范围
+* toJson/toArray支持隐藏和增加属性输出
+* 增加远程一对多关联
+
+### [ 其它 ]
+* 日志存储结构调整
+* Trace调试功能从日志类独立并增强
+* 原Input类功能并入Request类
+* 类库映射文件采用命令行生成 包含应用类库
+* 验证类的check方法data数据取消引用传参
+* 路由增加MISS路由规则
+* 路由增加路由别名功能
+
+## 2016-4-23 RC3版本
+### [ 底层架构 ]
+* 框架核心仓库和应用仓库分离 便于composer独立更新
+* 数据库类重构,拆分为Connection(连接器)/Query(查询器)/Builder(SQL生成器)
+* 模型类重构,更加对象化
+
+### [ 数据库 ]
+
+* 新的查询语法
+* 闭包查询和闭包事务
+* Query对象查询
+* 数据分批处理
+* 数据库SQL执行监听
+
+### [ 模型 ]
+* 对象化操作
+* 支持静态调用(查询)
+* 支持读取器/修改器
+* 时间戳字段
+* 对象/数组访问
+* JSON序列化
+* 事件触发
+* 命名范围
+* 类型自动转换
+* 数据验证和完成
+* 关联查询/写入
+* 关联预载入
+
+### [ 其它更新 ]
+* 路由类增加快速路由支持
+* 验证Validate类重构
+* Build类增加快速创建模块的方法
+* Url生成类改进
+* Validate类改进
+* View类及模板引擎驱动设计改进
+* 取消模板引擎的模板主题设计
+* 修正社区反馈的一些问题
+* 助手函数重新命名
+* `router.php`文件位置移动
+
+## 2016-3-11 RC2版本
+
+* 重新设计的自动验证和自动完成机制(原有自动验证和完成支持采用traits\model\Auto兼容);
+* 验证类Validate独立设计;
+* 自动生成功能交给Console完成;
+* 对数据表字段大小写的处理;
+* 改进Controller类(取消traits\contorller\View);
+* 改进Input类;
+* 改进Url类;
+* 改进Cookie类;
+* 优化Loader类;
+* 优化Route类;
+* 优化Template类;
+* Session类自动初始化;
+* 增加traits\model\Bulk模型扩展用于大批量数据写入和更新;
+* 缓存类和日志类增加Test驱动;
+* 对异常机制和错误处理的改进;
+* 增加URL控制器和操作是否自动转换开关;
+* 支持类名后缀设置;
+* 取消操作绑定到类的功能;
+* 取消use_db_switch参数设计;
+
+## 2016-1-30 RC1版本
+### [ 底层架构 ]
+
+*   真正的惰性加载
+*   核心类库组件化
+*   框架引导文件
+*   完善的类库自动加载(支持Composer)
+*   采用Traits扩展
+*   API友好(输出、异常和调试)
+*   文件命名规范调整
+
+### [ 调试和异常 ]
+
+*   专为API开发而设计的输出、调试和异常处理
+*   日志类支持本地文件/SAE/页面Trace/SocketLog输出,可以实现远程浏览器插件调试
+*   内置trace方法直接远程调试
+*   异常预警通知驱动设计
+*   数据库SQL性能分析支持
+
+### [ 路由 ]
+
+*   动态注册路由
+*   自定义路由检测方法
+*   路由分组功能
+*   规则路由中的变量支持采用正则规则定义(包括全局和局部)
+*   闭包路由
+*   支持路由到多层控制器
+
+### [ 控制器 ]
+
+*   控制器类无需继承controller类
+*   灵活的多层控制器支持
+*   可以Traits引入高级控制器功能
+*   rest/yar/rpc/hprose/jsonrpc控制器扩展
+*   前置操作方法支持排除和指定操作
+
+
+### [ 模型 ]
+
+*   简化的核心模型
+*   Traits引入高级模型/视图模型/关联模型
+*   主从分布时候主数据库读操作支持
+*   改进的join方法和order方法
+
+### [ 视图 ]
+
+*   视图解析驱动设计(模板引擎)
+*   所有方法不再直接输出而是返回交由系统统一输出处理
+*   动态切换模板主题设计
+*   动态切换模板引擎设计
+
+### [ 数据库 ]
+
+*   完全基于PDO实现
+*   简化的数据库驱动设计
+*   SQL性能监控(需要开启数据库调试模式)
+*   PDO参数绑定改进
+
+### [ 其他方面 ]
+
+*   目录和MVC文件自动生成支持
+*   I函数默认添加变量修饰符为/s
+*   一个行为类里面支持为多个标签位定义不同的方法
+*   更多的社交扩展类库

+ 32 - 0
serviceApi/LICENSE.txt

@@ -0,0 +1,32 @@
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+版权所有Copyright © 2006-2017 by ThinkPHP (http://thinkphp.cn)
+All rights reserved。
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+Apache Licence是著名的非盈利开源组织Apache采用的协议。
+该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
+允许代码修改,再作为开源或商业软件发布。需要满足
+的条件: 
+1. 需要给代码的用户一份Apache Licence ;
+2. 如果你修改了代码,需要在被修改的文件中说明;
+3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
+带有原来代码中的协议,商标,专利声明和其他原来作者规
+定需要包含的说明;
+4. 如果再发布的产品中包含一个Notice文件,则在Notice文
+件中需要带有本协议内容。你可以在Notice中增加自己的
+许可,但不可以表现为对Apache Licence构成更改。 
+具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

+ 133 - 0
serviceApi/README.md

@@ -0,0 +1,133 @@
+ThinkPHP 5.0
+===============
+
+[![Total Downloads](https://poser.pugx.org/topthink/think/downloads)](https://packagist.org/packages/topthink/think)
+[![Latest Stable Version](https://poser.pugx.org/topthink/think/v/stable)](https://packagist.org/packages/topthink/think)
+[![Latest Unstable Version](https://poser.pugx.org/topthink/think/v/unstable)](https://packagist.org/packages/topthink/think)
+[![License](https://poser.pugx.org/topthink/think/license)](https://packagist.org/packages/topthink/think)
+
+ThinkPHP5在保持快速开发和大道至简的核心理念不变的同时,PHP版本要求提升到5.4,对已有的CBD模式做了更深的强化,优化核心,减少依赖,基于全新的架构思想和命名空间实现,是ThinkPHP突破原有框架思路的颠覆之作,其主要特性包括:
+
+ + 基于命名空间和众多PHP新特性
+ + 核心功能组件化
+ + 强化路由功能
+ + 更灵活的控制器
+ + 重构的模型和数据库类
+ + 配置文件可分离
+ + 重写的自动验证和完成
+ + 简化扩展机制
+ + API支持完善
+ + 改进的Log类
+ + 命令行访问支持
+ + REST支持
+ + 引导文件支持
+ + 方便的自动生成定义
+ + 真正惰性加载
+ + 分布式环境支持
+ + 更多的社交类库
+
+> ThinkPHP5的运行环境要求PHP5.4以上。
+
+详细开发文档参考 [ThinkPHP5完全开发手册](http://www.kancloud.cn/manual/thinkphp5)
+
+## 目录结构
+
+初始的目录结构如下:
+
+~~~
+www  WEB部署目录(或者子目录)
+├─application           应用目录
+│  ├─common             公共模块目录(可以更改)
+│  ├─module_name        模块目录
+│  │  ├─config.php      模块配置文件
+│  │  ├─common.php      模块函数文件
+│  │  ├─controller      控制器目录
+│  │  ├─model           模型目录
+│  │  ├─view            视图目录
+│  │  └─ ...            更多类库目录
+│  │
+│  ├─command.php        命令行工具配置文件
+│  ├─common.php         公共函数文件
+│  ├─config.php         公共配置文件
+│  ├─route.php          路由配置文件
+│  ├─tags.php           应用行为扩展定义文件
+│  └─database.php       数据库配置文件
+│
+├─public                WEB目录(对外访问目录)
+│  ├─index.php          入口文件
+│  ├─router.php         快速测试文件
+│  └─.htaccess          用于apache的重写
+│
+├─thinkphp              框架系统目录
+│  ├─lang               语言文件目录
+│  ├─library            框架类库目录
+│  │  ├─think           Think类库包目录
+│  │  └─traits          系统Trait目录
+│  │
+│  ├─tpl                系统模板目录
+│  ├─base.php           基础定义文件
+│  ├─console.php        控制台入口文件
+│  ├─convention.php     框架惯例配置文件
+│  ├─helper.php         助手函数文件
+│  ├─phpunit.xml        phpunit配置文件
+│  └─start.php          框架入口文件
+│
+├─extend                扩展类库目录
+├─runtime               应用的运行时目录(可写,可定制)
+├─vendor                第三方类库目录(Composer依赖库)
+├─build.php             自动生成定义文件(参考)
+├─composer.json         composer 定义文件
+├─LICENSE.txt           授权说明文件
+├─README.md             README 文件
+├─think                 命令行入口文件
+~~~
+
+> router.php用于php自带webserver支持,可用于快速测试
+> 切换到public目录后,启动命令:php -S localhost:8888  router.php
+> 上面的目录结构和名称是可以改变的,这取决于你的入口文件和配置参数。
+
+## 命名规范
+
+`ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范,并且注意如下规范:
+
+### 目录和文件
+
+*   目录不强制规范,驼峰和小写+下划线模式均支持;
+*   类库、函数文件统一以`.php`为后缀;
+*   类的文件名均以命名空间定义,并且命名空间的路径和类库文件所在路径一致;
+*   类名和类文件名保持一致,统一采用驼峰法命名(首字母大写);
+
+### 函数和类、属性命名
+
+*   类的命名采用驼峰法,并且首字母大写,例如 `User`、`UserType`,默认不需要添加后缀,例如`UserController`应该直接命名为`User`;
+*   函数的命名使用小写字母和下划线(小写字母开头)的方式,例如 `get_client_ip`;
+*   方法的命名使用驼峰法,并且首字母小写,例如 `getUserName`;
+*   属性的命名使用驼峰法,并且首字母小写,例如 `tableName`、`instance`;
+*   以双下划线“__”打头的函数或方法作为魔法方法,例如 `__call` 和 `__autoload`;
+
+### 常量和配置
+
+*   常量以大写字母和下划线命名,例如 `APP_PATH`和 `THINK_PATH`;
+*   配置参数以小写字母和下划线命名,例如 `url_route_on` 和`url_convert`;
+
+### 数据表和字段
+
+*   数据表和字段采用小写加下划线方式命名,并注意字段名不要以下划线开头,例如 `think_user` 表和 `user_name`字段,不建议使用驼峰和中文作为数据表字段命名。
+
+## 参与开发
+
+请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)。
+
+## 版权信息
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+
+本项目包含的第三方源码和二进制文件之版权信息另行标注。
+
+版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn)
+
+All rights reserved。
+
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+更多细节参阅 [LICENSE.txt](LICENSE.txt)

+ 1 - 0
serviceApi/application/.htaccess

@@ -0,0 +1 @@
+deny from all

+ 12 - 0
serviceApi/application/command.php

@@ -0,0 +1,12 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: yunwuxin <448901948@qq.com>
+// +----------------------------------------------------------------------
+
+return [];

+ 12 - 0
serviceApi/application/common.php

@@ -0,0 +1,12 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 流年 <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// 应用公共文件

+ 243 - 0
serviceApi/application/config.php

@@ -0,0 +1,243 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    // +----------------------------------------------------------------------
+    // | 应用设置
+    // +----------------------------------------------------------------------
+
+    // 应用调试模式
+    'app_debug'              => true,
+    // 应用Trace
+    'app_trace'              => false,
+    // 应用模式状态
+    'app_status'             => '',
+    // 是否支持多模块
+    'app_multi_module'       => true,
+    // 入口自动绑定模块
+    'auto_bind_module'       => false,
+    // 注册的根命名空间
+    'root_namespace'         => [],
+    // 扩展函数文件
+    'extra_file_list'        => [THINK_PATH . 'helper' . EXT],
+    // 默认输出类型
+    'default_return_type'    => 'html',
+    // 默认AJAX 数据返回格式,可选json xml ...
+    'default_ajax_return'    => 'json',
+    // 默认JSONP格式返回的处理方法
+    'default_jsonp_handler'  => 'jsonpReturn',
+    // 默认JSONP处理方法
+    'var_jsonp_handler'      => 'callback',
+    // 默认时区
+    'default_timezone'       => 'PRC',
+    // 是否开启多语言
+    'lang_switch_on'         => false,
+    // 默认全局过滤方法 用逗号分隔多个
+    'default_filter'         => '',
+    // 默认语言
+    'default_lang'           => 'zh-cn',
+    // 应用类库后缀
+    'class_suffix'           => false,
+    // 控制器类后缀
+    'controller_suffix'      => false,
+
+    // +----------------------------------------------------------------------
+    // | 模块设置
+    // +----------------------------------------------------------------------
+
+    // 默认模块名
+    'default_module'         => 'index',
+    // 禁止访问模块
+    'deny_module_list'       => ['common'],
+    // 默认控制器名
+    'default_controller'     => 'Index',
+    // 默认操作名
+    'default_action'         => 'index',
+    // 默认验证器
+    'default_validate'       => '',
+    // 默认的空控制器名
+    'empty_controller'       => 'Error',
+    // 操作方法后缀
+    'action_suffix'          => '',
+    // 自动搜索控制器
+    'controller_auto_search' => false,
+
+    // +----------------------------------------------------------------------
+    // | URL设置
+    // +----------------------------------------------------------------------
+
+    // PATHINFO变量名 用于兼容模式
+    'var_pathinfo'           => 's',
+    // 兼容PATH_INFO获取
+    'pathinfo_fetch'         => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
+    // pathinfo分隔符
+    'pathinfo_depr'          => '/',
+    // URL伪静态后缀
+    'url_html_suffix'        => 'html',
+    // URL普通方式参数 用于自动生成
+    'url_common_param'       => false,
+    // URL参数方式 0 按名称成对解析 1 按顺序解析
+    'url_param_type'         => 0,
+    // 是否开启路由
+    'url_route_on'           => true,
+    // 路由使用完整匹配
+    'route_complete_match'   => false,
+    // 路由配置文件(支持配置多个)
+    'route_config_file'      => ['route'],
+    // 是否开启路由解析缓存
+    'route_check_cache'      => false,
+    // 是否强制使用路由
+    'url_route_must'         => false,
+    // 域名部署
+    'url_domain_deploy'      => false,
+    // 域名根,如thinkphp.cn
+    'url_domain_root'        => '',
+    // 是否自动转换URL中的控制器和操作名
+    'url_convert'            => true,
+    // 默认的访问控制器层
+    'url_controller_layer'   => 'controller',
+    // 表单请求类型伪装变量
+    'var_method'             => '_method',
+    // 表单ajax伪装变量
+    'var_ajax'               => '_ajax',
+    // 表单pjax伪装变量
+    'var_pjax'               => '_pjax',
+    // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
+    'request_cache'          => false,
+    // 请求缓存有效期
+    'request_cache_expire'   => null,
+    // 全局请求缓存排除规则
+    'request_cache_except'   => [],
+
+    // +----------------------------------------------------------------------
+    // | 模板设置
+    // +----------------------------------------------------------------------
+
+    'template'               => [
+        // 模板引擎类型 支持 php think 支持扩展
+        'type'         => 'Think',
+        // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写
+        'auto_rule'    => 1,
+        // 模板路径
+        'view_path'    => '',
+        // 模板后缀
+        'view_suffix'  => 'html',
+        // 模板文件名分隔符
+        'view_depr'    => DS,
+        // 模板引擎普通标签开始标记
+        'tpl_begin'    => '{',
+        // 模板引擎普通标签结束标记
+        'tpl_end'      => '}',
+        // 标签库标签开始标记
+        'taglib_begin' => '{',
+        // 标签库标签结束标记
+        'taglib_end'   => '}',
+    ],
+
+    // 视图输出字符串内容替换
+    'view_replace_str'       => [],
+    // 默认跳转页面对应的模板文件
+    'dispatch_success_tmpl'  => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
+    'dispatch_error_tmpl'    => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
+
+    // +----------------------------------------------------------------------
+    // | 异常及错误设置
+    // +----------------------------------------------------------------------
+
+    // 异常页面的模板文件
+    'exception_tmpl'         => THINK_PATH . 'tpl' . DS . 'think_exception.tpl',
+
+    // 错误显示信息,非调试模式有效
+    'error_message'          => '页面错误!请稍后再试~',
+    // 显示错误信息
+    'show_error_msg'         => false,
+    // 异常处理handle类 留空使用 \think\exception\Handle
+    'exception_handle'       => '',
+
+    // +----------------------------------------------------------------------
+    // | 日志设置
+    // +----------------------------------------------------------------------
+
+    'log'                    => [
+        // 日志记录方式,内置 file socket 支持扩展
+        'type'  => 'File',
+        // 日志保存目录
+        'path'  => LOG_PATH,
+        // 日志记录级别
+        'level' => [],
+    ],
+
+    // +----------------------------------------------------------------------
+    // | Trace设置 开启 app_trace 后 有效
+    // +----------------------------------------------------------------------
+    'trace'                  => [
+        // 内置Html Console 支持扩展
+        'type' => 'Html',
+    ],
+
+    // +----------------------------------------------------------------------
+    // | 缓存设置
+    // +----------------------------------------------------------------------
+
+    'cache'                  => [
+        // 驱动方式
+        'type'   => 'File',
+        // 缓存保存目录
+        'path'   => CACHE_PATH,
+        // 缓存前缀
+        'prefix' => '',
+        // 缓存有效期 0表示永久缓存
+        'expire' => 0,
+    ],
+
+    // +----------------------------------------------------------------------
+    // | 会话设置
+    // +----------------------------------------------------------------------
+
+    'session'                => [
+        'id'             => '',
+        // SESSION_ID的提交变量,解决flash上传跨域
+        'var_session_id' => '',
+        // SESSION 前缀
+        'prefix'         => 'think',
+        // 驱动方式 支持redis memcache memcached
+        'type'           => '',
+        // 是否自动开启 SESSION
+        'auto_start'     => true,
+    ],
+
+    // +----------------------------------------------------------------------
+    // | Cookie设置
+    // +----------------------------------------------------------------------
+    'cookie'                 => [
+        // cookie 名称前缀
+        'prefix'    => '',
+        // cookie 保存时间
+        'expire'    => 0,
+        // cookie 保存路径
+        'path'      => '/',
+        // cookie 有效域名
+        'domain'    => '',
+        //  cookie 启用安全传输
+        'secure'    => false,
+        // httponly设置
+        'httponly'  => '',
+        // 是否使用 setcookie
+        'setcookie' => true,
+    ],
+
+    //分页配置
+    'paginate'               => [
+        'type'      => 'bootstrap',
+        'var_page'  => 'page',
+        'list_rows' => 15,
+    ],
+];

+ 55 - 0
serviceApi/application/database.php

@@ -0,0 +1,55 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    // 数据库类型
+    'type'            => 'mysql',
+    // 服务器地址
+    'hostname'        => '127.0.0.1',
+    // 数据库名
+    'database'        => 'applet',
+    // 用户名
+    'username'        => 'applet',
+    // 密码
+    'password'        => 'titan666',
+    // 端口
+    'hostport'        => '',
+    // 连接dsn
+    'dsn'             => '',
+    // 数据库连接参数
+    'params'          => [],
+    // 数据库编码默认采用utf8
+    'charset'         => 'utf8',
+    // 数据库表前缀
+    'prefix'          => '',
+    // 数据库调试模式
+    'debug'           => true,
+    // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+    'deploy'          => 0,
+    // 数据库读写是否分离 主从式有效
+    'rw_separate'     => false,
+    // 读写分离后 主服务器数量
+    'master_num'      => 1,
+    // 指定从服务器序号
+    'slave_no'        => '',
+    // 自动读取主库数据
+    'read_master'     => false,
+    // 是否严格检查字段是否存在
+    'fields_strict'   => true,
+    // 数据集返回类型
+    'resultset_type'  => 'array',
+    // 自动写入时间戳字段
+    'auto_timestamp'  => false,
+    // 时间字段取出后的默认时间格式
+    'datetime_format' => 'Y-m-d H:i:s',
+    // 是否需要进行SQL性能分析
+    'sql_explain'     => false,
+];

+ 14 - 0
serviceApi/application/extra/queue.php

@@ -0,0 +1,14 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: yunwuxin <448901948@qq.com>
+// +----------------------------------------------------------------------
+
+return [
+    'connector' => 'Sync'
+];

+ 58 - 0
serviceApi/application/index/controller/AccessToken.php

@@ -0,0 +1,58 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Titan 名字就是密码
+ * Date: 2019/12/12
+ * Time: 12:18
+ */
+
+namespace app\index\controller;
+
+
+use think\Controller;
+use think\Request;
+
+class AccessToken extends Controller
+{
+    public $appId = "wx3636f10fcd0790ff";
+    public $appSecret = "550375e8a99321ab8be36c2978bc9dea";
+    public function getAccessToken()
+    {
+
+        $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->appId}&secret={$this->appSecret}";
+        $token = cache("token");
+        if(!$token){
+            $data = $this->curl_get($url);
+            $token = $data->access_token;
+            cache("token",$token,7000);
+            return $token;
+        }else{
+            return $token;
+        }
+
+    }
+
+    public function getOpenid($code)
+    {
+
+        $url = "https://api.weixin.qq.com/sns/jscode2session?appid=$this->appId&secret=$this->appSecret&js_code=$code&grant_type=authorization_code";
+        $result = $this->curl_get($url);
+        return $result->openid;
+    }
+
+    public function curl_get($url)
+    {
+        $ch = curl_init();//初始化curl
+        curl_setopt($ch, CURLOPT_URL,$url); //要访问的地址
+        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//跳过证书验证
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);  // 从证书中检查SSL加密算法是否存在
+        $data = json_decode(curl_exec($ch));
+        if(curl_errno($ch)){
+            var_dump(curl_error($ch)); //若错误打印错误信息
+        }
+
+        curl_close($ch);//关闭curl
+        return $data;
+    }
+}

+ 80 - 0
serviceApi/application/index/controller/Article.php

@@ -0,0 +1,80 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Titan 名字就是密码
+ * Date: 2019/12/11
+ * Time: 12:09
+ */
+
+namespace app\index\controller;
+
+
+use think\Controller;
+use think\Db;
+use think\Request;
+
+class Article extends Controller
+{
+   
+    public function uploadImg()
+    {
+        $filePath = $this->upload();
+        $sql = "update article set imageTitle='{$filePath}' order by `no` desc limit 1";
+        $result = Db::query($sql);
+        if($result){
+            return json(['result'=>1,'msg'=>"插入成功"]);
+        }else{
+            return json(['result'=>0,"msg"=>'插入失败']);
+        }
+    }
+
+    public function upload()
+    {
+        $path = "static/wechat/upload";
+        $files = $_FILES["file"]["name"];
+        $suffix = substr($files,strrpos($files,'.'));
+        $name = time().rand(1,1000).$suffix;
+        move_uploaded_file($_FILES["file"]["tmp_name"],"$path/$name");
+        $filePath = $_SERVER["REQUEST_SCHEME"].":"."//".$_SERVER['SERVER_NAME']."/".$path."/".$name;
+        return $filePath;
+    }
+    public function message(Request $request)
+    {
+        $title = $request->param("title");
+        $describ = $request->param("describe");
+        $id = $request->param("id");
+        $isheck = $request->param("ischeck");
+        $date = date("Y-m-d",time());
+        if($isheck == 0){
+            $data = ['title'=>$title,"describ"=>$describ,'g_id'=>$id,"date"=>$date];
+            $result = Db::name("article")->insert($data);
+            if($result > 0){
+                return json(['result'=>1,'meg'=>"文章提交成功"]);
+            }else{
+                return json(['result'=>0,"文章提交失败"]);
+            }
+        }else{
+
+        }
+    }
+
+    public function listdata(Request $request)
+    {
+        $id = $request->param("id");
+        $type = $request->param("type");
+        $no = $request->param("no");
+        if($type == 2){
+
+           $result = Db::name("article")->delete(['id'=>$no,'g_id'=>$no]);
+            if($result){
+                return json(['result'=>'1','msg'=>"删除成功"]);
+            }else{
+                return json(['result'=>0,'msg'=>"删除失败"]);
+            }
+        }else{
+            $data = Db::name("article")->where(['g_id'=>$id])->select();
+            return json(['result'=>1,'msg'=>"获取文章信息成功","content"=>$data]);
+        }
+
+    }
+}

+ 44 - 0
serviceApi/application/index/controller/Index.php

@@ -0,0 +1,44 @@
+<?php
+namespace app\index\controller;
+
+use Symfony\Component\HttpFoundation\RedirectResponse;
+use think\Controller;
+use think\Db;
+use think\Request;
+
+class Index extends Controller
+{
+
+    public function login(Request $request)
+    {
+        $code = $request->param("code");
+        $openid = (new AccessToken())->getOpenid($code);
+        return json(["result"=>1,"openid"=>$openid]);
+    }
+    public function getGongMessage()
+    {
+        $data = Db::name("gonginfo")->select();
+        return json(['result'=>1,'content'=>$data]);
+    }
+    public function identify(Request $request)
+    {
+        $password = $request->param("password");
+        $list = Db::name("gonginfo")->where("password",$password)->select();
+        return json(['result'=>1,"content"=>$list]);
+    }
+
+    public function admin(Request $request)
+    {
+
+        $id = $request->param("id");
+        $formid = $request->param("formid");
+        $openid = $request->param("openid");
+        $sql = "Update gonginfo set fromid = $formid,openid=$openid where id = $id";
+        $result = Db::query($sql);
+        if($result){
+            return json(['result'=>1,'msg'=>'更改成功']);
+        }else{
+            return json(['result'=>0,'msg'=>'更改失败']);
+        }
+    }
+}

+ 293 - 0
serviceApi/application/index/controller/Message.php

@@ -0,0 +1,293 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Titan 名字就是密码
+ * Date: 2019/12/12
+ * Time: 10:25
+ */
+
+namespace app\index\controller;
+
+
+use think\Controller;
+use think\Db;
+use think\Request;
+
+class Message extends Controller
+{
+    public function zanCount(Request $request)
+    {
+        $status = $request->param("status");
+        $p_id = $request->param("p_id");
+        $g_id = $request->param("g_id");
+        $no = $request->param("no");
+        $openid = $request->param("openid");
+        if($status == 1){
+            $data = ["g_id"=>$g_id,"p_id"=>$p_id,"openid"=>$openid,"no"=>$no];
+            $find = Db::name("zan")->where(["g_id"=>$g_id,"p_id"=>$p_id,"openid"=>$openid,"no"=>$no])->find();
+            if(!$find){
+                $zan = Db::name("zan")->insert($data);
+                if($zan > 0){
+                    $update = Db::name("messages")->where(["g_id"=>$g_id,"p_id"=>$p_id,"no"=>$no])->inc("zanCounts")->update();
+                    if($update >0){
+                        return json(["result"=>1,"msg"=>"点赞成功"]);
+                    }else{
+                        return json(["result"=>0,"msg"=>"点赞失败"]);
+                    }
+                }else{
+                    return json(["result"=>0,"msg"=>"点赞失败"]);
+                }
+            }else{
+                return json(["result"=>0,"msg"=>"点赞失败"]);
+            }
+
+        }else{
+            $delete = Db::name("zan")->where(["g_id"=>$g_id,"no"=>$no,"p_id"=>$p_id,"openid"=>$openid])->delete();
+            if($delete >0 ){
+                $update = Db::name("messages")->where(["g_id"=>$g_id,"p_id"=>$p_id,"no"=>$no])->dec("zanCounts")->update();
+                if($update >0){
+                    return json(['result'=>1,"msg"=>"取消点赞成功"]);
+                }else{
+                    return json(['result'=>0,"msg"=>"取消点赞失败"]);
+                }
+            }else{
+                return json(["result"=>0,"msg"=>"取消点赞失败"]);
+            }
+        }
+    }
+    public function topMessages(Request $request)
+    {
+        $id = $request->param("id");
+        $type = $request->param("type");
+        if($type == 1){
+            $result = Db::name("messages")->where(["p_id"=>$id])->update(["isTop"=>1]);
+            if($result >0 ){
+                return json(["result"=>1,"msg"=>"置顶成功"]);
+            }else{
+                return json(['result'=>0,"msg"=>"置顶失败"]);
+            }
+        }else{
+            $res = Db::name("messages")->where(["p_id"=>$id])->update(["isTop"=>0]);
+            if($res >0 ){
+                return json(["result"=>1,"msg"=>"取消置顶成功"]);
+            }else{
+                return json(['result'=>0,"msg"=>"取消置顶失败"]);
+            }
+        }
+    }
+    public function chooseDeleteMessage(Request $request)
+    {
+        $id = $request->param("id");
+        $type = $request->param("type");
+        if($type == 1){
+            $update = Db::name("messages")->where(["p_id"=>$id])->update(["isCheck"=>1]);
+            if($update >0){
+                return json(["result"=>1,"msg"=>"精选成功"]);
+            }else{
+                return json(["result"=>0,"msg"=>"精选失败"]);
+            }
+        }elseif ($type == 0){
+            $messgeDelete = Db::name("messages")->where(["p_id"=>$id])->delete();
+            if($messgeDelete > 0){
+                $zanDelete = Db::name("zan")->where(["p_id"=>$id])->delete();
+                if($zanDelete >=0 ){
+                    return json(["result"=>1,"msg"=>"已删除留言"]);
+                }else{
+                    return json(["result"=>0,"删除留言失败"]);
+                }
+            }else{
+                return json(["result"=>0,"删除留言失败"]);
+            }
+        }else{
+            $update = Db::name("messages")->where(["p_id"=>$id])->update(["isCheck"=>0]);
+            if($update >0){
+                return json(["result"=>1,"msg"=>"已取消为精选留言"]);
+            }else{
+                return json(["result"=>0,"msg"=>"取消精选留言失败"]);
+            }
+        }
+
+    }
+    public function authorReply(Request $request)
+    {
+        $id = $request->param("id");
+        $replyContent = $request->param("replyContent");
+        $isCheckChoess = $request->param("isCheckChoess");
+        if($isCheckChoess == 1){
+            $update = Db::name("messages")->where(["p_id"=>$id])->update(["isCheck"=>1]);
+            if($update >0){
+                return json(["result"=>1,"msg"=>"精选成功"]);
+            }else{
+                return json(["result"=>0,"msg"=>"精选失败"]);
+            }
+        }else{
+            $replyUpdate = Db::name("messages")->where(["p_id"=>$id])->update(["authorMesContent"=>$replyContent]);
+            if($replyUpdate > 0){
+                return json(['result'=>1,"msg"=>"回复成功","replyContent"=>$replyContent]);
+            }else{
+                return json(['result'=>0,"msg"=>"回复失败","replyContent"=>$replyContent]);
+            }
+        }
+    }
+
+    /**
+     *
+     * @param Request $request
+     */
+    public function messagesModel(Request $request)
+    {
+        $p_id = $request->param("p_id");
+        $title = $request->param("title");
+        $message = $request->param("message");
+        $repleyMes = $request->param("replyMes");
+        $page = $request->param("page");
+        $upformid = $request->param("formid");
+        $g_id = $request->param("g_id");
+        $list = Db::name("messages")->field(["fromid","openid"])->where(["p_id"=>$p_id])->find();
+        $update = Db::name("gonginfo")->where('id',$g_id)->update(["fromid"=>$upformid]);
+        $token = (new AccessToken())->getAccessToken();
+        if($list){
+            $data = ["keyword1"=>["value"=>$repleyMes],"keyword2"=>["value"=>"作者"],"keyword3"=>["value"=>$message],"keyword4"=>
+                ["value"=>$title]
+            ];
+            $modelData = ["touser"=>$list["openid"],"template_id","page"=>$page,"form_id"=>$list['fromid'],"data"=>$data];
+            $url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" .$token;
+            $this->http($url,$modelData,"POST");
+        }
+    }
+    public function realyMessagesList(Request $request)
+    {
+        $ischeckmessage = $request->param("ischeckmessage");
+        if($ischeckmessage == 1){
+            $g_id = $request->param("g_id");
+            $no = $request->param("no");
+            $openid = $request->param("openid");
+            $sql = "select * from messages where no = $no and isCheck = 1 and g_id = $g_id ORDER BY messages.istop DESC ";
+            $list = Db::query($sql);
+
+            $zan = Db::name("zan")->where(["no"=>$no,"g_id"=>$g_id,"openid"=>$openid])->column("p_id");
+
+                foreach ($list as $key=>$value){
+                    if(count($zan) > 0 ){
+                        if(in_array($value['p_id'],$zan)){
+                            $list[$key]['iszan'] = 1;
+                        }else{
+                            $list[$key]['iszan'] = 0;
+                        }
+                    }else{
+                        $list[$key]['iszan'] = 0;
+                    }
+
+                }
+
+
+            return json(["result"=>1,"msg"=>"获取公开留言成功","content"=>$list]);
+
+        }else{
+            $g_id = $request->param("id");
+            $no = $request->param("no");
+            $list = Db::name("messages")->where(["no"=>$no,"g_id"=>$g_id])->select();
+            if(count($list)>0){
+                return json(["result"=>1,"count"=>count($list),"content"=>$list]);
+            }
+        }
+
+
+    }
+    public function userDeleteMessage(Request $request)
+    {
+        $no = $request->param("no");
+        $username = $request->param("username");
+        $title = $request->param("title");
+        $messages = $request->param("messages");
+        $deletesql = "delete from messages where no = $no and username ='$username' and title ='$title' and userMesContent = '$messages'";
+        $result = Db::query($deletesql);
+    }
+    public function submit(Request $request)
+    {
+        $g_id = $request->param("g_id");
+        $no = $request->param('no');
+        $username = $request->param("username");
+        $title = $request->param("title");
+        $headimage = $request->param("avatarUrl");
+        $messages = $request->param("messages");
+        $openid = $request->param("openid");
+        $ischeck = $request->param("ischeck");
+        $fromid = $request->param("form_id");
+        //$token = $request->param("token");
+        $data = ['g_id'=>$g_id,"no"=>$no,"username"=>$username,"title"=>$title,"headimage"=>$headimage,
+            "userMesContent"=>$messages,"isCheck"=>$ischeck,"openid"=>$openid,"fromid"=>$fromid
+        ];
+        $result = Db::name("messages")->insert($data);
+        if($result >0){
+            return json(["result"=>1,"message"=>$messages]);
+        }else{
+            return json(["result"=>0,"msg"=>"提交失败"]);
+        }
+    }
+
+    public function userModel(Request $request)
+    {
+        $title = $request->param("title");
+        $message = $request->param("message");
+        $page = $request->param("page");
+        $g_id = $request->param("g_id");
+        $username = $request->param("username");
+        $result = Db::name("gonginfo")->field(["fromid","openid"])->where(["id"=>$g_id])->find();
+        $data = ["keyword1"=>["value"=>$message],//留言内容
+                 "keyword2"=>["value"=>$username],//留言人
+                 "keyword3"=>["value"=>$title]//文章类型
+            ];
+        $modelData = ["touser"=>$result['openid'],"template_id"=>"","page"=>$page,"form_id"=>$result["fromid"],"data"=>$data];
+        $token = (new AccessToken())->getAccessToken();
+        $url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=".$token;
+        $res = $this->http($url,$modelData,"POST");
+
+    }
+
+    public function http($url, $params, $method = 'GET', $header = array(), $timeout = 5)
+    {
+        // POST 提交方式的传入 $set_params 必须是字符串形式
+        $opts = array(
+            CURLOPT_TIMEOUT => $timeout,
+            CURLOPT_RETURNTRANSFER => 1,
+            CURLOPT_SSL_VERIFYPEER => false,
+            CURLOPT_SSL_VERIFYHOST => false,
+            CURLOPT_HTTPHEADER => $header
+        );
+
+        /* 根据请求类型设置特定参数 */
+        switch (strtoupper($method)) {
+            case 'GET':
+                $opts[CURLOPT_URL] = $url . '?' . http_build_query($params);
+                break;
+            case 'POST':
+                $params = http_build_query($params);
+                $opts[CURLOPT_URL] = $url;
+                $opts[CURLOPT_POST] = 1;
+                $opts[CURLOPT_POSTFIELDS] = $params;
+                break;
+            case 'DELETE':
+                $opts[CURLOPT_URL] = $url;
+                $opts[CURLOPT_HTTPHEADER] = array("X-HTTP-Method-Override: DELETE");
+                $opts[CURLOPT_CUSTOMREQUEST] = 'DELETE';
+                $opts[CURLOPT_POSTFIELDS] = $params;
+                break;
+            case 'PUT':
+                $opts[CURLOPT_URL] = $url;
+                $opts[CURLOPT_POST] = 0;
+                $opts[CURLOPT_CUSTOMREQUEST] = 'PUT';
+                $opts[CURLOPT_POSTFIELDS] = $params;
+                break;
+            default:
+                throw new Exception('不支持的请求方式!');
+        }
+
+        /* 初始化并执行curl请求 */
+        $ch = curl_init();
+        curl_setopt_array($ch, $opts);
+        $data = curl_exec($ch);
+        $error = curl_error($ch);
+        return $data;
+    }
+}

+ 44 - 0
serviceApi/application/index/controller/Weichatcallbackapi.php

@@ -0,0 +1,44 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Titan 名字就是密码
+ * Date: 2019/12/13
+ * Time: 11:19
+ */
+
+namespace app\index\controller;
+
+define("TOKEN","titan666");
+
+class Weichatcallbackapi
+{
+
+    public function valid()
+    {
+        $echoStr = $_GET["echostr"];
+
+        //valid signature , option
+        if($this->checkSignature()){
+            echo $echoStr;
+            exit;
+        }
+    }
+
+    private function checkSignature()
+    {
+    	$signature = $_GET["signature"];
+		$timestamp = $_GET["timestamp"];
+		$nonce = $_GET["nonce"];
+		$token = TOKEN;
+		$tmpArr = array($token, $timestamp, $nonce);
+	    sort($tmpArr, SORT_STRING);
+	    $tmpStr = implode( $tmpArr );
+	    $tmpStr = sha1( $tmpStr );
+	
+	    if ($tmpStr == $signature ) {
+	        return true;
+	    } else {
+	        return false;
+	    }
+    }
+}

+ 21 - 0
serviceApi/application/route.php

@@ -0,0 +1,21 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    '__pattern__' => [
+        'name' => '\w+',
+    ],
+    '[hello]'     => [
+        ':id'   => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
+        ':name' => ['index/hello', ['method' => 'post']],
+    ],
+
+];

+ 28 - 0
serviceApi/application/tags.php

@@ -0,0 +1,28 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// 应用行为扩展定义文件
+return [
+    // 应用初始化
+    'app_init'     => [],
+    // 应用开始
+    'app_begin'    => [],
+    // 模块初始化
+    'module_init'  => [],
+    // 操作开始执行
+    'action_begin' => [],
+    // 视图内容过滤
+    'view_filter'  => [],
+    // 日志写入
+    'log_write'    => [],
+    // 应用结束
+    'app_end'      => [],
+];

+ 25 - 0
serviceApi/build.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+return [
+    // 生成应用公共文件
+    '__file__' => ['common.php', 'config.php', 'database.php'],
+
+    // 定义demo模块的自动生成 (按照实际定义的文件名生成)
+    'demo'     => [
+        '__file__'   => ['common.php'],
+        '__dir__'    => ['behavior', 'controller', 'model', 'view'],
+        'controller' => ['Index', 'Test', 'UserType'],
+        'model'      => ['User', 'UserType'],
+        'view'       => ['index/index'],
+    ],
+    // 其他更多的模块定义
+];

+ 34 - 0
serviceApi/composer.json

@@ -0,0 +1,34 @@
+{
+    "name": "topthink/think",
+    "description": "the new thinkphp framework",
+    "type": "project",
+    "keywords": [
+        "framework",
+        "thinkphp",
+        "ORM"
+    ],
+    "homepage": "http://thinkphp.cn/",
+    "license": "Apache-2.0",
+    "authors": [
+        {
+            "name": "liu21st",
+            "email": "liu21st@gmail.com"
+        }
+    ],
+    "require": {
+        "php": ">=5.4.0",
+        "topthink/framework": "5.0.*",
+        "naixiaoxin/think-wechat": "^1.6"
+    },
+    "autoload": {
+        "psr-4": {
+            "app\\": "application"
+        }
+    },
+    "extra": {
+        "think-path": "thinkphp"
+    },
+    "config": {
+        "preferred-install": "dist"
+    }
+}

+ 2 - 0
serviceApi/extend/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 8 - 0
serviceApi/public/.htaccess

@@ -0,0 +1,8 @@
+<IfModule mod_rewrite.c>
+  Options +FollowSymlinks -Multiviews
+  RewriteEngine On
+
+  RewriteCond %{REQUEST_FILENAME} !-d
+  RewriteCond %{REQUEST_FILENAME} !-f
+  RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
+</IfModule>

BIN
serviceApi/public/favicon.ico


+ 17 - 0
serviceApi/public/index.php

@@ -0,0 +1,17 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// [ 应用入口文件 ]
+
+// 定义应用目录
+define('APP_PATH', __DIR__ . '/../application/');
+// 加载框架引导文件
+require __DIR__ . '/../thinkphp/start.php';

+ 2 - 0
serviceApi/public/robots.txt

@@ -0,0 +1,2 @@
+User-agent: *
+Disallow:

+ 20 - 0
serviceApi/public/router.php

@@ -0,0 +1,20 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+// $Id$
+
+if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
+    return false;
+} else {
+    if (!isset($_SERVER['PATH_INFO'])) {
+        $_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
+    }
+    require __DIR__ . "/index.php";
+}

+ 2 - 0
serviceApi/public/static/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 2 - 0
serviceApi/runtime/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 17 - 0
serviceApi/think

@@ -0,0 +1,17 @@
+#!/usr/bin/env php
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: yunwuxin <448901948@qq.com>
+// +----------------------------------------------------------------------
+
+// 定义项目路径
+define('APP_PATH', __DIR__ . '/application/');
+
+// 加载框架引导文件
+require __DIR__.'/thinkphp/console.php';

+ 2 - 0
serviceApi/vendor/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

Some files were not shown because too many files changed in this diff