From 9a3e37e1f2168d835333d8d05b04ffdb52b670fe Mon Sep 17 00:00:00 2001
From: shinn lancelot <945226793@qq.com>
Date: Mon, 7 Jan 2019 10:28:53 +0800
Subject: [PATCH 01/15] =?UTF-8?q?1.=20Common.php=E6=96=B0=E5=A2=9EisWin?=
 =?UTF-8?q?=E3=80=81getNonceByURandom=E3=80=81extendArrayData=E9=80=9A?=
 =?UTF-8?q?=E7=94=A8=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/Common.php | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/src/Common.php b/src/Common.php
index 34e739c..e57c3d5 100644
--- a/src/Common.php
+++ b/src/Common.php
@@ -30,6 +30,19 @@ public static function httpRequest($url, $data = null)
         return $output;
     }
 
+    /**
+     * 是否为windows系统
+     * @return bool
+     */
+    public static function isWin()
+    {
+        if (strtoupper(substr(PHP_OS,0,3)) === 'WIN') {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     /**
      * 获取字符串
      * @param int $type
@@ -58,6 +71,50 @@ public static function getNonce($type = 1, $length = 16)
         return $nonce;
     }
 
+    /**
+     * 根据URandom获取字符串
+     * @param int $length
+     * @return bool|string
+     */
+    public static function getNonceByURandom($length = 16)
+    {
+        $nonce = '';
+        $binary = '';
+        $fp = @fopen('/dev/urandom', 'rb');
+        if ($fp !== false) {
+            $binary .= @fread($fp, $length);
+            @fclose($fp);
+        } else {
+            trigger_error('Can not open /dev/urandom.');
+        }
+        $string = base64_encode($binary);
+        $nonce = substr($string, 0, $length);
+        return $nonce;
+    }
+
+    /**
+     * 扩展原数组的数据（仅更新原数组已有的键）
+     * @param $rawData
+     * @param $newData
+     * @return array
+     */
+    public static function extendArrayData($rawData, $newData)
+    {
+        if (!is_array($rawData) || count($rawData) <= 0) {
+            return array();
+        }
+
+        if (!is_array($newData)) {
+            return $rawData;
+        }
+
+        foreach ($rawData as $key=>$value) {
+            isset($newData[$key]) && $rawData[$key] = $newData[$key];
+        }
+
+        return $rawData;
+    }
+
     /**
      * 根据错误码获取错误信息
      * @param $errorCode

From f66b8720d604dbfb9a21a1c365109db03ca470f3 Mon Sep 17 00:00:00 2001
From: shinn lancelot <945226793@qq.com>
Date: Mon, 7 Jan 2019 10:31:17 +0800
Subject: [PATCH 02/15] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9EDefaultParamInfo.p?=
 =?UTF-8?q?hp=E6=95=B0=E7=BB=84=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/wxBizDataCrypt/DefaultParamInfo.php | 32 +++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 src/wxBizDataCrypt/DefaultParamInfo.php

diff --git a/src/wxBizDataCrypt/DefaultParamInfo.php b/src/wxBizDataCrypt/DefaultParamInfo.php
new file mode 100644
index 0000000..6a92b1c
--- /dev/null
+++ b/src/wxBizDataCrypt/DefaultParamInfo.php
@@ -0,0 +1,32 @@
+<?php
+
+return array(
+    'decryptData'=>array(
+        'sessionKey'=>'',
+        'openId'=>'',
+        'code'=>'',
+        'rawData'=>'',
+        'signature'=>'',
+        'encryptedData'=>'',
+        'iv'=>''
+    ),
+    'createWXAQRCode'=>array(
+        'path'=>'',
+        'width'=>430
+    ),
+    'getWXACode'=>array(
+        'path'=>'',
+        'width'=>430,
+        'auto_color'=>false,
+        'line_color'=>'{"r":0,"g":0,"b":0}',
+        'is_hyaline'=>false
+    ),
+    'getWXACodeUnlimit'=>array(
+        'scene'=>'',
+        'page'=>'page/index/index',
+        'width'=>430,
+        'auto_color'=>false,
+        'line_color'=>'{"r":0,"g":0,"b":0}',
+        'is_hyaline'=>false
+    )
+);
\ No newline at end of file

From fad0a984bc163e1e29981746cdfa10f83a0a8d9f Mon Sep 17 00:00:00 2001
From: shinn lancelot <945226793@qq.com>
Date: Mon, 7 Jan 2019 10:32:28 +0800
Subject: [PATCH 03/15] =?UTF-8?q?1.=20=E8=B0=83=E6=95=B4DefaultParamInfo.p?=
 =?UTF-8?q?hp=E6=96=87=E4=BB=B6=E7=9B=AE=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/{wxBizDataCrypt => }/DefaultParamInfo.php | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename src/{wxBizDataCrypt => }/DefaultParamInfo.php (100%)

diff --git a/src/wxBizDataCrypt/DefaultParamInfo.php b/src/DefaultParamInfo.php
similarity index 100%
rename from src/wxBizDataCrypt/DefaultParamInfo.php
rename to src/DefaultParamInfo.php

From b4dda18f08b79c8b9ade2b7f5e08b973e7ef8f94 Mon Sep 17 00:00:00 2001
From: shinn lancelot <945226793@qq.com>
Date: Mon, 7 Jan 2019 10:39:51 +0800
Subject: [PATCH 04/15] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9MiniProgram.php?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/MiniProgram.php | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/MiniProgram.php b/src/MiniProgram.php
index b3fc4bb..7821f90 100644
--- a/src/MiniProgram.php
+++ b/src/MiniProgram.php
@@ -13,6 +13,7 @@ class MiniProgram
     private $appId = '';
     private $appSecret = '';
     private $accessToken = '';
+    private $defaultParamInfo = array();
     public $accessTokenData = array();
 
     const API_HOST = 'https://api.weixin.qq.com';
@@ -38,6 +39,7 @@ public function __construct($appId, $appSecret, $accessToken = '')
             $this->accessTokenData = $this->getAccessTokenData();
             $this->accessTokenData && $this->accessToken = $this->accessTokenData['access_token'];
         }
+        $this->defaultParamInfo = include_once 'DefaultParamInfo.php';
     }
 
     /**
@@ -85,17 +87,20 @@ public function jscode2Session($code)
      */
     public function decryptData($paramArr = array())
     {
+        // 扩展原参数数组
+        $finalParamArr = Common::extendArrayData($this->defaultParamInfo[__FUNCTION__], $paramArr);
+
         // 初始化返回数据
         $res['code'] = -100;
         $res['msg'] = '操作失败';
         $res['data'] = array();
 
         // 1.获取openid、session_key（若存在session_key，则默认理解为session_key未过期，直接使用其进行解密）
-        if (isset($paramArr['sessionKey']) && $paramArr['sessionKey']) {
-            $openId = isset($paramArr['openId']) ? $paramArr['openId'] : '';
-            $sessionKey = $paramArr['sessionKey'];
+        if ($finalParamArr['sessionKey']) {
+            $openId = $finalParamArr['openId'];
+            $sessionKey = $finalParamArr['sessionKey'];
         } else {
-            $sessionData = $this->jscode2Session($paramArr['code']);
+            $sessionData = $this->jscode2Session($finalParamArr['code']);
             if (isset($sessionData['errcode'])) {
                 $res['code'] = -101;
                 $res['msg'] = Common::getErrorMsg($sessionData['errcode']);
@@ -106,8 +111,8 @@ public function decryptData($paramArr = array())
         }
 
         // 2.计算签名并与传入签名进行校验
-        $newSignature = sha1($paramArr['rawData'] . $sessionKey);
-        if ($newSignature !== $paramArr['signature']) {
+        $newSignature = sha1($finalParamArr['rawData'] . $sessionKey);
+        if ($newSignature !== $finalParamArr['signature']) {
             $res['code'] = -102;
             $res['msg'] = '签名不匹配';
             return $res;
@@ -116,7 +121,7 @@ public function decryptData($paramArr = array())
         // 3.使用sessionKey解密加密数据包
         include_once "wxBizDataCrypt/wxBizDataCrypt.php";
         $pc = new \WXBizDataCrypt($this->appId, $sessionKey);
-        $errCode = $pc->decryptData($paramArr['encryptedData'], $paramArr['iv'], $data);
+        $errCode = $pc->decryptData($finalParamArr['encryptedData'], $finalParamArr['iv'], $data);
         if (!empty($errCode)) {
             $res['code'] = -103;
             $res['msg'] = Common::getErrorMsg($errCode);
@@ -125,7 +130,7 @@ public function decryptData($paramArr = array())
 
         // 4.生成3rd_session
         $data = json_decode($data, true);
-        $session3rd = Common::getNonce();
+        $session3rd = Common::isWin() === true ? Common::getNonce() : Common::getNonceByURandom();
 
         // 5.返回相关数据
         $res['code'] = 100;
@@ -144,11 +149,12 @@ public function decryptData($paramArr = array())
      */
     public function createWXAQRCode($postParamArr = array())
     {
+        $finalParamArr = Common::extendArrayData($this->defaultParamInfo[__FUNCTION__], $postParamArr);
         $urlParamArr = array(
             'access_token'=>$this->accessToken
         );
         $url = self::API_HOST . self::WXAQRCODE_PATH . http_build_query($urlParamArr);
-        $res = Common::httpRequest($url, json_encode($postParamArr));
+        $res = Common::httpRequest($url, json_encode($finalParamArr));
         return $res;
     }
 
@@ -159,11 +165,12 @@ public function createWXAQRCode($postParamArr = array())
      */
     public function getWXACode($postParamArr = array())
     {
+        $finalParamArr = Common::extendArrayData($this->defaultParamInfo[__FUNCTION__], $postParamArr);
         $urlParamArr = array(
             'access_token'=>$this->accessToken
         );
         $url = self::API_HOST . self::WXACODE_PATH . http_build_query($urlParamArr);
-        $res = Common::httpRequest($url, json_encode($postParamArr));
+        $res = Common::httpRequest($url, json_encode($finalParamArr));
         return $res;
     }
 
@@ -174,11 +181,12 @@ public function getWXACode($postParamArr = array())
      */
     public function getWxacodeUnlimit($postParamArr = array())
     {
+        $finalParamArr = Common::extendArrayData($this->defaultParamInfo[__FUNCTION__], $postParamArr);
         $urlParamArr = array(
             'access_token'=>$this->accessToken
         );
         $url = self::API_HOST . self::WXACODE_UNLIMIT_PATH . http_build_query($urlParamArr);
-        $res = Common::httpRequest($url, json_encode($postParamArr));
+        $res = Common::httpRequest($url, json_encode($finalParamArr));
         return $res;
     }
 }
\ No newline at end of file

From 443d0691073a38d30fa146579ad0323fcf1bbc8c Mon Sep 17 00:00:00 2001
From: shinn lancelot <945226793@qq.com>
Date: Mon, 7 Jan 2019 14:23:20 +0800
Subject: [PATCH 05/15] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9DefaultParamInfo.p?=
 =?UTF-8?q?hp=E4=B8=AD=E5=8F=82=E6=95=B0line=5Fcolor=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/DefaultParamInfo.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/DefaultParamInfo.php b/src/DefaultParamInfo.php
index 6a92b1c..958d0d0 100644
--- a/src/DefaultParamInfo.php
+++ b/src/DefaultParamInfo.php
@@ -18,7 +18,7 @@
         'path'=>'',
         'width'=>430,
         'auto_color'=>false,
-        'line_color'=>'{"r":0,"g":0,"b":0}',
+        'line_color'=>array('r'=>0, 'g'=>0, 'b'=>0),
         'is_hyaline'=>false
     ),
     'getWXACodeUnlimit'=>array(
@@ -26,7 +26,7 @@
         'page'=>'page/index/index',
         'width'=>430,
         'auto_color'=>false,
-        'line_color'=>'{"r":0,"g":0,"b":0}',
+        'line_color'=>array('r'=>0, 'g'=>0, 'b'=>0),
         'is_hyaline'=>false
     )
 );
\ No newline at end of file

From f358bcff55f6bb640da65bcfe094007f5169b912 Mon Sep 17 00:00:00 2001
From: shinn-lancelot <945226793@qq.com>
Date: Tue, 8 Jan 2019 23:02:27 +0800
Subject: [PATCH 06/15] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9README.md=E5=8F=8A?=
 =?UTF-8?q?=E5=85=B6=E5=AE=83=E7=BB=86=E8=8A=82=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 README.md           | 142 +++-----------------------------------------
 demo.php            |  20 +++----
 src/MiniProgram.php |   4 +-
 3 files changed, 19 insertions(+), 147 deletions(-)

diff --git a/README.md b/README.md
index d0b75cc..52f93fa 100644
--- a/README.md
+++ b/README.md
@@ -1,127 +1,15 @@
-# 微信小程序php后端开发包
-
-[![issue](https://img.shields.io/github/issues/hillpy/MiniProgramSDK.svg)](https://github.com/hillpy/MiniProgramSDK/issues)
-[![star](https://img.shields.io/github/stars/hillpy/MiniProgramSDK.svg)](https://github.com/hillpy/MiniProgramSDK)
-[![fork](https://img.shields.io/github/forks/hillpy/MiniProgramSDK.svg)](https://github.com/hillpy/MiniProgramSDK)
 [![license](https://img.shields.io/github/license/hillpy/MiniProgramSDK.svg)](https://github.com/hillpy/MiniProgramSDK/blob/master/LICENSE)
+[![release](https://img.shields.io/github/release/hillpy/MiniProgramSDK.svg)](https://img.shields.io/github/release/hillpy/MiniProgramSDK.svg)
+[![packagist](https://img.shields.io/packagist/v/hillpy/mini-program-sdk.svg)](https://packagist.org/packages/hillpy/mini-program-sdk)
+[![downloads](https://img.shields.io/packagist/dt/hillpy/mini-program-sdk.svg)](https://img.shields.io/packagist/dt/hillpy/mini-program-sdk.svg)
 
-### 功能描述
-#### 封装微信小程序php端相关接口，比如php端微信用户信息解密（即登陆功能）、获取sessionKey、获取小程序码等等。
-
-### 安装方法
-
-1. 下载[发行版](https://github.com/hillpy/MiniProgramSDK/releases)
-
-2. 使用composer安装（推荐）
-
-```
-composer require hillpy/mini-program-sdk
-```
-
-### 使用方法
-
-* 实例化开发包、accessToken获取及缓存
-
-```
-/**
- * 使用案例
- * 注意：实际项目若使用composer安装的库，请先引入自动加载脚本（require __DIR__ . '/vender/autoload.php';）。另外需安装redis扩展并开启redis服务
- */
-use hillpy\MiniProgramSDK\MiniProgram;
-
-// 设置变量
-$appId = '';
-$appSecret = '';
-$accessToken = '';
-
-// 从redis获取accessToken;
-$redis = new Redis();
-$redis->connect('127.0.0.1', 6379);
-$accessToken = $redis->get('miniprogram_access_token_appid_' . $appId);
-
-// 实例化MiniProgram
-$miniProgram = new MiniProgram($appId, $appSecret, $accessToken);
-
-//若缓存中不存在accessToken，从新实例化对象中获取并写入redis
-if (!$accessToken) {
-    isset($miniProgram->accessTokenData['access_token']) && $accessToken = $miniProgram->accessTokenData['access_token'];
-
-    if ($accessToken) {
-        // 获取的expires_in为秒时间戳，减去30秒（过期时间适当提前避免accessToken实际已失效）
-        if (isset($miniProgram->accessTokenData['expires_in'])) {
-            $cacheTime = $miniProgram->accessTokenData['expires_in'] - 30;
-        } else {
-            $cacheTime = 0;
-        }
-        $redis->setex('miniprogram_access_token_appid_' . $appId, $cacheTime, $accessToken);
-    }
-}
-
-// 输出accessToken
-if ($accessToken == '') {
-    echo 'accessToken获取失败<br>';
-} else {
-    echo 'accessToken:' . $accessToken . '<br>';
-}
-```
-
-* 解密登录用户数据
+### MiniProgramSDK是什么
 
-```
-// 解密登录用户数据
-$paramArr['code'] = isset($_POST['code']) ? $_POST['code'] : '';
-$paramArr['rawData'] = isset($_POST['rawData']) ? $_POST['rawData'] : '';
-$paramArr['signature'] = isset($_POST['signature']) ? $_POST['signature'] : '';
-$paramArr['encryptedData'] = isset($_POST['encryptedData']) ? $_POST['encryptedData'] : '';
-$paramArr['iv'] = isset($_POST['iv']) ? $_POST['iv'] : '';
-$paramArr['sessionKeyExpired'] = isset($_POST['sessionKeyExpired']) ? $_POST['sessionKeyExpired'] : '';
+MiniProgramSDK是一个PHP的小程序开发包。封装微信小程序后端相关接口，比如php端微信用户信息解密（微信登录）、获取小程序码等等。 
 
-// sessionKeyExpired参数表示session_key是否过期（必须由前端判断），未过期则从缓存获取sessionKeyData
-if ($paramArr['sessionKeyExpired'] != 1) {
-    $sessionKeyData = $redis->get('miniprogram_jscode2session_appid_' . $appId);
-    $sessionKeyDataArr = json_decode($sessionKeyData, true);
-    $paramArr['sessionKey'] = $sessionKeyDataArr['sessionKey'];
-    $paramArr['openId'] = $sessionKeyDataArr['openId'];
-}
+### 项目文档
 
-$res = $miniProgram->decryptData($paramArr);
-
-if ($res['code'] == 100) {
-    // 将sessionKeyData写入缓存
-    $sessionKeyDataArr['sessionKey'] = $res['data']['sessionKey'];
-    $sessionKeyDataArr['openId'] = $res['data']['data']['openId'];
-    $redis->set('miniprogram_jscode2session_appid_' . $appId, json_encode($sessionKeyDataArr));
-
-    echo '解密成功';
-} else {
-    echo $res['msg'];
-}
-```
-
-* 获取无数量限制的小程序码
-
-```
-// 小程序码图片的保存路径
-$path = '';
-// 小程序码图片的保存名称
-$filename = '';
-
-// 小程序码接口所需参数
-$paramArr['scene'] = '';
-$paramArr['page'] = '';
-$paramArr['width'] = '';
-$paramArr['auto_color'] = '';
-$paramArr['line_color'] = '';
-$paramArr['is_hyaline'] = '';
-
-// 请求小程序码接口
-$res = $miniProgram->getWxacodeUnlimit($paramArr);
-
-// 打开文件并写入二进制流，生成图片
-$file = fopen($path . $filename, 'w');
-fwrite($file, $res);
-fclose($file);
-```
+[MiniProgramSDK Document](https://hillpy.github.io/MiniProgramSDK/v1/)
 
 ### TODO
 
@@ -129,22 +17,6 @@ fclose($file);
 
 ~~2. 小程序二维码、小程序码~~
 
-3. 模板消息
-
-4. 统一服务消息
-
-5. 动态消息
-
-6. 客服消息
-
-7. 数据分析
-
-8. 附近的小程序
-
-9. 插件管理
-
-10. 内容安全
-
 ### 仓库地址
 
 [Coding](https://coding.net/u/shinn_lancelot/p/MiniProgramSDK/git "MiniProgramSDK")<br>
diff --git a/demo.php b/demo.php
index e3d693c..d444a58 100644
--- a/demo.php
+++ b/demo.php
@@ -2,31 +2,31 @@
 
 /**
  * 使用案例
- * 注意：实际项目若使用composer安装的库，请先引入自动加载脚本（require __DIR__ . '/vender/autoload.php';），此例子中直接引用类库。另外需安装redis扩展并开启redis服务
+ * 注意：实际项目若使用composer安装的库，请先引入自动加载脚本（require __DIR__ . '/vender/autoload.php';），此例子中直接引用类库。另外需安装redis扩展并开启redis服务。
  */
 require __DIR__ . '/src/MiniProgram.php';
 
 use hillpy\MiniProgramSDK\MiniProgram;
 
-// 设置变量
+// 设置变量。
 $appId = '';
 $appSecret = '';
 $accessToken = '';
 
-// 从redis获取accessToken;
+// 从redis获取accessToken。
 $redis = new Redis();
 $redis->connect('127.0.0.1', 6379);
 $accessToken = $redis->get('miniprogram_access_token_appid_' . $appId);
 
-// 实例化MiniProgram
+// 实例化MiniProgram。
 $miniProgram = new MiniProgram($appId, $appSecret, $accessToken);
 
-//若缓存中不存在accessToken，从新实例化对象中获取并写入redis
+//若缓存中不存在accessToken，从新实例化对象中获取并写入redis。
 if (!$accessToken) {
     isset($miniProgram->accessTokenData['access_token']) && $accessToken = $miniProgram->accessTokenData['access_token'];
 
     if ($accessToken) {
-        // 获取的expires_in为秒时间戳，减去30秒（过期时间适当提前避免accessToken实际已失效）
+        // 获取的expires_in为秒时间戳，减去30秒（过期时间适当提前避免accessToken实际已失效）。
         if (isset($miniProgram->accessTokenData['expires_in'])) {
             $cacheTime = $miniProgram->accessTokenData['expires_in'] - 30;
         } else {
@@ -36,14 +36,14 @@
     }
 }
 
-// 输出accessToken
+// 输出accessToken。
 if ($accessToken == '') {
     echo 'accessToken获取失败<br>';
 } else {
     echo 'accessToken:' . $accessToken . '<br>';
 }
 
-// 解密登录用户数据
+// 解密登录用户数据。
 $paramArr['code'] = isset($_POST['code']) ? $_POST['code'] : '';
 $paramArr['rawData'] = isset($_POST['rawData']) ? $_POST['rawData'] : '';
 $paramArr['signature'] = isset($_POST['signature']) ? $_POST['signature'] : '';
@@ -51,7 +51,7 @@
 $paramArr['iv'] = isset($_POST['iv']) ? $_POST['iv'] : '';
 $paramArr['sessionKeyExpired'] = isset($_POST['sessionKeyExpired']) ? $_POST['sessionKeyExpired'] : '';
 
-// sessionKeyExpired参数表示session_key是否过期（必须由前端判断），未过期则从缓存获取sessionKeyData
+// sessionKeyExpired参数表示session_key是否过期（必须由前端判断），未过期则从缓存获取sessionKeyData。
 if ($paramArr['sessionKeyExpired'] != 1) {
     $sessionKeyData = $redis->get('miniprogram_jscode2session_appid_' . $appId);
     $sessionKeyDataArr = json_decode($sessionKeyData, true);
@@ -62,7 +62,7 @@
 $res = $miniProgram->decryptData($paramArr);
 
 if ($res['code'] == 100) {
-    // 将sessionKeyData写入缓存
+    // 将sessionKeyData写入缓存。
     $sessionKeyDataArr['sessionKey'] = $res['data']['sessionKey'];
     $sessionKeyDataArr['openId'] = $res['data']['data']['openId'];
     $redis->set('miniprogram_jscode2session_appid_' . $appId, json_encode($sessionKeyDataArr));
diff --git a/src/MiniProgram.php b/src/MiniProgram.php
index 7821f90..d1e98a4 100644
--- a/src/MiniProgram.php
+++ b/src/MiniProgram.php
@@ -159,7 +159,7 @@ public function createWXAQRCode($postParamArr = array())
     }
 
     /**
-     * 获取小程序码
+     * 获取有数量限制的小程序码
      * @param array $postParamArr
      * @return mixed
      */
@@ -175,7 +175,7 @@ public function getWXACode($postParamArr = array())
     }
 
     /**
-     * 获取小程序码（无数量限制）
+     * 获取无数量限制的小程序码
      * @param array $postParamArr
      * @return mixed
      */

From 3ad574f13cad885f8955af52a8184f194e3c07dc Mon Sep 17 00:00:00 2001
From: shinn_lancelot <lanhaichun0317@gmail.com>
Date: Sun, 15 Mar 2020 15:49:01 +0800
Subject: [PATCH 07/15] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9README.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 README.md | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 52f93fa..0eb8818 100644
--- a/README.md
+++ b/README.md
@@ -19,9 +19,8 @@ MiniProgramSDK是一个PHP的小程序开发包。封装微信小程序后端相
 
 ### 仓库地址
 
-[Coding](https://coding.net/u/shinn_lancelot/p/MiniProgramSDK/git "MiniProgramSDK")<br>
-[Gitee](https://gitee.com/hillpy/MiniProgramSDK "MiniProgramSDK")<br>
 [Github](https://github.com/hillpy/MiniProgramSDK "MiniProgramSDK")<br>
+[Gitee](https://gitee.com/hillpy/MiniProgramSDK "MiniProgramSDK")<br>
 
 ### 协议
 

From 39c7f5ec3d1f836f39fa68b215ebd5f62323624c Mon Sep 17 00:00:00 2001
From: shinn_lancelot <lanhaichun0317@gmail.com>
Date: Thu, 19 Mar 2020 21:05:03 +0800
Subject: [PATCH 08/15] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8E=B7?=
 =?UTF-8?q?=E5=8F=96getWxacodeUnlimit=E6=8E=A5=E5=8F=A3=E7=9A=84=E9=BB=98?=
 =?UTF-8?q?=E8=AE=A4=E5=8F=82=E6=95=B0=E7=9A=84bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/DefaultParamInfo.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/DefaultParamInfo.php b/src/DefaultParamInfo.php
index 958d0d0..949609d 100644
--- a/src/DefaultParamInfo.php
+++ b/src/DefaultParamInfo.php
@@ -21,7 +21,7 @@
         'line_color'=>array('r'=>0, 'g'=>0, 'b'=>0),
         'is_hyaline'=>false
     ),
-    'getWXACodeUnlimit'=>array(
+    'getWxacodeUnlimit'=>array(
         'scene'=>'',
         'page'=>'page/index/index',
         'width'=>430,

From b21fa081a92dcf860cd01154e8078d0a596f6bf7 Mon Sep 17 00:00:00 2001
From: shinn_lancelot <lanhaichun0317@gmail.com>
Date: Fri, 17 Apr 2020 09:42:35 +0800
Subject: [PATCH 09/15] =?UTF-8?q?feature:=20=E4=BC=98=E5=8C=96decryptData?=
 =?UTF-8?q?=E6=96=B9=E6=B3=95,=E9=80=82=E7=94=A8=E4=BA=8E=E8=A7=A3?=
 =?UTF-8?q?=E5=AF=86=E7=94=A8=E6=88=B7=E6=89=8B=E6=9C=BA=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/MiniProgram.php | 45 ++++++++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/src/MiniProgram.php b/src/MiniProgram.php
index d1e98a4..329f800 100644
--- a/src/MiniProgram.php
+++ b/src/MiniProgram.php
@@ -4,6 +4,7 @@
  * 微信小程序api封装类
  * Author: shinn_lancelot
  */
+
 namespace hillpy\MiniProgramSDK;
 
 include "Common.php";
@@ -49,9 +50,9 @@ public function __construct($appId, $appSecret, $accessToken = '')
     public function getAccessTokenData()
     {
         $urlParamArr = array(
-            'grant_type'=>'client_credential',
-            'appid'=>$this->appId,
-            'secret'=>$this->appSecret
+            'grant_type' => 'client_credential',
+            'appid' => $this->appId,
+            'secret' => $this->appSecret
         );
         $url = self::API_HOST . self::ACCESS_TOKEN_PATH . http_build_query($urlParamArr);
         $res = json_decode(Common::httpRequest($url), true);
@@ -70,13 +71,13 @@ public function getAccessTokenData()
     public function jscode2Session($code)
     {
         $urlParamArr = array(
-            'appid'=>$this->appId,
-            'secret'=>$this->appSecret,
-            'js_code'=>$code,
-            'grant_type'=>'authorization_code'
+            'appid' => $this->appId,
+            'secret' => $this->appSecret,
+            'js_code' => $code,
+            'grant_type' => 'authorization_code'
         );
         $url = self::API_HOST . self::JSCODE_2_SESSSION_PATH . http_build_query($urlParamArr);
-        $res = json_decode(Common::httpRequest($url),true);
+        $res = json_decode(Common::httpRequest($url), true);
         return $res;
     }
 
@@ -97,8 +98,8 @@ public function decryptData($paramArr = array())
 
         // 1.获取openid、session_key（若存在session_key，则默认理解为session_key未过期，直接使用其进行解密）
         if ($finalParamArr['sessionKey']) {
-            $openId = $finalParamArr['openId'];
             $sessionKey = $finalParamArr['sessionKey'];
+            $openId = isset($finalParamArr['openId']) ? $finalParamArr['openId'] : '';
         } else {
             $sessionData = $this->jscode2Session($finalParamArr['code']);
             if (isset($sessionData['errcode'])) {
@@ -106,16 +107,21 @@ public function decryptData($paramArr = array())
                 $res['msg'] = Common::getErrorMsg($sessionData['errcode']);
                 return $res;
             }
-            $openId = $sessionData['openid'];
             $sessionKey = $sessionData['session_key'];
+            $openId = isset($sessionData['openId']) ? $sessionData['openId'] : '';
         }
 
         // 2.计算签名并与传入签名进行校验
-        $newSignature = sha1($finalParamArr['rawData'] . $sessionKey);
-        if ($newSignature !== $finalParamArr['signature']) {
-            $res['code'] = -102;
-            $res['msg'] = '签名不匹配';
-            return $res;
+        if (
+            $finalParamArr['rawData'] != '' &&
+            $finalParamArr['signature'] != ''
+        ) {
+            $newSignature = sha1($finalParamArr['rawData'] . $sessionKey);
+            if ($newSignature !== $finalParamArr['signature']) {
+                $res['code'] = -102;
+                $res['msg'] = '签名不匹配';
+                return $res;
+            }
         }
 
         // 3.使用sessionKey解密加密数据包
@@ -138,6 +144,7 @@ public function decryptData($paramArr = array())
         $resData['session3rd'] = $session3rd;
         $resData['data'] = $data;
         $resData['sessionKey'] = $sessionKey;
+        $resData['openId'] = $openId;
         $res['data'] = $resData;
         return $res;
     }
@@ -151,7 +158,7 @@ public function createWXAQRCode($postParamArr = array())
     {
         $finalParamArr = Common::extendArrayData($this->defaultParamInfo[__FUNCTION__], $postParamArr);
         $urlParamArr = array(
-            'access_token'=>$this->accessToken
+            'access_token' => $this->accessToken
         );
         $url = self::API_HOST . self::WXAQRCODE_PATH . http_build_query($urlParamArr);
         $res = Common::httpRequest($url, json_encode($finalParamArr));
@@ -167,7 +174,7 @@ public function getWXACode($postParamArr = array())
     {
         $finalParamArr = Common::extendArrayData($this->defaultParamInfo[__FUNCTION__], $postParamArr);
         $urlParamArr = array(
-            'access_token'=>$this->accessToken
+            'access_token' => $this->accessToken
         );
         $url = self::API_HOST . self::WXACODE_PATH . http_build_query($urlParamArr);
         $res = Common::httpRequest($url, json_encode($finalParamArr));
@@ -183,10 +190,10 @@ public function getWxacodeUnlimit($postParamArr = array())
     {
         $finalParamArr = Common::extendArrayData($this->defaultParamInfo[__FUNCTION__], $postParamArr);
         $urlParamArr = array(
-            'access_token'=>$this->accessToken
+            'access_token' => $this->accessToken
         );
         $url = self::API_HOST . self::WXACODE_UNLIMIT_PATH . http_build_query($urlParamArr);
         $res = Common::httpRequest($url, json_encode($finalParamArr));
         return $res;
     }
-}
\ No newline at end of file
+}

From 6f44ad1b7d3ad4a9164d78d21e1b62d21def5dc8 Mon Sep 17 00:00:00 2001
From: shinn_lancelot <lanhaichun0317@gmail.com>
Date: Fri, 17 Apr 2020 09:43:36 +0800
Subject: [PATCH 10/15] =?UTF-8?q?style:=20=E6=A0=BC=E5=BC=8F=E5=8C=96?=
 =?UTF-8?q?=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/Common.php                        |  6 ++--
 src/DefaultParamInfo.php              | 50 +++++++++++++--------------
 src/wxBizDataCrypt/errorCode.php      |  2 --
 src/wxBizDataCrypt/wxBizDataCrypt.php | 22 +++++-------
 4 files changed, 37 insertions(+), 43 deletions(-)

diff --git a/src/Common.php b/src/Common.php
index e57c3d5..4715c1b 100644
--- a/src/Common.php
+++ b/src/Common.php
@@ -3,6 +3,7 @@
 /**
  * 通用函数类
  */
+
 namespace hillpy\MiniProgramSDK;
 
 class Common
@@ -36,7 +37,7 @@ public static function httpRequest($url, $data = null)
      */
     public static function isWin()
     {
-        if (strtoupper(substr(PHP_OS,0,3)) === 'WIN') {
+        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
             return true;
         } else {
             return false;
@@ -108,7 +109,7 @@ public static function extendArrayData($rawData, $newData)
             return $rawData;
         }
 
-        foreach ($rawData as $key=>$value) {
+        foreach ($rawData as $key => $value) {
             isset($newData[$key]) && $rawData[$key] = $newData[$key];
         }
 
@@ -144,4 +145,3 @@ public static function getErrorMsg($errorCode)
         return $errorMsg;
     }
 }
-
diff --git a/src/DefaultParamInfo.php b/src/DefaultParamInfo.php
index 949609d..905af0a 100644
--- a/src/DefaultParamInfo.php
+++ b/src/DefaultParamInfo.php
@@ -1,32 +1,32 @@
 <?php
 
 return array(
-    'decryptData'=>array(
-        'sessionKey'=>'',
-        'openId'=>'',
-        'code'=>'',
-        'rawData'=>'',
-        'signature'=>'',
-        'encryptedData'=>'',
-        'iv'=>''
+    'decryptData' => array(
+        'sessionKey' => '',
+        'openId' => '',
+        'code' => '',
+        'rawData' => '',
+        'signature' => '',
+        'encryptedData' => '',
+        'iv' => ''
     ),
-    'createWXAQRCode'=>array(
-        'path'=>'',
-        'width'=>430
+    'createWXAQRCode' => array(
+        'path' => '',
+        'width' => 430
     ),
-    'getWXACode'=>array(
-        'path'=>'',
-        'width'=>430,
-        'auto_color'=>false,
-        'line_color'=>array('r'=>0, 'g'=>0, 'b'=>0),
-        'is_hyaline'=>false
+    'getWXACode' => array(
+        'path' => '',
+        'width' => 430,
+        'auto_color' => false,
+        'line_color' => array('r' => 0, 'g' => 0, 'b' => 0),
+        'is_hyaline' => false
     ),
-    'getWxacodeUnlimit'=>array(
-        'scene'=>'',
-        'page'=>'page/index/index',
-        'width'=>430,
-        'auto_color'=>false,
-        'line_color'=>array('r'=>0, 'g'=>0, 'b'=>0),
-        'is_hyaline'=>false
+    'getWxacodeUnlimit' => array(
+        'scene' => '',
+        'page' => 'page/index/index',
+        'width' => 430,
+        'auto_color' => false,
+        'line_color' => array('r' => 0, 'g' => 0, 'b' => 0),
+        'is_hyaline' => false
     )
-);
\ No newline at end of file
+);
diff --git a/src/wxBizDataCrypt/errorCode.php b/src/wxBizDataCrypt/errorCode.php
index 9b12a8c..27095ad 100644
--- a/src/wxBizDataCrypt/errorCode.php
+++ b/src/wxBizDataCrypt/errorCode.php
@@ -19,5 +19,3 @@ class ErrorCode
     public static $IllegalBuffer = -41003;
     public static $DecodeBase64Error = -41004;
 }
-
-?>
\ No newline at end of file
diff --git a/src/wxBizDataCrypt/wxBizDataCrypt.php b/src/wxBizDataCrypt/wxBizDataCrypt.php
index 3214c18..449a1f9 100644
--- a/src/wxBizDataCrypt/wxBizDataCrypt.php
+++ b/src/wxBizDataCrypt/wxBizDataCrypt.php
@@ -20,7 +20,7 @@ class WXBizDataCrypt
      * @param $sessionKey string 用户在小程序登录后获取的会话密钥
      * @param $appid string 小程序的appid
      */
-    public function __construct( $appid, $sessionKey)
+    public function __construct($appid, $sessionKey)
     {
         $this->sessionKey = $sessionKey;
         $this->appid = $appid;
@@ -35,35 +35,31 @@ public function __construct( $appid, $sessionKey)
      *
      * @return int 成功0，失败返回对应的错误码
      */
-    public function decryptData( $encryptedData, $iv, &$data )
+    public function decryptData($encryptedData, $iv, &$data)
     {
         if (strlen($this->sessionKey) != 24) {
             return ErrorCode::$IllegalAesKey;
         }
-        $aesKey=base64_decode($this->sessionKey);
+        $aesKey = base64_decode($this->sessionKey);
 
 
         if (strlen($iv) != 24) {
             return ErrorCode::$IllegalIv;
         }
-        $aesIV=base64_decode($iv);
+        $aesIV = base64_decode($iv);
 
-        $aesCipher=base64_decode($encryptedData);
+        $aesCipher = base64_decode($encryptedData);
 
-        $result=openssl_decrypt( $aesCipher, "AES-128-CBC", $aesKey, 1, $aesIV);
+        $result = openssl_decrypt($aesCipher, "AES-128-CBC", $aesKey, 1, $aesIV);
 
-        $dataObj=json_decode( $result );
-        if( $dataObj  == NULL )
-        {
+        $dataObj = json_decode($result);
+        if ($dataObj  == NULL) {
             return ErrorCode::$IllegalBuffer;
         }
-        if( $dataObj->watermark->appid != $this->appid )
-        {
+        if ($dataObj->watermark->appid != $this->appid) {
             return ErrorCode::$IllegalBuffer;
         }
         $data = $result;
         return ErrorCode::$OK;
     }
-
 }
-

From cf65930d9881605e558a60b89863319cb2e3cd53 Mon Sep 17 00:00:00 2001
From: shinn_lancelot <lanhaichun0317@gmail.com>
Date: Fri, 17 Apr 2020 09:44:59 +0800
Subject: [PATCH 11/15] =?UTF-8?q?refactor:=20=E5=AE=8C=E5=96=84demo.php,?=
 =?UTF-8?q?=E5=8C=85=E5=90=AB=E4=BA=86=E8=A7=A3=E5=AF=86=E7=94=A8=E6=88=B7?=
 =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E4=BA=8B=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 demo.php | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/demo.php b/demo.php
index d444a58..9896518 100644
--- a/demo.php
+++ b/demo.php
@@ -9,8 +9,8 @@
 use hillpy\MiniProgramSDK\MiniProgram;
 
 // 设置变量。
-$appId = '';
-$appSecret = '';
+$appId = '小程序APPID';
+$appSecret = '小程序APPSECRET';
 $accessToken = '';
 
 // 从redis获取accessToken。
@@ -49,23 +49,22 @@
 $paramArr['signature'] = isset($_POST['signature']) ? $_POST['signature'] : '';
 $paramArr['encryptedData'] = isset($_POST['encryptedData']) ? $_POST['encryptedData'] : '';
 $paramArr['iv'] = isset($_POST['iv']) ? $_POST['iv'] : '';
-$paramArr['sessionKeyExpired'] = isset($_POST['sessionKeyExpired']) ? $_POST['sessionKeyExpired'] : '';
+$sessionCacheKey = isset($_POST['sessionCacheKey']) ? $_POST['sessionCacheKey'] : '';
 
-// sessionKeyExpired参数表示session_key是否过期（必须由前端判断），未过期则从缓存获取sessionKeyData。
-if ($paramArr['sessionKeyExpired'] != 1) {
-    $sessionKeyData = $redis->get('miniprogram_jscode2session_appid_' . $appId);
-    $sessionKeyDataArr = json_decode($sessionKeyData, true);
-    $paramArr['sessionKey'] = $sessionKeyDataArr['sessionKey'];
-    $paramArr['openId'] = $sessionKeyDataArr['openId'];
-}
+// sessionCacheKey为sessionKey缓存名的一部分。若存在，则从缓存获取。否则，从接口请求。
+$sessionCacheKey && $paramArr['sessionKey'] = $redis->get('miniprogram_session_key_appid_' . $appId . '_key_' . $sessionCacheKey);
 
 $res = $miniProgram->decryptData($paramArr);
 
 if ($res['code'] == 100) {
-    // 将sessionKeyData写入缓存。
-    $sessionKeyDataArr['sessionKey'] = $res['data']['sessionKey'];
-    $sessionKeyDataArr['openId'] = $res['data']['data']['openId'];
-    $redis->set('miniprogram_jscode2session_appid_' . $appId, json_encode($sessionKeyDataArr));
+    if (!$sessionCacheKey) {
+        // 将sessionKey写入缓存，过期时间尽量长一些，此处缓存30天。
+        $sessionCacheKey = '随机生成字符串';
+        $redis->setex('miniprogram_session_key_appid_' . $appId . '_key_' . $sessionCacheKey, $res['data']['sessionKey'], 3600 * 24 * 30);
+    }
+
+    // data为解密后的数据。可根据解密数据，做相关处理。如登录注册，并生成jwt。然后将jwt、sessionCacheKey、用户信息返回给小程序端
+    $data = $res['data']['data'];
 
     echo '解密成功';
 } else {

From fa27818c625e03b5abd2d854238148ec97810c55 Mon Sep 17 00:00:00 2001
From: shinn_lancelot <lanhaichun0317@gmail.com>
Date: Fri, 17 Apr 2020 09:45:35 +0800
Subject: [PATCH 12/15] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9.gitignore?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 779e19d..bfec22f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 .idea
 .vscode
 /vendor/
+.DS_Store
\ No newline at end of file

From a9df4f553f60033a6235891a92a740a1b64ffe7a Mon Sep 17 00:00:00 2001
From: shinn_lancelot <lanhaichun0317@gmail.com>
Date: Fri, 17 Apr 2020 09:47:30 +0800
Subject: [PATCH 13/15] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9composer?=
 =?UTF-8?q?=E4=B8=AD=E7=9A=84=E9=82=AE=E7=AE=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index cbed262..17b7bfa 100644
--- a/composer.json
+++ b/composer.json
@@ -7,7 +7,7 @@
     "authors": [
         {
             "name": "shinn_lancelot",
-            "email": "945226793@qq.com",
+            "email": "lanhaichun0317@gmail.com",
             "homepage": "https://hillpy.com",
             "role": "Developer"
         }

From 1f9f76e6694ca517d57f5e4ce3a567f913bb3efe Mon Sep 17 00:00:00 2001
From: shinn_lancelot <lanhaichun0317@gmail.com>
Date: Fri, 17 Apr 2020 11:30:43 +0800
Subject: [PATCH 14/15] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9demo.=E4=BF=AE?=
 =?UTF-8?q?=E6=94=B9README=E7=AD=89=E5=85=B6=E5=AE=83=E7=9B=B8=E5=85=B3.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 LICENSE       | 2 +-
 README.md     | 8 +-------
 composer.json | 2 +-
 demo.php      | 2 +-
 4 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/LICENSE b/LICENSE
index 61846df..b9f3734 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2018 shinn lancelot
+Copyright (c) 2018-present shinn_lancelot
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 0eb8818..ed4bda0 100644
--- a/README.md
+++ b/README.md
@@ -5,18 +5,12 @@
 
 ### MiniProgramSDK是什么
 
-MiniProgramSDK是一个PHP的小程序开发包。封装微信小程序后端相关接口，比如php端微信用户信息解密（微信登录）、获取小程序码等等。 
+MiniProgramSDK是一个PHP的小程序开发包。封装微信小程序后端相关接口，比如解密信息（用户信息、手机号）、获取小程序码等。
 
 ### 项目文档
 
 [MiniProgramSDK Document](https://hillpy.github.io/MiniProgramSDK/v1/)
 
-### TODO
-
-~~1. 微信用户数据解密~~
-
-~~2. 小程序二维码、小程序码~~
-
 ### 仓库地址
 
 [Github](https://github.com/hillpy/MiniProgramSDK "MiniProgramSDK")<br>
diff --git a/composer.json b/composer.json
index 17b7bfa..728d1a7 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
 {
     "name": "hillpy/mini-program-sdk",
-    "description": "微信小程序后端php开发包，封装微信小程序php端相关接口，比如php端微信用户信息解密（即登陆功能）、获取sessionKey、获取小程序码等",
+    "description": "MiniProgramSDK是一个PHP的小程序开发包。封装微信小程序后端相关接口，比如解密信息（用户信息、手机号）、获取小程序码等。",
     "keywords": ["小程序", "miniprogram", "微信", "wechat"],
     "type": "library",
     "license": "MIT",
diff --git a/demo.php b/demo.php
index 9896518..a46d72b 100644
--- a/demo.php
+++ b/demo.php
@@ -43,7 +43,7 @@
     echo 'accessToken:' . $accessToken . '<br>';
 }
 
-// 解密登录用户数据。
+// 客户端请求参数。
 $paramArr['code'] = isset($_POST['code']) ? $_POST['code'] : '';
 $paramArr['rawData'] = isset($_POST['rawData']) ? $_POST['rawData'] : '';
 $paramArr['signature'] = isset($_POST['signature']) ? $_POST['signature'] : '';

From 8cac4d67677f542e13d3af5d15130c66013e0384 Mon Sep 17 00:00:00 2001
From: shinn_lancelot <lanhaichun0317@gmail.com>
Date: Fri, 17 Apr 2020 13:41:13 +0800
Subject: [PATCH 15/15] =?UTF-8?q?doc:=20=E4=BF=AE=E6=94=B9README?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 README.md | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index ed4bda0..f770345 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,11 @@
+## MiniProgramSDK
+
 [![license](https://img.shields.io/github/license/hillpy/MiniProgramSDK.svg)](https://github.com/hillpy/MiniProgramSDK/blob/master/LICENSE)
 [![release](https://img.shields.io/github/release/hillpy/MiniProgramSDK.svg)](https://img.shields.io/github/release/hillpy/MiniProgramSDK.svg)
 [![packagist](https://img.shields.io/packagist/v/hillpy/mini-program-sdk.svg)](https://packagist.org/packages/hillpy/mini-program-sdk)
 [![downloads](https://img.shields.io/packagist/dt/hillpy/mini-program-sdk.svg)](https://img.shields.io/packagist/dt/hillpy/mini-program-sdk.svg)
 
-### MiniProgramSDK是什么
-
-MiniProgramSDK是一个PHP的小程序开发包。封装微信小程序后端相关接口，比如解密信息（用户信息、手机号）、获取小程序码等。
-
-### 项目文档
-
-[MiniProgramSDK Document](https://hillpy.github.io/MiniProgramSDK/v1/)
+> MiniProgramSDK是一个PHP的小程序开发包。封装微信小程序后端相关接口，比如解密信息（用户信息、手机号）、获取小程序码等。
 
 ### 仓库地址
 
