├── public ├── uploads │ └── 1.txt ├── images │ ├── jg.png │ ├── jt.png │ ├── pw.jpg │ ├── admin.png │ ├── ali.png │ ├── dis1.png │ ├── dis2.png │ ├── jgs.png │ ├── pay.png │ ├── g_geYbg.png │ ├── g_name.png │ ├── loading.gif │ ├── vmstats.png │ ├── weixin.jpeg │ ├── z_upage.png │ ├── g_Sheiji.png │ ├── g_addJia.png │ ├── g_dengBg.png │ ├── g_huiGong.png │ ├── g_huiXia.png │ ├── g_jianHao.png │ ├── g_poresd.png │ ├── g_remoJian.png │ ├── g_tanJiabd.png │ ├── g_upDown.png │ ├── jtmobile.png │ ├── jtmobilet.png │ ├── testlive.png │ ├── windowspc.png │ ├── z_lastpage.png │ ├── z_nextpage.png │ ├── z_shouye.png │ └── multiprocess.png ├── vue │ └── images │ │ ├── 1.jpg │ │ ├── 2.png │ │ ├── 3.jpg │ │ └── bg.jpg ├── json │ ├── jsapi_ticket.json │ ├── token.json │ └── access_token.json ├── css │ ├── bootstrapValidator.css │ ├── validate.css │ ├── g_commenLeft.css │ ├── z_tanwindow.css │ ├── z_AddMemu.css │ ├── g_dengLu.css │ ├── grid_bootstrap.min.css │ ├── l_addSystem.css │ └── g_commenTop.css └── js │ ├── transformToTreeFormat.js │ ├── grid.zh-CN.min.js │ ├── adminAreaIndex.js │ ├── systemAreaIndex.js │ ├── adminAreaList.js │ ├── systemAreaList.js │ └── area.js ├── vmstat ├── img │ ├── 1.txt │ └── vmstat.png ├── index.php └── stats.css ├── server ├── log │ └── log.log ├── hprose │ └── Server.php ├── distributed │ └── DistributedServer.php ├── swoole │ ├── HttpServer.php │ ├── WebSocketServer.php │ ├── SwooleLiveServer_table.php │ └── TaskServer.php └── rpc │ └── RpcServer.php ├── MYPATH └── logs │ └── 20171215 │ └── 17_12_15.log ├── .htaccess ├── application ├── views │ ├── index │ │ ├── test.phtml │ │ ├── action.phtml │ │ ├── index.html │ │ ├── distributed.html │ │ └── swoolesocket.html │ └── error │ │ └── error.phtml ├── models │ ├── Test │ │ └── Foo.php │ ├── User.php │ └── Leslie.php ├── library │ ├── wx │ │ └── pay │ │ │ ├── Exception.php │ │ │ ├── Notify.php │ │ │ ├── config.php │ │ │ ├── NativeCall.php │ │ │ ├── OrderQuery.php │ │ │ ├── ShortUrl.php │ │ │ ├── DownloadBill.php │ │ │ ├── server.php │ │ │ ├── NativeLink.php │ │ │ ├── RefundQuery.php │ │ │ ├── pay.php │ │ │ └── Refund.php │ ├── think │ │ ├── CacheInterface.php │ │ ├── db │ │ │ ├── exception │ │ │ │ ├── ClassNotFoundException.php │ │ │ │ ├── BindParamException.php │ │ │ │ ├── ModelNotFoundException.php │ │ │ │ ├── DataNotFoundException.php │ │ │ │ ├── DbException.php │ │ │ │ └── PDOException.php │ │ │ └── builder │ │ │ │ ├── Sqlite.php │ │ │ │ ├── Oracle.php │ │ │ │ └── Pgsql.php │ │ ├── model │ │ │ ├── Pivot.php │ │ │ ├── concern │ │ │ │ └── TimeStamp.php │ │ │ └── Collection.php │ │ ├── Exception.php │ │ ├── config.php │ │ └── paginator │ │ │ └── Collection.php │ ├── hprose.php │ ├── swoole │ │ ├── socket.php │ │ └── taskclient.php │ ├── distributed.php │ ├── RpcClient.php │ ├── distributed │ │ └── dredis.php │ └── mysqlpool.php ├── modules │ └── Admin │ │ └── views │ │ └── user │ │ ├── top.html │ │ └── login.html ├── controllers │ └── Error.php ├── Bootstrap.php └── plugins │ └── Autoload.php ├── .travis.yml ├── thrift ├── Bin │ └── rpc │ │ └── Handler.php ├── Thrift │ ├── Factory │ │ ├── TTransportFactory.php │ │ ├── TFramedTransportFactory.php │ │ ├── TProtocolFactory.php │ │ ├── TCompactProtocolFactory.php │ │ ├── TJSONProtocolFactory.php │ │ ├── TBinaryProtocolFactory.php │ │ └── TStringFuncFactory.php │ ├── Server │ │ ├── TNonblockingServer.php │ │ ├── TServerTransport.php │ │ ├── TSimpleServer.php │ │ ├── TServerSocket.php │ │ ├── TNonblockingServerSocket.php │ │ └── TServer.php │ ├── StringFunc │ │ ├── TStringFunc.php │ │ ├── Core.php │ │ └── Mbstring.php │ ├── Type │ │ ├── TMessageType.php │ │ ├── TType.php │ │ └── TConstant.php │ ├── Protocol │ │ ├── SimpleJSON │ │ │ ├── Context.php │ │ │ ├── CollectionMapKeyException.php │ │ │ ├── ListContext.php │ │ │ ├── MapContext.php │ │ │ └── StructContext.php │ │ ├── JSON │ │ │ ├── BaseContext.php │ │ │ ├── ListContext.php │ │ │ ├── LookaheadReader.php │ │ │ └── PairContext.php │ │ └── TBinaryProtocolAccelerated.php │ ├── Exception │ │ ├── TTransportException.php │ │ ├── TProtocolException.php │ │ └── TApplicationException.php │ └── Transport │ │ ├── TNullTransport.php │ │ ├── TTransport.php │ │ └── TMemoryBuffer.php ├── gen │ └── rpc.thrift ├── test │ ├── client.php │ └── server.php └── swoole │ ├── RpcServer.php │ └── Socket.php ├── hprose ├── test │ ├── TcpServer.php │ └── TcpClient.php ├── lib │ ├── TimeoutException.php │ ├── ResultMode.php │ ├── ReaderRefer.php │ ├── WriterRefer.php │ ├── FakeWriterRefer.php │ ├── Timer.php │ ├── FakeReaderRefer.php │ ├── RealReaderRefer.php │ ├── Tags.php │ ├── InvokeSettings.php │ └── RealWriterRefer.php └── server.php ├── index.php ├── composer.json ├── .gitattributes ├── distributed └── test │ └── server.php ├── .gitignore └── console └── console.config.php /public/uploads/1.txt: -------------------------------------------------------------------------------- 1 | 1111 2 | -------------------------------------------------------------------------------- /vmstat/img/1.txt: -------------------------------------------------------------------------------- 1 | vmstat监控 2 | -------------------------------------------------------------------------------- /server/log/log.log: -------------------------------------------------------------------------------- 1 | [ 2016-08-03T14:32:16+08:00 ] err: 123 2 | -------------------------------------------------------------------------------- /MYPATH/logs/20171215/17_12_15.log: -------------------------------------------------------------------------------- 1 | [ 2017-12-15T07:12:28+00:00 ] DEBUG: zas 2 | -------------------------------------------------------------------------------- /public/images/jg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/jg.png -------------------------------------------------------------------------------- /public/images/jt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/jt.png -------------------------------------------------------------------------------- /public/images/pw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/pw.jpg -------------------------------------------------------------------------------- /public/images/admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/admin.png -------------------------------------------------------------------------------- /public/images/ali.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/ali.png -------------------------------------------------------------------------------- /public/images/dis1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/dis1.png -------------------------------------------------------------------------------- /public/images/dis2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/dis2.png -------------------------------------------------------------------------------- /public/images/jgs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/jgs.png -------------------------------------------------------------------------------- /public/images/pay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/pay.png -------------------------------------------------------------------------------- /public/vue/images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/vue/images/1.jpg -------------------------------------------------------------------------------- /public/vue/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/vue/images/2.png -------------------------------------------------------------------------------- /public/vue/images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/vue/images/3.jpg -------------------------------------------------------------------------------- /vmstat/img/vmstat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/vmstat/img/vmstat.png -------------------------------------------------------------------------------- /.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | RewriteCond %{REQUEST_FILENAME} !-f 3 | RewriteRule .* index.php 4 | -------------------------------------------------------------------------------- /public/images/g_geYbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_geYbg.png -------------------------------------------------------------------------------- /public/images/g_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_name.png -------------------------------------------------------------------------------- /public/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/loading.gif -------------------------------------------------------------------------------- /public/images/vmstats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/vmstats.png -------------------------------------------------------------------------------- /public/images/weixin.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/weixin.jpeg -------------------------------------------------------------------------------- /public/images/z_upage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/z_upage.png -------------------------------------------------------------------------------- /public/vue/images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/vue/images/bg.jpg -------------------------------------------------------------------------------- /public/images/g_Sheiji.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_Sheiji.png -------------------------------------------------------------------------------- /public/images/g_addJia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_addJia.png -------------------------------------------------------------------------------- /public/images/g_dengBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_dengBg.png -------------------------------------------------------------------------------- /public/images/g_huiGong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_huiGong.png -------------------------------------------------------------------------------- /public/images/g_huiXia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_huiXia.png -------------------------------------------------------------------------------- /public/images/g_jianHao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_jianHao.png -------------------------------------------------------------------------------- /public/images/g_poresd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_poresd.png -------------------------------------------------------------------------------- /public/images/g_remoJian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_remoJian.png -------------------------------------------------------------------------------- /public/images/g_tanJiabd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_tanJiabd.png -------------------------------------------------------------------------------- /public/images/g_upDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/g_upDown.png -------------------------------------------------------------------------------- /public/images/jtmobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/jtmobile.png -------------------------------------------------------------------------------- /public/images/jtmobilet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/jtmobilet.png -------------------------------------------------------------------------------- /public/images/testlive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/testlive.png -------------------------------------------------------------------------------- /public/images/windowspc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/windowspc.png -------------------------------------------------------------------------------- /public/images/z_lastpage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/z_lastpage.png -------------------------------------------------------------------------------- /public/images/z_nextpage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/z_nextpage.png -------------------------------------------------------------------------------- /public/images/z_shouye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/z_shouye.png -------------------------------------------------------------------------------- /public/images/multiprocess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/zys/HEAD/public/images/multiprocess.png -------------------------------------------------------------------------------- /application/views/index/test.phtml: -------------------------------------------------------------------------------- 1 | getMessage(); 7 | } 8 | 9 | } 10 | 11 | ?> -------------------------------------------------------------------------------- /application/models/Leslie.php: -------------------------------------------------------------------------------- 1 | test(); 14 | } 15 | } -------------------------------------------------------------------------------- /thrift/Bin/rpc/Handler.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | $title | Action 7 | 8 | 9 | $webroot 10 |

actionAction

11 | 12 | 13 | HTML; 14 | -------------------------------------------------------------------------------- /application/views/index/index.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | $title 8 | 9 | 10 | $webroot 11 |

$body

12 | 13 | 14 | HTML; 15 | -------------------------------------------------------------------------------- /application/views/error/error.phtml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 出错啦!!!! 7 | 8 | 9 |

code: {$code}

10 |

message: {$message}

11 | 12 | 13 | HTML; 14 | -------------------------------------------------------------------------------- /hprose/test/TcpServer.php: -------------------------------------------------------------------------------- 1 | setErrorTypes(E_ALL); 9 | $server->setDebugEnabled(); 10 | $server->addFunction('zys'); 11 | $server->start(); 12 | -------------------------------------------------------------------------------- /application/library/think/CacheInterface.php: -------------------------------------------------------------------------------- 1 | 9 | * @package think 10 | */ 11 | interface CacheInterface 12 | { 13 | function get($name, $default = false); 14 | 15 | function set($name, $value, $expire = null); 16 | 17 | function rm($name); 18 | } -------------------------------------------------------------------------------- /thrift/Thrift/Factory/TTransportFactory.php: -------------------------------------------------------------------------------- 1 | bootstrap() //可选的调用 13 | ->run()/*执行*/; -------------------------------------------------------------------------------- /thrift/gen/rpc.thrift: -------------------------------------------------------------------------------- 1 | namespace php Bin.rpc 2 | 3 | typedef i64 Int 4 | 5 | enum RetCode 6 | { 7 | SUCCESS = 0, 8 | PARAM_ERROR = 1000, 9 | ACCESS_DENY = 1001, 10 | } 11 | 12 | struct Message 13 | { 14 | 1:Int send_uid, 15 | 2:Int recv_uid, 16 | 3:Int channel_id, 17 | 4:string name, 18 | 5:string result, 19 | } 20 | 21 | service rpc 22 | { 23 | RetCode sendMessage(1:Message msg) 24 | } 25 | -------------------------------------------------------------------------------- /application/modules/Admin/views/user/top.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 后台系统功能页 7 | 8 | 9 | 10 |
首页>系统管理
11 |
12 |
13 | 每天都有好心情 14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "qieangel2013/zys", 3 | "description": "zys php Framework", 4 | "type": "framework", 5 | "keywords": ["swoole","yaf","thrift"], 6 | "license": "Apache2", 7 | "authors": [ 8 | { 9 | "name": "qieangel2013", 10 | "email": "904208360@qq.com" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.5" 15 | }, 16 | "minimum-stability": "dev" 17 | } 18 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /server/hprose/Server.php: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /application/views/index/distributed.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 分布式服务器文件同步测试 6 | 7 | 8 |
9 | 10 | 11 |
12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /thrift/Thrift/Factory/TFramedTransportFactory.php: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /public/css/bootstrapValidator.css: -------------------------------------------------------------------------------- 1 | /** 2 | * BootstrapValidator (http://bootstrapvalidator.com) 3 | * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3 4 | * 5 | * @author http://twitter.com/nghuuphuoc 6 | * @copyright (c) 2013 - 2014 Nguyen Huu Phuoc 7 | * @license MIT 8 | */ 9 | 10 | .bv-form .help-block { 11 | margin-bottom: 0; 12 | } 13 | .bv-form .tooltip-inner { 14 | text-align: left; 15 | } 16 | .nav-tabs li.bv-tab-success > a { 17 | color: #3c763d; 18 | } 19 | .nav-tabs li.bv-tab-error > a { 20 | color: #a94442; 21 | } 22 | -------------------------------------------------------------------------------- /distributed/test/server.php: -------------------------------------------------------------------------------- 1 | 22 | -------------------------------------------------------------------------------- /application/library/hprose.php: -------------------------------------------------------------------------------- 1 | hprose->toArray(); 11 | $client = new Client("tcp://" . $hprose_config['ServerIp'] . ":" . $hprose_config['port'],false); 12 | return $client->zys("zys"); 13 | } 14 | public static function getInstance() { 15 | if (!(self::$instance instanceof hprose)) { 16 | self::$instance = new hprose; 17 | } 18 | return self::$instance; 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /public/css/validate.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | label.errorLabel{color:#ea5200; margin-left:4px; padding:5px 25px; background:url(../images/unchecked.gif) no-repeat 2px 2px; } 3 | label.validLabel{color:#ea5200; margin-left:4px; padding:5px 25px; background:url(../images/checked.gif) no-repeat 2px 2px;} 4 | .gao_indx_shou li label.errorLabel{float:none;background: url(../images/unchecked.gif) no-repeat 2px 2px;} 5 | .gao_indx_shou li label.validLabel{float:none;background: url(../images/checked.gif) no-repeat 2px 2px;} 6 | .gao_mai_along label.errorLabel{background:url(../images/unchecked.gif) no-repeat 2px 10px;float: left} 7 | .gao_mai_along label.validLabel{background:url(../images/checked.gif) no-repeat 2px 10px;float: left} 8 | 9 | -------------------------------------------------------------------------------- /public/css/g_commenLeft.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | .g_leftAll{width: 200px;float: left;background-color: #eee;height: 780px;} 3 | .g_indent{width: 200px;cursor: pointer;} 4 | .g_indent p{width: 172px;padding-left: 28px;font-size: 14px;color: #222;height: 50px;line-height: 50px; 5 | cursor: pointer;} 6 | .g_dowmXia{width: 200px;border-top: 1px solid #e9e9e9;border-bottom: 1px solid #e9e9e9;display: none;} 7 | .g_dowmXia li{height: 50px;line-height: 50px;padding-left: 48px;} 8 | .g_dowmXia li a{color: #666;font-size: 14px;} 9 | .g_below{background: url("../images/g_addJia.png") 160px center no-repeat;} 10 | .g_leftUp{background: url("../images/g_remoJian.png") 160px center no-repeat;} 11 | .g_dowmXia .g_qianYemian{background-color: #fff;} 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /vmstat/index.php: -------------------------------------------------------------------------------- 1 | 2 | Stats 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |

16 | 17 | 23 |
24 |
25 | -------------------------------------------------------------------------------- /vmstat/stats.css: -------------------------------------------------------------------------------- 1 | .template { 2 | display: none !important; 3 | } 4 | * { 5 | cursor: default; 6 | } 7 | body { 8 | background-color: #333; 9 | color: #eee; 10 | font-family: "helvetica neue", helvetica, arial, sans-serif; 11 | } 12 | h2 { 13 | margin: 40px 0 0 0; 14 | font-weight: 300; 15 | } 16 | main { 17 | width: 600px; 18 | margin: auto; 19 | } 20 | section { 21 | clear: left; 22 | } 23 | .stats { 24 | margin: 0; 25 | } 26 | .stat { 27 | list-style-type: none; 28 | float: left; 29 | margin: 0; 30 | width: 130px; 31 | font-size: 12px; 32 | } 33 | .stat-name { 34 | display: inline-block; 35 | text-align: right; 36 | width: 50px; 37 | margin-right: 5px; 38 | } 39 | .stat-value { 40 | font-weight: bold; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /public/js/transformToTreeFormat.js: -------------------------------------------------------------------------------- 1 | /*settings,指定当前节点名称,父节点名称,孩子节点名称 2 | nodes,json对象 3 | 返回树结构的json串 4 | */ 5 | function transformTozTreeFormat(settings,nodes) { 6 | var i,l, 7 | key = settings.keyName, 8 | parentKey = settings.parentKeyName, 9 | childKey = settings.childKeyName; 10 | if (!key || key=="" || !nodes) return []; 11 | var r = []; 12 | var tmpMap = []; 13 | for (i=0, l=nodes.length; i404"); 14 | } 15 | // if ($exception->getCode() > 100000) { 16 | // //这里可以捕获到应用内抛出的异常 17 | // echo $exception->getCode(); 18 | // echo $exception->getMessage(); 19 | // die; 20 | // } 21 | // switch ($exception->getCode()) { 22 | // case 404://404 23 | // case 515: 24 | // case 516: 25 | // case 517: 26 | // //输出404 27 | // //header(getHttpStatusCode(404)); 28 | // echo '404'; 29 | // // dump($exception->getTrace()); 30 | // exit(); 31 | // break; 32 | // default : 33 | // echo $exception->getMessage(); 34 | // break; 35 | // } 36 | throw $exception; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /application/library/swoole/socket.php: -------------------------------------------------------------------------------- 1 | table); 7 | } 8 | public function getname($userid){ 9 | $where=array('id' =>$userid); 10 | $result =$this->user->where($where)->select(); 11 | } 12 | public static function savefd($fd,$kname='fd'){ 13 | $redis_con=new phpredis(); 14 | if($redis_con->listSize($kname)){ 15 | $redis_con->listPush($kname,$fd,0,1); 16 | }else{ 17 | $redis_con->listPush($kname,$fd); 18 | } 19 | } 20 | public static function getfd($kname='fd'){ 21 | $redis_con=new phpredis(); 22 | $result=$redis_con->listGet($kname,0,-1); 23 | echo json_encode($result); 24 | } 25 | public static function removefd($fd,$kname='fd'){ 26 | $redis_con=new phpredis(); 27 | $redis_con->listRemove($kname,$fd); 28 | } 29 | 30 | 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /application/library/swoole/taskclient.php: -------------------------------------------------------------------------------- 1 | query($sql); 19 | echo json_encode($result); 20 | } 21 | public static function getInstance() { 22 | if (!(self::$instance instanceof swoole_taskclient)) { 23 | self::$instance = new swoole_taskclient; 24 | } 25 | return self::$instance; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /public/css/z_tanwindow.css: -------------------------------------------------------------------------------- 1 | /* 弹窗设置1 */ 2 | body{position: relative;} 3 | .z_graybg{width:100%;position: fixed; top:0; left: 0; z-index: 9;background:rgba(0,0,0,0.5); background-color: #000\0; filter: alpha(opacity=50);background-color: #000;opacity:0.5;*filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7F000000,endcolorstr=#7F000000);*background-color:transparent;} 4 | .z_seltory{width:474px;height:206px;border:3px solid #ededed;background-color: #fff;position: absolute;z-index: 10;text-align: center;} 5 | .z_seltory p{width:100%;text-align: center;font-size: 18px;color: #222;line-height: 206px;} 6 | .z_seltory span{font-size: 18px;color: #222;/*background: url(../images/z_tanhao.png) no-repeat 150px center;*/padding-left: 30px;display:block;margin:55px 0 50px;} 7 | .z_ascertain,.z_aconcle{width:88px;height:30px;line-height: 30px;text-align: center;font-size: 12px;color: #fff;background-color: #ff5a00;margin:0 8px;cursor: pointer;} 8 | .z_aconcle{background-color: #ccc;} -------------------------------------------------------------------------------- /application/library/wx/pay/Notify.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/js/grid.zh-CN.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery.bsgrid v1.37 by @Baishui2004 3 | * Copyright 2014 Apache v2 License 4 | * https://github.com/baishui2004/jquery.bsgrid 5 | */ 6 | (function(a){a.bsgridLanguage={isFirstPage:"已经是第一页!",isLastPage:"已经是最后一页!",needInteger:"请输入数字!",needRange:function(c,b){return"请输入一个在"+c+"到"+b+"之间的数字!"},errorForRequestData:"请求数据失败!",errorForSendOrRequestData:"发送或请求数据失败!",noPagingation:function(b){return'共: '},pagingToolbar:{pageSizeDisplay:function(d,c){var b="";if(!c){b+="每页显示:"}return b+' '},currentDisplayRows:function(c,b,e){var d="";if(!e){d+="当前显示:"}return d+'  - '},totalRows:function(b){return'共: '},currentDisplayPageAndTotalPages:function(b,c){return'
 / 
'},firstPage:"首 页",prevPage:"上一页",nextPage:"下一页",lastPage:"末 页",gotoPage:"跳 转",refreshPage:"刷 新"},loadingDataMessage:"正在加载数据,请稍候......",noDataToDisplay:"没有数据可以用于显示。"}})(jQuery); -------------------------------------------------------------------------------- /application/library/wx/pay/config.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /thrift/Thrift/Server/TNonblockingServer.php: -------------------------------------------------------------------------------- 1 | transport_->setCallback(array($this, 'handleRequest')); 12 | $this->transport_->listen(); 13 | } 14 | 15 | public function stop() { 16 | $this->transport_->close(); 17 | } 18 | 19 | public function handleRequest(TTransport $transport) { 20 | $inputTransport = $this->inputTransportFactory_->getTransport($transport); 21 | $outputTransport = $this->outputTransportFactory_->getTransport($transport); 22 | $inputProtocol = $this->inputProtocolFactory_->getProtocol($inputTransport); 23 | $outputProtocol = $this->outputProtocolFactory_->getProtocol($outputTransport); 24 | $this->processor_->process($inputProtocol, $outputProtocol); 25 | //$protocol = new TBinaryProtocol($transport, true, true); 26 | //$this->processor_->process($protocol, $protocol); 27 | } 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /public/css/z_AddMemu.css: -------------------------------------------------------------------------------- 1 | /* 添加菜单页 */ 2 | .z_addmemu table td{border:1px solid #ddd;padding:8px 0;text-align: left;vertical-align: middle;font-size: 14px;font-weight: bold;width:730px;padding-left: 30px;} 3 | .z_addmemu table td select,.z_addmemu table td input,.z_addmemu table td textarea{width:200px;height:26px;line-height: 26px;border:1px solid #ddd;font-size: 14px;color: #000;font-weight: normal;float: left;padding-left: 2px;} 4 | .z_addmemu table .z_shuxing{width:200px;text-align: center;padding-left: 0;} 5 | .z_addmemu table td input{width:196px;} 6 | .z_addmemu table td textarea{width:300px;height:50px;resize:none;} 7 | .z_addmemu table td span{float: left;color: #fd6002;margin:6px 0 0 5px;} 8 | .z_addmemu table .z_mumenre input{width:76px;height:26px;text-align: center;line-height: 24px;border:1px solid #ddd;background-color: #fff;float: none;font-weight: bold;color: #333;cursor: pointer;} 9 | .z_addmemu table .z_mumenre td{padding:32px 0 32px 0;text-align: center;} 10 | .z_rightMidden{float: left;width: 960px;padding-left: 20px;} 11 | .z_rightMidden .g_topluJIng{border:1px solid #ddd;border-bottom: none;} -------------------------------------------------------------------------------- /thrift/Thrift/StringFunc/TStringFunc.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /thrift/Thrift/Type/TMessageType.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\exception; 13 | 14 | class ClassNotFoundException extends \RuntimeException 15 | { 16 | protected $class; 17 | public function __construct($message, $class = '') 18 | { 19 | $this->message = $message; 20 | $this->class = $class; 21 | } 22 | 23 | /** 24 | * 获取类名 25 | * @access public 26 | * @return string 27 | */ 28 | public function getClass() 29 | { 30 | return $this->class; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /thrift/Thrift/Protocol/SimpleJSON/Context.php: -------------------------------------------------------------------------------- 1 | acceptImpl(); 49 | 50 | if ($transport == null) { 51 | throw new TTransportException("accept() may not return NULL"); 52 | } 53 | 54 | return $transport; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /thrift/Thrift/Protocol/JSON/BaseContext.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 系统登录页 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |

管理后台

16 |
17 | 18 | 19 | 20 | 6213 21 | 用户名或密码错误! 22 | 23 |
24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /hprose/lib/TimeoutException.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | 22 | class TimeoutException extends Exception {} 23 | -------------------------------------------------------------------------------- /thrift/Thrift/Protocol/SimpleJSON/CollectionMapKeyException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\exception; 13 | 14 | /** 15 | * PDO参数绑定异常 16 | */ 17 | class BindParamException extends DbException 18 | { 19 | 20 | /** 21 | * BindParamException constructor. 22 | * @param string $message 23 | * @param array $config 24 | * @param string $sql 25 | * @param array $bind 26 | * @param int $code 27 | */ 28 | public function __construct($message, $config, $sql, $bind, $code = 10502) 29 | { 30 | $this->setData('Bind Param', $bind); 31 | parent::__construct($message, $config, $sql, $code); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /thrift/Thrift/Factory/TProtocolFactory.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | require_once dirname(__DIR__) . '/lib/Client.php'; 22 | $client = new Client('tcp://192.168.102.163:1314', false); 23 | echo $client->zys("zys"); -------------------------------------------------------------------------------- /hprose/lib/ResultMode.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | class ResultMode { 22 | const Normal = 0; 23 | const Serialized = 1; 24 | const Raw = 2; 25 | const RawWithEndTag = 3; 26 | } 27 | -------------------------------------------------------------------------------- /hprose/lib/ReaderRefer.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | 22 | interface ReaderRefer { 23 | public function set($val); 24 | public function read($index); 25 | public function reset(); 26 | } 27 | -------------------------------------------------------------------------------- /hprose/lib/WriterRefer.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | interface WriterRefer { 22 | public function set($val); 23 | public function write(BytesIO $stream, $val); 24 | public function reset(); 25 | } -------------------------------------------------------------------------------- /thrift/Thrift/Factory/TCompactProtocolFactory.php: -------------------------------------------------------------------------------- 1 | "password". 10 | */ 11 | $users = array( 12 | 'admin' => '1234', 13 | ); 14 | 15 | $realm = 'Console'; 16 | 17 | /** 18 | * Console style. 19 | * Available styles: white, green, grey, far, ubuntu 20 | */ 21 | $theme = 'default'; 22 | 23 | /** 24 | * List of commands filters. You can use * for any symbol. And $1 as replacement. 25 | * Usually you only need '*' => '$1' command. If you need some mapping add more. 26 | * Example: 'move * *' => 'mv $1 $2' 27 | */ 28 | $commands = array( 29 | 'git*' => '/usr/bin/local/git $1', 30 | 'composer*' => '/usr/local/bin/composer $1', 31 | 'symfony*' => './app/console $1', 32 | '*' => '$1', // Allow any command. Must be at the end of the list. 33 | ); 34 | 35 | /** 36 | * array of allowed commands. Default: empty array (all are allowed) 37 | * You can use * for any symbol. 38 | * Example: "branch*" will allow both "branch" and "branch -v" commands 39 | */ 40 | $allow = array(); 41 | 42 | /** 43 | * array of denied commands. Default: empty array (none is denied) 44 | * You can use * for any symbol. 45 | */ 46 | $deny = array( 47 | "rm*", 48 | ); 49 | 50 | -------------------------------------------------------------------------------- /hprose/server.php: -------------------------------------------------------------------------------- 1 | start(); 15 | function zys($name) 16 | { 17 | return "$name is high performance service framework based on yaf and swoole\r\n"; 18 | } 19 | function hproseserver_call(swoole_process $worker) 20 | { 21 | define('APPLICATION_PATH', dirname(__DIR__) . "/application"); 22 | define('MYPATH', dirname(APPLICATION_PATH)); 23 | $application = new \Yaf\Application(dirname(APPLICATION_PATH) . "/conf/application.ini"); 24 | $application->bootstrap(); 25 | $config_obj = \Yaf\Registry::get("config"); 26 | $hprose_config = $config_obj->hprose->toArray(); 27 | $server = new Server("tcp://" . $hprose_config['ServerIp'] . ":" . $hprose_config['port']); 28 | $server->setErrorTypes(E_ALL); 29 | $server->setDebugEnabled(); 30 | $server->addFunction('zys'); 31 | $server->start(); 32 | } 33 | swoole_process::daemon(true); 34 | swoole_process::wait(); -------------------------------------------------------------------------------- /thrift/test/client.php: -------------------------------------------------------------------------------- 1 | registerNamespace('Thrift', THRIFT_DIR_PATH); 7 | $loader->registerNamespace('swoole', THRIFT_DIR_PATH); 8 | $loader->registerNamespace('Bin', THRIFT_DIR_PATH); 9 | $loader->registerDefinition('Bin', THRIFT_DIR_PATH); 10 | $loader->register(); 11 | define('APPLICATION_PATH', dirname(dirname(__DIR__)). "/application"); 12 | $application = new Yaf_Application(dirname(APPLICATION_PATH_DIR). "/conf/application.ini"); 13 | $application->bootstrap(); 14 | $config_obj=Yaf_Registry::get("config"); 15 | $rpc_config=$config_obj->rpc->toArray(); 16 | $socket = new Thrift\Transport\TSocket($rpc_config['host'],$rpc_config['port']); 17 | $transport = new Thrift\Transport\TFramedTransport($socket); 18 | $protocol = new Thrift\Protocol\TBinaryProtocol($transport); 19 | $transport->open(); 20 | 21 | $client = new Bin\rpc\rpcClient($protocol); 22 | $message = new Bin\rpc\Message(array('name' => 'userinfo','result'=>'{"id":37936,"name"=>"zqf",email:"904208360@qq.comn"}')); 23 | $ret = $client->sendMessage($message); 24 | var_dump($ret); 25 | 26 | $transport->close(); 27 | 28 | -------------------------------------------------------------------------------- /thrift/Thrift/Exception/TTransportException.php: -------------------------------------------------------------------------------- 1 | registerNamespace('Thrift', THRIFT_DIR_PATH); 7 | $loader->registerNamespace('swoole', THRIFT_DIR_PATH); 8 | $loader->registerNamespace('Bin', THRIFT_DIR_PATH); 9 | $loader->registerDefinition('Bin', THRIFT_DIR_PATH); 10 | $loader->register(); 11 | $application = new Yaf_Application(dirname(APPLICATION_PATH). "/conf/application.ini"); 12 | $application->bootstrap(); 13 | $config_obj=Yaf_Registry::get("config"); 14 | $rpc_config=$config_obj->rpc->toArray(); 15 | define('SERVERIP',$rpc_config['ServerIp']); 16 | define('SERVERPORT',$rpc_config['port']); 17 | define('SERVERHOST',$rpc_config['host']); 18 | $service = new Bin\rpc\Handler(); 19 | $processor = new Bin\rpc\rpcProcessor($service); 20 | $socket_tranport = new Thrift\Server\TServerSocket(SERVERIP,SERVERPORT); 21 | $out_factory = $in_factory = new Thrift\Factory\TFramedTransportFactory(); 22 | $out_protocol = $in_protocol = new Thrift\Factory\TBinaryProtocolFactory(); 23 | $server = new swoole\Server($processor, $socket_tranport, $in_factory, $out_factory, $in_protocol, $out_protocol); 24 | $server->serve(); 25 | 26 | -------------------------------------------------------------------------------- /application/library/think/db/exception/ModelNotFoundException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\exception; 13 | 14 | class ModelNotFoundException extends DbException 15 | { 16 | protected $model; 17 | 18 | /** 19 | * 构造方法 20 | * @param string $message 21 | * @param string $model 22 | */ 23 | public function __construct($message, $model = '', array $config = []) 24 | { 25 | $this->message = $message; 26 | $this->model = $model; 27 | 28 | $this->setData('Database Config', $config); 29 | } 30 | 31 | /** 32 | * 获取模型类名 33 | * @access public 34 | * @return string 35 | */ 36 | public function getModel() 37 | { 38 | return $this->model; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /thrift/Thrift/StringFunc/Core.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\exception; 13 | 14 | class DataNotFoundException extends DbException 15 | { 16 | protected $table; 17 | 18 | /** 19 | * DbException constructor. 20 | * @param string $message 21 | * @param string $table 22 | * @param array $config 23 | */ 24 | public function __construct($message, $table = '', array $config = []) 25 | { 26 | $this->message = $message; 27 | $this->table = $table; 28 | 29 | $this->setData('Database Config', $config); 30 | } 31 | 32 | /** 33 | * 获取数据表名 34 | * @access public 35 | * @return string 36 | */ 37 | public function getTable() 38 | { 39 | return $this->table; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /application/library/distributed.php: -------------------------------------------------------------------------------- 1 | client = new swoole_client(SWOOLE_SOCK_TCP); 8 | $config_obj=\Yaf\Registry::get("config"); 9 | $distributed_config=$config_obj->distributed->toArray(); 10 | $localinfo=swoole_get_local_ip(); 11 | if (!$this->client->connect(current($localinfo),$distributed_config['port'], -1)) 12 | { 13 | exit("connect failed. Error: {$client->errCode}\n"); 14 | } 15 | } 16 | //sql执行 17 | public function query($sql) { 18 | $this->client->send(json_encode($sql)); 19 | { 20 | $dbclient_data=json_decode($this->client->recv(),true); 21 | } 22 | return $dbclient_data; 23 | 24 | } 25 | //文件执行 26 | public function queryfile($data) { 27 | $this->client->send(json_encode($data)); 28 | { 29 | $dbclient_data=json_decode($this->client->recv(),true); 30 | } 31 | return $dbclient_data; 32 | 33 | } 34 | 35 | public function close() { 36 | $this->client->close(); 37 | } 38 | public static function getInstance() { 39 | if (!(self::$instance instanceof distributed)) { 40 | self::$instance = new distributed; 41 | } 42 | return self::$instance; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /hprose/lib/FakeWriterRefer.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | require_once __DIR__ . '/WriterRefer.php'; 22 | class FakeWriterRefer implements WriterRefer { 23 | public function set($val) {} 24 | public function write(BytesIO $stream, $val) { return false; } 25 | public function reset() {} 26 | } 27 | -------------------------------------------------------------------------------- /application/library/think/model/Pivot.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\model; 13 | 14 | use think\Model; 15 | 16 | class Pivot extends Model 17 | { 18 | 19 | /** @var Model */ 20 | public $parent; 21 | 22 | protected $autoWriteTimestamp = false; 23 | 24 | /** 25 | * 架构函数 26 | * @access public 27 | * @param Model $parent 上级模型 28 | * @param array|object $data 数据 29 | * @param string $table 中间数据表名 30 | */ 31 | public function __construct(Model $parent = null, $data = [], $table = '') 32 | { 33 | $this->parent = $parent; 34 | 35 | if (is_null($this->name)) { 36 | $this->name = $table; 37 | } 38 | 39 | parent::__construct($data); 40 | 41 | // 当前类名 42 | $this->class = $this->name; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /thrift/Thrift/Protocol/SimpleJSON/ListContext.php: -------------------------------------------------------------------------------- 1 | p_ = $p; 35 | } 36 | 37 | public function write() 38 | { 39 | if ($this->first_) { 40 | $this->first_ = false; 41 | } else { 42 | $this->p_->getTransport()->write(TSimpleJSONProtocol::COMMA); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /thrift/Thrift/Type/TType.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | class Timer { 22 | public function setTimeout($callback, $delay) { 23 | return swoole_timer_after($delay, $callback); 24 | } 25 | public function clearTimeout($timerid) { 26 | return swoole_timer_clear($timerid); 27 | } 28 | public function setImmediate($callback) { 29 | swoole_event_defer($callback); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /server/swoole/HttpServer.php: -------------------------------------------------------------------------------- 1 | set( 10 | array( 11 | 'worker_num' => 16, 12 | 'daemonize' => true, 13 | 'max_request' => 10000, 14 | 'dispatch_mode' => 1 15 | ) 16 | ); 17 | define('APPLICATION_PATH', dirname(dirname(__DIR__)). "/application"); 18 | $this->application = new \Yaf\Application(dirname(APPLICATION_PATH). "/conf/application.ini"); 19 | $this->application->bootstrap(); 20 | $http->on('Request',array($this , 'onRequest')); 21 | $http->start(); 22 | } 23 | public function onRequest($request,$response) { 24 | $response->status('200'); 25 | $ser=$request->server; 26 | $hea= $request->header; 27 | $hea['host']=str_replace(':9501','',$hea['host']);//如果端口号是80,就不用要此句代码 28 | ob_start(); 29 | try { 30 | $yaf_request = new \Yaf\Request_Http($ser['request_uri']); 31 | $yaf_request->setBaseUri($hea['host']); 32 | $this->application->getDispatcher()->dispatch($yaf_request); 33 | } catch ( \Yaf\Exception $e ) { 34 | //var_dump( $e ); 35 | } 36 | $result = ob_get_contents(); 37 | ob_end_clean(); 38 | $response->end($result); 39 | } 40 | 41 | public static function getInstance() { 42 | if (!self::$instance) { 43 | self::$instance = new HttpServer; 44 | } 45 | return self::$instance; 46 | } 47 | } 48 | HttpServer::getInstance(); 49 | -------------------------------------------------------------------------------- /application/library/think/db/exception/DbException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\exception; 13 | 14 | use think\Exception; 15 | 16 | /** 17 | * Database相关异常处理类 18 | */ 19 | class DbException extends Exception 20 | { 21 | /** 22 | * DbException constructor. 23 | * @param string $message 24 | * @param array $config 25 | * @param string $sql 26 | * @param int $code 27 | */ 28 | public function __construct($message, array $config, $sql, $code = 10500) 29 | { 30 | $this->message = $message; 31 | $this->code = $code; 32 | 33 | $this->setData('Database Status', [ 34 | 'Error Code' => $code, 35 | 'Error Message' => $message, 36 | 'Error SQL' => $sql, 37 | ]); 38 | 39 | unset($config['username'], $config['password']); 40 | $this->setData('Database Config', $config); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /hprose/lib/FakeReaderRefer.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | require_once __DIR__ . '/ReaderRefer.php'; 22 | class FakeReaderRefer implements ReaderRefer { 23 | public function set($val) {} 24 | public function read($index) { 25 | throw new Exception("Unexpected serialize tag '" . 26 | Tags::TagRef . 27 | "' in stream"); 28 | } 29 | public function reset() {} 30 | } 31 | -------------------------------------------------------------------------------- /thrift/Thrift/Factory/TBinaryProtocolFactory.php: -------------------------------------------------------------------------------- 1 | strictRead_ = $strictRead; 38 | $this->strictWrite_ = $strictWrite; 39 | } 40 | 41 | public function getProtocol($trans) 42 | { 43 | return new TBinaryProtocol($trans, $this->strictRead_, $this->strictWrite_); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /application/library/think/db/exception/PDOException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\exception; 13 | 14 | /** 15 | * PDO异常处理类 16 | * 重新封装了系统的\PDOException类 17 | */ 18 | class PDOException extends DbException 19 | { 20 | /** 21 | * PDOException constructor. 22 | * @param \PDOException $exception 23 | * @param array $config 24 | * @param string $sql 25 | * @param int $code 26 | */ 27 | public function __construct(\PDOException $exception, array $config, $sql, $code = 10501) 28 | { 29 | $error = $exception->errorInfo; 30 | 31 | $this->setData('PDO Error Info', [ 32 | 'SQLSTATE' => $error[0], 33 | 'Driver Error Code' => isset($error[1]) ? $error[1] : 0, 34 | 'Driver Error Message' => isset($error[2]) ? $error[2] : '', 35 | ]); 36 | 37 | parent::__construct($exception->getMessage(), $config, $sql, $code); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /hprose/lib/RealReaderRefer.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | class RealReaderRefer implements ReaderRefer { 22 | private $ref; 23 | public function __construct() { 24 | $this->reset(); 25 | } 26 | public function set($val) { 27 | $this->ref[] = $val; 28 | } 29 | public function read($index) { 30 | return $this->ref[$index]; 31 | } 32 | public function reset() { 33 | $this->ref = array(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /thrift/Thrift/Protocol/SimpleJSON/MapContext.php: -------------------------------------------------------------------------------- 1 | isKey = !$this->isKey; 41 | } 42 | 43 | public function isMapKey() 44 | { 45 | // we want to coerce map keys to json strings regardless 46 | // of their type 47 | return $this->isKey; 48 | } 49 | } 50 | 51 | 52 | -------------------------------------------------------------------------------- /application/library/RpcClient.php: -------------------------------------------------------------------------------- 1 | setLibraryPath($rpc_dir,true); 11 | require_once $rpc_dir. "/Thrift/ClassLoader/ThriftClassLoader.php"; 12 | $loader = new Thrift\ClassLoader\ThriftClassLoader(); 13 | $loader->registerNamespace('Thrift', $rpc_dir); 14 | $loader->registerNamespace('swoole', $rpc_dir); 15 | $loader->registerNamespace('Bin', $rpc_dir); 16 | $loader->registerDefinition('Bin', $rpc_dir); 17 | $loader->register(); 18 | $config_obj=\Yaf\Registry::get("config"); 19 | $rpc_config=$config_obj->rpc->toArray(); 20 | $socket = new Thrift\Transport\TSocket($rpc_config['host'],$rpc_config['port']); 21 | $this->transport = new Thrift\Transport\TFramedTransport($socket); 22 | $protocol = new Thrift\Protocol\TBinaryProtocol($this->transport); 23 | $this->transport->open(); 24 | $this->client = new Bin\rpc\rpcClient($protocol); 25 | //$yaf_load->setLibraryPath(dirname($rpc_dir).'/library',true); 26 | } 27 | public function send($data=array('name' => 'userinfo','result'=>'{"id":37936,"name"=>"zqf",email:"904208360@qq.comn"}')){ 28 | 29 | $this->message = new Bin\rpc\Message($data); 30 | $this->result=$this->client->sendMessage($this->message); 31 | } 32 | public function getresult(){ 33 | return $this->result; 34 | } 35 | public function close() { 36 | $this->transport->close(); 37 | } 38 | 39 | 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /thrift/Thrift/Transport/TNullTransport.php: -------------------------------------------------------------------------------- 1 | transport_->listen(); 31 | 32 | while (!$this->stop_) { 33 | try { 34 | $transport = $this->transport_->accept(); 35 | 36 | if ($transport != null) { 37 | $inputTransport = $this->inputTransportFactory_->getTransport($transport); 38 | $outputTransport = $this->outputTransportFactory_->getTransport($transport); 39 | $inputProtocol = $this->inputProtocolFactory_->getProtocol($inputTransport); 40 | $outputProtocol = $this->outputProtocolFactory_->getProtocol($outputTransport); 41 | while ($this->processor_->process($inputProtocol, $outputProtocol)) { } 42 | } 43 | } catch (TTransportException $e) { } 44 | } 45 | } 46 | 47 | /** 48 | * Stops the server running. Kills the transport 49 | * and then stops the main serving loop 50 | * 51 | * @return void 52 | */ 53 | public function stop() 54 | { 55 | $this->transport_->close(); 56 | $this->stop_ = true; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /application/library/think/Exception.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think; 13 | 14 | class Exception extends \Exception 15 | { 16 | 17 | /** 18 | * 保存异常页面显示的额外Debug数据 19 | * @var array 20 | */ 21 | protected $data = []; 22 | 23 | /** 24 | * 设置异常额外的Debug数据 25 | * 数据将会显示为下面的格式 26 | * 27 | * Exception Data 28 | * -------------------------------------------------- 29 | * Label 1 30 | * key1 value1 31 | * key2 value2 32 | * Label 2 33 | * key1 value1 34 | * key2 value2 35 | * 36 | * @param string $label 数据分类,用于异常页面显示 37 | * @param array $data 需要显示的数据,必须为关联数组 38 | */ 39 | final protected function setData($label, array $data) 40 | { 41 | $this->data[$label] = $data; 42 | } 43 | 44 | /** 45 | * 获取异常额外Debug数据 46 | * 主要用于输出到异常页面便于调试 47 | * @return array 由setData设置的Debug数据 48 | */ 49 | final public function getData() 50 | { 51 | return $this->data; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /thrift/Thrift/Exception/TProtocolException.php: -------------------------------------------------------------------------------- 1 | ' 10 | +'
首页> 行政区域管理
' 11 | +'
' 12 | +'' 13 | +'
' 14 | +'
' 15 | +'
'; 16 | $('#administrtionOutTree').html(html); 17 | $("#addAdminArea").click(function(){addAdminArea();}); 18 | $("#editAdminArea").click(function(){editAdminArea();}); 19 | $.fn.tree.init({ 20 | nodes:(JSON.stringify(aa)) 21 | }); 22 | } 23 | }); 24 | }); 25 | 26 | 27 | 28 | function transformTozTreeFormat(sNodes) { 29 | sNodes=$.parseJSON(sNodes); 30 | var i,l, 31 | key = "areaId", 32 | parentKey = "parentId", 33 | childKey = "nodes"; 34 | if (!key || key=="" || !sNodes) return []; 35 | var r = []; 36 | var tmpMap = []; 37 | for (i=0, l=sNodes.length; i首页> 系统区域管理' 11 | +'
' 12 | +'' 13 | +'
' 14 | +'
' 15 | +'
'; 16 | $('#systemOutTree').html(html); 17 | $("#addSysArea").click(function(){addSysArea();}); 18 | $("#editSysArea").click(function(){editSysArea();}); 19 | $.fn.tree.init({ 20 | nodes:(JSON.stringify(aa)) 21 | }); 22 | 23 | } 24 | }); 25 | 26 | }); 27 | function transformTozTreeFormat(sNodes) { 28 | sNodes=$.parseJSON(sNodes); 29 | var i,l, 30 | key = "areaId", 31 | parentKey = "parentId", 32 | childKey = "nodes"; 33 | if (!key || key=="" || !sNodes) return []; 34 | var r = []; 35 | var tmpMap = []; 36 | for (i=0, l=sNodes.length; ip_ = $p; 35 | } 36 | 37 | public function write() 38 | { 39 | if ($this->first_) { 40 | $this->first_ = false; 41 | } else { 42 | $this->p_->getTransport()->write(TJSONProtocol::COMMA); 43 | } 44 | } 45 | 46 | public function read() 47 | { 48 | if ($this->first_) { 49 | $this->first_ = false; 50 | } else { 51 | $this->p_->readJSONSyntaxChar(TJSONProtocol::COMMA); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /public/js/adminAreaList.js: -------------------------------------------------------------------------------- 1 | $(function(){ 2 | $.ajax({ 3 | url:server_url+'areaManager/initAdminAreaTree.do?ran='+Math.random(), 4 | type:'get', 5 | success:function(data){ 6 | var aa=transformTozTreeFormat(JSON.stringify(data.data)); 7 | console.log(aa); 8 | console.log(JSON.stringify(aa)); 9 | var html='
' 10 | +'
首页> 行政区域管理
' 11 | +'
' 12 | +'' 13 | +'
' 14 | +'
' 15 | +'
'; 16 | $('#administrtionOutTree').html(html); 17 | $("#addAdminArea").click(function(){addAdminArea();}); 18 | $("#editAdminArea").click(function(){editAdminArea();}); 19 | $.fn.tree.init({ 20 | nodes:(JSON.stringify(aa)) 21 | }); 22 | } 23 | }); 24 | }); 25 | 26 | 27 | 28 | function transformTozTreeFormat(sNodes) { 29 | sNodes=$.parseJSON(sNodes); 30 | var i,l, 31 | key = "areaId", 32 | parentKey = "parentId", 33 | childKey = "nodes"; 34 | if (!key || key=="" || !sNodes) return []; 35 | var r = []; 36 | var tmpMap = []; 37 | for (i=0, l=sNodes.length; i首页> 系统区域管理
' 11 | +'
' 12 | +'' 13 | +'
' 14 | +'
' 15 | +'
'; 16 | $('#systemOutTree').html(html); 17 | $("#addSysArea").click(function(){addSysArea();}); 18 | $("#editSysArea").click(function(){editSysArea();}); 19 | $.fn.tree.init({ 20 | nodes:(JSON.stringify(aa)) 21 | }); 22 | 23 | } 24 | }); 25 | 26 | }); 27 | function transformTozTreeFormat(sNodes) { 28 | sNodes=$.parseJSON(sNodes); 29 | var i,l, 30 | key = "areaId", 31 | parentKey = "parentId", 32 | childKey = "nodes"; 33 | if (!key || key=="" || !sNodes) return []; 34 | var r = []; 35 | var tmpMap = []; 36 | for (i=0, l=sNodes.length; istrlen($str) - $start; 37 | } 38 | 39 | return mb_substr($str, $start, $length, '8bit'); 40 | } 41 | 42 | public function strlen($str) 43 | { 44 | return mb_strlen($str, '8bit'); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /thrift/Thrift/Protocol/SimpleJSON/StructContext.php: -------------------------------------------------------------------------------- 1 | p_ = $p; 36 | } 37 | 38 | public function write() 39 | { 40 | if ($this->first_) { 41 | $this->first_ = false; 42 | $this->colon_ = true; 43 | } else { 44 | $this->p_->getTransport()->write( 45 | $this->colon_ ? 46 | TSimpleJSONProtocol::COLON : 47 | TSimpleJSONProtocol::COMMA 48 | ); 49 | $this->colon_ = !$this->colon_; 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /thrift/Thrift/Protocol/JSON/LookaheadReader.php: -------------------------------------------------------------------------------- 1 | p_ = $p; 34 | } 35 | 36 | public function read() 37 | { 38 | if ($this->hasData_) { 39 | $this->hasData_ = false; 40 | } else { 41 | $this->data_ = $this->p_->getTransport()->readAll(1); 42 | } 43 | 44 | return substr($this->data_, 0, 1); 45 | } 46 | 47 | public function peek() 48 | { 49 | if (!$this->hasData_) { 50 | $this->data_ = $this->p_->getTransport()->readAll(1); 51 | } 52 | 53 | $this->hasData_ = true; 54 | 55 | return substr($this->data_, 0, 1); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /application/library/wx/pay/NativeCall.php: -------------------------------------------------------------------------------- 1 | returnParameters["return_code"] == "SUCCESS") { 42 | $this->returnParameters["appid"] = wx_pay_config::APPID; //公众账号ID 43 | $this->returnParameters["mch_id"] = wx_pay_config::MCHID; //商户号 44 | $this->returnParameters["nonce_str"] = $this->createNoncestr(); //随机字符串 45 | $this->returnParameters["sign"] = $this->getSign($this->returnParameters); //签名 46 | } 47 | return $this->arrayToXml($this->returnParameters); 48 | } 49 | 50 | /** 51 | * 获取product_id 52 | */ 53 | function getProductId() { 54 | $product_id = $this->data["product_id"]; 55 | return $product_id; 56 | } 57 | 58 | } 59 | 60 | ?> -------------------------------------------------------------------------------- /application/library/distributed/dredis.php: -------------------------------------------------------------------------------- 1 | distributed->toArray(); 18 | $dredis_config['server']=$config['redisserver']; 19 | $dredis_config['port']=$config['redisport']; 20 | self::$redis_con=new phpredis($dredis_config); 21 | } 22 | public function getname($userid){ 23 | $where=array('id' =>$userid); 24 | $result =$this->user->where($where)->select(); 25 | } 26 | public static function savefd($fd,$score,$kname='fd'){ 27 | self::$redis_con->setAdd($kname,$fd,1,$score); 28 | } 29 | public static function getfd($kname='fd'){ 30 | $result=self::$redis_con->setRange($kname,0,-1); 31 | echo json_encode($result); 32 | } 33 | public static function removefd($fd,$kname='fd'){ 34 | self::$redis_con->setMove($kname,$fd,1); 35 | } 36 | public static function setkey($data,$kname='fd'){ 37 | self::$redis_con->set($kname,$data); 38 | } 39 | public static function getkey($kname='fd'){ 40 | return self::$redis_con->get($kname); 41 | } 42 | public static function delkey($kname='fd'){ 43 | return self::$redis_con->delete($kname); 44 | } 45 | public static function getInstance() { 46 | if (!(self::$instance instanceof distributed_dredis)) { 47 | self::$instance = new distributed_dredis; 48 | } 49 | return self::$instance; 50 | } 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /application/library/think/config.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace think; 12 | 13 | Db::setConfig([ 14 | // 数据库类型 15 | 'type' => '', 16 | // 服务器地址 17 | 'hostname' => '', 18 | // 数据库名 19 | 'database' => '', 20 | // 用户名 21 | 'username' => '', 22 | // 密码 23 | 'password' => '', 24 | // 端口 25 | 'hostport' => '', 26 | // 连接dsn 27 | 'dsn' => '', 28 | // 数据库连接参数 29 | 'params' => [], 30 | // 数据库编码默认采用utf8 31 | 'charset' => 'utf8', 32 | // 数据库表前缀 33 | 'prefix' => '', 34 | // 数据库调试模式 35 | 'debug' => false, 36 | // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 37 | 'deploy' => 0, 38 | // 数据库读写是否分离 主从式有效 39 | 'rw_separate' => false, 40 | // 读写分离后 主服务器数量 41 | 'master_num' => 1, 42 | // 指定从服务器序号 43 | 'slave_no' => '', 44 | // 是否严格检查字段是否存在 45 | 'fields_strict' => true, 46 | // 数据集返回类型 47 | 'resultset_type' => '', 48 | // 自动写入时间戳字段 49 | 'auto_timestamp' => false, 50 | // 时间字段取出后的默认时间格式 51 | 'datetime_format' => 'Y-m-d H:i:s', 52 | // 是否需要进行SQL性能分析 53 | 'sql_explain' => false, 54 | // Builder类 55 | 'builder' => '', 56 | // Query类 57 | 'query' => '\\think\\db\\Query', 58 | // 是否需要断线重连 59 | 'break_reconnect' => false, 60 | ]); 61 | -------------------------------------------------------------------------------- /server/rpc/RpcServer.php: -------------------------------------------------------------------------------- 1 | start(); 14 | function rpcserver_call(swoole_process $worker) 15 | { 16 | define('APPLICATION_PATH', dirname(dirname(__DIR__)). "/application"); 17 | define('THRIFT_DIR_PATH',dirname(APPLICATION_PATH)."/thrift"); 18 | require_once THRIFT_DIR_PATH. "/Thrift/ClassLoader/ThriftClassLoader.php"; 19 | $loader = new Thrift\ClassLoader\ThriftClassLoader(); 20 | $loader->registerNamespace('Thrift', THRIFT_DIR_PATH); 21 | $loader->registerNamespace('swoole', THRIFT_DIR_PATH); 22 | $loader->registerNamespace('Bin', THRIFT_DIR_PATH); 23 | $loader->registerDefinition('Bin', THRIFT_DIR_PATH); 24 | $loader->register(); 25 | define('MYPATH', dirname(APPLICATION_PATH)); 26 | $application = new \Yaf\Application(dirname(APPLICATION_PATH). "/conf/application.ini"); 27 | $application->bootstrap(); 28 | $config_obj=\Yaf\Registry::get("config"); 29 | $rpc_config=$config_obj->rpc->toArray(); 30 | define('SERVERIP',$rpc_config['ServerIp']); 31 | define('SERVERPORT',$rpc_config['port']); 32 | define('SERVERHOST',$rpc_config['host']); 33 | $service = new Bin\rpc\Handler(); 34 | $processor = new Bin\rpc\rpcProcessor($service); 35 | $socket_tranport = new Thrift\Server\TServerSocket(SERVERIP,SERVERPORT); 36 | $out_factory = $in_factory = new Thrift\Factory\TFramedTransportFactory(); 37 | $out_protocol = $in_protocol = new Thrift\Factory\TBinaryProtocolFactory(); 38 | $server = new swoole\RpcServer($processor, $socket_tranport, $in_factory, $out_factory, $in_protocol, $out_protocol); 39 | $server->serve(); 40 | } 41 | swoole_process::daemon(true); 42 | swoole_process::wait(); 43 | 44 | 45 | -------------------------------------------------------------------------------- /public/css/grid_bootstrap.min.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8";.bsgrid{font-size:12px;border:1px solid #ccc}.bsgrid th,.bsgrid td{padding:2px;border:1px dotted #ccc;background-color:white;color:black}.bsgrid th{background-image:none;background-color:#f2f2f2;background:-webkit-linear-gradient(top,#fff 0,#f2f2f2 100%);background:-moz-linear-gradient(top,#fff 0,#f2f2f2 100%);background:-o-linear-gradient(top,#fff 0,#f2f2f2 100%);background:linear-gradient(to bottom,#fff 0,#f2f2f2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#F2F2F2,GradientType=0)}.bsgrid tr.even_index_row td{background-color:#f5f5f5}.bsgrid tr.row_hover td{background-color:#0092dc!important}.bsgrid tr.selected.selected_color td{background-color:#0092dc!important}.bsgridPagingOutTab{border-color:#ccc;background-color:white}.bsgridPaging{font-size:12px;color:black}.bsgridPaging .pagingBtn{border-color:#ccc;background-image:none;background-color:#f2f2f2;background:-webkit-linear-gradient(top,#fff 0,#f2f2f2 100%);background:-moz-linear-gradient(top,#fff 0,#f2f2f2 100%);background:-o-linear-gradient(top,#fff 0,#f2f2f2 100%);background:linear-gradient(to bottom,#fff 0,#f2f2f2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#F2F2F2,GradientType=0)}.bsgridPaging.pagingLittleToolbar .pagingBtn{background:url(../../images/skins/bootstrap/glyphicons-halflings.png) transparent no-repeat!important}.bsgridPaging.pagingLittleToolbar .pagingBtn.firstPage{background-position:-191px -70px!important}.bsgridPaging.pagingLittleToolbar .pagingBtn.prevPage{background-position:-431px -70px!important}.bsgridPaging.pagingLittleToolbar .pagingBtn.nextPage{background-position:-455px -70px!important}.bsgridPaging.pagingLittleToolbar .pagingBtn.lastPage{background-position:-384px -70px!important}.bsgridPaging .gotoPageInput{border-color:#ccc}.bsgridPaging.pagingLittleToolbar .pagingBtn.gotoPage{background-position:-263px -93px!important}.bsgridPaging.pagingLittleToolbar .pagingBtn.refreshPage{background-position:-239px -21px!important} -------------------------------------------------------------------------------- /thrift/swoole/RpcServer.php: -------------------------------------------------------------------------------- 1 | serviceName . "\\" . $this->serviceName . 'Processor'; 24 | $handler_class = "\\Bin\\" . $this->serviceName . "\\Handler"; 25 | 26 | $handler = new $handler_class(); 27 | $this->processor = new $processor_class($handler); 28 | 29 | $socket = new Socket(); 30 | $socket->setHandle($fd); 31 | $socket->buffer = $data; 32 | $socket->server = $serv; 33 | $protocol = new Thrift\Protocol\TBinaryProtocol($socket, false, false); 34 | 35 | try { 36 | $protocol->fname = $this->serviceName; 37 | $this->processor->process($protocol, $protocol); 38 | } catch (\Exception $e) { 39 | $this->notice('CODE:' . $e->getCode() . ' MESSAGE:' . $e->getMessage() . "\n" . $e->getTraceAsString()); 40 | } 41 | } 42 | 43 | function serve() 44 | { 45 | $serv = new \swoole_server(SERVERHOST,SERVERPORT); 46 | $serv->on('workerStart', [$this, 'onStart']); 47 | $serv->on('receive', [$this, 'onReceive']); 48 | $serv->set(array( 49 | 'worker_num' => 1, 50 | 'dispatch_mode' => 1, //1: 轮循, 3: 争抢 51 | 'open_length_check' => true, //打开包长检测 52 | 'package_max_length' => 8192000, //最大的请求包长度,8M 53 | 'package_length_type' => 'N', //长度的类型,参见PHP的pack函数 54 | 'package_length_offset' => 0, //第N个字节是包长度的值 55 | 'package_body_offset' => 4, //从第几个字节计算长度 56 | )); 57 | $serv->start(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /thrift/Thrift/Protocol/JSON/PairContext.php: -------------------------------------------------------------------------------- 1 | p_ = $p; 36 | } 37 | 38 | public function write() 39 | { 40 | if ($this->first_) { 41 | $this->first_ = false; 42 | $this->colon_ = true; 43 | } else { 44 | $this->p_->getTransport()->write($this->colon_ ? TJSONProtocol::COLON : TJSONProtocol::COMMA); 45 | $this->colon_ = !$this->colon_; 46 | } 47 | } 48 | 49 | public function read() 50 | { 51 | if ($this->first_) { 52 | $this->first_ = false; 53 | $this->colon_ = true; 54 | } else { 55 | $this->p_->readJSONSyntaxChar($this->colon_ ? TJSONProtocol::COLON : TJSONProtocol::COMMA); 56 | $this->colon_ = !$this->colon_; 57 | } 58 | } 59 | 60 | public function escapeNum() 61 | { 62 | return $this->colon_; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /application/library/wx/pay/OrderQuery.php: -------------------------------------------------------------------------------- 1 | url = "https://api.mch.weixin.qq.com/pay/orderquery"; 40 | //设置curl超时时间 41 | $this->curl_timeout = wx_pay_config::CURL_TIMEOUT; 42 | } 43 | 44 | /** 45 | * 生成接口参数xml 46 | */ 47 | function createXml() { 48 | try { 49 | //检测必填参数 50 | if ($this->parameters["out_trade_no"] == null && 51 | $this->parameters["transaction_id"] == null) { 52 | throw new SDKRuntimeException("订单查询接口中,out_trade_no、transaction_id至少填一个!" . "
"); 53 | } 54 | $this->parameters["appid"] = wx_pay_config::APPID; //公众账号ID 55 | $this->parameters["mch_id"] = wx_pay_config::MCHID; //商户号 56 | $this->parameters["nonce_str"] = $this->createNoncestr(); //随机字符串 57 | $this->parameters["sign"] = $this->getSign($this->parameters); //签名 58 | return $this->arrayToXml($this->parameters); 59 | } catch (SDKRuntimeException $e) { 60 | die($e->errorMessage()); 61 | } 62 | } 63 | 64 | } 65 | 66 | ?> -------------------------------------------------------------------------------- /application/library/think/model/concern/TimeStamp.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\model\concern; 13 | 14 | /** 15 | * 自动时间戳 16 | */ 17 | trait TimeStamp 18 | { 19 | // 是否需要自动写入时间戳 如果设置为字符串 则表示时间字段的类型 20 | protected $autoWriteTimestamp; 21 | // 创建时间字段 22 | protected $createTime = 'create_time'; 23 | // 更新时间字段 24 | protected $updateTime = 'update_time'; 25 | // 时间字段取出后的默认时间格式 26 | protected $dateFormat; 27 | 28 | /** 29 | * 时间日期字段格式化处理 30 | * @access public 31 | * @param mixed $time 时间日期表达式 32 | * @param mixed $format 日期格式 33 | * @param bool $timestamp 是否进行时间戳转换 34 | * @return mixed 35 | */ 36 | protected function formatDateTime($time, $format, $timestamp = false) 37 | { 38 | if (false !== strpos($format, '\\')) { 39 | $time = new $format($time); 40 | } elseif (!$timestamp && false !== $format) { 41 | $time = date($format, $time); 42 | } 43 | 44 | return $time; 45 | } 46 | 47 | protected function checkTimeStampWrite() 48 | { 49 | // 自动写入创建时间和更新时间 50 | if ($this->autoWriteTimestamp) { 51 | if ($this->createTime && !isset($this->data[$this->createTime])) { 52 | $this->data[$this->createTime] = $this->autoWriteTimestamp($this->createTime); 53 | } 54 | if ($this->updateTime && !isset($this->data[$this->updateTime])) { 55 | $this->data[$this->updateTime] = $this->autoWriteTimestamp($this->updateTime); 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /thrift/swoole/Socket.php: -------------------------------------------------------------------------------- 1 | fd = $fd; 19 | } 20 | 21 | function readFrame() 22 | { 23 | $buf = $this->_read(4); 24 | $val = unpack('N', $buf); 25 | $sz = $val[1]; 26 | 27 | $this->rBuf_ = $this->_read($sz); 28 | } 29 | 30 | public function _read($len) 31 | { 32 | if (strlen($this->buffer) - $this->offset < $len) 33 | { 34 | throw new TTransportException('TSocket['.strlen($this->buffer).'] read '.$len.' bytes failed.'); 35 | } 36 | $data = substr($this->buffer, $this->offset, $len); 37 | $this->offset += $len; 38 | return $data; 39 | } 40 | 41 | public function read($len) { 42 | if (!$this->read_) { 43 | return $this->_read($len); 44 | } 45 | 46 | if (Thrift\Factory\TStringFuncFactory::create()->strlen($this->rBuf_) === 0) { 47 | $this->readFrame(); 48 | } 49 | // Just return full buff 50 | if ($len >= Thrift\Factory\TStringFuncFactory::create()->strlen($this->rBuf_)) { 51 | $out = $this->rBuf_; 52 | $this->rBuf_ = null; 53 | return $out; 54 | } 55 | 56 | // Return TStringFuncFactory::create()->substr 57 | $out = Thrift\Factory\TStringFuncFactory::create()->substr($this->rBuf_, 0, $len); 58 | $this->rBuf_ = Thrift\Factory\TStringFuncFactory::create()->substr($this->rBuf_, $len); 59 | return $out; 60 | } 61 | 62 | public function write($buf) 63 | { 64 | $this->wBuf_ .= $buf; 65 | } 66 | 67 | function flush() 68 | { 69 | $out = pack('N', strlen($this->wBuf_)); 70 | $out .= $this->wBuf_; 71 | $this->server->send($this->fd, $out); 72 | $this->wBuf_ = ''; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /application/library/wx/pay/ShortUrl.php: -------------------------------------------------------------------------------- 1 | url = "https://api.mch.weixin.qq.com/tools/shorturl"; 41 | //设置curl超时时间 42 | $this->curl_timeout = wx_pay_config::CURL_TIMEOUT; 43 | } 44 | 45 | /** 46 | * 生成接口参数xml 47 | */ 48 | function createXml() { 49 | try { 50 | if ($this->parameters["long_url"] == null) { 51 | throw new SDKRuntimeException("短链接转换接口中,缺少必填参数long_url!" . "
"); 52 | } 53 | $this->parameters["appid"] = wx_pay_config::APPID; //公众账号ID 54 | $this->parameters["mch_id"] = wx_pay_config::MCHID; //商户号 55 | $this->parameters["nonce_str"] = $this->createNoncestr(); //随机字符串 56 | $this->parameters["sign"] = $this->getSign($this->parameters); //签名 57 | return $this->arrayToXml($this->parameters); 58 | } catch (SDKRuntimeException $e) { 59 | die($e->errorMessage()); 60 | } 61 | } 62 | 63 | /** 64 | * 获取prepay_id 65 | */ 66 | function getShortUrl() { 67 | $this->postXml(); 68 | $prepay_id = $this->result["short_url"]; 69 | return $prepay_id; 70 | } 71 | 72 | } 73 | 74 | ?> -------------------------------------------------------------------------------- /application/library/wx/pay/DownloadBill.php: -------------------------------------------------------------------------------- 1 | url = "https://api.mch.weixin.qq.com/pay/downloadbill"; 40 | //设置curl超时时间 41 | $this->curl_timeout = wx_pay_config::CURL_TIMEOUT; 42 | } 43 | 44 | /** 45 | * 生成接口参数xml 46 | */ 47 | function createXml() { 48 | try { 49 | if ($this->parameters["bill_date"] == null) { 50 | throw new SDKRuntimeException("对账单接口中,缺少必填参数bill_date!" . "
"); 51 | } 52 | $this->parameters["appid"] = wx_pay_config::APPID; //公众账号ID 53 | $this->parameters["mch_id"] = wx_pay_config::MCHID; //商户号 54 | $this->parameters["nonce_str"] = $this->createNoncestr(); //随机字符串 55 | $this->parameters["sign"] = $this->getSign($this->parameters); //签名 56 | return $this->arrayToXml($this->parameters); 57 | } catch (SDKRuntimeException $e) { 58 | die($e->errorMessage()); 59 | } 60 | } 61 | 62 | /** 63 | * 作用:获取结果,默认不使用证书 64 | */ 65 | function getResult() { 66 | $this->postXml(); 67 | $this->result = $this->xmlToArray($this->result_xml); 68 | return $this->result; 69 | } 70 | 71 | } 72 | 73 | ?> -------------------------------------------------------------------------------- /public/js/area.js: -------------------------------------------------------------------------------- 1 | /*select框id分别为provinceId,cityId,countyId即可*/ 2 | $(document).ready(function(){ 3 | queryProvince(); 4 | $("#provinceId").change(queryCity); 5 | $("#cityId").change(queryCounty); 6 | }); 7 | function queryProvince(){ 8 | $("#provinceId").empty(); 9 | var html=""; 10 | $(html).appendTo("#provinceId"); 11 | $.ajax({ 12 | type:"get", 13 | url:server_url+"areaManager/getProvince.do", 14 | async:false, 15 | success:function(data){ 16 | for(var i=0;i"+data.data[i].areaName+""; 18 | $(html).appendTo("#provinceId"); 19 | } 20 | } 21 | }); 22 | queryCity(); 23 | } 24 | 25 | function queryCity(){ 26 | $.ajax({ 27 | type:"get", 28 | url:server_url+"areaManager/getByParent.do", 29 | data:{ 30 | parentId:$("#provinceId").val() 31 | }, 32 | async:false, 33 | success:function(data){ 34 | $("#cityId").empty(); 35 | if(data.data!=null){ 36 | var html=""; 37 | $(html).appendTo("#cityId"); 38 | for(var i=0;i"+data.data[i].areaName+""; 40 | $(html).appendTo("#cityId"); 41 | }; 42 | }else{ 43 | var html=""; 44 | $(html).appendTo("#cityId"); 45 | } 46 | } 47 | }); 48 | queryCounty(); 49 | } 50 | 51 | function queryCounty(){ 52 | $.ajax({ 53 | type:"get", 54 | url:server_url+"areaManager/getByParent.do", 55 | data:{ 56 | parentId:$("#cityId").val() 57 | }, 58 | async:false, 59 | success:function(data){ 60 | $("#countyId").empty(); 61 | if(data.data!=null){ 62 | var html=""; 63 | $(html).appendTo("#countyId"); 64 | for(var i=0;i"+data.data[i].areaName+""; 66 | $(html).appendTo("#countyId"); 67 | } 68 | }else{ 69 | var html=""; 70 | $(html).appendTo("#countyId"); 71 | } 72 | } 73 | }); 74 | } -------------------------------------------------------------------------------- /application/library/wx/pay/server.php: -------------------------------------------------------------------------------- 1 | data = $this->xmlToArray($xml); 46 | } 47 | 48 | function checkSign() { 49 | $tmpData = $this->data; 50 | unset($tmpData['sign']); 51 | $sign = $this->getSign($tmpData); //本地签名 52 | if ($this->data['sign'] == $sign) { 53 | return TRUE; 54 | } 55 | return FALSE; 56 | } 57 | 58 | /** 59 | * 获取微信的请求数据 60 | */ 61 | function getData() { 62 | return $this->data; 63 | } 64 | 65 | /** 66 | * 设置返回微信的xml数据 67 | */ 68 | function setReturnParameter($parameter, $parameterValue) { 69 | $this->returnParameters[$this->trimString($parameter)] = $this->trimString($parameterValue); 70 | } 71 | 72 | /** 73 | * 生成接口参数xml 74 | */ 75 | function createXml() { 76 | return $this->arrayToXml($this->returnParameters); 77 | } 78 | 79 | /** 80 | * 将xml数据返回微信 81 | */ 82 | function returnXml() { 83 | $returnXml = $this->createXml(); 84 | return $returnXml; 85 | } 86 | 87 | } 88 | 89 | ?> -------------------------------------------------------------------------------- /thrift/Thrift/Factory/TStringFuncFactory.php: -------------------------------------------------------------------------------- 1 | application = new \Yaf\Application(dirname(APPLICATION_PATH). "/conf/application.ini"); 23 | $this->application->bootstrap(); 24 | 25 | $server = new swoole_websocket_server("0.0.0.0", 9503); 26 | 27 | $server->set( 28 | array( 29 | 'daemonize' => true 30 | ) 31 | ); 32 | 33 | $server->on('Open',array($this , 'onOpen')); 34 | 35 | $server->on('Message',array($this , 'onMessage')); 36 | 37 | $server->on('Close',array($this , 'onClose')); 38 | 39 | $server->start(); 40 | } 41 | 42 | public function onOpen($server, $req) { 43 | //echo $req->fd; 44 | $this->application->execute(array('swoole_socket','savefd'),$req->fd); 45 | } 46 | public function onMessage($server, $frame) { 47 | ob_start(); 48 | $this->application->execute(array('swoole_socket','getfd')); 49 | $result = ob_get_contents(); 50 | ob_end_clean(); 51 | /*for($i=1 ; $i<= $result ; $i++) { 52 | $server->push($i,'游客'.$frame->fd.'说:' .$frame->data); 53 | }*/ 54 | if('smes_closed'==$frame->data){ 55 | $server->Close($frame->fd); 56 | }else{ 57 | $result_fd=json_decode($result,true); 58 | foreach($result_fd as $id=>$fd){ 59 | $server->push($fd,'游客'.$frame->fd.'说:' .$frame->data); 60 | } 61 | } 62 | } 63 | public function onClose($server, $fd) { 64 | $this->application->execute(array('swoole_socket','removefd'),$fd); 65 | } 66 | public static function getInstance() { 67 | if (!self::$instance) { 68 | self::$instance = new WebSocketServer; 69 | } 70 | return self::$instance; 71 | } 72 | } 73 | 74 | WebSocketServer::getInstance(); 75 | -------------------------------------------------------------------------------- /hprose/lib/Tags.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | class Tags { 22 | /* Serialize Tags */ 23 | const TagInteger = 'i'; 24 | const TagLong = 'l'; 25 | const TagDouble = 'd'; 26 | const TagNull = 'n'; 27 | const TagEmpty = 'e'; 28 | const TagTrue = 't'; 29 | const TagFalse = 'f'; 30 | const TagNaN = 'N'; 31 | const TagInfinity = 'I'; 32 | const TagDate = 'D'; 33 | const TagTime = 'T'; 34 | const TagUTC = 'Z'; 35 | const TagBytes = 'b'; 36 | const TagUTF8Char = 'u'; 37 | const TagString = 's'; 38 | const TagGuid = 'g'; 39 | const TagList = 'a'; 40 | const TagMap = 'm'; 41 | const TagClass = 'c'; 42 | const TagObject = 'o'; 43 | const TagRef = 'r'; 44 | /* Serialize Marks */ 45 | const TagPos = '+'; 46 | const TagNeg = '-'; 47 | const TagSemicolon = ';'; 48 | const TagOpenbrace = '{'; 49 | const TagClosebrace = '}'; 50 | const TagQuote = '"'; 51 | const TagPoint = '.'; 52 | /* Protocol Tags */ 53 | const TagFunctions = 'F'; 54 | const TagCall = 'C'; 55 | const TagResult = 'R'; 56 | const TagArgument = 'A'; 57 | const TagError = 'E'; 58 | const TagEnd = 'z'; 59 | } 60 | -------------------------------------------------------------------------------- /public/css/l_addSystem.css: -------------------------------------------------------------------------------- 1 | /* 系统管理-添加系统 */ 2 | .g_rightMidden{float: left;width: 960px;padding-left: 20px;} 3 | .g_rightMidden .z_title{font-size: 12px;color: #666;padding:18px 0 12px;border-bottom: 1px solid #f5f5f5;} 4 | .l_system{padding-top: 10px;} 5 | .l_system ul{width: 800px;float: right;} 6 | .l_system li{margin-top: 20px;position: relative;} 7 | .l_system li span,.l_system li p,.l_system li select,.l_system li input{float: left;font-size: 12px;color: #222;} 8 | .l_system li span{width:48px;padding-right: 20px;text-align: right;line-height: 30px;} 9 | .l_system li p{line-height: 30px;} 10 | .l_system li select{float: left;font-size: 12px;color: #222;width:110px;height:28px;border:1px solid #ededed;padding-left: 8px;line-height: 28px;margin-right: 20px;} 11 | .l_system li input{border:1px solid #ededed;width:290px;height:28px;line-height: 28px;padding-left: 8px;} 12 | .l_system li textarea{width:523px;height:62px;border:1px solid #ededed;resize:none;padding-left: 5px;padding-top: 8px;font-size: 12px;color: #ccc;} 13 | .l_system li em{font-style: normal;color: #ff5a00;margin:5px 0 0 10px;line-height:25px;float: left;} 14 | .l_system li span.system-alert{width:auto !important;text-align: left;line-height: 30px;margin-left:5px;font-size:12px;color: #ff5a00;float: left;} 15 | .z_sure,.z_goback{display: inline-block;*display: inline;zoom:1;width:88px;height:30px;line-height: 30px;font-size: 12px;color: #fff;text-align: center;background-color: #ff5a00;margin-left: 380px;margin-top: 30px;} 16 | .z_goback{background-color: #ccc;margin-left: 20px;} 17 | .z_system li select{height:30px;line-height: 30px;width:300px;margin-right: 0px;} 18 | .z_system li span{color: #666;} 19 | .z_system li p{padding-left: 8px;} 20 | /*行政区域管理-添加区域*/ 21 | .l_system li .l_adress{float:left;width: 290px;height: 28px;font-size: 12px;color: #222;line-height: 28px;padding-left: 8px;} 22 | .l_system li .l_adress span{float:left;width:auto !important;text-align: left;padding-right:0px;line-height: 30px;} 23 | .l_system li .l_adress em{width: 15px;font-size: 12px;color: #222;margin: 0px;text-align: center;line-height: 28px;} 24 | /*组织管理-添加组织*/ 25 | .l_system li select.l_sjzjsel{float: left;font-size: 12px;color: #222;width:300px;height:30px;border:1px solid #ededed;padding-left: 8px;line-height: 30px;margin-right: 0px;} 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /thrift/Thrift/Server/TServerSocket.php: -------------------------------------------------------------------------------- 1 | host_ = $host; 52 | $this->port_ = $port; 53 | } 54 | 55 | /** 56 | * Sets the accept timeout 57 | * 58 | * @param int $acceptTimeout 59 | * @return void 60 | */ 61 | public function setAcceptTimeout($acceptTimeout) 62 | { 63 | $this->acceptTimeout_ = $acceptTimeout; 64 | } 65 | 66 | /** 67 | * Opens a new socket server handle 68 | * 69 | * @return void 70 | */ 71 | public function listen() 72 | { 73 | $this->listener_ = stream_socket_server('tcp://' . $this->host_ . ':' . $this->port_); 74 | } 75 | 76 | /** 77 | * Closes the socket server handle 78 | * 79 | * @return void 80 | */ 81 | public function close() 82 | { 83 | @fclose($this->listener_); 84 | $this->listener_ = null; 85 | } 86 | 87 | /** 88 | * Implementation of accept. If not client is accepted in the given time 89 | * 90 | * @return TSocket 91 | */ 92 | protected function acceptImpl() 93 | { 94 | $handle = @stream_socket_accept($this->listener_, $this->acceptTimeout_ / 1000.0); 95 | if(!$handle) return null; 96 | 97 | $socket = new TSocket(); 98 | $socket->setHandle($handle); 99 | 100 | return $socket; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /hprose/lib/InvokeSettings.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | class InvokeSettings implements ArrayAccess { 22 | public $settings; 23 | public function __construct(array $settings = array()) { 24 | if ($settings !== null) { 25 | $this->settings = $settings; 26 | } 27 | else { 28 | $this->settings = array(); 29 | } 30 | } 31 | public function __set($name, $value) { 32 | $this->settings[$name] = $value; 33 | } 34 | public function __get($name) { 35 | return isset($this->settings[$name]) ? $this->settings[$name] : null; 36 | } 37 | public function __isset($name) { 38 | return isset($this->settings[$name]); 39 | } 40 | public function __unset($name) { 41 | unset($this->settings[$name]); 42 | } 43 | public function offsetSet($offset, $value) { 44 | $this->settings[$offset] = $value; 45 | } 46 | public function offsetGet($offset) { 47 | return isset($this->settings[$offset]) ? $this->settings[$offset] : null; 48 | } 49 | public function offsetExists($offset) { 50 | return isset($this->settings[$offset]); 51 | } 52 | public function offsetUnset($offset) { 53 | unset($this->settings[$offset]); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /public/css/g_commenTop.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | .g_none{display: none;} 3 | .g_topAll{width: 100%;min-width: 1200px;background-color: #1777d8;height: 72px;} 4 | .g_topCome{height: 72px;min-width: 1200px;} 5 | .g_houLeft{width: 180px;float: left;height: 72px;padding-left: 20px;cursor: pointer;position: relative;} 6 | .g_houLeft span{line-height: 24px;color: #fff;font-size: 18px;padding-right: 18px;width: 160px; 7 | display: block;background: url("../images/g_upDown.png") 154px 11px no-repeat;margin-top: 26px; 8 | border-right: 1px solid #4592e0;} 9 | .g_niazhanK{position: absolute;left: -1px;top: 70px;width: 198px;border: 1px solid #ddd;z-index: 3; 10 | background-color: #fff;} 11 | .g_niazhanK li{height: 54px;line-height: 54px;font-size: 15px;overflow: hidden;} 12 | .g_niazhanK li a{color: #222;height: 54px;line-height: 54px;padding-left: 48px;float: left;width: 150px;} 13 | .g_niazhanK li a:hover{background-color: #1677d8;color: #fff;} 14 | .g_huMing{float: left;padding-left: 24px;height: 72px;position: relative;cursor: pointer;} 15 | .g_huMing span{line-height: 24px;color: #fff;font-size: 14px;display: block;margin-top: 26px; 16 | background: url("../images/g_upDown.png") 50px 11px no-repeat;padding-right: 32px;} 17 | .g_yuiChu{position: absolute;left: 0px;top: 70px;width: 99%;height: 70px;border: 1px solid #ddd; 18 | background-color: #fff;} 19 | .g_yuiChu a{float: left;text-align: center;width: 100%;line-height: 70px;color: #666;font-size: 14px;} 20 | .g_daoNav{float: right;height: 72px;} 21 | .g_bifUlbao{height: 72px;} 22 | .g_bifUlbao li{float: left;padding: 0px 15px;color: #fff;font-size: 14px;line-height: 72px;} 23 | .g_bifUlbao li a{color: #fff;} 24 | .g_bifUlbao li span{background: url("../images/g_Sheiji.png") 0 2px no-repeat;padding-left: 26px; 25 | cursor: pointer;} 26 | .g_bifUlbao .g_qianBlue{background-color: #4c90d7;} 27 | .g_bifUlbao .g_baiSd{background-color: #fff;} 28 | .g_bifUlbao .g_baiSd a{color: #333;} 29 | .g_nCaidan{position: relative;} 30 | .g_biaoGecon{width: 790px;background: #fff;border: 1px solid #ddd;position: absolute;right: 0px;top:72px; 31 | padding-left: 18px;} 32 | .g_biaoGecon{overflow: hidden;} 33 | .g_smallUlbao li{float: left;padding: 0px 28px; color: #222;line-height: 90px;} 34 | .g_smallUlbao li a{color: #222;} 35 | .g_smallUlbao li .g_Ahover{color: #4c90d6;} 36 | .g_smallUlbao li .g_danQia{color: #1777d8;} 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /server/swoole/SwooleLiveServer_table.php: -------------------------------------------------------------------------------- 1 | table = new swoole_table(1024); 19 | $this->table->column('id', swoole_table::TYPE_INT, 8); //1,2,4,8 20 | $this->table->create(); 21 | $config_obj=\Yaf\Registry::get("config"); 22 | $live_config=$config_obj->live->toArray(); 23 | $server = new swoole_websocket_server($live_config['ServerIp'], $live_config['port']); 24 | if(isset($live_config['logfile'])){ 25 | $server->set( 26 | array( 27 | 'daemonize' => true, 28 | 'log_file' => $live_config['logfile'] 29 | ) 30 | ); 31 | }else{ 32 | $server->set( 33 | array( 34 | 'daemonize' => true 35 | ) 36 | ); 37 | } 38 | 39 | $server->on('Open',array($this , 'onOpen')); 40 | $server->on('Message',array($this , 'onMessage')); 41 | $server->on('Close',array($this , 'onClose')); 42 | $server->start(); 43 | } 44 | public function onOpen($server, $req) { 45 | $this->table->set($req->fd, array('id'=>$req->fd)); 46 | 47 | } 48 | public function onMessage($server, $frame) { 49 | $framedata=json_decode($frame->data,true); 50 | if('smes_closed'==$framedata['data']){ 51 | $server->Close($frame->fd); 52 | }else{ 53 | 54 | 55 | foreach($this->table as $row) 56 | { 57 | 58 | if($framedata['type']=='mess'){ 59 | $data_mes['data']='游客'.$frame->fd.'说:' .$framedata['data']; 60 | $data_mes['type']=$framedata['type']; 61 | $server->push($row['id'],json_encode($data_mes,true)); 62 | }elseif($framedata['type']=='video'){ 63 | $server->push($row['id'],$frame->data); 64 | }elseif($framedata['type']=='mic'){ 65 | $server->push($row['id'],$frame->data); 66 | } 67 | } 68 | 69 | } 70 | } 71 | public function onClose($server, $fd) { 72 | $this->table->del($fd); 73 | } 74 | public static function getInstance() { 75 | if (!self::$instance) { 76 | self::$instance = new SwooleLiveServer; 77 | } 78 | return self::$instance; 79 | } 80 | } 81 | SwooleLiveServer::getInstance(); 82 | -------------------------------------------------------------------------------- /thrift/Thrift/Server/TNonblockingServerSocket.php: -------------------------------------------------------------------------------- 1 | port_ = $port; 20 | } 21 | 22 | /** 23 | * Start listening 24 | */ 25 | public function listen() { 26 | $this->handle_ = stream_socket_server("tcp://{$this->host_}:{$this->port_}", $this->errno_, $this->errstr_); 27 | stream_set_blocking($this->handle_, 0); // no blocking 28 | 29 | $this->base_ = \event_base_new(); 30 | $this->serverEvent_ = \event_new(); 31 | \event_set($this->serverEvent_, $this->handle_, EV_READ | EV_PERSIST, array( 32 | $this, 33 | 'onConnect' 34 | )); 35 | \event_base_set($this->serverEvent_, $this->base_); 36 | \event_add($this->serverEvent_); 37 | \event_base_loop($this->base_); 38 | } 39 | 40 | // 41 | public function close() { 42 | @stream_socket_shutdown($this->handle_, STREAM_SHUT_RDWR); 43 | @fclose($this->handle_); 44 | } 45 | 46 | // 47 | public function onConnect() { 48 | $clientSocket = stream_socket_accept($this->handle_); 49 | stream_set_blocking($clientSocket, 0); 50 | $clientEvent = event_new(); 51 | \event_set($clientEvent, $clientSocket, EV_READ | EV_PERSIST, array( 52 | $this, 53 | 'onRequest' 54 | ) , array( 55 | $clientEvent, 56 | )); 57 | \event_base_set($clientEvent, $this->base_); 58 | event_add($clientEvent); 59 | } 60 | 61 | // 62 | public function onRequest($clientSocket, $events, $arg) { 63 | try { 64 | //$transport = new TBufferedTransport(new TNonblockingSocket($clientSocket)); 65 | $transport = new TNonblockingSocket($clientSocket); 66 | call_user_func($this->callback, $transport); 67 | } catch(Exception $e) { 68 | \event_del($arg[0]); 69 | \event_free($arg[0]); 70 | 71 | // close socket 72 | @stream_socket_shutdown($clientSocket, STREAM_SHUT_RDWR); 73 | @fclose($clientSocket); 74 | return; 75 | } 76 | } 77 | 78 | public function setCallback($callback) { 79 | $this->callback = $callback; 80 | } 81 | protected function acceptImpl() { 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /hprose/lib/RealWriterRefer.php: -------------------------------------------------------------------------------- 1 | * 19 | * * 20 | \**********************************************************/ 21 | require_once __DIR__ . '/WriterRefer.php'; 22 | class RealWriterRefer implements WriterRefer { 23 | private $oref; 24 | private $sref = array(); 25 | private $refcount = 0; 26 | 27 | public function __construct() { 28 | $this->oref = new SplObjectStorage(); 29 | } 30 | 31 | private function writeRef(BytesIO $stream, $index) { 32 | $stream->write(Tags::TagRef . $index . Tags::TagSemicolon); 33 | return true; 34 | } 35 | public function set($val) { 36 | if (is_string($val)) { 37 | $this->sref[$val] = $this->refcount; 38 | } 39 | elseif (is_object($val)) { 40 | $this->oref->attach($val, $this->refcount); 41 | } 42 | $this->refcount++; 43 | } 44 | public function write(BytesIO $stream, $val) { 45 | if (is_string($val) && isset($this->sref[$val])) { 46 | return $this->writeRef($stream, $this->sref[$val]); 47 | } 48 | elseif (is_object($val) && isset($this->oref[$val])) { 49 | return $this->writeRef($stream, $this->oref[$val]); 50 | } 51 | return false; 52 | } 53 | public function reset() { 54 | $this->oref = new \SplObjectStorage(); 55 | $this->sref = array(); 56 | $this->refcount = 0; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /application/library/wx/pay/NativeLink.php: -------------------------------------------------------------------------------- 1 | parameters[$this->trimString($parameter)] = $this->trimString($parameterValue); 50 | } 51 | 52 | /** 53 | * 生成Native支付链接二维码 54 | */ 55 | function createLink() { 56 | try { 57 | if ($this->parameters["product_id"] == null) { 58 | throw new SDKRuntimeException("缺少Native支付二维码链接必填参数product_id!" . "
"); 59 | } 60 | $this->parameters["appid"] = wx_pay_config::APPID; //公众账号ID 61 | $this->parameters["mch_id"] = wx_pay_config::MCHID; //商户号 62 | $time_stamp = time(); 63 | $this->parameters["time_stamp"] = "$time_stamp"; //时间戳 64 | $this->parameters["nonce_str"] = $this->createNoncestr(); //随机字符串 65 | $this->parameters["sign"] = $this->getSign($this->parameters); //签名 66 | $bizString = $this->formatBizQueryParaMap($this->parameters, false); 67 | $this->url = "weixin://wxpay/bizpayurl?" . $bizString; 68 | } catch (SDKRuntimeException $e) { 69 | die($e->errorMessage()); 70 | } 71 | } 72 | 73 | /** 74 | * 返回链接 75 | */ 76 | function getUrl() { 77 | $this->createLink(); 78 | return $this->url; 79 | } 80 | 81 | } 82 | 83 | ?> -------------------------------------------------------------------------------- /application/library/wx/pay/RefundQuery.php: -------------------------------------------------------------------------------- 1 | url = "https://api.mch.weixin.qq.com/pay/refundquery"; 41 | //设置curl超时时间 42 | $this->curl_timeout = wx_pay_config::CURL_TIMEOUT; 43 | } 44 | 45 | /** 46 | * 生成接口参数xml 47 | */ 48 | function createXml() { 49 | try { 50 | if ($this->parameters["out_refund_no"] == null && 51 | $this->parameters["out_trade_no"] == null && 52 | $this->parameters["transaction_id"] == null && 53 | $this->parameters["refund_id "] == null) { 54 | throw new SDKRuntimeException("退款查询接口中,out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个!" . "
"); 55 | } 56 | $this->parameters["appid"] = wx_pay_config::APPID; //公众账号ID 57 | $this->parameters["mch_id"] = wx_pay_config::MCHID; //商户号 58 | $this->parameters["nonce_str"] = $this->createNoncestr(); //随机字符串 59 | $this->parameters["sign"] = $this->getSign($this->parameters); //签名 60 | return $this->arrayToXml($this->parameters); 61 | } catch (SDKRuntimeException $e) { 62 | die($e->errorMessage()); 63 | } 64 | } 65 | 66 | /** 67 | * 作用:获取结果,使用证书通信 68 | */ 69 | function getResult() { 70 | $this->postXmlSSL(); 71 | $this->result = $this->xmlToArray($this->response); 72 | return $this->result; 73 | } 74 | 75 | } 76 | 77 | ?> -------------------------------------------------------------------------------- /server/swoole/TaskServer.php: -------------------------------------------------------------------------------- 1 | application = new \Yaf\Application(dirname(APPLICATION_PATH). "/conf/application.ini"); 20 | $this->application->bootstrap(); 21 | $config_obj=\Yaf\Registry::get("config"); 22 | $task_config=$config_obj->task->toArray(); 23 | $server = new swoole_server($task_config['ServerIp'], $task_config['port']); 24 | if(isset($task_config['logfile'])){ 25 | $server->set( 26 | array( 27 | 'worker_num' => 8, 28 | 'daemonize' => true, 29 | 'task_worker_num' => 8, 30 | 'log_file' => $task_config['logfile'] 31 | ) 32 | ); 33 | }else{ 34 | $server->set( 35 | array( 36 | 'worker_num' => 8, 37 | 'daemonize' => true, 38 | 'task_worker_num' => 8 39 | ) 40 | ); 41 | } 42 | 43 | 44 | $server->on('Receive',array($this , 'onReceive')); 45 | 46 | $server->on('Task',array($this , 'onTask')); 47 | 48 | $server->on('Finish',array($this , 'onFinish')); 49 | 50 | $server->start(); 51 | } 52 | 53 | public function onReceive($serv, $fd, $from_id, $data) { 54 | $param = array( 55 | 'fd' => $fd, 56 | 'data'=>json_decode($data, true) 57 | ); 58 | // start a task 59 | $serv->task(json_encode($param)); 60 | } 61 | public function onTask($serv, $task_id, $from_id, $data) { 62 | $fd = json_decode($data, true); 63 | $tmp_data=$fd['data']; 64 | $this->application->execute(array('swoole_task','demcode'),$tmp_data); 65 | $serv->send($fd['fd'] , "Data in Task {$task_id}"); 66 | return 'ok'; 67 | } 68 | public function onFinish($serv, $task_id, $data) { 69 | echo "Task {$task_id} finish\n"; 70 | echo "Result: {$data}\n"; 71 | } 72 | public static function getInstance() { 73 | if (!self::$instance) { 74 | self::$instance = new TaskServer; 75 | } 76 | return self::$instance; 77 | } 78 | } 79 | 80 | TaskServer::getInstance(); 81 | -------------------------------------------------------------------------------- /application/library/think/paginator/Collection.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\paginator; 13 | 14 | use Exception; 15 | use think\Paginator; 16 | 17 | /** 18 | * Class Collection 19 | * @package think\paginator 20 | * @method integer total() 21 | * @method integer listRows() 22 | * @method integer currentPage() 23 | * @method string render() 24 | * @method Paginator fragment($fragment) 25 | * @method Paginator appends($key, $value) 26 | * @method integer lastPage() 27 | * @method boolean hasPages() 28 | */ 29 | class Collection extends \think\Collection 30 | { 31 | 32 | /** @var Paginator */ 33 | protected $paginator; 34 | 35 | public function __construct($items = [], Paginator $paginator = null) 36 | { 37 | $this->paginator = $paginator; 38 | parent::__construct($items); 39 | } 40 | 41 | public static function make($items = [], Paginator $paginator = null) 42 | { 43 | return new static($items, $paginator); 44 | } 45 | 46 | public function toArray() 47 | { 48 | if ($this->paginator) { 49 | try { 50 | $total = $this->total(); 51 | } catch (Exception $e) { 52 | $total = null; 53 | } 54 | 55 | return [ 56 | 'total' => $total, 57 | 'per_page' => $this->listRows(), 58 | 'current_page' => $this->currentPage(), 59 | 'data' => parent::toArray(), 60 | ]; 61 | } else { 62 | return parent::toArray(); 63 | } 64 | } 65 | 66 | public function __call($method, $args) 67 | { 68 | if ($this->paginator && method_exists($this->paginator, $method)) { 69 | return call_user_func_array([$this->paginator, $method], $args); 70 | } else { 71 | throw new Exception('method not exists:' . __CLASS__ . '->' . $method); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /application/Bootstrap.php: -------------------------------------------------------------------------------- 1 | config = \Yaf\Application::app()->getConfig(); 12 | \Yaf\Registry::set("config", $this->config); 13 | $dispatcher->returnResponse(true); // 开启后,不自动加载视图 14 | $dispatcher->setErrorHandler([$this,"myErrorHandler"]); 15 | } 16 | 17 | public function _initSession($dispatcher) { 18 | Yaf\Session::getInstance()->start(); 19 | } 20 | 21 | public function _initPlugin(\Yaf\Dispatcher $dispatcher) 22 | { 23 | $AutoloadPlugin = new AutoloadPlugin(); 24 | $dispatcher->registerPlugin($AutoloadPlugin); 25 | } 26 | 27 | public function _initBase() 28 | { 29 | // 环境常量 30 | defined('APPDEBUG') or define('APPDEBUG', $this->config->application->appdebug); 31 | defined('DS') or define('DS', DIRECTORY_SEPARATOR); 32 | define('IS_CGI', strpos(PHP_SAPI, 'cgi') === 0 ? 1 : 0); 33 | define('IS_WIN', strstr(PHP_OS, 'WIN') ? 1 : 0); 34 | define('IS_MAC', strstr(PHP_OS, 'Darwin') ? 1 : 0); 35 | define('IS_CLI', PHP_SAPI == 'cli' ? 1 : 0); 36 | define('IS_AJAX', (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') ? true : false); 37 | define('NOW_TIME', $_SERVER['REQUEST_TIME']); 38 | define('REQUEST_METHOD', IS_CLI ? 'GET' : $_SERVER['REQUEST_METHOD']); 39 | define('IS_GET', REQUEST_METHOD == 'GET' ? true : false); 40 | define('IS_POST', REQUEST_METHOD == 'POST' ? true : false); 41 | define('IS_PUT', REQUEST_METHOD == 'PUT' ? true : false); 42 | define('IS_DELETE', REQUEST_METHOD == 'DELETE' ? true : false); 43 | } 44 | 45 | public function _initDb() 46 | { 47 | if(class_exists('\think\Db')){ 48 | \think\Db::setConfig($this->config->tpdatabase->toArray()); 49 | //Model关键字,手动加载文件 50 | \Yaf\Loader::import($this->config->application->directory . '/library/think/Model.php'); 51 | } 52 | } 53 | 54 | function myErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) 55 | { 56 | //可记录日志 57 | switch ($errno) { 58 | case YAF\ERR\NOTFOUND\CONTROLLER: 59 | case YAF\ERR\NOTFOUND\MODULE: 60 | case YAF\ERR\NOTFOUND\ACTION: 61 | header(" 404 Not Found"); 62 | break; 63 | 64 | default: 65 | echo "Unknown error type: [$errno]--- $errstr ---$errfile ---- $errline
\n"; 66 | break; 67 | } 68 | return true; //继续执行可执行的代码 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /application/library/think/db/builder/Sqlite.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\builder; 13 | 14 | use think\db\Builder; 15 | use think\db\Query; 16 | 17 | /** 18 | * Sqlite数据库驱动 19 | */ 20 | class Sqlite extends Builder 21 | { 22 | 23 | /** 24 | * limit 25 | * @access public 26 | * @param Query $query 查询对象 27 | * @param mixed $limit 28 | * @return string 29 | */ 30 | public function parseLimit(Query $query, $limit) 31 | { 32 | $limitStr = ''; 33 | 34 | if (!empty($limit)) { 35 | $limit = explode(',', $limit); 36 | if (count($limit) > 1) { 37 | $limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' '; 38 | } else { 39 | $limitStr .= ' LIMIT ' . $limit[0] . ' '; 40 | } 41 | } 42 | 43 | return $limitStr; 44 | } 45 | 46 | /** 47 | * 随机排序 48 | * @access protected 49 | * @param Query $query 查询对象 50 | * @return string 51 | */ 52 | protected function parseRand(Query $query) 53 | { 54 | return 'RANDOM()'; 55 | } 56 | 57 | /** 58 | * 字段和表名处理 59 | * @access protected 60 | * @param Query $query 查询对象 61 | * @param string $key 62 | * @return string 63 | */ 64 | protected function parseKey(Query $query, $key) 65 | { 66 | $key = trim($key); 67 | if (strpos($key, '.')) { 68 | list($table, $key) = explode('.', $key, 2); 69 | 70 | $alias = $query->getOptions('alias'); 71 | 72 | if ('__TABLE__' == $table) { 73 | $table = $query->getOptions('table'); 74 | } 75 | 76 | if (isset($alias[$table])) { 77 | $table = $alias[$table]; 78 | } 79 | } 80 | 81 | if (isset($table)) { 82 | $key = $table . '.' . $key; 83 | } 84 | 85 | return $key; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /thrift/Thrift/Exception/TApplicationException.php: -------------------------------------------------------------------------------- 1 | array('var' => 'message', 31 | 'type' => TType::STRING), 32 | 2 => array('var' => 'code', 33 | 'type' => TType::I32)); 34 | 35 | const UNKNOWN = 0; 36 | const UNKNOWN_METHOD = 1; 37 | const INVALID_MESSAGE_TYPE = 2; 38 | const WRONG_METHOD_NAME = 3; 39 | const BAD_SEQUENCE_ID = 4; 40 | const MISSING_RESULT = 5; 41 | const INTERNAL_ERROR = 6; 42 | const PROTOCOL_ERROR = 7; 43 | const INVALID_TRANSFORM = 8; 44 | const INVALID_PROTOCOL = 9; 45 | const UNSUPPORTED_CLIENT_TYPE = 10; 46 | 47 | public function __construct($message=null, $code=0) 48 | { 49 | parent::__construct($message, $code); 50 | } 51 | 52 | public function read($output) 53 | { 54 | return $this->_read('TApplicationException', self::$_TSPEC, $output); 55 | } 56 | 57 | public function write($output) 58 | { 59 | $xfer = 0; 60 | $xfer += $output->writeStructBegin('TApplicationException'); 61 | if ($message = $this->getMessage()) { 62 | $xfer += $output->writeFieldBegin('message', TType::STRING, 1); 63 | $xfer += $output->writeString($message); 64 | $xfer += $output->writeFieldEnd(); 65 | } 66 | if ($code = $this->getCode()) { 67 | $xfer += $output->writeFieldBegin('type', TType::I32, 2); 68 | $xfer += $output->writeI32($code); 69 | $xfer += $output->writeFieldEnd(); 70 | } 71 | $xfer += $output->writeFieldStop(); 72 | $xfer += $output->writeStructEnd(); 73 | 74 | return $xfer; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /application/plugins/Autoload.php: -------------------------------------------------------------------------------- 1 | config=Yaf\Application::app()->getConfig(); 12 | $this->fileload=Yaf\Loader::getInstance(); 13 | if(isset($this->config->application->autolibrary) && !empty($this->config->application->autolibrary)){ 14 | $autoclass=explode(',',$this->config->application->autolibrary); 15 | foreach ($autoclass as $v) { 16 | if(is_dir(APPLICATION_PATH.'/'.$v)){ 17 | $this->getlist(APPLICATION_PATH.'/'.$v,'class'); 18 | }else{ 19 | throw new Exception(APPLICATION_PATH.'/'.$v.'不是目录'); 20 | } 21 | } 22 | } 23 | } 24 | //路由结束之后触发,此时路由一定正确完成, 否则这个事件不会触发 25 | public function routerShutdown(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response) { 26 | if(isset($this->config->application->autofunction) && !empty($this->config->application->autofunction)){ 27 | $autofunction=explode(',',$this->config->application->autofunction); 28 | foreach ($autofunction as $v) { 29 | if(is_dir(APPLICATION_PATH.'/'.$v)){ 30 | $this->getlist(APPLICATION_PATH.'/'.$v,'function'); 31 | }else{ 32 | throw new Exception(APPLICATION_PATH.'/'.$v.'不是目录'); 33 | } 34 | } 35 | } 36 | 37 | $this->fileload->setLibraryPath(APPLICATION_PATH.'/library',true); 38 | } 39 | private function getlist($dir_str,$type) 40 | { 41 | try{ 42 | $handler = opendir($dir_str); 43 | $this->fileload->setLibraryPath($dir_str,true); 44 | while(($filename = readdir($handler)) !== false) 45 | { 46 | if($filename != "." && $filename != ".." && count(scandir($dir_str))>2) 47 | { 48 | if(is_dir($dir_str.'/'.$filename)) 49 | { 50 | $this->getlist($dir_str.'/'.$filename,$type); 51 | } 52 | else 53 | { 54 | if(is_file($dir_str.'/'.$filename)) 55 | { 56 | switch ($type) { 57 | case 'class': 58 | $fname=pathinfo($filename); 59 | $this->fileload->autoload($fname['filename']); 60 | break; 61 | case 'function': 62 | $this->fileload->import($dir_str.'/'.$filename); 63 | break; 64 | } 65 | }else{ 66 | throw new Exception($dir_str.'/'.$filename.'不是文件'); 67 | } 68 | } 69 | } 70 | } 71 | closedir($handler); 72 | }catch(\Exception $e){ 73 | throw new Exception($e->getMessage()); 74 | } 75 | } 76 | } 77 | 78 | ?> -------------------------------------------------------------------------------- /application/library/mysqlpool.php: -------------------------------------------------------------------------------- 1 | client = new swoole_client(SWOOLE_SOCK_TCP | SWOOLE_KEEP); 9 | $this->client = new swoole_client(SWOOLE_SOCK_TCP); 10 | $this->client->set(array( 11 | 'socket_buffer_size' => 1024*1024*500, 12 | 'open_length_check' => 1, 13 | 'package_length_type' => 'N', 14 | 'package_length_offset' => 0, //第N个字节是包长度的值 15 | 'package_body_offset' => 4, //第几个字节开始计算长度 16 | 'package_max_length' => 200000000 17 | )); 18 | } 19 | } 20 | 21 | public function connect($data,$type='sql') { 22 | $config_obj=Yaf_Registry::get("config"); 23 | $config=$config_obj->syncmysql->toArray(); 24 | if(!$fp = $this->client->connect($config['ServerIp'],$config['port'],-1)) { 25 | return; 26 | } 27 | $senddata['type']=$type; 28 | $senddata['data']=$data; 29 | $this->send($this->packmes(json_encode($senddata,true))); 30 | $return_result=$this->client->recv(); 31 | if($return_result==''){ 32 | $return_result['success']= false; 33 | $return_result['error']='返回数据超时!'; 34 | $this->msg=$return_result; 35 | }else{ 36 | $this->msg=json_decode($this->unpackmes($return_result),true); 37 | } 38 | $this->client->close(); 39 | return $this->msg; 40 | } 41 | 42 | public function onClose($cli) { 43 | $return_result['success']= false; 44 | $return_result['error']="Client close connection"; 45 | $this->msg=$return_result; 46 | } 47 | 48 | public function onError($cli) { 49 | $return_result['success']= false; 50 | $return_result['error']=$cli->errCode; 51 | $this->msg=$return_result; 52 | $cli->close(); 53 | } 54 | //包装数据 55 | public function packmes($data, $format = '\r\n\r\n', $preformat = '######') 56 | { 57 | //return $preformat . json_encode($data, true) . $format; 58 | return pack('N', strlen($data)) . $data; 59 | } 60 | 61 | //解包装数据 62 | public function unpackmes($data, $format = '\r\n\r\n', $preformat = '######') 63 | { 64 | 65 | $resultdata = substr($data, 4); 66 | return $resultdata; 67 | } 68 | 69 | public function send($data) { 70 | $this->client->send($data); 71 | } 72 | 73 | public function isConnected($cli) { 74 | return $this->client->isConnected(); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /application/library/wx/pay/pay.php: -------------------------------------------------------------------------------- 1 | parameters[$this->trimString($parameter)] = $this->trimString($parameterValue); 50 | } 51 | 52 | /** 53 | * 作用:设置标配的请求参数,生成签名,生成接口参数xml 54 | */ 55 | function createXml() { 56 | $this->parameters["appid"] = wx_pay_config::APPID; //公众账号ID 57 | $this->parameters["mch_id"] = wx_pay_config::MCHID; //商户号 58 | $this->parameters["nonce_str"] = $this->createNoncestr(); //随机字符串 59 | $this->parameters["sign"] = $this->getSign($this->parameters); //签名 60 | return $this->arrayToXml($this->parameters); 61 | } 62 | 63 | /** 64 | * 作用:post请求xml 65 | */ 66 | function postXml() { 67 | $xml = $this->createXml(); 68 | $this->response = $this->postXmlCurl($xml, $this->url, $this->curl_timeout); 69 | //$this->printErr('请求参数=', $this->xmlToArray($this->response)); 70 | return $this->response; 71 | } 72 | 73 | /** 74 | * 作用:使用证书post请求xml 75 | */ 76 | function postXmlSSL() { 77 | $xml = $this->createXml(); 78 | $this->response = $this->postXmlSSLCurl($xml, $this->url, $this->curl_timeout); 79 | return $this->response; 80 | } 81 | 82 | /** 83 | * 作用:获取结果,默认不使用证书 84 | */ 85 | function getResult() { 86 | $this->postXml(); 87 | $this->result = $this->xmlToArray($this->response); 88 | return $this->result; 89 | } 90 | 91 | } 92 | ?> -------------------------------------------------------------------------------- /thrift/Thrift/Transport/TTransport.php: -------------------------------------------------------------------------------- 1 | read($len); 71 | 72 | $data = ''; 73 | $got = 0; 74 | while (($got = TStringFuncFactory::create()->strlen($data)) < $len) { 75 | $data .= $this->read($len - $got); 76 | } 77 | 78 | return $data; 79 | } 80 | 81 | /** 82 | * Writes the given data out. 83 | * 84 | * @param string $buf The data to write 85 | * @throws TTransportException if writing fails 86 | */ 87 | abstract public function write($buf); 88 | 89 | /** 90 | * Flushes any pending data out of a buffer 91 | * 92 | * @throws TTransportException if a writing error occurs 93 | */ 94 | public function flush() {} 95 | } 96 | -------------------------------------------------------------------------------- /thrift/Thrift/Protocol/TBinaryProtocolAccelerated.php: -------------------------------------------------------------------------------- 1 | strictRead_; 60 | } 61 | public function isStrictWrite() 62 | { 63 | return $this->strictWrite_; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /thrift/Thrift/Server/TServer.php: -------------------------------------------------------------------------------- 1 | processor_ = $processor; 76 | $this->transport_ = $transport; 77 | $this->inputTransportFactory_ = $inputTransportFactory; 78 | $this->outputTransportFactory_ = $outputTransportFactory; 79 | $this->inputProtocolFactory_ = $inputProtocolFactory; 80 | $this->outputProtocolFactory_ = $outputProtocolFactory; 81 | } 82 | 83 | /** 84 | * Serves the server. This should never return 85 | * unless a problem permits it to do so or it 86 | * is interrupted intentionally 87 | * 88 | * @abstract 89 | * @return void 90 | */ 91 | abstract public function serve(); 92 | 93 | /** 94 | * Stops the server serving 95 | * 96 | * @abstract 97 | * @return void 98 | */ 99 | abstract public function stop(); 100 | } 101 | -------------------------------------------------------------------------------- /thrift/Thrift/Transport/TMemoryBuffer.php: -------------------------------------------------------------------------------- 1 | buf_ = $buf; 45 | } 46 | 47 | protected $buf_ = ''; 48 | 49 | public function isOpen() 50 | { 51 | return true; 52 | } 53 | 54 | public function open() {} 55 | 56 | public function close() {} 57 | 58 | public function write($buf) 59 | { 60 | $this->buf_ .= $buf; 61 | } 62 | 63 | public function read($len) 64 | { 65 | $bufLength = TStringFuncFactory::create()->strlen($this->buf_); 66 | 67 | if ($bufLength === 0) { 68 | throw new TTransportException('TMemoryBuffer: Could not read ' . 69 | $len . ' bytes from buffer.', 70 | TTransportException::UNKNOWN); 71 | } 72 | 73 | if ($bufLength <= $len) { 74 | $ret = $this->buf_; 75 | $this->buf_ = ''; 76 | 77 | return $ret; 78 | } 79 | 80 | $ret = TStringFuncFactory::create()->substr($this->buf_, 0, $len); 81 | $this->buf_ = TStringFuncFactory::create()->substr($this->buf_, $len); 82 | 83 | return $ret; 84 | } 85 | 86 | public function getBuffer() 87 | { 88 | return $this->buf_; 89 | } 90 | 91 | public function available() 92 | { 93 | return TStringFuncFactory::create()->strlen($this->buf_); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /application/library/think/db/builder/Oracle.php: -------------------------------------------------------------------------------- 1 | 8 | // +---------------------------------------------------------------------- 9 | 10 | namespace think\db\builder; 11 | 12 | use think\db\Builder; 13 | use think\db\Query; 14 | 15 | /** 16 | * Oracle数据库驱动 17 | */ 18 | class Oracle extends Builder 19 | { 20 | 21 | protected $selectSql = 'SELECT * FROM (SELECT thinkphp.*, rownum AS numrow FROM (SELECT %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%) thinkphp ) %LIMIT%%COMMENT%'; 22 | 23 | /** 24 | * limit分析 25 | * @access protected 26 | * @param Query $query 查询对象 27 | * @param mixed $limit 28 | * @return string 29 | */ 30 | protected function parseLimit(Query $query, $limit) 31 | { 32 | $limitStr = ''; 33 | if (!empty($limit)) { 34 | $limit = explode(',', $limit); 35 | if (count($limit) > 1) { 36 | $limitStr = "(numrow>" . $limit[0] . ") AND (numrow<=" . ($limit[0] + $limit[1]) . ")"; 37 | } else { 38 | $limitStr = "(numrow>0 AND numrow<=" . $limit[0] . ")"; 39 | } 40 | 41 | } 42 | 43 | return $limitStr ? ' WHERE ' . $limitStr : ''; 44 | } 45 | 46 | /** 47 | * 设置锁机制 48 | * @access protected 49 | * @param Query $query 查询对象 50 | * @param bool|false $lock 51 | * @return string 52 | */ 53 | protected function parseLock(Query $query, $lock = false) 54 | { 55 | if (!$lock) { 56 | return ''; 57 | } 58 | 59 | return ' FOR UPDATE NOWAIT '; 60 | } 61 | 62 | /** 63 | * 字段和表名处理 64 | * @access protected 65 | * @param Query $query 查询对象 66 | * @param string $key 67 | * @return string 68 | */ 69 | protected function parseKey(Query $query, $key) 70 | { 71 | $key = trim($key); 72 | 73 | if (strpos($key, '->') && false === strpos($key, '(')) { 74 | // JSON字段支持 75 | list($field, $name) = explode($key, '->'); 76 | $key = $field . '."' . $name . '"'; 77 | } 78 | 79 | return $key; 80 | } 81 | 82 | /** 83 | * 随机排序 84 | * @access protected 85 | * @param Query $query 查询对象 86 | * @return string 87 | */ 88 | protected function parseRand(Query $query) 89 | { 90 | return 'DBMS_RANDOM.value'; 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /application/library/think/model/Collection.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\model; 13 | 14 | use think\Collection as BaseCollection; 15 | use think\Model; 16 | 17 | class Collection extends BaseCollection 18 | { 19 | /** 20 | * 返回数组中指定的一列 21 | * @param string $column_key 22 | * @param string|null $index_key 23 | * @return array 24 | */ 25 | public function column($column_key, $index_key = null) 26 | { 27 | return array_column($this->toArray(), $column_key, $index_key); 28 | } 29 | 30 | /** 31 | * 延迟预载入关联查询 32 | * @access public 33 | * @param mixed $relation 关联 34 | * @return $this 35 | */ 36 | public function load($relation) 37 | { 38 | $item = current($this->items); 39 | $item->eagerlyResultSet($this->items, $relation); 40 | 41 | return $this; 42 | } 43 | 44 | /** 45 | * 设置需要隐藏的输出属性 46 | * @access public 47 | * @param array $hidden 属性列表 48 | * @param bool $override 是否覆盖 49 | * @return $this 50 | */ 51 | public function hidden($hidden = [], $override = false) 52 | { 53 | $this->each(function ($model) use ($hidden, $override) { 54 | /** @var Model $model */ 55 | $model->hidden($hidden, $override); 56 | }); 57 | 58 | return $this; 59 | } 60 | 61 | /** 62 | * 设置需要输出的属性 63 | * @param array $visible 64 | * @param bool $override 是否覆盖 65 | * @return $this 66 | */ 67 | public function visible($visible = [], $override = false) 68 | { 69 | $this->each(function ($model) use ($visible, $override) { 70 | /** @var Model $model */ 71 | $model->visible($visible, $override); 72 | }); 73 | 74 | return $this; 75 | } 76 | 77 | /** 78 | * 设置需要追加的输出属性 79 | * @access public 80 | * @param array $append 属性列表 81 | * @param bool $override 是否覆盖 82 | * @return $this 83 | */ 84 | public function append($append = [], $override = false) 85 | { 86 | $this->each(function ($model) use ($append, $override) { 87 | /** @var Model $model */ 88 | $model && $model->append($append, $override); 89 | }); 90 | 91 | return $this; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /application/library/wx/pay/Refund.php: -------------------------------------------------------------------------------- 1 | url = "https://api.mch.weixin.qq.com/secapi/pay/refund"; 40 | //设置curl超时时间 41 | $this->curl_timeout = wx_pay_config::CURL_TIMEOUT; 42 | } 43 | 44 | /** 45 | * 生成接口参数xml 46 | */ 47 | function createXml() { 48 | try { 49 | //检测必填参数 50 | if ($this->parameters["out_trade_no"] == null && $this->parameters["transaction_id"] == null) { 51 | throw new SDKRuntimeException("退款申请接口中,out_trade_no、transaction_id至少填一个!" . "
"); 52 | } elseif ($this->parameters["out_refund_no"] == null) { 53 | throw new SDKRuntimeException("退款申请接口中,缺少必填参数out_refund_no!" . "
"); 54 | } elseif ($this->parameters["total_fee"] == null) { 55 | throw new SDKRuntimeException("退款申请接口中,缺少必填参数total_fee!" . "
"); 56 | } elseif ($this->parameters["refund_fee"] == null) { 57 | throw new SDKRuntimeException("退款申请接口中,缺少必填参数refund_fee!" . "
"); 58 | } elseif ($this->parameters["op_user_id"] == null) { 59 | throw new SDKRuntimeException("退款申请接口中,缺少必填参数op_user_id!" . "
"); 60 | } 61 | $this->parameters["appid"] = wx_pay_config::APPID; //公众账号ID 62 | $this->parameters["mch_id"] = wx_pay_config::MCHID; //商户号 63 | $this->parameters["nonce_str"] = $this->createNoncestr(); //随机字符串 64 | $this->parameters["sign"] = $this->getSign($this->parameters); //签名 65 | return $this->arrayToXml($this->parameters); 66 | } catch (SDKRuntimeException $e) { 67 | die($e->errorMessage()); 68 | } 69 | } 70 | 71 | /** 72 | * 作用:获取结果,使用证书通信 73 | */ 74 | function getResult() { 75 | $this->postXmlSSL(); 76 | $this->result = $this->xmlToArray($this->response); 77 | return $this->result; 78 | } 79 | 80 | } 81 | ?> -------------------------------------------------------------------------------- /application/library/think/db/builder/Pgsql.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\builder; 13 | 14 | use think\db\Builder; 15 | use think\db\Query; 16 | 17 | /** 18 | * Pgsql数据库驱动 19 | */ 20 | class Pgsql extends Builder 21 | { 22 | 23 | protected $insertSql = 'INSERT INTO %TABLE% (%FIELD%) VALUES (%DATA%) %COMMENT%'; 24 | protected $insertAllSql = 'INSERT INTO %TABLE% (%FIELD%) %DATA% %COMMENT%'; 25 | 26 | /** 27 | * limit分析 28 | * @access protected 29 | * @param Query $query 查询对象 30 | * @param mixed $limit 31 | * @return string 32 | */ 33 | public function parseLimit(Query $query, $limit) 34 | { 35 | $limitStr = ''; 36 | 37 | if (!empty($limit)) { 38 | $limit = explode(',', $limit); 39 | if (count($limit) > 1) { 40 | $limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' '; 41 | } else { 42 | $limitStr .= ' LIMIT ' . $limit[0] . ' '; 43 | } 44 | } 45 | 46 | return $limitStr; 47 | } 48 | 49 | /** 50 | * 字段和表名处理 51 | * @access protected 52 | * @param Query $query 查询对象 53 | * @param string $key 54 | * @return string 55 | */ 56 | protected function parseKey(Query $query, $key) 57 | { 58 | $key = trim($key); 59 | 60 | if (strpos($key, '$.') && false === strpos($key, '(')) { 61 | // JSON字段支持 62 | list($field, $name) = explode('$.', $key); 63 | $key = $field . '->>\'' . $name . '\''; 64 | } elseif (strpos($key, '.')) { 65 | list($table, $key) = explode('.', $key, 2); 66 | 67 | $alias = $query->getOptions('alias'); 68 | 69 | if ('__TABLE__' == $table) { 70 | $table = $query->getOptions('table'); 71 | } 72 | 73 | if (isset($alias[$table])) { 74 | $table = $alias[$table]; 75 | } 76 | } 77 | 78 | if (isset($table)) { 79 | $key = $table . '.' . $key; 80 | } 81 | 82 | return $key; 83 | } 84 | 85 | /** 86 | * 随机排序 87 | * @access protected 88 | * @param Query $query 查询对象 89 | * @return string 90 | */ 91 | protected function parseRand(Query $query) 92 | { 93 | return 'RANDOM()'; 94 | } 95 | 96 | } 97 | --------------------------------------------------------------------------------