<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ##版本升級接口開發及演示 學習要點: 1. 掌握如何封裝 check 方法; 2. check 方法用于檢測最新版本信息! 接口傳遞參數: ||| |---|---|---| | app_id | 客戶端ID1、安卓pad | | version_id | 版本號 | | did | 客戶端設備號 | | version_mini | 小版本號 | | encrypt_did | 加密后的 did 串 | 基本參數傳遞方式和獲取方法 | 方式 | 獲取 | |---|---| | get | $_GET | | post | $_POST | | header頭 | $_SERVER | $_SERVER 是一個包含了諸如頭信息(header)、路徑(path)、以及腳本位置(script location)等信息的數組 ###**檢測APP發送數據** *模擬APP發送POST請求頁面:/var/www/app/init.html* ~~~html <!DOCTYPE html> <html> <head> <title></title> </head> <body> <form action="http://192.168.2.110/app/init.php?format=xml" method="post" accept-charset="utf-8"> 設備號:<input type="text" value="" name="did" /> <br /> 版本號:<input type="text" value="" name="version_id" /> <br /> 小版本號:<input type="text" value="" name="version_mini" /> <br /> APP類型:<input type="text" value="" name="app_id" /> <br /> encrypt_did:<input type="text" value="c39f07bf54425745d642498395ce144c" name="encrypt_did" /> <br /> <input type="submit" value="提交"> </form> </body> </html> ~~~ *獲取POST請求數據頁面:/var/www/app/init.php* ~~~php /** * 處理版本升級 */ require_once('./common.php'); class Init extends Common { public function index() { $this->check(); } } $init = new Init(); $init->index(); ~~~ *處理接口公共業務:/var/www/app/common.php* ~~~php require_once('./response.php'); require_once('./db.php'); /** * 處理接口公共業務 */ class Common { public $params; public $app; public function check() { $this->params['app_id'] = $appId = isset($_POST['app_id']) ? $_POST['app_id'] : ''; $this->params['version_id'] = $versionId = isset($_POST['version_id']) ? $_POST['version_id'] : ''; $this->params['version_mini'] = $versionMini = isset($_POST['version_mini']) ? $_POST['version_mini'] : ''; $this->params['did'] = $did = isset($_POST['did']) ? $_POST['did'] : ''; $this->params['encrypt_did'] = $encryptDid = isset($_POST['encrypt_did']) ? $_POST['encrypt_did'] : ''; if(!is_numeric($appId) || !is_numeric($versionId)) { return Response::show(401, '參數不合法'); } // 判定app是否需要加密 $this->app = $this->getApp($appId); if (!$this->app) { return Response::show(402, 'app_id不存在'); } // 該設備需要加密,并且對設備號did連上加密key進行加密的結果不等于encrypt_did,則沒有權限 if($this->app['is_encryption'] && $encryptDid != md5($did . $this->app['key'])) { return Response::show(403, '沒有該權限'); } } // 獲取設備信息 public function getApp($id) { $sql = "select * from `app` where id = " . $id . " and status = 1 limit 1"; $connect = Db::getInstance()->connect(); $result = mysql_query($sql, $connect); return mysql_fetch_assoc($result); } } ~~~ ###**判斷是否升級APP** *common類里增加獲取版本信息的方法* ``` // 獲取版本信息 public function getversionUpgrade($appId) { $sql = "select * from `version_upgrade` where app_id = " . $appId . " and status = 1 limit 1"; $connect = Db::getInstance()->connect(); $result = mysql_query($sql, $connect); return mysql_fetch_assoc($result); } ``` *修改init.php首頁文件* ``` require_once('./common.php'); class Init extends Common { public function index() { $this->check(); // 獲取版本升級信息 $versionUpgrade = $this->getversionUpgrade($this->app['id']); if ($versionUpgrade) { // 要升級 并且 當前版本號小于要升級的版本號 if ($versionUpgrade['type'] && $this->params['version_id'] < $versionUpgrade['version_id']) { // 要升級 $versionUpgrade['is_upload'] = $versionUpgrade['type']; } else { // 不升級 $versionUpgrade['is_upload'] = 0; } return Response::show(200, '版本升級信息獲取成功', $versionUpgrade); } else { return Response::show(400, '版本升級信息獲取失敗'); } } } $init = new Init(); $init->index(); ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看