資源簡介
蘋果cms 追劇達人App 后臺Api接口文件
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Net;
using?System.IO;
namespace?PhalApiClientSDK
{
????/**
?????*?PhalApi客戶端SDK包(JAVA版)
?????*
?????*?-?以接口查詢語言(ASQL)的方式來實現接口請求
?????*?-?出于簡明客戶端,將全部的類都歸于同一個文件,避免過多的加載
?????*?
?????*?
使用示例:
?????‘‘‘
?????*?PhalApiClientResponse?response?=?PhalApiClient.create()
?????*???.withHost(“http://demo.phalapi.net/“)
?????*???.withService(“Default.Index“)
?????*???.withparamsList(“name“?“dogstar“)
?????*???.withTimeout(3000)
?????*???.request();
?????*
?????*?Log.v(“response?ret“?response.ret?+?““);
?????*?Log.v(“response?data“?response.data);
?????*?Log.v(“response?msg“?response.msg);
????‘‘‘
????????*
????????*?@package?????PhalApi\Response
????????*?@license?????http://www.phalapi.net/license?GPL?協議
????????*?@link????????http://www.phalapi.net/
????????*?@author??????dogstar??2015-10-16
?????*/
????public?class?PhalApiClient?{
????????protected?String?host;
????????protected?PhalApiClientFilter?filter;
????????protected?PhalApiClientParser?parser;
????????protected?String?service;
????????protected?int?timeoutMs;
????????protected?Dictionary?paramsList;
????????/**
?????????*?創建一個接口實例,注意:不是單例模式
?????????*?@return?PhalApiClient
?????????*/
????????public?static?PhalApiClient?create()?{
????????????return?new?PhalApiClient();
????????}
????????protected?PhalApiClient()?{
???? ????this.host?=?““;
????????????this.parser?=?new?PhalApiClientParserJson();
????????????this.reset();
????????}
????????/**
?????????*?設置接口域名
?????????*?@param?String?host
?????????*?@return?PhalApiClient
?????????*/
????????public?PhalApiClient?withHost(String?host)?{
????????????this.host?=?host;
????????????return?this;
????????}
????????/**
?????????*?設置過濾器,與服務器的DI().filter對應
?????????*?@param?PhalApiClientFilter?filter?過濾器
?????????*?@return?PhalApiClient
?????????*/
????????public?PhalApiClient?withFilter(PhalApiClientFilter?filter)?{
????????????this.filter?=?filter;
????????????return?this;
????????}
????????/**
?????????*?設置結果解析器,僅當不是JSON返回格式時才需要設置
?????????*?@param?PhalApiClientParser?parser?結果解析器
?????????*?@return?PhalApiClient
?????????*/
????????public?PhalApiClient?withParser(PhalApiClientParser?parser)?{
????????????this.parser?=?parser;
????????????return?this;
????????}
????????/**
?????????*?重置,將接口服務名稱、接口參數、請求超時進行重置,便于重復請求
?????????*?@return?PhalApiClient
?????????*/
????????public?PhalApiClient?reset()?{
????????????this.service?=?““;
????????????this.timeoutMs?=?3000;
????????????this.paramsList?=?new?Dictionary();
????????
????????????return?this;
????????}
????????/**
?????????*?設置將在調用的接口服務名稱,如:Default.Index
?????????*?@param?String?service?接口服務名稱
?????????*?@return?PhalApiClient
?????????*/
????????public?PhalApiClient?withService(String?service)?{
????????????this.service?=?service;
????????????return?this;
????????}
????????/**
?????????*?設置接口參數,此方法是唯一一個可以多次調用并累加參數的操作
?????????*?@param?String?name
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-03-06?01:03??app\
?????目錄???????????0??2020-03-06?01:03??app\cms\
?????文件???????14340??2019-10-19?14:18??app\cms\.DS_Store
?????文件??????????73??2019-04-27?18:21??app\cms\.gitignore
?????目錄???????????0??2020-03-06?01:03??app\cms\.idea\
?????文件?????????458??2019-10-08?14:50??app\cms\.idea\deployment.xm
?????文件?????????174??2019-05-22?08:23??app\cms\.idea\misc.xm
?????文件?????????254??2019-05-22?08:23??app\cms\.idea\modules.xm
?????文件?????????814??2019-05-22?08:23??app\cms\.idea\p.iml
?????文件?????????591??2019-05-22?08:23??app\cms\.idea\php.xm
?????文件?????????196??2019-10-08?11:28??app\cms\.idea\vcs.xm
?????文件?????????617??2019-10-08?14:50??app\cms\.idea\webServers.xm
?????文件???????42035??2019-10-19?14:18??app\cms\.idea\workspace.xm
?????文件???????18048??2019-04-27?18:21??app\cms\LICENSE
?????文件????????4820??2019-04-27?18:21??app\cms\README.md
?????目錄???????????0??2020-03-06?01:03??app\cms\bin\
?????文件????????5237??2019-04-27?18:21??app\cms\bin\build_sqls.php
?????文件????????9037??2019-04-27?18:21??app\cms\bin\build_test.php
?????文件?????????181??2019-04-27?18:21??app\cms\bin\phalapi-buildsqls
?????文件?????????182??2019-04-27?18:21??app\cms\bin\phalapi-buildtest
?????文件?????????131??2019-04-27?18:21??app\cms\bin\phalapi-cli
?????文件?????????915??2019-09-16?15:06??app\cms\composer.json
?????文件????????8808??2019-09-10?11:39??app\cms\composer.lock
?????目錄???????????0??2020-03-06?01:03??app\cms\config\
?????文件?????????824??2019-04-27?18:21??app\cms\config\app.php
?????文件????????1911??2020-02-05?08:44??app\cms\config\dbs.php
?????文件????????1688??2019-05-23?14:23??app\cms\config\di.php
?????文件?????????712??2019-04-27?18:21??app\cms\config\sys.php
?????目錄???????????0??2020-03-06?01:03??app\cms\data\
?????文件?????????560??2019-04-27?18:21??app\cms\data\phalapi.sql
?????目錄???????????0??2020-03-06?01:03??app\cms\language\
............此處省略1156個文件信息
評論
共有 條評論