├── server.key ├── server.pem ├── src └── App │ ├── Common │ ├── README.md │ ├── CommonDomain.php │ ├── Request.php │ └── Exception │ │ └── WrongRequestException.php │ ├── Model │ ├── Project │ │ ├── Task.php │ │ ├── TaskTag.php │ │ ├── TaskToTag.php │ │ ├── Doc.php │ │ ├── Build.php │ │ ├── Log.php │ │ ├── TaskLog.php │ │ ├── TaskType.php │ │ ├── TaskUser.php │ │ ├── Level.php │ │ ├── ProjectType.php │ │ ├── File.php │ │ ├── TaskTypeTemplate.php │ │ └── User.php │ ├── System │ │ ├── Log.php │ │ ├── Action.php │ │ └── Setting.php │ ├── User │ │ ├── Level.php │ │ ├── Position.php │ │ ├── Setting │ │ │ └── UserSetting.php │ │ └── UserToken.php │ ├── Team │ │ ├── Team.php │ │ └── TeamUser.php │ ├── Examples │ │ └── CURD.php │ └── Common │ │ └── Notify.php │ ├── Auth │ ├── Domain │ │ ├── User.php │ │ ├── MenuModel.php │ │ ├── Rule.php │ │ └── Menu.php │ └── Model │ │ ├── User.php │ │ └── Access.php │ ├── Plugins │ ├── GateWayWorker │ │ ├── start_register.php │ │ ├── start_businessworker.php │ │ ├── Events.php │ │ └── start_gateway.php │ └── MessageService.php │ ├── Api │ ├── Site.php │ ├── Common │ │ └── Search.php │ ├── Team │ │ └── User.php │ ├── System │ │ ├── Setting.php │ │ └── Log.php │ └── User │ │ └── UserSetting │ │ └── Setting.php │ └── Domain │ ├── System │ ├── Setting.php │ └── Log.php │ ├── Project │ ├── Level.php │ ├── TaskTypeTemplate.php │ └── ProjectType.php │ └── User │ ├── Setting │ └── UserSetting.php │ ├── Level.php │ └── Position.php ├── sdk ├── Python │ └── PhalApiClient │ │ ├── python2.x │ │ ├── __init__.py │ │ ├── PhalApiClient.py │ │ └── demo.py │ │ ├── python3.x │ │ ├── __init__.py │ │ ├── PhalApiClient.py │ │ └── demo.py │ │ └── RequestResult.txt ├── Ruby │ ├── PhalApiClient │ │ ├── tests │ │ │ ├── run_tests │ │ │ ├── client_response.rb │ │ │ └── client_parser_json.rb │ │ └── demo.rb │ └── README.md ├── Objective-C │ ├── PhalApiClient │ │ ├── AFNPhalApiClient │ │ │ ├── AFNPhalApiClient.h │ │ │ └── Vendor │ │ │ │ └── AFNetworking-2.6.1 │ │ │ │ └── AFNetworking.h │ │ ├── PhalApiClientFilter.h │ │ └── PhalApiClientFilter.m │ └── XSHttpTool │ │ ├── Singleton.h │ │ └── AFNetworking │ │ ├── UIKit+AFNetworking │ │ ├── UIKit+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.h │ │ └── UIActivityIndicatorView+AFNetworking.h │ │ └── AFNetworking.h ├── JAVA │ └── net │ │ └── phalapi │ │ └── sdk │ │ ├── PhalApiClientParser.java │ │ ├── PhalApiClientFilter.java │ │ ├── PhalApiClientParserJson.java │ │ └── PhalApiClientResponse.java ├── C_Sharp │ └── PhalApiClient │ │ ├── PhalApiClientParser.cs │ │ ├── PhalApiClientFilter.cs │ │ ├── PhalApiClientParserJson.cs │ │ └── PhalApiClientResponse.cs ├── Go │ └── main.go ├── PHP │ └── PhalApiClient │ │ └── demo.php └── React-Native │ └── PhalApi.js ├── .gitignore ├── public ├── upload │ └── image │ │ └── avatar │ │ ├── 05615469049164891.jpg │ │ ├── 05615469329162689.jpg │ │ ├── 05615471850782075.jpg │ │ ├── 05615473055751945.jpg │ │ ├── 05615473335854671.jpg │ │ ├── 05615475386505726.jpg │ │ ├── 05615475470682611.jpg │ │ ├── 05615476045203194.jpg │ │ ├── 05615476081595275.jpg │ │ ├── 05615569889600599.jpg │ │ ├── 05615570159577770.jpg │ │ ├── 05615571376804168.jpg │ │ ├── 05615571488974809.jpg │ │ ├── 05615571557460600.jpg │ │ ├── 05616723878064943.png │ │ ├── 05616727525274124.png │ │ ├── 05616727684643009.png │ │ ├── 05616727728296098.png │ │ ├── 05617492627907609.jpg │ │ ├── 05617492738849947.png │ │ ├── 05618223696604524.png │ │ ├── 05618325540518915.png │ │ ├── 05619145712777874.png │ │ ├── 05619145754930775.png │ │ ├── 05619237151924827.png │ │ ├── 05619237189303418.png │ │ ├── 05619237270573549.png │ │ ├── 05619237353657756.png │ │ ├── 05622647172200915.png │ │ ├── 05622784160981931.png │ │ ├── 05639093062375230.jpg │ │ ├── 05641641361119512.jpg │ │ ├── 05641642052571346.jpg │ │ ├── 05641642452621148.jpg │ │ ├── 05646905706191511.jpg │ │ ├── 05655254325069485.jpeg │ │ ├── 05655255423226668.jpg │ │ ├── 05655255495984840.jpg │ │ ├── 05655255554844756.jpg │ │ ├── 05655257511635588.jpeg │ │ ├── 05655505681633672.jpeg │ │ ├── 05655506982150225.jpg │ │ ├── 05656936443651717.png │ │ ├── 05656938352531032.jpg │ │ ├── 05659620324959916.jpg │ │ ├── 05660592941388599.jpg │ │ ├── 05660593227113728.jpg │ │ ├── 05660593362235279.jpg │ │ ├── 05660595689816134.jpg │ │ ├── 05660595922924642.jpg │ │ ├── 05661499926164858.jpg │ │ ├── 05666588804890448.jpg │ │ ├── 05666646428976777.jpg │ │ ├── 05666646566596902.jpg │ │ ├── 05669877855020268.png │ │ ├── 05669877895945431.jpg │ │ ├── 05669877947863746.png │ │ ├── 05669878008284742.jpg │ │ ├── 05669878794325037.png │ │ ├── 05669878824655350.jpg │ │ ├── 05669878894957473.jpg │ │ ├── 05669878964915480.jpg │ │ ├── 05669878999126203.jpg │ │ ├── 05672461596569805.png │ │ ├── 05672649543073197.jpg │ │ ├── 05675999474165911.png │ │ ├── 05676017114798050.jpg │ │ ├── 05676017222437800.jpg │ │ ├── 05676017809560972.jpg │ │ ├── 05676017889874872.jpg │ │ ├── 05676017940665072.jpg │ │ ├── 05676017998326370.jpg │ │ ├── 05676018060285467.jpg │ │ ├── 05676018095666840.jpg │ │ ├── 05676182749352491.jpg │ │ ├── 05676182948551469.jpg │ │ ├── 05676205653138090.png │ │ ├── 05685703863142127.jpg │ │ ├── 05707253318913434.jpg │ │ ├── 05730588304298814.jpg │ │ └── 05730588518666251.jpg ├── index.php ├── init.php └── docs.php ├── language ├── zh_tw │ └── common.php ├── en │ └── common.php ├── fr │ └── common.php ├── de │ └── common.php └── zh_cn │ └── common.php ├── gate_start_for_win.bat ├── stop.sh ├── start.sh ├── data ├── 1.2.1 │ └── 1.1.0-1.2.1.sql ├── 1.0.1 │ └── 1.0.0-1.0.1.sql └── 1.1.0 │ └── 1.0.1-1.1.0.sql ├── config ├── constant.php ├── sys.php ├── di.php └── dbs.php ├── Library └── PHPExcel │ ├── PHPExcel │ ├── Chart │ │ ├── Renderer │ │ │ └── PHP Charting Libraries.txt │ │ ├── Exception.php │ │ └── Title.php │ ├── Shared │ │ ├── JAMA │ │ │ ├── CHANGELOG.TXT │ │ │ └── utils │ │ │ │ └── Maths.php │ │ ├── Escher │ │ │ ├── DggContainer │ │ │ │ ├── BstoreContainer.php │ │ │ │ └── BstoreContainer │ │ │ │ │ └── BSE │ │ │ │ │ └── Blip.php │ │ │ └── DgContainer.php │ │ ├── PasswordHasher.php │ │ ├── Escher.php │ │ └── OLE │ │ │ └── PPS │ │ │ └── File.php │ ├── locale │ │ ├── en │ │ │ └── uk │ │ │ │ └── config │ │ ├── cs │ │ │ └── config │ │ ├── de │ │ │ └── config │ │ ├── fr │ │ │ └── config │ │ ├── it │ │ │ └── config │ │ ├── no │ │ │ └── config │ │ ├── pt │ │ │ ├── config │ │ │ └── br │ │ │ │ └── config │ │ ├── ru │ │ │ └── config │ │ ├── tr │ │ │ └── config │ │ ├── nl │ │ │ └── config │ │ ├── pl │ │ │ └── config │ │ ├── hu │ │ │ └── config │ │ ├── da │ │ │ └── config │ │ ├── sv │ │ │ └── config │ │ ├── fi │ │ │ └── config │ │ └── es │ │ │ └── config │ ├── IComparable.php │ ├── Writer │ │ ├── IWriter.php │ │ ├── Exception.php │ │ └── Excel2007 │ │ │ └── WriterPart.php │ ├── Reader │ │ ├── IReadFilter.php │ │ ├── IReader.php │ │ ├── Exception.php │ │ └── DefaultReadFilter.php │ ├── Cell │ │ └── IValueBinder.php │ ├── Calculation │ │ ├── ExceptionHandler.php │ │ └── Exception.php │ ├── Exception.php │ ├── RichText │ │ └── ITextElement.php │ └── Worksheet │ │ └── Row.php │ └── README.md ├── tests ├── bootstrap.php ├── phpunit.xml └── app │ └── Api │ └── Site_Test.php ├── composer.json └── killboom.php /server.key: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server.pem: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/App/Common/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/App/Common/CommonDomain.php: -------------------------------------------------------------------------------- 1 | '{name}您好,歡迎使用PhalApi!', 5 | 'user not exists' => '用戶不存在', 6 | ); 7 | -------------------------------------------------------------------------------- /gate_start_for_win.bat: -------------------------------------------------------------------------------- 1 | php src\App\Plugins\GateWayWorker\start_register.php src\App\Plugins\GateWayWorker\start_gateway.php src\App\Plugins\GateWayWorker\start_businessworker.php 2 | pause 3 | -------------------------------------------------------------------------------- /language/en/common.php: -------------------------------------------------------------------------------- 1 | 'Hello {name}, Welcome to use PhalApi!', 5 | 'user not exists' => 'user not exists', 6 | ); 7 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | response()->output(); 10 | 11 | -------------------------------------------------------------------------------- /stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | php src/App/Plugins/GateWayWorker/start_register.php stop& 3 | php src/App/Plugins/GateWayWorker/start_gateway.php stop& 4 | php src/App/Plugins/GateWayWorker/start_businessworker.php stop; 5 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | php src/App/Plugins/GateWayWorker/start_register.php start& 3 | php src/App/Plugins/GateWayWorker/start_gateway.php start& 4 | php src/App/Plugins/GateWayWorker/start_businessworker.php start; 5 | -------------------------------------------------------------------------------- /language/fr/common.php: -------------------------------------------------------------------------------- 1 | '{name}Bonjour, bienvenue PhalApi!', 6 | 'user not exists' => "L'utilisateur n'existe pas", 7 | ); 8 | -------------------------------------------------------------------------------- /data/1.2.1/1.1.0-1.2.1.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | ALTER TABLE `pms`.`pms_task_tag` ADD COLUMN `color_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `create_time`; 4 | 5 | SET FOREIGN_KEY_CHECKS=1; 6 | -------------------------------------------------------------------------------- /src/App/Model/Project/Task.php: -------------------------------------------------------------------------------- 1 | '{name}Hallo, Willkommen PhalApi!', 8 | 'user not exists' => 'Der nutzer gibt es nicht', 9 | ); 10 | -------------------------------------------------------------------------------- /src/App/Model/User/Setting/UserSetting.php: -------------------------------------------------------------------------------- 1 | 2015-02-09 9 | */ 10 | 11 | return array( 12 | 'Hi {name}, welcome to use PhalApi!' => '{name}您好,欢迎使用PhalApi!', 13 | 'user not exists' => '用户不存在', 14 | ); 15 | -------------------------------------------------------------------------------- /src/App/Model/Project/Doc.php: -------------------------------------------------------------------------------- 1 | getUserInfo($uid); return $r; } } -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Chart/Renderer/PHP Charting Libraries.txt: -------------------------------------------------------------------------------- 1 | ChartDirector 2 | http://www.advsofteng.com/cdphp.html 3 | 4 | GraPHPite 5 | http://graphpite.sourceforge.net/ 6 | 7 | JpGraph 8 | http://www.aditus.nu/jpgraph/ 9 | 10 | LibChart 11 | http://naku.dohcrew.com/libchart/pages/introduction/ 12 | 13 | pChart 14 | http://pchart.sourceforge.net/ 15 | 16 | TeeChart 17 | http://www.steema.com/products/teechart/overview.html 18 | -------------------------------------------------------------------------------- /src/App/Common/Request.php: -------------------------------------------------------------------------------- 1 | get('api'); 8 | if (!empty($service)) { 9 | $namespace = count(explode('/', $service)) == 2 ? 'App.' : ''; 10 | return $namespace . str_replace('/', '.', $service); 11 | } 12 | return parent::getService(); 13 | } 14 | } -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | logger = new ExplorerLogger( 16 | Logger::LOG_LEVEL_DEBUG | Logger::LOG_LEVEL_INFO | Logger::LOG_LEVEL_ERROR); 17 | 18 | -------------------------------------------------------------------------------- /sdk/JAVA/net/phalapi/sdk/PhalApiClientFilter.java: -------------------------------------------------------------------------------- 1 | package net.phalapi.sdk; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * 接口过滤器 7 | * 8 | * - 可用于接口签名生成 9 | */ 10 | public interface PhalApiClientFilter { 11 | 12 | /** 13 | * 过滤操作 14 | * @param string service 接口服务名称 15 | * @param Map params 接口参数,注意是引用。可以直接修改 16 | * @return null 17 | */ 18 | public void filter(String service, Map params); 19 | } 20 | -------------------------------------------------------------------------------- /sdk/Ruby/PhalApiClient/tests/client_response.rb: -------------------------------------------------------------------------------- 1 | require_relative '../phalapi_client' 2 | require 'test/unit' 3 | 4 | class ClientResponseTest < Test::Unit::TestCase 5 | def test_new 6 | a_response = PhalApi::ClientResponse.new(400) 7 | assert_equal 400, a_response.ret 8 | 9 | a_response = PhalApi::ClientResponse.new(500, [], 'Server Error') 10 | assert_equal 500, a_response.ret 11 | assert_equal [], a_response.data 12 | assert_equal 'Server Error', a_response.msg 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /sdk/Objective-C/PhalApiClient/PhalApiClientFilter.h: -------------------------------------------------------------------------------- 1 | // 2 | // PhalApiClientFilter.h 3 | // PhalApiClientDemo 4 | // 5 | // Created by Aevit on 15/10/18. 6 | // Copyright © 2015年 Aevit. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PhalApiClientFilter : NSObject 12 | 13 | /** 14 | * 接口过滤器 15 | * 可用于接口签名生成 16 | * 17 | * @param service 接口服务名称 18 | * @param params 接口参数,注意是mutable变量,可以直接修改 19 | */ 20 | - (void)filter:(NSString*)service params:(NSMutableDictionary*)params; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /sdk/C_Sharp/PhalApiClient/PhalApiClientParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhalApiClientSDK 7 | { 8 | /** 9 | * 接口结果解析器 10 | * 11 | * - 可用于不同接口返回格式的处理 12 | */ 13 | public interface PhalApiClientParser 14 | { 15 | 16 | /** 17 | * 结果解析 18 | * @param String apiResult 19 | * @return PhalApiClientResponse 20 | */ 21 | PhalApiClientResponse parse(String apiResult); 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /sdk/Objective-C/PhalApiClient/PhalApiClientFilter.m: -------------------------------------------------------------------------------- 1 | // 2 | // PhalApiClientFilter.m 3 | // PhalApiClientDemo 4 | // 5 | // Created by Aevit on 15/10/18. 6 | // Copyright © 2015年 Aevit. All rights reserved. 7 | // 8 | 9 | #import "PhalApiClientFilter.h" 10 | 11 | @implementation PhalApiClientFilter 12 | 13 | /** 14 | * 接口过滤器 15 | * 可用于接口签名生成 16 | * 17 | * @param service 接口服务名称 18 | * @param params 接口参数,注意是mutable变量,可以直接修改 19 | */ 20 | - (void)filter:(NSString*)service params:(NSMutableDictionary*)params { 21 | // 在此对接口进行过滤 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /sdk/Go/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "./PhalApiClient" 5 | "fmt" 6 | "net/url" 7 | ) 8 | 9 | func main() { 10 | rs, err := PhalApiClient.NewRequest(). 11 | WithHost(`http://127.0.0.1/PhalApi/Public/index.php`). 12 | WithService("Default.index"). 13 | WithParams(url.Values{}). 14 | Get() 15 | if err != nil { 16 | fmt.Println(err.Error()) 17 | } else { 18 | fmt.Println("code------------------------", rs.Code) 19 | fmt.Println("data------------------------", rs.Data) 20 | fmt.Println("msg------------------------", rs.Msg) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/App/Model/Team/TeamUser.php: -------------------------------------------------------------------------------- 1 | getORM()->where('user_id', $user_id)->where('team_id', $team_id)->delete(); 11 | } 12 | public function delTeam($team_id) 13 | { 14 | return $this->getORM()->where('team_id', $team_id)->delete(); 15 | } 16 | 17 | protected function getTableName($id) 18 | { 19 | return 'team_user'; 20 | } 21 | } -------------------------------------------------------------------------------- /config/sys.php: -------------------------------------------------------------------------------- 1 | 2017-07-13 8 | */ 9 | return array( 10 | /** 11 | * 默认环境配置 12 | */ 13 | 'debug' => false, 14 | 15 | /** 16 | * MC缓存服务器参考配置 17 | */ 18 | 'mc' => array( 19 | 'host' => '127.0.0.1', 20 | 'port' => 11211, 21 | ), 22 | 23 | /** 24 | * 加密 25 | */ 26 | 'crypt' => array( 27 | 'mcrypt_iv' => '12345678', //8位 28 | ), 29 | ); 30 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Shared/JAMA/CHANGELOG.TXT: -------------------------------------------------------------------------------- 1 | Mar 1, 2005 11:15 AST by PM 2 | 3 | + For consistency, renamed Math.php to Maths.java, utils to util, 4 | tests to test, docs to doc - 5 | 6 | + Removed conditional logic from top of Matrix class. 7 | 8 | + Switched to using hypo function in Maths.php for all php-hypot calls. 9 | NOTE TO SELF: Need to make sure that all decompositions have been 10 | switched over to using the bundled hypo. 11 | 12 | Feb 25, 2005 at 10:00 AST by PM 13 | 14 | + Recommend using simpler Error.php instead of JAMA_Error.php but 15 | can be persuaded otherwise. 16 | 17 | -------------------------------------------------------------------------------- /sdk/C_Sharp/PhalApiClient/PhalApiClientFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhalApiClientSDK 7 | { 8 | /** 9 | * 接口过滤器 10 | * 11 | * - 可用于接口签名生成 12 | */ 13 | public interface PhalApiClientFilter { 14 | 15 | /** 16 | * 过滤操作 17 | * @param string service 接口服务名称 18 | * @param Map params 接口参数,注意是引用。可以直接修改 19 | * @return null 20 | */ 21 | void filter(String service, Dictionary paramsList); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /public/init.php: -------------------------------------------------------------------------------- 1 | debug) { 20 | // 启动追踪器 21 | \PhalApi\DI()->tracer->mark(); 22 | 23 | error_reporting(E_ALL); 24 | ini_set('display_errors', 'Off'); 25 | } 26 | 27 | // 翻译语言包设定 28 | \PhalApi\SL('zh_cn'); 29 | -------------------------------------------------------------------------------- /src/App/Auth/Model/User.php: -------------------------------------------------------------------------------- 1 | config->get('app.auth.auth_user'); 16 | } 17 | 18 | public function getUserInfo($uid){ 19 | static $userinfo = array(); 20 | if (!isset($userinfo[$uid])) { 21 | $userinfo[$uid] = $this->getORM()->where('id', $uid)->fetchOne(); 22 | } 23 | return $userinfo[$uid]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /sdk/Objective-C/XSHttpTool/Singleton.h: -------------------------------------------------------------------------------- 1 | // .h 2 | #define singleton_interface(class) + (instancetype)shared##class; 3 | 4 | // .m 5 | #define singleton_implementation(class) \ 6 | static class *_instance; \ 7 | \ 8 | + (id)allocWithZone:(struct _NSZone *)zone \ 9 | { \ 10 | static dispatch_once_t onceToken; \ 11 | dispatch_once(&onceToken, ^{ \ 12 | _instance = [super allocWithZone:zone]; \ 13 | }); \ 14 | \ 15 | return _instance; \ 16 | } \ 17 | \ 18 | + (instancetype)shared##class \ 19 | { \ 20 | if (_instance == nil) { \ 21 | _instance = [[class alloc] init]; \ 22 | } \ 23 | \ 24 | return _instance; \ 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/App/Common/Exception/WrongRequestException.php: -------------------------------------------------------------------------------- 1 | 2015-02-05 14 | */ 15 | 16 | class WrongRequestException extends Exception { 17 | 18 | public function __construct($message, $code = 0) { 19 | parent::__construct( 20 | \PhalApi\T('{message}', array('message' => $message)), 200 + $code 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /sdk/Python/PhalApiClient/python2.x/PhalApiClient.py: -------------------------------------------------------------------------------- 1 | #-*- coding:utf-8 -*- 2 | #gaoyiping (iam@gaoyiping.com) 2017-02-18 3 | import json, urllib, urllib2 4 | 5 | def PhalApiClient(host, service = None, params = None, timeout = None): 6 | url = host + ('' if service is None else ('?service=' + service)) 7 | if params is not None: 8 | assert type(params) is dict, 'params type must be dict' 9 | assert params, 'params must is valid values' 10 | params = urllib.urlencode(params) 11 | request = urllib2.Request(url) 12 | response = urllib2.urlopen(request, data = params, timeout = timeout) 13 | return {'info': response.info(), 'state': response.getcode(), 'data': json.loads(response.read())} -------------------------------------------------------------------------------- /sdk/Python/PhalApiClient/python3.x/PhalApiClient.py: -------------------------------------------------------------------------------- 1 | #-*- coding:utf-8 -*- 2 | #gaoyiping (iam@gaoyiping.com) 2017-02-18 3 | import json 4 | from urllib import request, parse 5 | 6 | def PhalApiClient(host, service = None, params = None, timeout = None): 7 | url = host + ('' if service is None else ('?service=' + service)) 8 | if params is not None: 9 | assert type(params) is dict, 'params type must be dict' 10 | assert params, 'params must is valid values' 11 | params = parse.urlencode(params) 12 | _request = request.Request(url) 13 | response = request.urlopen(_request, data = params, timeout = timeout) 14 | return {'info': response.info(), 'state': response.getcode(), 'data': json.loads(response.read())} -------------------------------------------------------------------------------- /sdk/C_Sharp/PhalApiClient/PhalApiClientParserJson.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | 4 | namespace PhalApiClientSDK 5 | { 6 | /** 7 | * JSON解析 8 | */ 9 | public class PhalApiClientParserJson : PhalApiClientParser { 10 | 11 | public PhalApiClientResponse parse(String apiResult) { 12 | if (apiResult == null) { 13 | return new PhalApiClientResponse(408, "", "Request Timeout"); 14 | } 15 | 16 | try { 17 | 18 | return JsonConvert.DeserializeObject(apiResult); 19 | } catch (Exception ex) { 20 | return new PhalApiClientResponse(500, "", "Internal Server Error: " + ex.Message); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /sdk/JAVA/net/phalapi/sdk/PhalApiClientParserJson.java: -------------------------------------------------------------------------------- 1 | package net.phalapi.sdk; 2 | 3 | import org.json.JSONObject; 4 | 5 | /** 6 | * JSON解析 7 | */ 8 | public class PhalApiClientParserJson implements PhalApiClientParser { 9 | 10 | public PhalApiClientResponse parse(String apiResult) { 11 | if (apiResult == null) { 12 | return new PhalApiClientResponse(408, "", "Request Timeout"); 13 | } 14 | 15 | try { 16 | JSONObject jsonObj = new JSONObject(apiResult); 17 | 18 | return new PhalApiClientResponse( 19 | jsonObj.getInt("ret"), jsonObj.getString("data"), jsonObj.getString("msg")); 20 | } catch (Exception ex) { 21 | return new PhalApiClientResponse(500, "", "Internal Server Error Or " + ex.getMessage()); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/App/Model/Project/File.php: -------------------------------------------------------------------------------- 1 | getORM()->where('objectID', $ids)->where('objectType', 'task')->where($extend)->order($order)->fetchAll(); 15 | } 16 | public function getFileListByDocIds($ids,$order = 'id desc',$extend = array()) 17 | { 18 | return $this->getORM()->where('objectID', $ids)->where('objectType', 'doc')->where($extend)->order($order)->fetchAll(); 19 | } 20 | 21 | protected function getTableName($id) 22 | { 23 | return 'file'; 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /src/App/Plugins/GateWayWorker/start_register.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | use Workerman\Worker; 15 | use GatewayWorker\Register; 16 | require_once __DIR__ . '/../../../../vendor/autoload.php'; 17 | 18 | 19 | 20 | // 自动加载类 21 | 22 | // register 必须是text协议 23 | $register = new Register('http://192.168.0.140:2346'); 24 | 25 | // 如果不是在根目录启动,则运行runAll方法 26 | if(!defined('GLOBAL_START')) 27 | { 28 | Worker::runAll(); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/App/Api/Site.php: -------------------------------------------------------------------------------- 1 | 2014-10-04 9 | */ 10 | 11 | class Site extends Api { 12 | 13 | public function getRules() { 14 | return array( 15 | 'index' => array( 16 | 'username' => array('name' => 'username', 'default' => 'PHPer', ), 17 | ), 18 | ); 19 | } 20 | 21 | /** 22 | * 默认接口服务 23 | * @desc 默认接口服务,当未指定接口服务时执行此接口服务 24 | * @return string title 标题 25 | * @return string content 内容 26 | * @return string version 版本,格式:X.X.X 27 | * @return int time 当前时间戳 28 | */ 29 | public function index() { 30 | return array( 31 | 'title' => '提示', 32 | 'content' => '项目部署成功', 33 | 'version' => PHALAPI_VERSION, 34 | 'time' => $_SERVER['REQUEST_TIME'], 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Shared/JAMA/utils/Maths.php: -------------------------------------------------------------------------------- 1 | abs($b)) { 16 | $r = $b / $a; 17 | $r = abs($a) * sqrt(1 + $r * $r); 18 | } elseif ($b != 0) { 19 | $r = $a / $b; 20 | $r = abs($b) * sqrt(1 + $r * $r); 21 | } else { 22 | $r = 0.0; 23 | } 24 | return $r; 25 | } // function hypo() 26 | 27 | 28 | /** 29 | * Mike Bommarito's version. 30 | * Compute n-dimensional hyotheneuse. 31 | * 32 | function hypot() { 33 | $s = 0; 34 | foreach (func_get_args() as $d) { 35 | if (is_numeric($d)) { 36 | $s += pow($d, 2); 37 | } else { 38 | throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException)); 39 | } 40 | } 41 | return sqrt($s); 42 | } 43 | */ 44 | -------------------------------------------------------------------------------- /src/App/Auth/Model/Access.php: -------------------------------------------------------------------------------- 1 | config->get('app.auth.auth_group_access'); 16 | } 17 | 18 | public function assUser($param) 19 | { 20 | $r = $this->getORM()->insert_multi($param); 21 | return $r === false ? false : true; 22 | } 23 | 24 | public function delByUid($uid) 25 | { 26 | $r = $this->getORM()->where('uid', $uid)->delete(); 27 | return $r === false ? false : true; 28 | } 29 | public function delByUidAndGroupId($uid,$group_id) 30 | { 31 | $r = $this->getORM()->where('uid', $uid)->where('group_id', $group_id)->delete(); 32 | return $r === false ? false : true; 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/App/Model/Project/TaskTypeTemplate.php: -------------------------------------------------------------------------------- 1 | '待办', 'list' => array(), 'show_card' => false, 'fixed_creator' => false), 15 | array('name' => '需求', 'list' => array(), 'show_card' => false, 'fixed_creator' => false), 16 | array('name' => '新增', 'list' => array(), 'show_card' => false, 'fixed_creator' => false), 17 | array('name' => '问题', 'list' => array(), 'show_card' => false, 'fixed_creator' => false), 18 | array('name' => '其他', 'list' => array(), 'show_card' => false, 'fixed_creator' => false), 19 | 20 | ); 21 | 22 | protected function getTableName($id) 23 | { 24 | return 'task_type_template'; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /sdk/Python/PhalApiClient/python2.x/demo.py: -------------------------------------------------------------------------------- 1 | #-*- coding:utf-8 -*- 2 | #gaoyiping (iam@gaoyiping.com) 2017-02-18 3 | 4 | import PhalApiClient 5 | 6 | print '-' * 20 7 | print 'Request: 1' 8 | result = PhalApiClient.PhalApiClient('http://demo.phalapi.net/', 'Default.Index', {'username': 'dogstar'}, 3) 9 | print 'head', result['info'] 10 | print 'state', result['state'] 11 | print 'result', result['data'] 12 | print '-' * 20 13 | print 'Request: 2' 14 | result = PhalApiClient.PhalApiClient('http://demo.phalapi.net/', 'User.GetBaseInfo', {'username': 'dogstar'}) 15 | print 'head', result['info'] 16 | print 'state', result['state'] 17 | print 'result', result['data'] 18 | print '-' * 20 19 | print 'Request: 3' 20 | result = PhalApiClient.PhalApiClient('http://demo.phalapi.net/') 21 | print 'head', result['info'] 22 | print 'state', result['state'] 23 | print 'result', result['data'] 24 | print '-' * 20 25 | print 'Request: 4 (illegal request)' 26 | result = PhalApiClient.PhalApiClient(1, 2, 3, 4) -------------------------------------------------------------------------------- /sdk/Python/PhalApiClient/python3.x/demo.py: -------------------------------------------------------------------------------- 1 | #-*- coding:utf-8 -*- 2 | #gaoyiping (iam@gaoyiping.com) 2017-02-18 3 | 4 | import PhalApiClient 5 | 6 | print('-' * 20) 7 | print('Request: 1') 8 | result = PhalApiClient.PhalApiClient('http://demo.phalapi.net/', 'Default.Index', {'username': 'dogstar'}, 3) 9 | print('head', result['info']) 10 | print('state', result['state']) 11 | print('result', result['data']) 12 | print('-' * 20) 13 | print('Request: 2') 14 | result = PhalApiClient.PhalApiClient('http://demo.phalapi.net/', 'User.GetBaseInfo', {'username': 'dogstar'}) 15 | print('head', result['info']) 16 | print('state', result['state']) 17 | print('result', result['data']) 18 | print('-' * 20) 19 | print('Request: 3') 20 | result = PhalApiClient.PhalApiClient('http://demo.phalapi.net/') 21 | print('head', result['info']) 22 | print('state', result['state']) 23 | print('result', result['data']) 24 | print('-' * 20) 25 | print('Request: 4 (illegal request)') 26 | result = PhalApiClient.PhalApiClient(1, 2, 3, 4) -------------------------------------------------------------------------------- /tests/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ./ 23 | 24 | 25 | 26 | 27 | 28 | ../src 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /sdk/JAVA/net/phalapi/sdk/PhalApiClientResponse.java: -------------------------------------------------------------------------------- 1 | package net.phalapi.sdk; 2 | 3 | /** 4 | * 接口返回结果 5 | * 6 | * - 与接口返回的格式对应,即有:ret/data/msg 7 | */ 8 | public class PhalApiClientResponse { 9 | 10 | protected int ret; 11 | protected String data; 12 | protected String msg; 13 | 14 | /** 15 | * 完全构造函数 16 | * @param int ret 17 | * @param String data 18 | * @param String msg 19 | */ 20 | public PhalApiClientResponse(int ret, String data, String msg) { 21 | this.ret = ret; 22 | this.data = data; 23 | this.msg = msg; 24 | } 25 | 26 | public PhalApiClientResponse(int ret, String data) { 27 | this(ret, data, ""); 28 | } 29 | 30 | public PhalApiClientResponse(int ret) { 31 | this(ret, "", ""); 32 | } 33 | 34 | public int getRet() { 35 | return this.ret; 36 | } 37 | 38 | public String getData() { 39 | return this.data; 40 | } 41 | 42 | public String getMsg() { 43 | return this.msg; 44 | } 45 | } -------------------------------------------------------------------------------- /src/App/Domain/System/Setting.php: -------------------------------------------------------------------------------- 1 | getInfo(array('set_name'=>$set_name))['value']); } public function doSetting($name,$data) { $param = json_decode($data); if($name == 'base_setting'){ if (!$param->site_name) { throw new WrongRequestException('请输入站点名称', 1); } } $result = self::$Model->updateByWhere(array('set_name'=>$name),array('value'=>$data)); if ($result === false) { throw new WrongRequestException('保存失败', 6); } addLog('修改系统配置,配置项:' . $name); } } -------------------------------------------------------------------------------- /sdk/Ruby/PhalApiClient/tests/client_parser_json.rb: -------------------------------------------------------------------------------- 1 | require_relative '../phalapi_client' 2 | require 'test/unit' 3 | 4 | class ClientParserJsonTest < Test::Unit::TestCase 5 | def setup 6 | @parser = PhalApi::ClientParserJson.new 7 | end 8 | 9 | def test_nil 10 | rs = nil 11 | a_response = @parser.parse(rs) 12 | 13 | assert_equal 408, a_response.ret 14 | end 15 | 16 | def test_illegal_json 17 | rs = 'i am not a json, as you can see' 18 | a_response = @parser.parse(rs) 19 | 20 | assert_equal 500, a_response.ret 21 | end 22 | 23 | def test_normal_json 24 | rs = '{"ret":200,"data":{"title":"Hello World","content":"Welcome to use Web Tools!","version":"1.0.0","time":1415982826},"msg":""}' 25 | a_response = @parser.parse(rs) 26 | 27 | assert_equal 200, a_response.ret 28 | 29 | data = a_response.data 30 | assert_equal 'Hello World', data['title'] 31 | assert_equal '1.0.0', data['version'] 32 | 33 | assert_equal '', a_response.msg 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phalapi/phalapi", 3 | "description": "PhalApi v2.x,一个PHP轻量级开源接口框架,致力于快速开发接口服务", 4 | "type": "project", 5 | "keywords": [ 6 | "api" 7 | ], 8 | "homepage": "http://www.phalapi.net", 9 | "license": "GPL-3.0+", 10 | "minimum-stability": "dev", 11 | "authors": [ 12 | { 13 | "name": "Dogstar Huang", 14 | "email": "chanzonghuang@gmail.com", 15 | "homepage": "http://my.oschina.net/dogstar", 16 | "role": "Developer" 17 | } 18 | ], 19 | "require": { 20 | "php": ">=5.3.3", 21 | "phalapi/cors":"dev-master", 22 | "phalapi/kernal": "dev-master", 23 | "phalapi/task": "dev-master", 24 | "phalapi/qiniu": "dev-master", 25 | "workerman/gateway-worker-for-win" : ">=3.0.0", 26 | "workerman/gateway-worker" : ">=3.0.0" 27 | }, 28 | "autoload": { 29 | "files": [ 30 | "src/App/functions.php" 31 | ], 32 | "psr-4": { 33 | "App\\": "src/App", 34 | "PhalApi\\Qiniu\\": "vendor/phalapi/qiniu/src/qiniu", 35 | "GatewayWorker\\": "vendor/workerman/gateway-worker-for-win/src" 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/App/Model/Examples/CURD.php: -------------------------------------------------------------------------------- 1 | getORM() 26 | ->select('*') 27 | ->where('state', $state) 28 | ->order('post_date DESC') 29 | ->limit(($page - 1) * $perpage, $perpage) 30 | ->fetchAll(); 31 | } 32 | 33 | public function getListTotal($state) { 34 | $total = $this->getORM() 35 | ->where('state', $state) 36 | ->count('id'); 37 | 38 | return intval($total); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/App/Plugins/GateWayWorker/start_businessworker.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | use Workerman\Worker; 15 | use Workerman\WebServer; 16 | use GatewayWorker\Gateway; 17 | use GatewayWorker\BusinessWorker; 18 | use Workerman\Autoloader; 19 | require_once __DIR__ . '/../../../../vendor/autoload.php'; 20 | 21 | // 自动加载类 22 | 23 | // bussinessWorker 进程 24 | $worker = new BusinessWorker(); 25 | // worker名称 26 | $worker->name = 'YourAppBusinessWorker'; 27 | // bussinessWorker进程数量 28 | $worker->count = 4; 29 | // 服务注册地址 30 | $worker->registerAddress = '192.168.0.140:2346'; 31 | 32 | // 如果不是在根目录启动,则运行runAll方法 33 | if(!defined('GLOBAL_START')) 34 | { 35 | Worker::runAll(); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/App/Model/Project/User.php: -------------------------------------------------------------------------------- 1 | get($project_id,'access_control_type'); 19 | if ($project_info['access_control_type'] == 'private') { 20 | if (!$user_account) { 21 | $current_user = getCurrentUser(); 22 | $user_account = $current_user['account']; 23 | } 24 | $project_user = self::getInfo(array('project' => $project_id, 'account' => $user_account)); 25 | if (!$project_user) { 26 | throw new BadRequestException('您无权限访问该项目', 2); 27 | } 28 | } 29 | } 30 | 31 | protected function getTableName($id) 32 | { 33 | return 'team'; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /sdk/C_Sharp/PhalApiClient/PhalApiClientResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PhalApiClientSDK 4 | { 5 | /** 6 | * 接口返回结果 7 | * 8 | * - 与接口返回的格式对应,即有:ret/data/msg 9 | */ 10 | public class PhalApiClientResponse 11 | { 12 | public int ret { get; set; } 13 | 14 | public dynamic data { get; set; } 15 | 16 | public String msg { get; set; } 17 | 18 | 19 | 20 | /** 21 | * 完全构造函数 22 | * @param int ret 23 | * @param JSONObject data 24 | * @param String msg 25 | */ 26 | public PhalApiClientResponse(int ret, dynamic data, String msg) 27 | { 28 | this.ret = ret; 29 | this.data = data; 30 | this.msg = msg; 31 | } 32 | 33 | public PhalApiClientResponse(int ret, dynamic data) 34 | { 35 | this.ret = ret; 36 | this.data = data; 37 | this.msg = ""; 38 | } 39 | 40 | public PhalApiClientResponse(int ret) 41 | { 42 | this.ret = ret; 43 | this.data = ""; 44 | this.msg = ""; 45 | } 46 | public PhalApiClientResponse() 47 | { 48 | 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/App/Api/Common/Search.php: -------------------------------------------------------------------------------- 1 | array( 23 | 'keyWord' => array('name' => 'keyword', 'type' => 'string', 'default' => '', 'desc' => '关键词'), 24 | 'page_size' => array('name' => 'page_size', 'type' => 'int', 'default'=> 5, 'desc' => '页面大小'), 25 | 'page_num' => array('name' => 'page_num', 'type' => 'int', 'default' => 1, 'desc' => '页码'), 26 | 'order' => array('name' => 'order', 'type' => 'string', 'default' => 'id desc', 'desc' => '排序参数,如:xx ASC,xx DESC') 27 | ), 28 | ); 29 | } 30 | 31 | 32 | /** 33 | * 获取等级列表 34 | * @desc 获取等级列表 35 | * @return array 36 | */ 37 | public function search() 38 | { 39 | unset($this->user_info); 40 | return self::$Domain->search($this); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/locale/en/uk/config: -------------------------------------------------------------------------------- 1 | ## 2 | ## PHPExcel 3 | ## 4 | ## Copyright (c) 2006 - 2013 PHPExcel 5 | ## 6 | ## This library is free software; you can redistribute it and/or 7 | ## modify it under the terms of the GNU Lesser General Public 8 | ## License as published by the Free Software Foundation; either 9 | ## version 2.1 of the License, or (at your option) any later version. 10 | ## 11 | ## This library is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ## Lesser General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU Lesser General Public 17 | ## License along with this library; if not, write to the Free Software 18 | ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | ## 20 | ## @category PHPExcel 21 | ## @package PHPExcel_Settings 22 | ## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) 23 | ## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL 24 | ## @version 1.7.9, 2013-06-02 25 | ## 26 | ## 27 | 28 | 29 | ## 30 | ## (For future use) 31 | ## 32 | currencySymbol = £ 33 | -------------------------------------------------------------------------------- /public/docs.php: -------------------------------------------------------------------------------- 1 | 使用示例:
10 | * ``` 11 | * render(); 48 | } else { 49 | $apiList = new \PhalApi\Helper\ApiList($projectName); 50 | $apiList->render(); 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/App/Api/Team/User.php: -------------------------------------------------------------------------------- 1 | array( 24 | 'team_id' => array('name' => 'team_id', 'type' => 'int', 'default' => 0, 'desc' => '团队id'), 25 | 'state' => array('name' => 'state', 'type' => 'int', 'require' => true, 'default' => 0, 'desc' => '状态'), 26 | ), 27 | 'delTeamUser' => array( 28 | 'user_id' => array('name' => 'user_id', 'type' => 'int', 'require' => true, 'desc' => '团队成员id'), 29 | 'team_id' => array('name' => 'team_id', 'type' => 'int', 'require' => true, 'desc' => '团队id') 30 | ), 31 | ); 32 | } 33 | 34 | /** 35 | * 移除团队成员 36 | * @desc 移除团队成员 37 | * @return array 38 | */ 39 | public function delTeamUser() 40 | { 41 | self::$Domain->delTeamUser($this->user_id, $this->team_id); 42 | } 43 | 44 | 45 | } -------------------------------------------------------------------------------- /tests/app/Api/Site_Test.php: -------------------------------------------------------------------------------- 1 | site = new Site(); 24 | } 25 | 26 | protected function tearDown() 27 | { 28 | } 29 | 30 | 31 | /** 32 | * @group testGetRules 33 | */ 34 | public function testGetRules() 35 | { 36 | $rs = $this->site->getRules(); 37 | 38 | $this->assertNotEmpty($rs); 39 | } 40 | 41 | public function testIndex() 42 | { 43 | //Step 1. 构建请求URL 44 | $url = 'service=App.Site.Index&username=dogstar'; 45 | 46 | //Step 2. 执行请求 47 | $rs = TestRunner::go($url); 48 | 49 | //Step 3. 验证 50 | $this->assertNotEmpty($rs); 51 | $this->assertArrayHasKey('title', $rs); 52 | $this->assertArrayHasKey('content', $rs); 53 | $this->assertArrayHasKey('version', $rs); 54 | $this->assertArrayHasKey('time', $rs); 55 | 56 | $this->assertEquals('dogstar您好,欢迎使用PhalApi!', $rs['content']); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/App/Api/System/Setting.php: -------------------------------------------------------------------------------- 1 | array( 23 | 'set_name' => array('name' => 'set_name', 'type' => 'string', 'required' => true, 'desc' => '配置名称') 24 | ), 25 | 'doSetting' => array( 26 | 'name' => array('name' => 'name', 'type' => 'string', 'required' => true, 'desc' => '配置项名称'), 27 | 'value' => array('name' => 'value', 'type' => 'string', 'required' => true, 'desc' => '配置值'), 28 | ) 29 | ); 30 | } 31 | 32 | /** 33 | * 获取系统配置信息 34 | * @desc 获取系统配置信息 35 | * @return array 36 | */ 37 | public function getSetting() 38 | { 39 | return self::$Domain->getSetting($this->set_name); 40 | } 41 | 42 | /** 43 | * 保存系统配置 44 | * @desc 保存系统配置 45 | */ 46 | public function doSetting() 47 | { 48 | self::$Domain->doSetting($this->name,$this->value); 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /src/App/Api/System/Log.php: -------------------------------------------------------------------------------- 1 | array( 24 | 'keyWord' => array('name' => 'keyword', 'type' => 'string', 'default' => '', 'desc' => '关键词'), 25 | 'page_size' => array('name' => 'page_size', 'type' => 'int', 'default'=> PAGE_SIZE, 'desc' => '页面大小'), 26 | 'page_num' => array('name' => 'page_num', 'type' => 'int', 'default' => 1, 'desc' => '页码'), 27 | 'search_date' => array('name' => 'search_date', 'type' => 'Array', 'format' => 'json', 'desc' => '日期范围'), 28 | 'order' => array('name' => 'order', 'type' => 'string', 'default' => 'id desc', 'desc' => '排序参数,如:xx ASC,xx DESC') 29 | ) 30 | ); 31 | } 32 | 33 | /** 34 | * 获取日志列表 35 | * @desc 获取日志列表 36 | * @return array 37 | */ 38 | public function getList() 39 | { 40 | unset($this->user_info); 41 | return self::$Domain->getList($this); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /sdk/PHP/PhalApiClient/demo.php: -------------------------------------------------------------------------------- 1 | withHost('http://demo.phalapi.net/'); 7 | 8 | $rs = $client->reset() 9 | ->withService('Default.Index') 10 | ->withParams('username', 'dogstar') 11 | ->withTimeout(3000) 12 | ->request(); 13 | 14 | var_dump($rs->getRet()); 15 | echo "\n"; 16 | var_dump($rs->getData()); 17 | echo "\n"; 18 | var_dump($rs->getMsg()); 19 | 20 | /** 21 | 22 | int(200) 23 | 24 | array(4) { 25 | ["title"]=> 26 | string(12) "Hello World!" 27 | ["content"]=> 28 | string(36) "dogstar您好,欢迎使用PhalApi!" 29 | ["version"]=> 30 | string(5) "1.2.1" 31 | ["time"]=> 32 | int(1444925238) 33 | } 34 | 35 | string(0) "" 36 | 37 | */ 38 | 39 | echo "\n--------------------\n"; 40 | 41 | //one more time 42 | $rs = $client->reset() 43 | ->withService("User.GetBaseInfo") 44 | ->withParams("user_id", "1") 45 | ->request(); 46 | 47 | var_dump($rs->getRet()); 48 | echo "\n"; 49 | var_dump($rs->getData()); 50 | echo "\n"; 51 | var_dump($rs->getMsg()); 52 | 53 | 54 | echo "\n--------------------\n"; 55 | 56 | //illegal request 57 | $rs = $client->reset() 58 | ->withService("XXX.XXXXX") 59 | ->withParams("user_id", "1") 60 | ->request(); 61 | 62 | var_dump($rs->getRet()); 63 | echo "\n"; 64 | var_dump($rs->getData()); 65 | echo "\n"; 66 | var_dump($rs->getMsg()); 67 | 68 | -------------------------------------------------------------------------------- /sdk/Ruby/PhalApiClient/demo.rb: -------------------------------------------------------------------------------- 1 | require_relative 'phalapi_client' 2 | 3 | class MyFilter < PhalApi::ClientFilter 4 | end 5 | 6 | def show_res(response) 7 | puts "response: #{response.ret}, #{response.data}, #{response.msg}" 8 | end 9 | 10 | a_client = PhalApi::Client.create.withHost('http://demo.phalapi.net') 11 | a_response = a_client.withService('Default.Index').withParams('username', 'dogstar').withTimeout(3000).request() 12 | 13 | puts a_response.ret, a_response.data, a_response.msg 14 | 15 | puts "--------------------" 16 | 17 | a_client = PhalApi::Client.create 18 | #a_client = PhalApi::Client.new 19 | 20 | a_response = a_client.withHost('http://demo.phalapi.net').withService('Default.Index').withParams('username', 'dogstar').withParams('v', '1.3.0').request() 21 | 22 | puts "--------------------" 23 | 24 | #puts a_client 25 | show_res a_response 26 | 27 | puts "--------------------" 28 | 29 | begin 30 | a_response = a_client.reset.withParams('one').request 31 | rescue Exception => e 32 | puts e.message 33 | end 34 | 35 | puts "--------------------" 36 | 37 | a_response = a_client.reset.withFilter(MyFilter.new).withService('Default.Index').withParams('username', 'dogstar').request 38 | show_res a_response 39 | 40 | puts "--------------------" 41 | 42 | a_response = a_client.reset.withService('XXXX.noThisMethod').request 43 | puts a_response.ret, a_response.data, a_response.msg 44 | show_res a_response 45 | 46 | puts 'we done!' 47 | puts 'we done!' 48 | puts 'we done!' 49 | -------------------------------------------------------------------------------- /src/App/Model/User/UserToken.php: -------------------------------------------------------------------------------- 1 | getORM()->select('*')->where('token = ?', $token)->fetchOne(); 19 | } 20 | 21 | /** 22 | * 登录生成token 23 | * @param int $user_id 用户id 24 | * @param string $user_name 用户名 25 | * @return null|string 26 | */ 27 | public function _get_token($user_id, $user_name) { 28 | 29 | //重新登录后以前的令牌失效 30 | 31 | //生成新的token 32 | $user_token_info = array(); 33 | $token = md5($user_name . strval(time()) . strval(rand(0,999999))); 34 | $user_token_info['user_id'] = $user_id; 35 | $user_token_info['user_name'] = $user_name; 36 | $user_token_info['token'] = $token; 37 | $user_token_info['login_time'] = time(); 38 | $user_token_info['login_ip'] = $_SERVER['REMOTE_ADDR']; 39 | 40 | $result = $this->insert($user_token_info); 41 | 42 | if($result) { 43 | return $token; 44 | } else { 45 | return null; 46 | } 47 | 48 | } 49 | 50 | protected function getTableName($id) 51 | { 52 | return 'user_token'; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /src/App/Api/User/UserSetting/Setting.php: -------------------------------------------------------------------------------- 1 | array( 26 | 'name' => array('name' => 'name', 'type' => 'string', 'required' => true, 'desc' => '配置项名称'), 27 | ), 28 | 'doSetting' => array( 29 | 'name' => array('name' => 'name', 'type' => 'string', 'required' => true, 'desc' => '配置项名称'), 30 | 'value' => array('name' => 'value', 'type' => 'string','required' => true, 'desc' => '配置值'), 31 | ) 32 | ); 33 | } 34 | 35 | /** 36 | * 获取用户配置信息 37 | * @desc 获取用户对应类型的配置 38 | * @return mixed 39 | */ 40 | public function getSetting() 41 | { 42 | return self::$Domain->getSetting($this->name); 43 | } 44 | 45 | /** 46 | * 保存用户配置 47 | * @desc 保存用户配置 48 | */ 49 | public function doSetting() 50 | { 51 | self::$Domain->doSetting($this->name,$this->value); 52 | } 53 | } -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/IComparable.php: -------------------------------------------------------------------------------- 1 | "; 18 | } else { 19 | $dirname = $basedir . "/" . $file; 20 | checkdir($dirname); 21 | } 22 | } 23 | } 24 | closedir($dh); 25 | } 26 | } 27 | function checkBOM($filename) 28 | { 29 | global $auto; 30 | $contents = file_get_contents($filename); 31 | $charset[1] = substr($contents, 0, 1); 32 | $charset[2] = substr($contents, 1, 1); 33 | $charset[3] = substr($contents, 2, 1); 34 | if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) { 35 | if ($auto == 1) { 36 | $rest = substr($contents, 3); 37 | rewrite($filename, $rest); 38 | return ('BOM found, automatically removed.'); 39 | } else { 40 | return ('BOM found.'); 41 | } 42 | } else 43 | return ("BOM Not Found."); 44 | } 45 | 46 | function rewrite($filename, $data) 47 | { 48 | $filenum = fopen($filename, "w"); 49 | flock($filenum, LOCK_EX); 50 | fwrite($filenum, $data); 51 | fclose($filenum); 52 | } -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Writer/IWriter.php: -------------------------------------------------------------------------------- 1 | 'zhangsan','password'=>"123456"), 33 | array('username'=>'lisi','password'=>"abcdefg"), 34 | array('username'=>'wangwu','password'=>"111111"), 35 | ); 36 | 37 | $filename = "test_excel.xlsx"; 38 | $headArr = array("用户名", "密码"); 39 | $PHPExcel = new PHPExcel_Lite(); 40 | $PHPExcel->exportExcel($filename, $data, $headArr); 41 | 42 | PhalApi-PHPExcel可根据导出的文件后缀来导出不同格式的Excel文档 43 | 44 | importExcel接受三个参数,$filename文件名称,$firstRowTitle标题(可选默认从第一行作为标题),$Sheet工作表(默认第一张工作表) 45 | 46 | $rs = $PHPExcel->importExcel("./test.xlsx"); 47 | 48 | **当然PHPExcel是一个强大的工具可以通过$PHPExcel->getPHPExcel();获得完整的PHPExcel实例自由使用** 49 | 50 | ##3. 总结 51 | 52 | 希望此拓展能够给大家带来方便以及实用,如有其他童鞋希望能加入其余常用功能可与笔者进行联系! 53 | 54 | 注:笔者能力有限有说的不对的地方希望大家能够指出,也希望多多交流! 55 | 56 | **官网QQ交流群:421032344 欢迎大家的加入!** -------------------------------------------------------------------------------- /src/App/Domain/Project/Level.php: -------------------------------------------------------------------------------- 1 | getList($param); return $list; } public function getInfo($where,$field = '*') { return self::$Model->getInfo($where,$field); } /** 删除等级 * @param $ids id列表 如1,2,3 * @return int */ public function delLevel($ids) { $result = self::$Model->delItems($ids); if ($result) { $ids = json_encode($ids); addLog("删除项目等级,编号:$ids"); } return $result == true ? 0 : 1; } /** * 新增等级 * @param $data * @throws WrongRequestException */ public function addLevel($data) { $data['create_time'] = nowTime(); $id = self::$Model->insert($data); if ($id === false) { throw new WrongRequestException('新增失败', 8); } addLog('新增等级,编号:' . $id); } public function editProjectLevel($id,$data) { $result = self::$Model->update($id,$data); if ($result === false) { throw new WrongRequestException('保存失败', 6); } addLog('修改项目评级,评级ID:' . $id); } } -------------------------------------------------------------------------------- /src/App/Domain/System/Log.php: -------------------------------------------------------------------------------- 1 | 0) { $param['where']["add_time >= ? "] = $param['search_date'][0]; $param['where']["add_time <= ? "] = date('Y-m-d H:i:s', strtotime($param['search_date'][1]) + 24 * 3600); } $list = self::$Model->getList($param); if ($list['list']) { $model_user = new \App\Model\User\User(); foreach ($list['list'] as &$item) { if ($item) { $user = $model_user->get($item['user_id'], 'account'); $item['account'] = $user['account']; } } unset($item); } return $list; } public static function addLog($content, $user_id = 0) { $param = array(); $service = \PhalApi\DI()->request->get('service'); $param['content'] = $content; $param['user_id'] = $user_id; $param['service'] = $service; $param['add_time'] = nowTime(); $model = new ModelLog(); return $model->insert($param); } } -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Calculation/ExceptionHandler.php: -------------------------------------------------------------------------------- 1 | line = $line; 49 | $e->file = $file; 50 | throw $e; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Reader/Exception.php: -------------------------------------------------------------------------------- 1 | line = $line; 49 | $e->file = $file; 50 | throw $e; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Writer/Exception.php: -------------------------------------------------------------------------------- 1 | line = $line; 49 | $e->file = $file; 50 | throw $e; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /sdk/Objective-C/XSHttpTool/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIKit+AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #ifndef _UIKIT_AFNETWORKING_ 26 | #define _UIKIT_AFNETWORKING_ 27 | 28 | #import "AFNetworkActivityIndicatorManager.h" 29 | 30 | #import "UIActivityIndicatorView+AFNetworking.h" 31 | #import "UIAlertView+AFNetworking.h" 32 | #import "UIButton+AFNetworking.h" 33 | #import "UIImageView+AFNetworking.h" 34 | #import "UIKit+AFNetworking.h" 35 | #import "UIProgressView+AFNetworking.h" 36 | #import "UIRefreshControl+AFNetworking.h" 37 | #import "UIWebView+AFNetworking.h" 38 | #endif /* _UIKIT_AFNETWORKING_ */ 39 | -------------------------------------------------------------------------------- /sdk/Python/PhalApiClient/RequestResult.txt: -------------------------------------------------------------------------------- 1 | 以下为终端输出,实际输出以环境及接口改动为准 2 | 3 | -------------------- 4 | Request: 1 5 | head Server: nginx/1.8.0 6 | Date: Sun, 19 Feb 2017 13:17:36 GMT 7 | Content-Type: application/json;charset=utf-8 8 | Transfer-Encoding: chunked 9 | Connection: close 10 | X-Powered-By: PHP/5.3.5 11 | 12 | state 200 13 | result {u'msg': u'', u'data': {u'content': u'dogstar\u60a8\u597d\uff0c\u6b22\u8fce\u4f7f\u7528PhalApi\uff01', u'version': u'1.3.5', u'time': 1487510256, u'title': u'Hello World!'}, u'ret': 200} 14 | -------------------- 15 | Request: 2 16 | head Server: nginx/1.8.0 17 | Date: Sun, 19 Feb 2017 13:17:36 GMT 18 | Content-Type: application/json;charset=utf-8 19 | Transfer-Encoding: chunked 20 | Connection: close 21 | X-Powered-By: PHP/5.3.5 22 | 23 | state 200 24 | result {u'msg': u'\u975e\u6cd5\u8bf7\u6c42\uff1a\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570user_id', u'data': [], u'ret': 400} 25 | -------------------- 26 | Request: 3 27 | head Server: nginx/1.8.0 28 | Date: Sun, 19 Feb 2017 13:17:37 GMT 29 | Content-Type: application/json;charset=utf-8 30 | Transfer-Encoding: chunked 31 | Connection: close 32 | X-Powered-By: PHP/5.3.5 33 | 34 | state 200 35 | result {u'msg': u'', u'data': {u'content': u'PHPer\u60a8\u597d\uff0c\u6b22\u8fce\u4f7f\u7528PhalApi\uff01', u'version': u'1.3.5', u'time': 1487510257, u'title': u'Hello World!'}, u'ret': 200} 36 | -------------------- 37 | Request: 4 (illegal request) 38 | Traceback (most recent call last): 39 | File "/Users/gaoyiping/Documents/git.oschina.net/PhalApi/SDK/Python/PhalApiClient/python2.x/demo.py", line 26, in 40 | result = PhalApiClient.PhalApiClient(1, 2, 3, 4) 41 | File "/Users/gaoyiping/Documents/git.oschina.net/PhalApi/SDK/Python/PhalApiClient/python2.x/PhalApiClient.py", line 6, in PhalApiClient 42 | url = host + ('' if service is None else ('?service=' + service)) 43 | TypeError: cannot concatenate 'str' and 'int' objects -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Calculation/Exception.php: -------------------------------------------------------------------------------- 1 | line = $line; 49 | $e->file = $file; 50 | throw $e; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Exception.php: -------------------------------------------------------------------------------- 1 | line = $line; 49 | $e->file = $file; 50 | throw $e; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/App/Domain/Project/TaskTypeTemplate.php: -------------------------------------------------------------------------------- 1 | getList($param); return $list; } public function getInfo($where,$field = '*') { return self::$Model->getInfo($where,$field); } /** 删除任务类型模板 * @param $ids id列表 如1,2,3 * @return int */ public function delTaskTypeTemplate($ids) { $result = self::$Model->delItems($ids); if ($result) { $ids = json_encode($ids); addLog("删除项目任务类型模板,编号:$ids"); } return $result == true ? 0 : 1; } /** * 新增任务类型模板 * @param $data * @throws WrongRequestException */ public function addTaskTypeTemplate($data) { $data['create_time'] = nowTime(); $id = self::$Model->insert($data); if ($id === false) { throw new WrongRequestException('新增失败', 8); } addLog('新增任务类型模板,编号:' . $id); } public function editProjectTaskTypeTemplate($id,$data) { $result = self::$Model->update($id,$data); if ($result === false) { throw new WrongRequestException('保存失败', 6); } addLog('修改任务类型模板,模板ID:' . $id); } } -------------------------------------------------------------------------------- /config/di.php: -------------------------------------------------------------------------------- 1 | 2017-07-13 8 | */ 9 | 10 | use PhalApi\Loader; 11 | use PhalApi\Config\FileConfig; 12 | use PhalApi\Logger; 13 | use PhalApi\Logger\FileLogger; 14 | use PhalApi\Database\NotORMDatabase; 15 | use App\Auth\Lite as AuthLite; 16 | 17 | /** ---------------- 注册&初始化 基本服务组件 ---------------- **/ 18 | 19 | // 兼容PhalApi 1.x 旧版本 20 | $loader = new Loader(API_ROOT, array('Library', 'library')); 21 | 22 | include 'constant.php'; 23 | 24 | $di = \PhalApi\DI(); 25 | 26 | // 自动加载 27 | $di->loader = $loader; 28 | 29 | // 配置 30 | $di->config = new FileConfig(API_ROOT . '/config'); 31 | 32 | // 调试模式,$_GET['__debug__']可自行改名 33 | $di->debug = !empty($_GET['__debug__']) ? true : $di->config->get('sys.debug'); 34 | 35 | // 日记纪录 36 | $di->logger = new FileLogger(API_ROOT . '/runtime', Logger::LOG_LEVEL_DEBUG | Logger::LOG_LEVEL_INFO | Logger::LOG_LEVEL_ERROR); 37 | // 数据操作 - 基于NotORM 38 | $di->notorm = new NotORMDatabase($di->config->get('dbs'), $di->debug); 39 | 40 | $di->request = New App\Common\Request(); 41 | 42 | $di->qiniu = new \PhalApi\Qiniu\Lite(); 43 | 44 | $di->auth = New AuthLite(); 45 | 46 | $di->phpExcel = New PHPExcel_Lite(); 47 | 48 | $di->cors = new \PhalApi\CORS\Lite(); 49 | 50 | \PhalApi\DI()->cookie = new PhalApi\Cookie(); 51 | 52 | /** ---------------- 定制注册 可选服务组件 ---------------- **/ 53 | 54 | /** 55 | // 签名验证服务 56 | $di->filter = new \PhalApi\Filter\SimpleMD5Filter(); 57 | */ 58 | 59 | /** 60 | // 缓存 - Memcache/Memcached 61 | $di->cache = function () { 62 | return new \PhalApi\Cache\MemcacheCache(DI()->config->get('sys.mc')); 63 | }; 64 | */ 65 | 66 | /** 67 | // 支持JsonP的返回 68 | if (!empty($_GET['callback'])) { 69 | $di->response = new \PhalApi\Response\JsonpResponse($_GET['callback']); 70 | } 71 | */ 72 | 73 | 74 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/RichText/ITextElement.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | 15 | /** 16 | * 用于检测业务代码死循环或者长时间阻塞等问题 17 | * 如果发现业务卡死,可以将下面declare打开(去掉//注释),并执行php start.php reload 18 | * 然后观察一段时间workerman.log看是否有process_timeout异常 19 | */ 20 | //declare(ticks=1); 21 | 22 | use GatewayWorker\Lib\Gateway; 23 | 24 | /** 25 | * 主逻辑 26 | * 主要是处理 onConnect onMessage onClose 三个方法 27 | * onConnect 和 onClose 如果不需要可以不用实现并删除 28 | */ 29 | class Events 30 | { 31 | /** 32 | * 当客户端连接时触发 33 | * 如果业务不需此回调可以删除onConnect 34 | * @param int $client_id 连接id 35 | * @throws Exception 36 | */ 37 | public static function onConnect($client_id) 38 | { 39 | // 向当前client_id发送数据 40 | $data = ['action' => 'connect', 'data' => ['client_id' => $client_id]]; 41 | Gateway::sendToClient($client_id, json_encode($data)); 42 | // 向所有人发送 43 | // Gateway::sendToAll("$client_id login\r\n"); 44 | } 45 | 46 | /** 47 | * 当客户端发来消息时触发 48 | * @param int $client_id 连接id 49 | * @param mixed $message 具体消息 50 | * @throws Exception 51 | */ 52 | public static function onMessage($client_id, $message) 53 | { 54 | // 向所有人发送 55 | Gateway::sendToAll("$client_id said $message\r\n"); 56 | } 57 | 58 | /** 59 | * 当用户断开连接时触发 60 | * @param int $client_id 连接id 61 | * @throws Exception 62 | */ 63 | public static function onClose($client_id) 64 | { 65 | // 向所有人发送 66 | // GateWay::sendToAll("$client_id logout\r\n"); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /config/dbs.php: -------------------------------------------------------------------------------- 1 | 2015-02-09 8 | */ 9 | 10 | return array( 11 | /** 12 | * DB数据库服务器集群 13 | */ 14 | 'servers' => array( 15 | 'db_master' => array( //服务器标记 16 | 'host' => '127.0.0.1', //数据库域名 17 | 'name' => 'project', //数据库名字 18 | 'user' => 'root', //数据库用户名 19 | 'password' => 'root', //数据库密码 20 | 'port' => 3306, //数据库端口 21 | 'charset' => 'UTF8', //数据库字符集 22 | ), 23 | ), 24 | 25 | /** 26 | * 自定义路由表 27 | */ 28 | 'tables' => array( 29 | //通用路由 30 | '__default__' => array( 31 | 'prefix' => 'pms_', 32 | 'key' => 'id', 33 | 'map' => array( 34 | array('db' => 'db_master'), 35 | ), 36 | ), 37 | 'pms' => array( 38 | 'prefix' => 'pms_', 39 | 'key' => 'id', 40 | 'map' => array( 41 | array('db' => 'db_master'), 42 | ), 43 | ), 44 | 45 | /** 46 | 'demo' => array( //表名 47 | 'prefix' => 'tbl_', //表名前缀 48 | 'key' => 'id', //表主键名 49 | 'map' => array( //表路由配置 50 | array('db' => 'db_master'), //单表配置:array('db' => 服务器标记) 51 | array('start' => 0, 'end' => 2, 'db' => 'db_master'), //分表配置:array('start' => 开始下标, 'end' => 结束下标, 'db' => 服务器标记) 52 | ), 53 | ), 54 | */ 55 | ), 56 | ); 57 | -------------------------------------------------------------------------------- /sdk/Objective-C/XSHttpTool/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | // AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | #ifndef _AFNETWORKING_ 27 | #define _AFNETWORKING_ 28 | 29 | #import "AFURLRequestSerialization.h" 30 | #import "AFURLResponseSerialization.h" 31 | #import "AFSecurityPolicy.h" 32 | #import "AFNetworkReachabilityManager.h" 33 | 34 | #import "AFURLConnectionOperation.h" 35 | #import "AFHTTPRequestOperation.h" 36 | #import "AFHTTPRequestOperationManager.h" 37 | 38 | #if ( ( defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || \ 39 | ( defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 ) ) 40 | #import "AFURLSessionManager.h" 41 | #import "AFHTTPSessionManager.h" 42 | #endif 43 | 44 | #endif /* _AFNETWORKING_ */ 45 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Reader/DefaultReadFilter.php: -------------------------------------------------------------------------------- 1 | "Hello World!", "content"=>"dogstar您好,欢迎使用PhalApi!", "version"=>"1.2.1", "time"=>1445741092} 29 | 30 | ``` 31 | ## 6.5.4 更多调用 32 | 当需要重复调用时,需要先进行 **重置操作** ,如: 33 | ```ruby 34 | #one more time 35 | a_response = a_client.reset \ 36 | .withService("User.GetBaseInfo") \ 37 | .withParams("user_id", "1") \ 38 | .request 39 | 40 | puts a_response.ret, a_response.data, a_response.msg 41 | ``` 42 | 43 | 当请求有异常时,返回的 ret!= 200,如: 44 | ```ruby 45 | #illegal request 46 | a_response = a_client.reset.withService('XXXX.noThisMethod').request 47 | 48 | puts a_response.ret, a_response.data, a_response.msg 49 | ``` 50 | 51 | 以上的输出为: 52 | ``` 53 | -------------------- 54 | 400 55 | 非法请求:接口服务XXXX.noThisMethod不存在 56 | 57 | ``` 58 | ## 扩展你的过滤器和结果解析器 59 | ### (1)扩展过滤器 60 | 当服务端接口需要接口签名验证,或者接口参数加密传送,或者压缩传送时,可以实现此过滤器,以便和服务端操持一致。 61 | 62 | 当需要扩展时,分两步。首先,需要实现过滤器接口: 63 | ```ruby 64 | class MyFilter < PhalApi::ClientFilter 65 | def filter(service, *params) 66 | #TODO ... 67 | end 68 | } 69 | ``` 70 | 然后设置过滤器: 71 | ```ruby 72 | a_response = PhalApi::Client.create.withHost('http://demo.phalapi.net') \ 73 | .withFilter(MyFilter.new) \ 74 | # ... \ 75 | .request 76 | ``` 77 | ### (2)扩展结果解析器 78 | 当返回的接口结果不是JSON格式时,可以重新实现此接口。 79 | 80 | 当需要扩展时,同样分两步。类似过滤器扩展,这里不再赘述。 81 | 82 | ## 一如既往的单元测试 83 | 最后,附一张单元测试运行的效果图: 84 | ![](http://7xiz2f.com1.z0.glb.clouddn.com/QQ20151025123152.png) 85 | -------------------------------------------------------------------------------- /src/App/Domain/User/Setting/UserSetting.php: -------------------------------------------------------------------------------- 1 | getInfo(array('name'=>$name))['value']); } public function doSetting($name,$data) { $param = json_decode($data); if($name == 'base_setting'){ if (!is_numeric($param->user_name_length_min) or $param->user_name_length_min <= 0) { throw new WrongRequestException('用户名最小长度不合法', 1); } if (!is_numeric($param->user_name_length_max) or $param->user_name_length_max <= 0) { throw new WrongRequestException('用户名最大长度不合法', 2); } if (!is_numeric($param->nick_name_length_min) or $param->nick_name_length_min <= 0) { throw new WrongRequestException('用户昵称最小长度不合法', 3); } if (!is_numeric($param->nick_name_length_max) or $param->nick_name_length_max <= 0) { throw new WrongRequestException('用户昵称最小长度不合法', 4); } if (!is_numeric($param->password_length_min) or $param->password_length_min <= 0) { throw new WrongRequestException('用户密码最小长度不合法', 4); } if (!is_numeric($param->password_length_max) or $param->password_length_max <= 0) { throw new WrongRequestException('用户昵称最小大度不合法', 4); } if (count($param->default_user_group_list) <= 0) { throw new WrongRequestException('请至少选择一个默认用户组', 5); } } $result = self::$Model->updateByWhere(array('name'=>$name),array('value'=>$data)); if ($result === false) { throw new WrongRequestException('保存失败', 6); } addLog('修改用户配置,配置项:' . $name); } } -------------------------------------------------------------------------------- /sdk/Objective-C/PhalApiClient/AFNPhalApiClient/Vendor/AFNetworking-2.6.1/AFNetworking.h: -------------------------------------------------------------------------------- 1 | // AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | #ifndef _AFNETWORKING_ 27 | #define _AFNETWORKING_ 28 | 29 | #import "AFURLRequestSerialization.h" 30 | #import "AFURLResponseSerialization.h" 31 | #import "AFSecurityPolicy.h" 32 | #if !TARGET_OS_WATCH 33 | #import "AFNetworkReachabilityManager.h" 34 | #import "AFURLConnectionOperation.h" 35 | #import "AFHTTPRequestOperation.h" 36 | #import "AFHTTPRequestOperationManager.h" 37 | #endif 38 | 39 | #if ( ( defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || \ 40 | ( defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 ) || \ 41 | TARGET_OS_WATCH ) 42 | #import "AFURLSessionManager.h" 43 | #import "AFHTTPSessionManager.h" 44 | #endif 45 | 46 | #endif /* _AFNETWORKING_ */ 47 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php: -------------------------------------------------------------------------------- 1 | _BSECollection[] = $BSE; 52 | $BSE->setParent($this); 53 | } 54 | 55 | /** 56 | * Get the collection of BLIP Store Entries 57 | * 58 | * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE[] 59 | */ 60 | public function getBSECollection() 61 | { 62 | return $this->_BSECollection; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/App/Domain/User/Level.php: -------------------------------------------------------------------------------- 1 | getList($param); return $list; } public function getUserList($param) { if (!is_array($param)) { $param = get_object_vars($param); } $position_id = $param['level_id']; unset($param['level_id']); $param['where'] = array('level_id'=>$position_id); $domain_user = new User(); return $domain_user->getUserList($param); } public function getInfo($where, $field = '*') { $info = self::$Model->getInfo($where, $field); return $info; } /** 删除等级 * @param $ids id列表 如1,2,3 * @return int */ public function delLevel($ids) { $result = self::$Model->delItems($ids); if ($result) { $ids = json_encode($ids); addLog("删除等级,编号:$ids"); } return $result == true ? 0 : 1; } /** * 新增等级 * @param $data * @throws WrongRequestException */ public function addLevel($data) { $data['create_time'] = nowTime(); $id = self::$Model->insert($data); if ($id === false) { throw new WrongRequestException('新增失败', 8); } addLog('新增等级,编号:' . $id); } public function editLevel($id, $data) { $result = self::$Model->update($id, $data); if ($result === false) { throw new WrongRequestException('保存失败', 6); } addLog('修改等级,评级ID:' . $id); } } -------------------------------------------------------------------------------- /src/App/Model/Common/Notify.php: -------------------------------------------------------------------------------- 1 | '任务动态', 'key' => '1', 'action' => 'task_dynamic'); 16 | $type[] = array('title' => '项目动态', 'key' => '2', 'action' => 'project_dynamic'); 17 | $type[] = array('title' => '团队动态', 'key' => '3', 'action' => 'team_dynamic'); 18 | $type[] = array('title' => '上线提醒', 'key' => '4', 'action' => 'user_login'); 19 | $type[] = array('title' => '项目同步', 'key' => '5', 'action' => 'project_synchronize'); 20 | $type[] = array('title' => '任务同步', 'key' => '6', 'action' => 'task_synchronize'); 21 | $type[] = array('title' => 'action同步', 'key' => '6', 'action' => 'action_synchronize'); 22 | return $type; 23 | } 24 | 25 | /** 获取通知类型 26 | * @param $key 27 | * @return mixed 28 | */ 29 | public function getNotifyType($key) 30 | { 31 | $task_list = $this->getNotifyTypeList(); 32 | foreach ($task_list as $item) { 33 | if ($item['key'] == $key) { 34 | return $item; 35 | } 36 | } 37 | } 38 | 39 | /** 40 | * 获取通知类型名称 41 | * @param $key 42 | * @return mixed 43 | */ 44 | public function getNotifyTypeTitle($key) 45 | { 46 | $task_list = $this->getNotifyTypeList(); 47 | foreach ($task_list as $item) { 48 | if ($item['key'] == $key) { 49 | return $item['title']; 50 | } 51 | } 52 | } 53 | /** 54 | * 获取通知类型action 55 | * @param $key 56 | * @return mixed 57 | */ 58 | public function getNotifyTypeAction($key) 59 | { 60 | $task_list = $this->getNotifyTypeList(); 61 | foreach ($task_list as $item) { 62 | if ($item['key'] == $key) { 63 | return $item['action']; 64 | } 65 | } 66 | } 67 | 68 | 69 | 70 | protected function getTableName($id) 71 | { 72 | return 'notify'; 73 | } 74 | } -------------------------------------------------------------------------------- /src/App/Domain/User/Position.php: -------------------------------------------------------------------------------- 1 | getList($param); return $list; } public function getUserList($param) { if (!is_array($param)) { $param = get_object_vars($param); } $position_id = $param['position_id']; unset($param['position_id']); $param['where'] = array('position_id'=>$position_id); $domain_user = new User(); return $domain_user->getUserList($param); } public function getInfo($where, $field = '*') { $info = self::$Model->getInfo($where, $field); return $info; } /** 删除职位 * @param $ids id列表 如1,2,3 * @return int */ public function delPosition($ids) { $result = self::$Model->delItems($ids); if ($result) { $ids = json_encode($ids); addLog("删除职位,编号:$ids"); } return $result == true ? 0 : 1; } /** * 新增职位 * @param $data * @throws WrongRequestException */ public function addPosition($data) { $data['create_time'] = nowTime(); $id = self::$Model->insert($data); if ($id === false) { throw new WrongRequestException('新增失败', 8); } addLog('新增职位,编号:' . $id); } public function editPosition($id, $data) { $result = self::$Model->update($id, $data); if ($result === false) { throw new WrongRequestException('保存失败', 6); } addLog('修改职位,评级ID:' . $id); } } -------------------------------------------------------------------------------- /src/App/Domain/Project/ProjectType.php: -------------------------------------------------------------------------------- 1 | getList($param); return $list; } public function getInfo($where,$field = '*') { return self::$Model->getInfo($where,$field); } /** 删除项目类型 * @param $ids id列表 如1,2,3 * @return int */ public function delProjectType($ids) { $result = self::$Model->delItems($ids); if ($result) { $ids = json_encode($ids); addLog("删除项目项目类型,编号:$ids"); } return $result == true ? 0 : 1; } /** * 新增项目类型 * @param $data * @throws WrongRequestException */ public function addProjectType($data) { $data['create_time'] = nowTime(); $id = self::$Model->insert($data); if ($id === false) { throw new WrongRequestException('新增失败', 8); } $model_task_type_template = new TaskTypeTemplate(); $template_data = $model_task_type_template->default_template; foreach ($template_data as $template) { $data = array(); $data['project_type_id'] = $id; $data['name'] = $template['name']; $data['create_time'] = nowTime(); $model_task_type_template->insert($data); } addLog('新增项目类型,编号:' . $id); } public function editProjectProjectType($id,$data) { $result = self::$Model->update($id,$data); if ($result === false) { throw new WrongRequestException('保存失败', 6); } addLog('修改项目类型,评级ID:' . $id); } } -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Shared/Escher/DgContainer.php: -------------------------------------------------------------------------------- 1 | _dgId; 56 | } 57 | 58 | public function setDgId($value) 59 | { 60 | $this->_dgId = $value; 61 | } 62 | 63 | public function getLastSpId() 64 | { 65 | return $this->_lastSpId; 66 | } 67 | 68 | public function setLastSpId($value) 69 | { 70 | $this->_lastSpId = $value; 71 | } 72 | 73 | public function getSpgrContainer() 74 | { 75 | return $this->_spgrContainer; 76 | } 77 | 78 | public function setSpgrContainer($spgrContainer) 79 | { 80 | return $this->_spgrContainer = $spgrContainer; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Chart/Title.php: -------------------------------------------------------------------------------- 1 | _caption = $caption; 59 | $this->_layout = $layout; 60 | } 61 | 62 | /** 63 | * Get caption 64 | * 65 | * @return string 66 | */ 67 | public function getCaption() { 68 | return $this->_caption; 69 | } 70 | 71 | /** 72 | * Set caption 73 | * 74 | * @param string $caption 75 | */ 76 | public function setCaption($caption = null) { 77 | $this->_caption = $caption; 78 | } 79 | 80 | /** 81 | * Get Layout 82 | * 83 | * @return PHPExcel_Chart_Layout 84 | */ 85 | public function getLayout() { 86 | return $this->_layout; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/App/Auth/Domain/MenuModel.php: -------------------------------------------------------------------------------- 1 | array(), 'count' => 0); $rs['count'] = self::$Model->getLimitCount($param['keyWord']); $rs['list'] = self::$Model->getLimitList($param); return $rs; } public function getAllList($param) { if (is_object($param)) { $param = get_object_vars($param); } $rs = array('list' => array(), 'count' => 0); $rs['count'] = self::$Model->getCount(array()); $rs['list'] = self::$Model->getListByWhere(array(),$param['field'],$param['order']); return $rs; } /** 获取单个规则信息 * @param $id * @return mixed */ public function getInfo($id) { $r = self::$Model->getInfo(array('id'=>$id)); return $r; } public function addModel($apiObj) { $param = get_object_vars($apiObj); //检查规则标识是否重复,重复返回2 $r = self::$Model->checkRepeat($param['name']); if ($r) return 2; //成功返回0,失败返回2 $r = self::$Model->addModel($param); return $r == true ? 0 : 1; } /**修改规则 * @param $apiObj * @return int 成功返回0,失败返回1,名称重复返回2 */ public function editModel($apiObj) { $param = get_object_vars($apiObj); //检查名称重复,重复返回2 $r = self::$Model->checkRepeat($param['name'], $param['id']); if ($r){ return 2; } $r = self::$Model->editModel($param['id'], $param); if ($r == true) { $id = $param['id']; addLog("编辑菜单模块,编号:$id"); } return $r == true ? 0 : 1; } /** 删除规则 * @param $ids id列表 如1,2,3 * @return int */ public function delModel($ids) { $r = self::$Model->delModel($ids); if ($r) { $ids = json_encode($ids); addLog("删除菜单模块,编号:$ids"); } return $r == true ? 0 : 1; } } -------------------------------------------------------------------------------- /sdk/React-Native/PhalApi.js: -------------------------------------------------------------------------------- 1 | /** 2 | * PhalApi框架 React-Naitve请求SDK 3 | * 4 | * "ダSimVlove辉"提供,QQ:254059780 有好的意见或建议请联系我 2016-03-08 5 | * 6 | * 分为3种请求方式:get,post 7 | * 8 | * 所有请求均统一传递4个参数值(请求地址,接口名称.请求参数GET传递拼接好的参数 9 | * Post传递数组key-value值,回调函数) 10 | * 11 | * 统一使用方式如下 12 | import PhalApi from 'sdk所在目录' 13 | 14 | const data = {user_id: "2"} 15 | 16 | PhalApi.apiPost("http://192.168.1.107/PhalApi_1.3.2/Public", "User.getBaseInfo", data, (rs) => { 17 | if(rs.ret == 200){ 18 | //成功处理 19 | }else{ 20 | //失败处理 21 | } 22 | }) 23 | 24 | * 如果想返回json 使用response.json() 25 | * 如果只要返回普通的string response.text() 26 | * 27 | */ 28 | 29 | // 配置调试 30 | const debug = false; 31 | 32 | export default PhalApi = new class { 33 | 34 | /* 35 | * 普通Post方式请求 36 | */ 37 | apiPost(api_url, api_name, data, callback) { 38 | const textBody = this.urlForQuery(data) 39 | const full_api = api_url + "/" 40 | const fetchOptions = { 41 | method: 'POST', 42 | headers: { 43 | "Content-Type": "application/x-www-form-urlencoded" 44 | }, 45 | body: 'service=' + api_name + '&' + textBody 46 | }; 47 | 48 | fetch(full_api, fetchOptions) 49 | .then(response => response.json()) 50 | .then((responseText) => { 51 | callback(textBody) 52 | 53 | if (debug) 54 | console.log(responseText); 55 | }) 56 | .catch((error) => { 57 | if (debug) 58 | console.warn(error); 59 | }); 60 | } 61 | 62 | /* 63 | * 普通Get方式请求 64 | */ 65 | apiGet(api_url, api_name, data, callback) { 66 | const textBody = this.urlForQuery(data) 67 | const full_api = api_url + "?service=" + api_name + "&" + textBody 68 | fetch(full_api) 69 | .then((response) => response.json()) 70 | .then((responseText) => { 71 | callback(responseText) 72 | 73 | if (debug) 74 | console.log(responseText); 75 | }) 76 | .catch((error) => { 77 | if (debug) 78 | console.warn(error); 79 | }); 80 | 81 | } 82 | 83 | // 相关参数的拼接 84 | urlForQuery(data) { 85 | const querystring = Object.keys(data) 86 | .map(key => key + '=' + encodeURIComponent(data[key])) 87 | .join('&'); 88 | 89 | return querystring; 90 | } 91 | } -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php: -------------------------------------------------------------------------------- 1 | _data; 59 | } 60 | 61 | /** 62 | * Set the raw image data 63 | * 64 | * @param string 65 | */ 66 | public function setData($data) 67 | { 68 | $this->_data = $data; 69 | } 70 | 71 | /** 72 | * Set parent BSE 73 | * 74 | * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent 75 | */ 76 | public function setParent($parent) 77 | { 78 | $this->_parent = $parent; 79 | } 80 | 81 | /** 82 | * Get parent BSE 83 | * 84 | * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent 85 | */ 86 | public function getParent() 87 | { 88 | return $this->_parent; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/App/Auth/Domain/Rule.php: -------------------------------------------------------------------------------- 1 | array(), 'count' => 0); $rs['count'] = self::$Model->getCount($param['keyWord']); $rs['list'] = self::$Model->getList($param); return $rs; } public function getLimitList($param) { $param = get_object_vars($param); $rs = array('list' => array(), 'count' => 0); $rs['count'] = self::$Model->getLimitCount($param['keyWord'],$param['pid']); $rs['list'] = self::$Model->getLimitList($param); return $rs; } /**添加规则 * @param $apiObj api对象 * @return int 成功返回0,失败返回1,标识重复返回2, */ public function addRule($apiObj) { $param = get_object_vars($apiObj); //检查规则标识是否重复,重复返回2 $r = self::$Model->checkRepeat($param['name']); if ($r) return 2; //成功返回0,失败返回2 $r = self::$Model->addRule($param); return $r == true ? 0 : 1; } /**修改规则 * @param $apiObj * @return int 成功返回0,失败返回1,名称重复返回2 */ public function editRule($apiObj) { $param = get_object_vars($apiObj); //检查名称重复,重复返回2 $r = self::$Model->checkRepeat($param['name'], $param['id']); if ($r) return 2; $r = self::$Model->editRule($param['id'], $param); if ($r) { $id = $param['id']; addLog("编辑权限规则,编号:$id"); } return $r == true ? 0 : 1; } /** 删除规则 * @param $ids id列表 如1,2,3 * @return int */ public function delRule($ids) { $r = self::$Model->delRule($ids); if ($r) { $ids = json_encode($this->ids); addLog("删除权限规则,编号:$ids"); } return $r == true ? 0 : 1; } /** 获取单个规则信息 * @param $id * @return mixed */ public function getInfo($id) { $r = self::$Model->getInfo($id); return $r; } public function getRulesInGroups($gids) { if (\PhalApi\DI()->cache === null) { $rules = self::$Model->getRulesInGroups($gids); } else { $rules = self::$Model->getRulesInGroupsCache($gids); } return $rules; } } -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Shared/PasswordHasher.php: -------------------------------------------------------------------------------- 1 | . 44 | * 45 | * @param string $pPassword Password to hash 46 | * @return string Hashed password 47 | */ 48 | public static function hashPassword($pPassword = '') { 49 | $password = 0x0000; 50 | $charPos = 1; // char position 51 | 52 | // split the plain text password in its component characters 53 | $chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY); 54 | foreach ($chars as $char) { 55 | $value = ord($char) << $charPos++; // shifted ASCII value 56 | $rotated_bits = $value >> 15; // rotated bits beyond bit 15 57 | $value &= 0x7fff; // first 15 bits 58 | $password ^= ($value | $rotated_bits); 59 | } 60 | 61 | $password ^= strlen($pPassword); 62 | $password ^= 0xCE4B; 63 | 64 | return(strtoupper(dechex($password))); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Worksheet/Row.php: -------------------------------------------------------------------------------- 1 | _parent = $parent; 63 | $this->_rowIndex = $rowIndex; 64 | } 65 | 66 | /** 67 | * Destructor 68 | */ 69 | public function __destruct() { 70 | unset($this->_parent); 71 | } 72 | 73 | /** 74 | * Get row index 75 | * 76 | * @return int 77 | */ 78 | public function getRowIndex() { 79 | return $this->_rowIndex; 80 | } 81 | 82 | /** 83 | * Get cell iterator 84 | * 85 | * @return PHPExcel_Worksheet_CellIterator 86 | */ 87 | public function getCellIterator() { 88 | return new PHPExcel_Worksheet_CellIterator($this->_parent, $this->_rowIndex); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /data/1.1.0/1.0.1-1.1.0.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | ALTER TABLE `pms`.`pms_project_level` MODIFY COLUMN `sort` int(11) NULL DEFAULT 0 COMMENT '排序' AFTER `money`; 4 | 5 | ALTER TABLE `pms`.`pms_project_type` MODIFY COLUMN `sort` int(11) NULL DEFAULT 0 AFTER `memo`; 6 | 7 | CREATE TABLE `pms`.`pms_task_tag` ( 8 | `id` int(11) NOT NULL AUTO_INCREMENT, 9 | `project` int(11) NULL DEFAULT NULL COMMENT '项目id', 10 | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名', 11 | `color` enum('blue','red','orange','green','brown','purple') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'blue' COMMENT '颜色', 12 | `create_time` datetime(0) NULL DEFAULT NULL, 13 | PRIMARY KEY (`id`) USING BTREE 14 | ) ENGINE = MyISAM CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; 15 | 16 | CREATE TABLE `pms`.`pms_task_to_tag` ( 17 | `id` int(11) NOT NULL AUTO_INCREMENT, 18 | `task_id` int(11) NULL DEFAULT 0, 19 | `tag_id` int(11) NULL DEFAULT 0, 20 | `create_time` datetime(0) NULL DEFAULT NULL, 21 | PRIMARY KEY (`id`) USING BTREE 22 | ) ENGINE = MyISAM CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Fixed; 23 | 24 | ALTER TABLE `pms`.`pms_user_level` MODIFY COLUMN `sort` tinyint(11) NULL DEFAULT 0 COMMENT '排序' AFTER `level_desc`; 25 | 26 | ALTER TABLE `pms`.`pms_user_position` MODIFY COLUMN `sort` tinyint(11) NULL DEFAULT 0 AFTER `position_desc`; 27 | 28 | INSERT INTO `pms`.`pms_auth_rule`(`id`, `name`, `title`, `status`, `add_condition`, `pid`, `model`, `rule_desc`) VALUES (154, 'Project_Task.addTaskTag', '添加任务标签', 1, '', 50, 0, '添加任务标签'); 29 | INSERT INTO `pms`.`pms_auth_rule`(`id`, `name`, `title`, `status`, `add_condition`, `pid`, `model`, `rule_desc`) VALUES (155, 'Project_Task.editTaskTag', '编辑任务标签', 1, '', 50, 0, '编辑任务标签'); 30 | INSERT INTO `pms`.`pms_auth_rule`(`id`, `name`, `title`, `status`, `add_condition`, `pid`, `model`, `rule_desc`) VALUES (156, 'Project_Task.delTaskTag', '删除任务标签', 1, '', 50, 0, '删除任务标签'); 31 | 32 | 33 | UPDATE `pms`.`pms_auth_group` SET `rules` = '1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156' WHERE `id` = 7; 34 | 35 | SET FOREIGN_KEY_CHECKS=1; 36 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Shared/Escher.php: -------------------------------------------------------------------------------- 1 | _dggContainer; 59 | } 60 | 61 | /** 62 | * Set Drawing Group Container 63 | * 64 | * @param PHPExcel_Shared_Escher_DggContainer $dggContainer 65 | */ 66 | public function setDggContainer($dggContainer) 67 | { 68 | return $this->_dggContainer = $dggContainer; 69 | } 70 | 71 | /** 72 | * Get Drawing Container 73 | * 74 | * @return PHPExcel_Shared_Escher_DgContainer 75 | */ 76 | public function getDgContainer() 77 | { 78 | return $this->_dgContainer; 79 | } 80 | 81 | /** 82 | * Set Drawing Container 83 | * 84 | * @param PHPExcel_Shared_Escher_DgContainer $dgContainer 85 | */ 86 | public function setDgContainer($dgContainer) 87 | { 88 | return $this->_dgContainer = $dgContainer; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Writer/Excel2007/WriterPart.php: -------------------------------------------------------------------------------- 1 | _parentWriter = $pWriter; 53 | } 54 | 55 | /** 56 | * Get parent IWriter object 57 | * 58 | * @return PHPExcel_Writer_IWriter 59 | * @throws PHPExcel_Writer_Exception 60 | */ 61 | public function getParentWriter() { 62 | if (!is_null($this->_parentWriter)) { 63 | return $this->_parentWriter; 64 | } else { 65 | throw new PHPExcel_Writer_Exception("No parent PHPExcel_Writer_IWriter assigned."); 66 | } 67 | } 68 | 69 | /** 70 | * Set parent IWriter object 71 | * 72 | * @param PHPExcel_Writer_IWriter $pWriter 73 | * @throws PHPExcel_Writer_Exception 74 | */ 75 | public function __construct(PHPExcel_Writer_IWriter $pWriter = null) { 76 | if (!is_null($pWriter)) { 77 | $this->_parentWriter = $pWriter; 78 | } 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/App/Plugins/GateWayWorker/start_gateway.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | 15 | use Workerman\Worker; 16 | use Workerman\WebServer; 17 | use GatewayWorker\Gateway; 18 | use GatewayWorker\BusinessWorker; 19 | use Workerman\Autoloader; 20 | 21 | require_once __DIR__ . '/../../../../vendor/autoload.php'; 22 | 23 | $ssl = false; 24 | $context = array(); 25 | if ($ssl) { 26 | // 证书最好是申请的证书 27 | $context = array( 28 | // 更多ssl选项请参考手册 http://php.net/manual/zh/context.ssl.php 29 | 'ssl' => array( 30 | // 请使用绝对路径 31 | 'local_cert' => '/www/wwwroot/projectManageApi/server.pem', // 也可以是crt文件 32 | 'local_pk' => '/www/wwwroot/projectManageApi/server.key', 33 | 'verify_peer' => false, 34 | 'allow_self_signed' => true, //如果是自签名证书需要开启此选项 35 | ) 36 | ); 37 | } 38 | 39 | // gateway 进程,这里使用Text协议,可以用telnet测试 40 | $gateway = new Gateway("websocket://192.168.0.140:2345", $context); 41 | 42 | if ($ssl) { 43 | // 开启SSL,websocket+SSL 即wss 44 | $gateway->transport = 'ssl'; 45 | } 46 | 47 | // gateway名称,status方便查看 48 | $gateway->name = 'YourAppGateway'; 49 | // gateway进程数 50 | $gateway->count = 4; 51 | // 本机ip,分布式部署时使用内网ip 52 | $gateway->lanIp = '127.0.0.1'; 53 | // 内部通讯起始端口,假如$gateway->count=4,起始端口为4000 54 | // 则一般会使用4000 4001 4002 4003 4个端口作为内部通讯端口 55 | $gateway->startPort = 2900; 56 | // 服务注册地址 57 | $gateway->registerAddress = '192.168.0.140:2346'; 58 | 59 | // 心跳间隔 60 | //$gateway->pingInterval = 10; 61 | // 心跳数据 62 | //$gateway->pingData = '{"type":"ping"}'; 63 | 64 | /* 65 | // 当客户端连接上来时,设置连接的onWebSocketConnect,即在websocket握手时的回调 66 | $gateway->onConnect = function($connection) 67 | { 68 | $connection->onWebSocketConnect = function($connection , $http_header) 69 | { 70 | // 可以在这里判断连接来源是否合法,不合法就关掉连接 71 | // $_SERVER['HTTP_ORIGIN']标识来自哪个站点的页面发起的websocket链接 72 | if($_SERVER['HTTP_ORIGIN'] != 'http://kedou.workerman.net') 73 | { 74 | $connection->close(); 75 | } 76 | // onWebSocketConnect 里面$_GET $_SERVER是可用的 77 | // var_dump($_GET, $_SERVER); 78 | }; 79 | }; 80 | */ 81 | 82 | // 如果不是在根目录启动,则运行runAll方法 83 | if (!defined('GLOBAL_START')) { 84 | Worker::runAll(); 85 | } 86 | 87 | -------------------------------------------------------------------------------- /src/App/Auth/Domain/Menu.php: -------------------------------------------------------------------------------- 1 | array(), 'count' => 0); $rs['count'] = self::$Model->getCount($param['keyWord']); $rs['list'] = self::$Model->getList($param); return $rs; } public function getLimitList($param) { if (is_object($param)) { $param = get_object_vars($param); } $rs = array('list' => array(), 'count' => 0); $rs['count'] = self::$Model->getLimitCount($param['keyWord'], $param['pid']); $rs['list'] = self::$Model->getLimitList($param); return $rs; } /**添加规则 * @param $apiObj api对象 * @return int 成功返回0,失败返回1,标识重复返回2, */ public function addMenu($apiObj) { $param = get_object_vars($apiObj); //检查规则标识是否重复,重复返回2 $r = self::$Model->checkRepeat($param['name']); if ($r) return 2; //成功返回0,失败返回2 $r = self::$Model->addMenu($param); return $r == true ? 0 : 1; } /**修改规则 * @param $apiObj * @return int 成功返回0,失败返回1,名称重复返回2 */ public function editMenu($apiObj) { $param = get_object_vars($apiObj); //检查名称重复,重复返回2 $r = self::$Model->checkRepeat($param['name'], $param['id']); if ($r){ return 2; } $r = self::$Model->editMenu($param['id'], $param); if ($r == true) { $id = $param['id']; addLog("编辑菜单,编号:$id"); } return $r == true ? 0 : 1; } /** 删除规则 * @param $ids id列表 如1,2,3 * @return int */ public function delMenu($ids) { $r = self::$Model->delMenu($ids); if ($r) { $ids = json_encode($ids); addLog("删除菜单,编号:$ids"); } return $r == true ? 0 : 1; } /** 获取单个规则信息 * @param $id * @return mixed */ public function getInfo($id) { $r = self::$Model->getInfo($id); return $r; } public function getMenusInGroups($gids) { if (\PhalApi\DI()->cache === null) { $menus = self::$Model->getMenusInGroups($gids); } else { $menus = self::$Model->getMenusInGroupsCache($gids); } return $menus; } } -------------------------------------------------------------------------------- /Library/PHPExcel/PHPExcel/Shared/OLE/PPS/File.php: -------------------------------------------------------------------------------- 1 | | 17 | // | Based on OLE::Storage_Lite by Kawai, Takanori | 18 | // +----------------------------------------------------------------------+ 19 | // 20 | // $Id: File.php,v 1.11 2007/02/13 21:00:42 schmidt Exp $ 21 | 22 | 23 | /** 24 | * Class for creating File PPS's for OLE containers 25 | * 26 | * @author Xavier Noguer 27 | * @category PHPExcel 28 | * @package PHPExcel_Shared_OLE 29 | */ 30 | class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS 31 | { 32 | /** 33 | * The constructor 34 | * 35 | * @access public 36 | * @param string $name The name of the file (in Unicode) 37 | * @see OLE::Asc2Ucs() 38 | */ 39 | public function __construct($name) 40 | { 41 | parent::__construct( 42 | null, 43 | $name, 44 | PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE, 45 | null, 46 | null, 47 | null, 48 | null, 49 | null, 50 | '', 51 | array()); 52 | } 53 | 54 | /** 55 | * Initialization method. Has to be called right after OLE_PPS_File(). 56 | * 57 | * @access public 58 | * @return mixed true on success 59 | */ 60 | public function init() 61 | { 62 | return true; 63 | } 64 | 65 | /** 66 | * Append data to PPS 67 | * 68 | * @access public 69 | * @param string $data The data to append 70 | */ 71 | public function append($data) 72 | { 73 | $this->_data .= $data; 74 | } 75 | 76 | /** 77 | * Returns a stream for reading this file using fread() etc. 78 | * @return resource a read-only stream 79 | */ 80 | public function getStream() 81 | { 82 | $this->ole->getStream($this); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /sdk/Objective-C/XSHttpTool/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIRefreshControl+AFNetworking.m 2 | // 3 | // Copyright (c) 2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFURLConnectionOperation; 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically begining and ending refreshing depending on the loading state of a request operation or session task. 35 | */ 36 | @interface UIRefreshControl (AFNetworking) 37 | 38 | ///----------------------------------- 39 | /// @name Refreshing for Session Tasks 40 | ///----------------------------------- 41 | 42 | /** 43 | Binds the refreshing state to the state of the specified task. 44 | 45 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 46 | */ 47 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 48 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; 49 | #endif 50 | 51 | ///---------------------------------------- 52 | /// @name Refreshing for Request Operations 53 | ///---------------------------------------- 54 | 55 | /** 56 | Binds the refreshing state to the execution state of the specified operation. 57 | 58 | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. 59 | */ 60 | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation; 61 | 62 | @end 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /sdk/Objective-C/XSHttpTool/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.h 2 | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #import 23 | 24 | #import 25 | 26 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 27 | 28 | #import 29 | 30 | @class AFURLConnectionOperation; 31 | 32 | /** 33 | This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a request operation or session task. 34 | */ 35 | @interface UIActivityIndicatorView (AFNetworking) 36 | 37 | ///---------------------------------- 38 | /// @name Animating for Session Tasks 39 | ///---------------------------------- 40 | 41 | /** 42 | Binds the animating state to the state of the specified task. 43 | 44 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 45 | */ 46 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 47 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task; 48 | #endif 49 | 50 | ///--------------------------------------- 51 | /// @name Animating for Request Operations 52 | ///--------------------------------------- 53 | 54 | /** 55 | Binds the animating state to the execution state of the specified operation. 56 | 57 | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. 58 | */ 59 | - (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation; 60 | 61 | @end 62 | 63 | #endif 64 | --------------------------------------------------------------------------------