├── .env.example ├── .gitattributes ├── .gitignore ├── .htaccess ├── LICENSE ├── README.md ├── application ├── .htaccess ├── command.php ├── common.php ├── common │ ├── Model │ │ ├── Areas.php │ │ ├── Collection.php │ │ ├── CommonModel.php │ │ ├── Department.php │ │ ├── DepartmentMember.php │ │ ├── Events.php │ │ ├── EventsLog.php │ │ ├── EventsMember.php │ │ ├── File.php │ │ ├── InviteLink.php │ │ ├── Member.php │ │ ├── MemberAccount.php │ │ ├── Notify.php │ │ ├── Organization.php │ │ ├── Project.php │ │ ├── ProjectAuth.php │ │ ├── ProjectAuthNode.php │ │ ├── ProjectCollection.php │ │ ├── ProjectFeatures.php │ │ ├── ProjectInfo.php │ │ ├── ProjectLog.php │ │ ├── ProjectMember.php │ │ ├── ProjectMenu.php │ │ ├── ProjectNode.php │ │ ├── ProjectReport.php │ │ ├── ProjectTemplate.php │ │ ├── ProjectVersion.php │ │ ├── ProjectVersionLog.php │ │ ├── SourceLink.php │ │ ├── SystemConfig.php │ │ ├── SystemLog.php │ │ ├── Task.php │ │ ├── TaskLike.php │ │ ├── TaskMember.php │ │ ├── TaskStages.php │ │ ├── TaskStagesTemplate.php │ │ ├── TaskTag.php │ │ ├── TaskToTag.php │ │ ├── TaskWorkTime.php │ │ ├── TaskWorkflow.php │ │ └── TaskWorkflowRule.php │ ├── Plugins │ │ └── GateWayWorker │ │ │ ├── Events.php │ │ │ ├── composer.json │ │ │ ├── composer.lock │ │ │ ├── config.php │ │ │ ├── crontab.php │ │ │ ├── start_businessworker.php │ │ │ ├── start_gateway.php │ │ │ ├── start_register.php │ │ │ └── vendor │ │ │ ├── autoload.php │ │ │ ├── composer │ │ │ ├── ClassLoader.php │ │ │ ├── LICENSE │ │ │ ├── autoload_classmap.php │ │ │ ├── autoload_namespaces.php │ │ │ ├── autoload_psr4.php │ │ │ ├── autoload_real.php │ │ │ ├── autoload_static.php │ │ │ └── installed.json │ │ │ └── workerman │ │ │ ├── gateway-worker │ │ │ ├── .gitignore │ │ │ ├── MIT-LICENSE.txt │ │ │ ├── README.md │ │ │ ├── composer.json │ │ │ └── src │ │ │ │ ├── BusinessWorker.php │ │ │ │ ├── Gateway.php │ │ │ │ ├── Lib │ │ │ │ ├── Context.php │ │ │ │ ├── Db.php │ │ │ │ ├── DbConnection.php │ │ │ │ └── Gateway.php │ │ │ │ ├── Protocols │ │ │ │ └── GatewayProtocol.php │ │ │ │ └── Register.php │ │ │ └── workerman │ │ │ ├── .gitignore │ │ │ ├── Autoloader.php │ │ │ ├── Connection │ │ │ ├── AsyncTcpConnection.php │ │ │ ├── AsyncUdpConnection.php │ │ │ ├── ConnectionInterface.php │ │ │ ├── TcpConnection.php │ │ │ └── UdpConnection.php │ │ │ ├── Events │ │ │ ├── Ev.php │ │ │ ├── Event.php │ │ │ ├── EventInterface.php │ │ │ ├── Libevent.php │ │ │ ├── React │ │ │ │ ├── Base.php │ │ │ │ ├── ExtEventLoop.php │ │ │ │ ├── ExtLibEventLoop.php │ │ │ │ └── StreamSelectLoop.php │ │ │ ├── Select.php │ │ │ └── Swoole.php │ │ │ ├── Lib │ │ │ ├── Constants.php │ │ │ └── Timer.php │ │ │ ├── MIT-LICENSE.txt │ │ │ ├── Protocols │ │ │ ├── Frame.php │ │ │ ├── Http.php │ │ │ ├── Http │ │ │ │ └── mime.types │ │ │ ├── ProtocolInterface.php │ │ │ ├── Text.php │ │ │ ├── Websocket.php │ │ │ └── Ws.php │ │ │ ├── README.md │ │ │ ├── WebServer.php │ │ │ ├── Worker.php │ │ │ └── composer.json │ ├── command │ │ └── ProjectReport.php │ ├── exception │ │ └── Api.php │ └── middleware │ │ └── CORS.php ├── index │ └── controller │ │ ├── Index.php │ │ ├── Notify.php │ │ └── Oauth.php ├── middleware.php └── project │ ├── behavior │ ├── Events.php │ ├── Project.php │ ├── Task.php │ └── Version.php │ ├── common.php │ ├── controller │ ├── Account.php │ ├── Auth.php │ ├── Department.php │ ├── DepartmentMember.php │ ├── Events.php │ ├── File.php │ ├── Index.php │ ├── InviteLink.php │ ├── Login.php │ ├── Menu.php │ ├── Node.php │ ├── Notify.php │ ├── Organization.php │ ├── Project.php │ ├── ProjectCollect.php │ ├── ProjectFeatures.php │ ├── ProjectInfo.php │ ├── ProjectMember.php │ ├── ProjectTemplate.php │ ├── ProjectVersion.php │ ├── SourceLink.php │ ├── Task.php │ ├── TaskMember.php │ ├── TaskStages.php │ ├── TaskStagesTemplate.php │ ├── TaskTag.php │ └── TaskWorkflow.php │ ├── middleware.php │ ├── middleware │ ├── Auth.php │ └── ProjectAuth.php │ └── tags.php ├── build.cmd ├── build.sh ├── composer.json ├── config ├── app.php ├── cache.php ├── config.php ├── console.php ├── const.php ├── cookie.php ├── database.php ├── dingtalk.php ├── jwt.php ├── log.php ├── mail.php ├── session.php ├── sms.php ├── storage.php ├── template.php ├── trace.php ├── upload.php └── wechat.php ├── crontab.bat ├── crontab.sh ├── crontab_stop.sh ├── data ├── 2.0.0 │ └── pearproject.sql ├── 2.1.0 │ ├── 2.0.0 - 2.1.0.sql │ └── pearproject.sql ├── 2.2.0 │ ├── 2.1.0 - 2.2.0.sql │ └── pearproject.sql ├── 2.3.0 │ ├── 2.3.6 - 2.3.0.sql │ └── pearproject.sql ├── 2.4.0 │ ├── 2.3.6-2.4.0.sql │ └── pearproject.sql ├── 2.5.0 │ ├── 2.4.0-2.5.0.sql │ └── pearproject.sql ├── 2.6.0 │ ├── 2.5.8-2.6.0.sql │ └── pearproject.sql ├── 2.8.0 │ ├── 2.6.0-2.8.0.sql │ ├── 2.8.0-2.8.1.sql │ ├── 2.8.1-2.8.4.sql │ ├── 2.8.13-2.8.14.sql │ ├── 2.8.15-2.8.16.sql │ ├── 2.8.16-2.8.17.sql │ ├── 2.8.5-2.8.6.sql │ ├── 2.8.6-2.8.8.sql │ ├── 2.8.8-2.8.9.sql │ ├── 2.8.9-2.8.13.sql │ └── pearproject.sql ├── pearproject.sql └── template │ ├── importMember.xlsx │ └── importTask.xlsx ├── docker ├── README.md ├── php72 │ └── Dockerfile └── php74 │ └── Dockerfile ├── extend ├── controller │ └── BasicApi.php ├── mail │ └── Mail.php ├── message │ └── DingTalk.php ├── service │ ├── ApiService.php │ ├── DataService.php │ ├── DateService.php │ ├── DesService.php │ ├── FileService.php │ ├── HttpService.php │ ├── JwtService.php │ ├── LogService.php │ ├── MessageService.php │ ├── NodeService.php │ ├── RandomService.php │ ├── SoapService.php │ └── ToolsService.php └── sms │ └── Sms.php ├── favicon.ico ├── index.html ├── index.php ├── route ├── demo.php └── route.php ├── server.key ├── server.pem ├── start.sh ├── start_for_win.bat ├── static ├── dist │ ├── css │ │ ├── app.1e0575d4.css │ │ ├── chunk-005cb6a0.dc09594a.css │ │ ├── chunk-1d0b0df0.c661772a.css │ │ ├── chunk-3db39e52.8f164f9a.css │ │ ├── chunk-48aea94b.c661772a.css │ │ ├── chunk-4de77fa6.a1cb6ee7.css │ │ ├── chunk-4e78cf04.cad8d30d.css │ │ ├── chunk-6142efe4.9186476f.css │ │ ├── chunk-7ee89c2d.bce6719c.css │ │ ├── chunk-8401588e.c661772a.css │ │ ├── chunk-b26634d8.bace433e.css │ │ ├── chunk-ba900cec.e1e1530d.css │ │ ├── chunk-c7eee472.a1cb6ee7.css │ │ ├── chunk-vendors.cc7481c6.css │ │ └── user.020d47d3.css │ ├── favicon.ico │ ├── img │ │ ├── 403.41acc6f2.svg │ │ ├── 404.77e1571b.svg │ │ ├── 500.5e6bf3ad.svg │ │ ├── background.a568162c.svg │ │ ├── bell.2dec628d.svg │ │ ├── laba.e793fb2e.svg │ │ └── logo.b83ac094.png │ ├── index.html │ └── js │ │ ├── app.9f1a58b4.js │ │ ├── chunk-005cb6a0.b02f8773.js │ │ ├── chunk-1d0b0df0.202359c3.js │ │ ├── chunk-3a86c7e2.eacd742a.js │ │ ├── chunk-3db39e52.8008f91a.js │ │ ├── chunk-48aea94b.0c46d36e.js │ │ ├── chunk-4de77fa6.b838892d.js │ │ ├── chunk-4e78cf04.ce3ae15e.js │ │ ├── chunk-6142efe4.5d0cff8f.js │ │ ├── chunk-7ee89c2d.88e340a1.js │ │ ├── chunk-8401588e.8410feb8.js │ │ ├── chunk-b26634d8.d56db2c6.js │ │ ├── chunk-ba900cec.6c11f943.js │ │ ├── chunk-c7eee472.bbfacff1.js │ │ ├── chunk-vendors.1462ec98.js │ │ └── user.0ba37607.js └── image │ └── default │ ├── cover.png │ ├── logo.png │ └── project-cover.png ├── stop.sh ├── think ├── thinkphp ├── .gitignore ├── .htaccess ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── base.php ├── composer.json ├── convention.php ├── helper.php ├── lang │ └── zh-cn.php ├── library │ ├── think │ │ ├── App.php │ │ ├── Build.php │ │ ├── Cache.php │ │ ├── Collection.php │ │ ├── Config.php │ │ ├── Console.php │ │ ├── Container.php │ │ ├── Controller.php │ │ ├── Cookie.php │ │ ├── Db.php │ │ ├── Debug.php │ │ ├── Env.php │ │ ├── Error.php │ │ ├── Exception.php │ │ ├── Facade.php │ │ ├── File.php │ │ ├── Hook.php │ │ ├── Lang.php │ │ ├── Loader.php │ │ ├── Log.php │ │ ├── Middleware.php │ │ ├── Model.php │ │ ├── Paginator.php │ │ ├── Process.php │ │ ├── Request.php │ │ ├── Response.php │ │ ├── Route.php │ │ ├── Session.php │ │ ├── Template.php │ │ ├── Url.php │ │ ├── Validate.php │ │ ├── View.php │ │ ├── cache │ │ │ ├── Driver.php │ │ │ └── driver │ │ │ │ ├── File.php │ │ │ │ ├── Lite.php │ │ │ │ ├── Memcache.php │ │ │ │ ├── Memcached.php │ │ │ │ ├── Redis.php │ │ │ │ ├── Sqlite.php │ │ │ │ ├── Wincache.php │ │ │ │ └── Xcache.php │ │ ├── config │ │ │ └── driver │ │ │ │ ├── Ini.php │ │ │ │ ├── Json.php │ │ │ │ └── Xml.php │ │ ├── console │ │ │ ├── Command.php │ │ │ ├── Input.php │ │ │ ├── LICENSE │ │ │ ├── Output.php │ │ │ ├── Table.php │ │ │ ├── bin │ │ │ │ ├── README.md │ │ │ │ └── hiddeninput.exe │ │ │ ├── command │ │ │ │ ├── Build.php │ │ │ │ ├── Clear.php │ │ │ │ ├── Help.php │ │ │ │ ├── Lists.php │ │ │ │ ├── Make.php │ │ │ │ ├── RouteList.php │ │ │ │ ├── RunServer.php │ │ │ │ ├── Version.php │ │ │ │ ├── make │ │ │ │ │ ├── Command.php │ │ │ │ │ ├── Controller.php │ │ │ │ │ ├── Middleware.php │ │ │ │ │ ├── Model.php │ │ │ │ │ ├── Validate.php │ │ │ │ │ └── stubs │ │ │ │ │ │ ├── command.stub │ │ │ │ │ │ ├── controller.api.stub │ │ │ │ │ │ ├── controller.plain.stub │ │ │ │ │ │ ├── controller.stub │ │ │ │ │ │ ├── middleware.stub │ │ │ │ │ │ ├── model.stub │ │ │ │ │ │ └── validate.stub │ │ │ │ └── optimize │ │ │ │ │ ├── Autoload.php │ │ │ │ │ ├── Config.php │ │ │ │ │ ├── Route.php │ │ │ │ │ └── Schema.php │ │ │ ├── input │ │ │ │ ├── Argument.php │ │ │ │ ├── Definition.php │ │ │ │ └── Option.php │ │ │ └── output │ │ │ │ ├── Ask.php │ │ │ │ ├── Descriptor.php │ │ │ │ ├── Formatter.php │ │ │ │ ├── Question.php │ │ │ │ ├── descriptor │ │ │ │ └── Console.php │ │ │ │ ├── driver │ │ │ │ ├── Buffer.php │ │ │ │ ├── Console.php │ │ │ │ └── Nothing.php │ │ │ │ ├── formatter │ │ │ │ ├── Stack.php │ │ │ │ └── Style.php │ │ │ │ └── question │ │ │ │ ├── Choice.php │ │ │ │ └── Confirmation.php │ │ ├── db │ │ │ ├── Builder.php │ │ │ ├── Connection.php │ │ │ ├── Expression.php │ │ │ ├── Query.php │ │ │ ├── Where.php │ │ │ ├── builder │ │ │ │ ├── Mysql.php │ │ │ │ ├── Pgsql.php │ │ │ │ ├── Sqlite.php │ │ │ │ └── Sqlsrv.php │ │ │ ├── connector │ │ │ │ ├── Mysql.php │ │ │ │ ├── Pgsql.php │ │ │ │ ├── Sqlite.php │ │ │ │ ├── Sqlsrv.php │ │ │ │ └── pgsql.sql │ │ │ └── exception │ │ │ │ ├── BindParamException.php │ │ │ │ ├── DataNotFoundException.php │ │ │ │ └── ModelNotFoundException.php │ │ ├── debug │ │ │ ├── Console.php │ │ │ └── Html.php │ │ ├── exception │ │ │ ├── ClassNotFoundException.php │ │ │ ├── DbException.php │ │ │ ├── ErrorException.php │ │ │ ├── Handle.php │ │ │ ├── HttpException.php │ │ │ ├── HttpResponseException.php │ │ │ ├── PDOException.php │ │ │ ├── RouteNotFoundException.php │ │ │ ├── TemplateNotFoundException.php │ │ │ ├── ThrowableError.php │ │ │ └── ValidateException.php │ │ ├── facade │ │ │ ├── App.php │ │ │ ├── Build.php │ │ │ ├── Cache.php │ │ │ ├── Config.php │ │ │ ├── Cookie.php │ │ │ ├── Debug.php │ │ │ ├── Env.php │ │ │ ├── Hook.php │ │ │ ├── Lang.php │ │ │ ├── Log.php │ │ │ ├── Middleware.php │ │ │ ├── Request.php │ │ │ ├── Response.php │ │ │ ├── Route.php │ │ │ ├── Session.php │ │ │ ├── Template.php │ │ │ ├── Url.php │ │ │ ├── Validate.php │ │ │ └── View.php │ │ ├── log │ │ │ └── driver │ │ │ │ ├── File.php │ │ │ │ └── Socket.php │ │ ├── model │ │ │ ├── Collection.php │ │ │ ├── Pivot.php │ │ │ ├── Relation.php │ │ │ ├── concern │ │ │ │ ├── Attribute.php │ │ │ │ ├── Conversion.php │ │ │ │ ├── ModelEvent.php │ │ │ │ ├── RelationShip.php │ │ │ │ ├── SoftDelete.php │ │ │ │ └── TimeStamp.php │ │ │ └── relation │ │ │ │ ├── BelongsTo.php │ │ │ │ ├── BelongsToMany.php │ │ │ │ ├── HasMany.php │ │ │ │ ├── HasManyThrough.php │ │ │ │ ├── HasOne.php │ │ │ │ ├── MorphMany.php │ │ │ │ ├── MorphOne.php │ │ │ │ ├── MorphTo.php │ │ │ │ └── OneToOne.php │ │ ├── paginator │ │ │ └── driver │ │ │ │ └── Bootstrap.php │ │ ├── process │ │ │ ├── Builder.php │ │ │ ├── Utils.php │ │ │ ├── exception │ │ │ │ ├── Faild.php │ │ │ │ ├── Failed.php │ │ │ │ └── Timeout.php │ │ │ └── pipes │ │ │ │ ├── Pipes.php │ │ │ │ ├── Unix.php │ │ │ │ └── Windows.php │ │ ├── response │ │ │ ├── Download.php │ │ │ ├── Json.php │ │ │ ├── Jsonp.php │ │ │ ├── Jump.php │ │ │ ├── Redirect.php │ │ │ ├── View.php │ │ │ └── Xml.php │ │ ├── route │ │ │ ├── AliasRule.php │ │ │ ├── Dispatch.php │ │ │ ├── Domain.php │ │ │ ├── Resource.php │ │ │ ├── Rule.php │ │ │ ├── RuleGroup.php │ │ │ ├── RuleItem.php │ │ │ ├── RuleName.php │ │ │ └── dispatch │ │ │ │ ├── Callback.php │ │ │ │ ├── Controller.php │ │ │ │ ├── Module.php │ │ │ │ ├── Redirect.php │ │ │ │ ├── Response.php │ │ │ │ ├── Url.php │ │ │ │ └── View.php │ │ ├── session │ │ │ └── driver │ │ │ │ ├── Memcache.php │ │ │ │ ├── Memcached.php │ │ │ │ └── Redis.php │ │ ├── template │ │ │ ├── TagLib.php │ │ │ ├── driver │ │ │ │ └── File.php │ │ │ └── taglib │ │ │ │ └── Cx.php │ │ ├── validate │ │ │ └── ValidateRule.php │ │ └── view │ │ │ └── driver │ │ │ ├── Php.php │ │ │ └── Think.php │ └── traits │ │ └── controller │ │ └── Jump.php ├── logo.png ├── phpunit.xml.dist └── tpl │ ├── default_index.tpl │ ├── dispatch_jump.tpl │ ├── page_trace.tpl │ └── think_exception.tpl └── vendor.zip /.env.example: -------------------------------------------------------------------------------- 1 | [app] 2 | app_name = PearProject 3 | app_version = 2.8.16 4 | app_host = '' 5 | app_debug = false 6 | app_trace = false 7 | 8 | [database] 9 | hostname = 127.0.0.1 10 | database = pearproject 11 | username = root 12 | password = root 13 | hostport = 3306 14 | prefix = pear_ 15 | debug = true 16 | 17 | [config] 18 | notice_push = false 19 | dingtalk_push = false 20 | mail_push = false 21 | 22 | 23 | [sms] 24 | debug = true 25 | 26 | [mail] 27 | open = false 28 | Host = smtp.example.com 29 | SMTPAuth = true 30 | Username = example@example.com 31 | Password = example 32 | SMTPSecure = tls 33 | Port = 25 34 | 35 | [cache] 36 | type = redis 37 | path = ./runtime/cache 38 | expire = 0 39 | 40 | [redis] 41 | host = 127.0.0.1 42 | port = 6379 43 | password = 44 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=php 2 | *.css linguist-language=php 3 | *.html linguist-language=php 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | !.gitattributes 3 | *.DS_Store 4 | *.idea 5 | *.svn 6 | *.git 7 | .env 8 | /runtime 9 | /log 10 | /vendor 11 | /data/install.lock 12 | /static/upload 13 | !composer.json 14 | /composer.lock 15 | /config/dingtalk.php 16 | /config/mail.php 17 | -------------------------------------------------------------------------------- /.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Options +FollowSymlinks -Multiviews 3 | RewriteEngine On 4 | 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | RewriteCond %{REQUEST_FILENAME} !-f 7 | RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] 8 | SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 9 | 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PearProject 2 | 3 | **Pear,梨子项目管理系统** 4 | 5 | **相关资料:https://www.yuque.com/bzsxmz** 6 | 7 | **安装指南:https://www.yuque.com/bzsxmz/siuq1w/kggzna** 8 | 9 | 需要配合[前端项目](https://github.com/a54552239/pearProject)使用,链接:https://github.com/a54552239/pearProject 10 | 11 | 有不明白的地方的可以加群:275264059,或者联系我,QQ:545522390 12 | ### 演示地址 13 | > [https://home.vilson.xyz](https://home.vilson.xyz) 14 | 15 | ### 登录 ### 16 | 账号:123456 密码:123456 17 | 18 | ### 友情链接 ### 19 | 20 | **JAVA版本:https://gitee.com/wulon/mk-teamwork-server** 21 | 22 | ### 界面截图 ### 23 |  24 | 25 |  26 | 27 |  28 | 29 |  30 | 31 |  32 | 33 |  34 | 35 |  36 | 37 |  38 | 39 |  40 | 41 |  42 | 43 |  44 | 45 |  46 | 47 |  48 | 49 | ### 功能设计 ### 50 |  51 | 52 | ### 鼓励一下 ### 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /application/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all -------------------------------------------------------------------------------- /application/command.php: -------------------------------------------------------------------------------- 1 | 'app\common\command\ProjectReport', 4 | ]; 5 | -------------------------------------------------------------------------------- /application/common/Model/Areas.php: -------------------------------------------------------------------------------- 1 | get('areadData'); 22 | if (!$list) { 23 | $list = self::where('id > 100000')->order('id asc')->select()->toArray(); 24 | Cache::store('redis')->set('areadData', $list); 25 | } 26 | if ($list) { 27 | $list = ToolsService::arr2tree($list, 'ID', 'ParentId'); 28 | } 29 | return $list; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /application/common/Model/Collection.php: -------------------------------------------------------------------------------- 1 | $code, 'type' => 'task', 'member_code' => $memberCode])->find(); 26 | if ($star && !$stared) { 27 | $data = [ 28 | 'create_time' => nowTime(), 29 | 'code' => createUniqueCode('collection'), 30 | 'create_by' => $memberCode, 31 | 'source_code' => $code, 32 | 'type' => 'task', 33 | 'member_code' => $memberCode, 34 | ]; 35 | return self::create($data); 36 | } 37 | if (!$star) { 38 | return self::where(['source_code' => $code, 'type' => 'task', 'member_code' => $memberCode])->delete(); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /application/common/Model/EventsLog.php: -------------------------------------------------------------------------------- 1 | $id]; 20 | $result = ProjectAuthNode::where($where)->delete(); 21 | if ($result !== false) { 22 | return true; 23 | } 24 | } 25 | return false; 26 | } 27 | 28 | public function getIdAttr($value) 29 | { 30 | return strval($value); 31 | } 32 | 33 | public function getStatusTextAttr($value, $data) 34 | { 35 | $status = [0 => '禁用', 1 => '使用中']; 36 | return $status[$data['status']]; 37 | } 38 | 39 | public function getCanDeleteAttr($value, $data) 40 | { 41 | if ($data['type'] == 'admin' || $data['type'] == 'member') { 42 | return 0; 43 | } 44 | return 1; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /application/common/Model/ProjectAuthNode.php: -------------------------------------------------------------------------------- 1 | $projectCode, 'deleted' => 0])->find(); 27 | if (!$project) { 28 | throw new \Exception('该项目已失效', 1); 29 | } 30 | $hasCollected = self::where(['member_code' => $memberCode, 'project_code' => $projectCode])->find(); 31 | if ($type == 'collect') { 32 | if ($hasCollected) { 33 | throw new \Exception('该项目已收藏', 1); 34 | } 35 | $data = [ 36 | 'member_code' => $memberCode, 37 | 'project_code' => $projectCode, 38 | 'create_time' => nowTime() 39 | ]; 40 | return self::create($data); 41 | } else { 42 | if (!$hasCollected) { 43 | throw new \Exception('尚未收藏该项目', 1); 44 | } 45 | return self::where(['member_code' => $memberCode, 'project_code' => $projectCode])->delete(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /application/common/Model/ProjectInfo.php: -------------------------------------------------------------------------------- 1 | $projectCode, 'deleted' => 0])->field('id')->find(); 26 | if (!$project) { 27 | return error(3, '该项目已失效'); 28 | } 29 | $data = [ 30 | 'create_time' => nowTime(), 31 | 'code' => createUniqueCode('ProjectInfo'), 32 | 'project_code' => $projectCode, 33 | 'description' => $description, 34 | 'organization_code' => $organizationCode, 35 | 'value' => trim($value), 36 | 'sort' => $sort, 37 | 'name' => trim($name), 38 | ]; 39 | $result = self::create($data)->toArray(); 40 | return $result; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /application/common/Model/ProjectLog.php: -------------------------------------------------------------------------------- 1 | select(); 12 | $data = []; 13 | foreach ($config as $item) { 14 | $data[$item['name']] = $item['value']; 15 | } 16 | return $data; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /application/common/Model/SystemLog.php: -------------------------------------------------------------------------------- 1 | group('action')->column('action'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /application/common/Model/TaskLike.php: -------------------------------------------------------------------------------- 1 | $code, 'member_code' => $memberCode])->find(); 28 | if ($like && !$liked) { 29 | $data = [ 30 | 'create_time' => nowTime(), 31 | 'create_by' => $memberCode, 32 | 'task_code' => $code, 33 | 'member_code' => $memberCode, 34 | ]; 35 | return self::create($data); 36 | } 37 | if (!$like) { 38 | return self::where(['task_code' => $code, 'member_code' => $memberCode])->delete(); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /application/common/Model/TaskToTag.php: -------------------------------------------------------------------------------- 1 | belongsTo('taskTag', 'tag_code', 'code'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /application/common/Model/TaskWorkTime.php: -------------------------------------------------------------------------------- 1 | $taskCode, 'deleted' => 0])->field('id')->find(); 36 | if (!$task) { 37 | return error(2, '该任务已失效'); 38 | } 39 | if (!$memberCode) { 40 | return error(3, '请指定成员'); 41 | } 42 | if (!$beginTime) { 43 | return error(4, '请选择开始时间'); 44 | } 45 | if (!$num || $num < 0 || !is_numeric($num)) { 46 | return error(6, '请输入有效工时'); 47 | } 48 | $data = [ 49 | 'create_time' => nowTime(), 50 | 'code' => createUniqueCode('TaskWorkTime'), 51 | 'task_code' => $taskCode, 52 | 'num' => $num, 53 | 'content' => $content, 54 | 'begin_time' => $beginTime, 55 | 'member_code' => $memberCode, 56 | ]; 57 | $result = self::create($data)->toArray(); 58 | return $result; 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /application/common/Model/TaskWorkflow.php: -------------------------------------------------------------------------------- 1 | nowTime(), 20 | 'code' => createUniqueCode('TaskWorkflow'), 21 | 'project_code' => $projectCode, 22 | 'organization_code' => $organizationCode, 23 | 'name' => trim($name), 24 | ]; 25 | return self::create($data); 26 | } 27 | 28 | public static function del($code) 29 | { 30 | Db::startTrans(); 31 | try { 32 | self::where(['code' => $code])->delete(); 33 | TaskWorkflowRule::where(['workflow_code' => $code])->delete(); 34 | } catch (\Exception $exception) { 35 | Db::rollback(); 36 | return error(1, $exception->getMessage()); 37 | } 38 | Db::commit(); 39 | return true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/Events.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | 15 | /** 16 | * 用于检测业务代码死循环或者长时间阻塞等问题 17 | * 如果发现业务卡死,可以将下面declare打开(去掉//注释),并执行php start.php reload 18 | * 然后观察一段时间workerman.log看是否有process_timeout异常 19 | */ 20 | 21 | //declare(ticks=1); 22 | 23 | use GatewayWorker\Lib\Gateway; 24 | 25 | /** 26 | * 主逻辑 27 | * 主要是处理 onConnect onMessage onClose 三个方法 28 | * onConnect 和 onClose 如果不需要可以不用实现并删除 29 | */ 30 | class Events 31 | { 32 | /** 33 | * 当客户端连接时触发 34 | * 如果业务不需此回调可以删除onConnect 35 | * @param int $client_id 连接id 36 | * @throws Exception 37 | */ 38 | public static function onConnect($client_id) 39 | { 40 | // 向所有人发送 41 | //getAllUidCount 42 | $data = ['action' => 'connect', 'data' => ['client_id' => $client_id, 'online' => Gateway::getAllClientCount()]]; 43 | Gateway::sendToAll(json_encode($data)); 44 | } 45 | 46 | /** 47 | * 当客户端发来消息时触发 48 | * @param int $client_id 连接id 49 | * @param mixed $message 具体消息 50 | * @throws Exception 51 | */ 52 | public static function onMessage($client_id, $message) 53 | { 54 | // 向所有人发送 55 | $data = ['action' => 'onMessage', 'data' => ['client_id' => $client_id, 'msg' => "$client_id said $message\r\n"]]; 56 | Gateway::sendToAll(json_encode($data)); 57 | } 58 | 59 | /** 60 | * 当用户断开连接时触发 61 | * @param int $client_id 连接id 62 | * @throws Exception 63 | */ 64 | public static function onClose($client_id) 65 | { 66 | // 向所有人发送 67 | $data = ['action' => 'onClose', 'data' => ['client_id' => $client_id, 'online' => Gateway::getAllClientCount()]]; 68 | GateWay::sendToAll(json_encode($data)); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "workerman/gateway-worker-for-win-demo", 3 | "keywords": ["distributed","communication"], 4 | "homepage": "http://www.workerman.net", 5 | "license" : "MIT", 6 | "require": { 7 | "workerman/gateway-worker" : ">=3.0.0" 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/config.php: -------------------------------------------------------------------------------- 1 | name = 'crontab'; 16 | $doneTicket = []; 17 | $task->onWorkerStart = function ($task) { 18 | $timerId = Timer::add(1, 'checkTime'); 19 | }; 20 | 21 | // 运行worker 22 | Worker::runAll(); 23 | 24 | function checkTime() 25 | { 26 | global $doneTicket; 27 | $now = time(); 28 | $dateTime = date('H:i', $now); 29 | //每天23:55统计项目情况 30 | if ($dateTime == '23:55' && (!isset($doneTicket['setProjectReportDate']) || date('Y-m-d', $now) != $doneTicket['setProjectReportDate'])) { 31 | setProjectReport(); 32 | } 33 | } 34 | 35 | function setProjectReport() 36 | { 37 | global $client,$doneTicket; 38 | $doneTicket['setProjectReportDate'] = date('Y-m-d', time()); 39 | //命令行模式 40 | // exec("php think projectReport",$out); 41 | // echo $out[0]; 42 | 43 | //http模式 44 | $res = $client->request('GET', SITE_URL . '/index.php/project/project/_setDayilyProejctReport'); 45 | echo $res->getBody(); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/start_businessworker.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | use Workerman\Worker; 15 | use Workerman\WebServer; 16 | use GatewayWorker\Gateway; 17 | use GatewayWorker\BusinessWorker; 18 | use Workerman\Autoloader; 19 | require_once __DIR__ . '/vendor/autoload.php'; 20 | require_once __DIR__ . '/config.php'; 21 | 22 | // 自动加载类 23 | 24 | // bussinessWorker 进程 25 | $worker = new BusinessWorker(); 26 | // worker名称 27 | $worker->name = 'YourAppBusinessWorker'; 28 | // bussinessWorker进程数量 29 | $worker->count = 4; 30 | // 服务注册地址 31 | $worker->registerAddress = SERVER_ADDRESS . ':' . SERVER_PORT; 32 | 33 | // 如果不是在根目录启动,则运行runAll方法 34 | if(!defined('GLOBAL_START')) 35 | { 36 | Worker::runAll(); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/start_register.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | 15 | use Workerman\Worker; 16 | use GatewayWorker\Register; 17 | 18 | require_once __DIR__ . '/vendor/autoload.php'; 19 | require_once __DIR__ . '/config.php'; 20 | 21 | 22 | // 自动加载类 23 | 24 | // register 必须是text协议 25 | $register = new Register('http://' . SERVER_ADDRESS . ':' . SERVER_PORT); 26 | 27 | // 如果不是在根目录启动,则运行runAll方法 28 | if (!defined('GLOBAL_START')) { 29 | Worker::runAll(); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/autoload.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/workerman/workerman'), 10 | 'GatewayWorker\\' => array($vendorDir . '/workerman/gateway-worker/src'), 11 | ); 12 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 27 | if ($useStaticLoader) { 28 | require_once __DIR__ . '/autoload_static.php'; 29 | 30 | call_user_func(\Composer\Autoload\ComposerStaticInitf4e34532a1d845b06a4253c44ea489ec::getInitializer($loader)); 31 | } else { 32 | $map = require __DIR__ . '/autoload_namespaces.php'; 33 | foreach ($map as $namespace => $path) { 34 | $loader->set($namespace, $path); 35 | } 36 | 37 | $map = require __DIR__ . '/autoload_psr4.php'; 38 | foreach ($map as $namespace => $path) { 39 | $loader->setPsr4($namespace, $path); 40 | } 41 | 42 | $classMap = require __DIR__ . '/autoload_classmap.php'; 43 | if ($classMap) { 44 | $loader->addClassMap($classMap); 45 | } 46 | } 47 | 48 | $loader->register(true); 49 | 50 | return $loader; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | 11 | array ( 12 | 'Workerman\\' => 10, 13 | ), 14 | 'G' => 15 | array ( 16 | 'GatewayWorker\\' => 14, 17 | ), 18 | ); 19 | 20 | public static $prefixDirsPsr4 = array ( 21 | 'Workerman\\' => 22 | array ( 23 | 0 => __DIR__ . '/..' . '/workerman/workerman', 24 | ), 25 | 'GatewayWorker\\' => 26 | array ( 27 | 0 => __DIR__ . '/..' . '/workerman/gateway-worker/src', 28 | ), 29 | ); 30 | 31 | public static function getInitializer(ClassLoader $loader) 32 | { 33 | return \Closure::bind(function () use ($loader) { 34 | $loader->prefixLengthsPsr4 = ComposerStaticInitf4e34532a1d845b06a4253c44ea489ec::$prefixLengthsPsr4; 35 | $loader->prefixDirsPsr4 = ComposerStaticInitf4e34532a1d845b06a4253c44ea489ec::$prefixDirsPsr4; 36 | 37 | }, null, ClassLoader::class); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/gateway-worker/.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .project 3 | .settings 4 | .idea -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/gateway-worker/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2009-2015 walkor and contributors (see https://github.com/walkor/workerman/contributors) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/gateway-worker/README.md: -------------------------------------------------------------------------------- 1 | GatewayWorker 2 | ================= 3 | 4 | GatewayWorker基于[Workerman](https://github.com/walkor/Workerman)开发的一个项目框架,用于快速开发长连接应用,例如app推送服务端、即时IM服务端、游戏服务端、物联网、智能家居等等。 5 | 6 | GatewayWorker使用经典的Gateway和Worker进程模型。Gateway进程负责维持客户端连接,并转发客户端的数据给Worker进程处理;Worker进程负责处理实际的业务逻辑,并将结果推送给对应的客户端。Gateway服务和Worker服务可以分开部署在不同的服务器上,实现分布式集群。 7 | 8 | GatewayWorker提供非常方便的API,可以全局广播数据、可以向某个群体广播数据、也可以向某个特定客户端推送数据。配合Workerman的定时器,也可以定时推送数据。 9 | 10 | 快速开始 11 | ====== 12 | 开发者可以从一个简单的demo开始(demo中包含了GatewayWorker内核,以及start_gateway.php start_business.php等启动入口文件) 13 | [点击这里下载demo](http://www.workerman.net/download/GatewayWorker.zip)。 14 | demo说明见源码readme。 15 | 16 | 手册 17 | ======= 18 | http://www.workerman.net/gatewaydoc/ 19 | 20 | 安装内核 21 | ======= 22 | 23 | 只安装GatewayWorker内核文件(不包含start_gateway.php start_businessworker.php等启动入口文件) 24 | ``` 25 | composer require workerman/gateway-worker 26 | ``` 27 | 28 | 使用GatewayWorker开发的项目 29 | ======= 30 | ## [tadpole](http://kedou.workerman.net/) 31 | [Live demo](http://kedou.workerman.net/) 32 | [Source code](https://github.com/walkor/workerman) 33 |  34 | 35 | ## [chat room](http://chat.workerman.net/) 36 | [Live demo](http://chat.workerman.net/) 37 | [Source code](https://github.com/walkor/workerman-chat) 38 |  39 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/gateway-worker/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "workerman/gateway-worker", 3 | "keywords": ["distributed","communication"], 4 | "homepage": "http://www.workerman.net", 5 | "license" : "MIT", 6 | "require": { 7 | "workerman/workerman" : ">=3.1.8" 8 | }, 9 | "autoload": { 10 | "psr-4": {"GatewayWorker\\": "./src"} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/.gitignore: -------------------------------------------------------------------------------- 1 | logs 2 | .buildpath 3 | .project 4 | .settings 5 | .idea 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/Events/React/ExtEventLoop.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Events\React; 15 | 16 | /** 17 | * Class ExtEventLoop 18 | * @package Workerman\Events\React 19 | */ 20 | class ExtEventLoop extends Base 21 | { 22 | 23 | public function __construct() 24 | { 25 | $this->_eventLoop = new \React\EventLoop\ExtEventLoop(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/Events/React/ExtLibEventLoop.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Events\React; 15 | use Workerman\Events\EventInterface; 16 | 17 | /** 18 | * Class ExtLibEventLoop 19 | * @package Workerman\Events\React 20 | */ 21 | class ExtLibEventLoop extends Base 22 | { 23 | public function __construct() 24 | { 25 | $this->_eventLoop = new \React\EventLoop\ExtLibeventLoop(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/Events/React/StreamSelectLoop.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Events\React; 15 | 16 | /** 17 | * Class StreamSelectLoop 18 | * @package Workerman\Events\React 19 | */ 20 | class StreamSelectLoop extends Base 21 | { 22 | public function __construct() 23 | { 24 | $this->_eventLoop = new \React\EventLoop\StreamSelectLoop(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/Lib/Constants.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | 15 | // Date.timezone 16 | if (!ini_get('date.timezone')) { 17 | date_default_timezone_set('Asia/Shanghai'); 18 | } 19 | // Display errors. 20 | ini_set('display_errors', 'on'); 21 | // Reporting all. 22 | error_reporting(E_ALL); 23 | 24 | // Reset opcache. 25 | if (function_exists('opcache_reset')) { 26 | opcache_reset(); 27 | } 28 | 29 | // For onError callback. 30 | define('WORKERMAN_CONNECT_FAIL', 1); 31 | // For onError callback. 32 | define('WORKERMAN_SEND_FAIL', 2); 33 | 34 | // Define OS Type 35 | define('OS_TYPE_LINUX', 'linux'); 36 | define('OS_TYPE_WINDOWS', 'windows'); 37 | 38 | // Compatible with php7 39 | if(!class_exists('Error')) 40 | { 41 | class Error extends Exception 42 | { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2009-2015 walkor and contributors (see https://github.com/walkor/workerman/contributors) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/Protocols/Frame.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Protocols; 15 | 16 | use Workerman\Connection\TcpConnection; 17 | 18 | /** 19 | * Frame Protocol. 20 | */ 21 | class Frame 22 | { 23 | /** 24 | * Check the integrity of the package. 25 | * 26 | * @param string $buffer 27 | * @param TcpConnection $connection 28 | * @return int 29 | */ 30 | public static function input($buffer, TcpConnection $connection) 31 | { 32 | if (strlen($buffer) < 4) { 33 | return 0; 34 | } 35 | $unpack_data = unpack('Ntotal_length', $buffer); 36 | return $unpack_data['total_length']; 37 | } 38 | 39 | /** 40 | * Decode. 41 | * 42 | * @param string $buffer 43 | * @return string 44 | */ 45 | public static function decode($buffer) 46 | { 47 | return substr($buffer, 4); 48 | } 49 | 50 | /** 51 | * Encode. 52 | * 53 | * @param string $buffer 54 | * @return string 55 | */ 56 | public static function encode($buffer) 57 | { 58 | $total_length = 4 + strlen($buffer); 59 | return pack('N', $total_length) . $buffer; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/Protocols/ProtocolInterface.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Protocols; 15 | 16 | use Workerman\Connection\ConnectionInterface; 17 | 18 | /** 19 | * Protocol interface 20 | */ 21 | interface ProtocolInterface 22 | { 23 | /** 24 | * Check the integrity of the package. 25 | * Please return the length of package. 26 | * If length is unknow please return 0 that mean wating more data. 27 | * If the package has something wrong please return false the connection will be closed. 28 | * 29 | * @param ConnectionInterface $connection 30 | * @param string $recv_buffer 31 | * @return int|false 32 | */ 33 | public static function input($recv_buffer, ConnectionInterface $connection); 34 | 35 | /** 36 | * Decode package and emit onMessage($message) callback, $message is the result that decode returned. 37 | * 38 | * @param ConnectionInterface $connection 39 | * @param string $recv_buffer 40 | * @return mixed 41 | */ 42 | public static function decode($recv_buffer, ConnectionInterface $connection); 43 | 44 | /** 45 | * Encode package brefore sending to client. 46 | * 47 | * @param ConnectionInterface $connection 48 | * @param mixed $data 49 | * @return string 50 | */ 51 | public static function encode($data, ConnectionInterface $connection); 52 | } 53 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/Protocols/Text.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright walkor 11 | * @link http://www.workerman.net/ 12 | * @license http://www.opensource.org/licenses/mit-license.php MIT License 13 | */ 14 | namespace Workerman\Protocols; 15 | 16 | use Workerman\Connection\TcpConnection; 17 | 18 | /** 19 | * Text Protocol. 20 | */ 21 | class Text 22 | { 23 | /** 24 | * Check the integrity of the package. 25 | * 26 | * @param string $buffer 27 | * @param TcpConnection $connection 28 | * @return int 29 | */ 30 | public static function input($buffer, TcpConnection $connection) 31 | { 32 | // Judge whether the package length exceeds the limit. 33 | if (strlen($buffer) >= $connection->maxPackageSize) { 34 | $connection->close(); 35 | return 0; 36 | } 37 | // Find the position of "\n". 38 | $pos = strpos($buffer, "\n"); 39 | // No "\n", packet length is unknown, continue to wait for the data so return 0. 40 | if ($pos === false) { 41 | return 0; 42 | } 43 | // Return the current package length. 44 | return $pos + 1; 45 | } 46 | 47 | /** 48 | * Encode. 49 | * 50 | * @param string $buffer 51 | * @return string 52 | */ 53 | public static function encode($buffer) 54 | { 55 | // Add "\n" 56 | return $buffer . "\n"; 57 | } 58 | 59 | /** 60 | * Decode. 61 | * 62 | * @param string $buffer 63 | * @return string 64 | */ 65 | public static function decode($buffer) 66 | { 67 | // Remove "\n" 68 | return rtrim($buffer, "\r\n"); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /application/common/Plugins/GateWayWorker/vendor/workerman/workerman/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "workerman/workerman", 3 | "type": "library", 4 | "keywords": [ 5 | "event-loop", 6 | "asynchronous" 7 | ], 8 | "homepage": "http://www.workerman.net", 9 | "license": "MIT", 10 | "description": "An asynchronous event driven PHP framework for easily building fast, scalable network applications.", 11 | "authors": [ 12 | { 13 | "name": "walkor", 14 | "email": "walkor@workerman.net", 15 | "homepage": "http://www.workerman.net", 16 | "role": "Developer" 17 | } 18 | ], 19 | "support": { 20 | "email": "walkor@workerman.net", 21 | "issues": "https://github.com/walkor/workerman/issues", 22 | "forum": "http://wenda.workerman.net/", 23 | "wiki": "http://doc3.workerman.net/index.html", 24 | "source": "https://github.com/walkor/workerman" 25 | }, 26 | "require": { 27 | "php": ">=5.3" 28 | }, 29 | "suggest": { 30 | "ext-event": "For better performance. " 31 | }, 32 | "autoload": { 33 | "psr-4": { 34 | "Workerman\\": "./" 35 | } 36 | }, 37 | "minimum-stability": "dev" 38 | } 39 | -------------------------------------------------------------------------------- /application/common/command/ProjectReport.php: -------------------------------------------------------------------------------- 1 | setName('ProjectReport'); 14 | } 15 | 16 | protected function execute(Input $input, Output $output) 17 | { 18 | \app\common\Model\ProjectReport::setDayilyProejctReport(); 19 | $output->writeln('success_at ' . nowTime()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /application/common/exception/Api.php: -------------------------------------------------------------------------------- 1 | getMessage(),[],$e->getCode()); 15 | 16 | // 参数验证错误 17 | if ($e instanceof ValidateException) { 18 | ToolsService::error($e->getError(), $e->getError(), $e->getCode()); 19 | return json($e->getError(), 422); 20 | } 21 | 22 | // 请求异常 23 | if ($e instanceof HttpException && request()->isAjax()) { 24 | return response($e->getMessage(), $e->getStatusCode()); 25 | } 26 | var_dump($e);die; 27 | 28 | // 其他错误交给系统处理 29 | return parent::render($e); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /application/common/middleware/CORS.php: -------------------------------------------------------------------------------- 1 | header('Origin'); 23 | $Headers = $request->header('Access-Control-Request-Headers'); 24 | header('Access-Control-Allow-Origin: ' . $Origin); 25 | header('Access-Control-Allow-Headers: ' . $Headers); 26 | header('Access-Control-Allow-Credentials:true'); 27 | header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); 28 | header('Access-Control-Max-Age: 1728000'); 29 | header('Content-Type:text/plain charset=UTF-8'); 30 | if (strtoupper($request->method()) == "OPTIONS") { 31 | header('HTTP/1.0 204 No Content'); 32 | header('Content-Length:0'); 33 | header('status:204'); 34 | exit(); 35 | } 36 | return $next($request); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /application/index/controller/Notify.php: -------------------------------------------------------------------------------- 1 | model) { 16 | $this->model = new \app\common\Model\Notify(); 17 | } 18 | } 19 | 20 | /** 21 | * 22 | * 列表 23 | * @return void 24 | * @throws \think\exception\DbException 25 | */ 26 | public function listTypeFormat() 27 | { 28 | $where = []; 29 | $params = Request::post(); 30 | if (isset($params['keyword']) && $params['keyword'] !== '') { 31 | $where[] = ['content', 'like', "%{$params['keyword']}%"]; 32 | } 33 | foreach (['to', 'type'] as $key) { 34 | if (isset($params[$key]) && $params[$key] !== '') { 35 | $where[] = [$key, '=', $params[$key]]; 36 | }; 37 | } 38 | $list = $this->model->listTypeFormat($where); 39 | $this->success('', $list); 40 | } 41 | 42 | public function noReads() 43 | { 44 | $projectId = getCurrentOrganizationCode(); 45 | $list = $this->model->listTypeFormat(['is_read' => 0, 'to' => 0], 5); 46 | $this->success('', $list); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /application/middleware.php: -------------------------------------------------------------------------------- 1 | checkExt(strtolower(sysconf('storage_local_exts')))) { 21 | \exception('不支持该文件类型', 1); 22 | } 23 | $path = $path_name; 24 | $info = $file->move($path, $saveName); 25 | if ($info) { 26 | $filename = str_replace('\\', '/', $path . '/' . $info->getSaveName()); 27 | // $image = \think\Image::open($info->getRealPath()); 28 | // $image->thumb($image->width() / 2, $image->height() / 2)->save($filename);//压缩 29 | $site_url = FileService::getFileUrl($filename, 'local'); 30 | $fileInfo = FileService::save($filename, file_get_contents($site_url)); 31 | if ($fileInfo) { 32 | return ['base_url' => $fileInfo['key'], 'url' => $fileInfo['url'], 'filename' => $file->getInfo('name'), 'uploadInfo' => $info]; 33 | } 34 | } 35 | return false; 36 | } 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /application/project/controller/InviteLink.php: -------------------------------------------------------------------------------- 1 | model) { 17 | $this->model = new \app\common\Model\InviteLink(); 18 | } 19 | } 20 | 21 | 22 | /** 23 | * 新增 24 | * 25 | * @param Request $request 26 | * @return void 27 | */ 28 | public function save(Request $request) 29 | { 30 | $data = $request::only('inviteType,sourceCode'); 31 | 32 | 33 | try { 34 | $result = \app\common\Model\InviteLink::createInvite($data['inviteType'], $data['sourceCode']); 35 | } catch (\Exception $e) { 36 | $this->error($e->getMessage()); 37 | } 38 | if ($result) { 39 | $this->success('', $result); 40 | } 41 | $this->error("操作失败,请稍候再试!"); 42 | } 43 | 44 | /** 45 | * 获取信息 46 | * 47 | * @param Request $request 48 | * @return void 49 | */ 50 | public function _read(Request $request) 51 | { 52 | $info = \app\common\Model\InviteLink::getInviteDetail($request::post('inviteCode')); 53 | $this->success('', $info); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /application/project/controller/ProjectCollect.php: -------------------------------------------------------------------------------- 1 | model) { 19 | $this->model = new \app\common\Model\ProjectCollection(); 20 | } 21 | } 22 | 23 | /** 24 | * 收藏项目 25 | */ 26 | public function collect() 27 | { 28 | $data = Request::only('projectCode,type'); 29 | if (!$data['projectCode']) { 30 | $this->error('请先选择项目'); 31 | } 32 | $project = \app\common\Model\Project::where(['code' => $data['projectCode']])->field('code')->find(); 33 | try { 34 | $member = getCurrentMember(); 35 | $this->model->collect($member['code'], $project['code'], $data['type']); 36 | } catch (\Exception $e) { 37 | $this->error($e->getMessage(), $e->getCode());; 38 | } 39 | $str = $data['type'] == 'collect' ? '加入收藏成功' : '取消收藏成功'; 40 | $this->success($str); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /application/project/controller/SourceLink.php: -------------------------------------------------------------------------------- 1 | model) { 29 | $this->model = new \app\common\Model\SourceLink(); 30 | } 31 | } 32 | 33 | 34 | /** 35 | * 删除资源 36 | * @return void 37 | * @throws \Exception 38 | */ 39 | public function delete() 40 | { 41 | $code = Request::post('sourceCode'); 42 | if (!$code) { 43 | $this->error("资源不存在"); 44 | } 45 | $this->model->deleteSource($code); 46 | $this->success(''); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /application/project/middleware.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'app\\project\\behavior\\Task' 5 | ], 6 | 'project' => [ 7 | 'app\\project\\behavior\\Project' 8 | ], 9 | 'version' => [ 10 | 'app\\project\\behavior\\Version' 11 | ], 12 | 'events' => [ 13 | 'app\\project\\behavior\\Events' 14 | ], 15 | ]; 16 | -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/build.cmd -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | LANG=en_US.UTF-8 4 | 5 | export PATH 6 | 7 | echo " 8 | +---------------------------------------------------------------------- 9 | | ThinkAdmin environmental preparation tools 10 | +---------------------------------------------------------------------- 11 | | GtiHub : https://github.com/zoujingli/ThinkAdmin 12 | +---------------------------------------------------------------------- 13 | | document : https://www.kancloud.cn/zoujingli/thinkadmin/323614 14 | +---------------------------------------------------------------------- 15 | " 16 | 17 | hasComposer=`command -v composer` 18 | 19 | echo -e "\033[34mConfirm the existence of the command....\033[0m" 20 | 21 | if [ ! -f "${hasComposer}" ]; then 22 | echo -e "\033[31mComposer Not Found! Initialization cannot continue. \033[0m" 23 | exit 24 | fi 25 | 26 | echo -e "\033[34mClean up the running environment....\033[0m" 27 | rm -rf ./vendor 28 | rm -rf ./thinkphp 29 | rm -rf ./composer.lock 30 | 31 | echo -e "\033[34mComposer install....\033[0m" 32 | composer install --profile --prefer-dist --optimize-autoloader 33 | 34 | echo -e "\033[34mMake Autoload....\033[0m" 35 | composer dump-autoload --optimize 36 | 37 | echo -e "\033[31mEnvironmental preparation success!\033[0m" -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vilson/pearproject", 3 | "description": "task collaboration", 4 | "homepage": "https://home.vilson.xyz", 5 | "keywords": [ 6 | "task", 7 | "team", 8 | "project", 9 | "plan" 10 | ], 11 | "license": "MIT", 12 | "authors": [ 13 | { 14 | "name": "vilson", 15 | "email": "545522390@qq.com" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=7.2", 20 | "qiniu/php-sdk": "^7.2", 21 | "endroid/qr-code": "^1.9", 22 | "topthink/framework": "5.1.*", 23 | "aliyuncs/oss-sdk-php": "^2.2", 24 | "topthink/think-image": "^1.0", 25 | "workerman/gateway-worker-for-win" : ">=3.0.0", 26 | "workerman/gateway-worker" : ">=3.0.0", 27 | "overtrue/easy-sms": "^1.1", 28 | "phpoffice/phpspreadsheet": "^1.5", 29 | "firebase/php-jwt": "^5.0", 30 | "phpmailer/phpmailer": "^6.0", 31 | "mingyoung/dingtalk": "^2.3.0", 32 | "zoujingli/ip2region": "^1.0" 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "app\\": "application" 37 | } 38 | }, 39 | "extra": { 40 | "think-path": "thinkphp" 41 | }, 42 | "config": { 43 | "preferred-install": "dist" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | use think\facade\Env; 12 | 13 | // +---------------------------------------------------------------------- 14 | // | 缓存设置 15 | // +---------------------------------------------------------------------- 16 | 17 | if (Env::get('cache.type', 'redis') == 'redis') { 18 | return [ 19 | // 驱动方式 20 | 'type' => 'redis', 21 | // 服务器地址 22 | 'host' => Env::get('redis.host', '127.0.0.1'), 23 | // 密码 24 | 'password' => Env::get('redis.password', ''), 25 | // 端口 26 | 'port' => Env::get('redis.port', 6379), 27 | // 缓存保存目录 28 | 'path' => Env::get('cache.path', './runtime/cache'), 29 | // 全局缓存有效期(0为永久有效) 30 | 'expire' => Env::get('cache.expire', 0), 31 | ]; 32 | } else { 33 | return [ 34 | // 驱动方式 35 | 'type' => 'File', 36 | // 缓存保存目录 37 | 'path' => '', 38 | // 缓存前缀 39 | 'prefix' => '', 40 | // 缓存有效期 0表示永久缓存 41 | 'expire' => Env::get('cache.expire', 0), 42 | ]; 43 | } 44 | -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | Env::get('config.notice_push', false), //是否开启websocket消息推送 5 | 'dingtalk_push' => Env::get('config.dingtalk_push', false), //是否开启钉钉消息推送 6 | 'mail_push' => Env::get('config.mail_push', false), //是否开启邮件消息推送 7 | ]; 8 | -------------------------------------------------------------------------------- /config/console.php: -------------------------------------------------------------------------------- 1 | 'Think Console', 5 | 'version' => '0.1', 6 | 'user' => null, 7 | ]; 8 | -------------------------------------------------------------------------------- /config/const.php: -------------------------------------------------------------------------------- 1 | 'Mcl5FwCI8cDtnBCQ', 4 | ]; 5 | -------------------------------------------------------------------------------- /config/cookie.php: -------------------------------------------------------------------------------- 1 | '', 6 | // cookie 保存时间 7 | 'expire' => 0, 8 | // cookie 保存路径 9 | 'path' => '/', 10 | // cookie 有效域名 11 | 'domain' => '', 12 | // cookie 启用安全传输 13 | 'secure' => false, 14 | // httponly设置 15 | 'httponly' => '', 16 | // 是否使用 setcookie 17 | 'setcookie' => true, 18 | ]; 19 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | Env::get('database.type', 'mysql'), 6 | // 服务器地址 7 | 'hostname' => Env::get('database.hostname', '127.0.0.1'), 8 | // 数据库名 9 | 'database' => Env::get('database.database', 'root'), 10 | // 用户名 11 | 'username' => Env::get('database.username', 'root'), 12 | // 密码 13 | 'password' => Env::get('database.password', 'root'), 14 | 15 | // 端口 16 | 'hostport' => Env::get('database.hostport', '3306'), 17 | // 连接dsn 18 | 'dsn' => '', 19 | // 数据库连接参数 20 | 'params' => [], 21 | // 数据库编码默认采用utf8mb4 22 | 'charset' => Env::get('database.charset', 'utf8mb4'), 23 | // 数据库表前缀 24 | 'prefix' => Env::get('database.prefix', 'sys_'), 25 | // 数据库调试模式 26 | 'debug' => Env::get('database.debug', false), 27 | // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 28 | 'deploy' => 0, 29 | // 数据库读写是否分离 主从式有效 30 | 'rw_separate' => false, 31 | // 读写分离后 主服务器数量 32 | 'master_num' => 1, 33 | // 指定从服务器序号 34 | 'slave_no' => '', 35 | // 自动读取主库数据 36 | 'read_master' => false, 37 | // 是否严格检查字段是否存在 38 | 'fields_strict' => true, 39 | // 数据集返回类型 40 | 'resultset_type' => 'array', 41 | // 自动写入时间戳字段 42 | 'auto_timestamp' => false, 43 | // 时间字段取出后的默认时间格式 44 | 'datetime_format' => 'Y-m-d H:i:s', 45 | // 是否需要进行SQL性能分析 46 | 'sql_explain' => false, 47 | // Builder类 48 | 'builder' => '', 49 | // Query类 50 | 'query' => '\\think\\db\\Query', 51 | // 是否需要断线重连 52 | 'break_reconnect' => true, 53 | // 断线标识字符串 54 | 'break_match_str' => [], 55 | ]; 56 | -------------------------------------------------------------------------------- /config/jwt.php: -------------------------------------------------------------------------------- 1 | 'pearProject', 6 | 'alg' => 'HS256', 7 | //access_token有效时间 8 | 'accessTokenExp' => 3600 * 24 * 7, 9 | //refresh_token有效时间 10 | 'refreshTokenExp' => 3600 * 24 * 7, 11 | //签发者 可选 12 | 'iss' => '', 13 | //接收该JWT的一方,可选 14 | 'aud' => '', 15 | 'tokenType' => 'bearer', 16 | ]; 17 | -------------------------------------------------------------------------------- /config/log.php: -------------------------------------------------------------------------------- 1 | 'File', 6 | // 日志保存目录 7 | 'path' => '', 8 | // 日志记录级别 9 | 'level' => [], 10 | // 单文件日志写入 11 | 'single' => false, 12 | // 独立日志级别 13 | 'apart_level' => ['emergency', 'alert', 'critical', 'error', 'sql','lock'], 14 | // 最大日志文件数量 15 | 'max_files' => 0, 16 | // 是否关闭日志写入 17 | 'close' => false, 18 | ]; 19 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | Env::get('mail.open', false), //Weather open mail support 6 | 'Host' => Env::get('mail.Host', 'smtp.example.com'),// Specify main and backup SMTP servers 7 | 'SMTPAuth' => Env::get('mail.SMTPAuth', true),// Enable SMTP authentication 8 | 'Username' => Env::get('mail.Username', 'example@example.com'),// SMTP username 9 | 'Password' => Env::get('mail.Password', 'example'),// SMTP password 10 | 'SMTPSecure' => Env::get('mail.SMTPSecure', 'tls'),// Enable TLS encryption, `ssl` also accepted 11 | 'Port' => Env::get('mail.Port', 25),// TCP port to connect to 12 | ]; 13 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | '', 11 | 'prefix' => 'ta', 12 | 'type' => Env::get('cache.type', 'redis') == 'redis' ? 'redis' : '', 13 | 'expire' => 3600 * 24, 14 | 'auto_start' => true, 15 | 'path' => $session_path, 16 | 'name' => $session_name, 17 | 'var_session_id' => $session_name, 18 | 19 | // 'use_trans_sid' => 0, 20 | // 'httponly' => true, 21 | // 'secure' => true, 22 | 23 | 24 | // redis主机 25 | 'host' => Env::get('redis.host', '127.0.0.1'), 26 | // redis端口 27 | 'port' => Env::get('redis.port', 6379), 28 | // 密码 29 | 'password' => Env::get('redis.password', ''), 30 | ]; 31 | -------------------------------------------------------------------------------- /config/sms.php: -------------------------------------------------------------------------------- 1 | Env::get('sms.debug', true), //debug模式下不发送短信 6 | // HTTP 请求的超时时间(秒) 7 | 'timeout' => 5.0, 8 | 9 | // 默认发送配置 10 | 'default' => [ 11 | // 网关调用策略,默认:顺序调用 12 | 'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class, 13 | 14 | // 默认可用的发送网关 15 | 'gateways' => [ 16 | 'submail' 17 | ], 18 | ], 19 | // 可用的网关配置 20 | 'gateways' => [ 21 | 'errorlog' => [ 22 | 'file' => '/tmp/easy-sms.log', 23 | ], 24 | 'submail' => [ 25 | 'app_id' => '', 26 | 'app_key' => '', 27 | 'project' => '', // 默认 project,可在发送时 data 中指定 28 | ], 29 | ], 30 | ]; 31 | -------------------------------------------------------------------------------- /config/storage.php: -------------------------------------------------------------------------------- 1 | false, 5 | 'storage_type' => 'local', //local:本地,qiniu:七牛,oss:阿里云oss 6 | 'storage_local_exts' => 'png,jpg,rar,doc,icon,mp4,zip,gif,jpeg,bmp,webp,mp4,m3u8,rmvb,avi,swf,3gp,mkv,flv,txt,docx,pages,epub,pdf,numbers,csv,xls,xlsx,keynote,ppt,pptx,mp3,wav,wma,ogg,aac,flac;', //支持上传的文件格式 7 | // 可用的第三方资源配置 8 | 'qiniu' => [ //七牛云 9 | 'storage_qiniu_bucket' => 'static', 10 | 'storage_qiniu_domain' => 'example.xyz', 11 | 'storage_qiniu_access_key' => 'example', 12 | 'storage_qiniu_secret_key' => 'example', 13 | 'storage_qiniu_is_https' => 'https',//域名前缀 14 | ], 15 | 'oss' => [ // 阿里云oss 16 | 'storage_oss_bucket' => 'vilson-static', 17 | 'storage_oss_endpoint' => 'oss-cn-shenzhen.aliyuncs.com', 18 | 'storage_oss_domain' => 'example.xyz', 19 | 'storage_oss_keyid' => 'example', 20 | 'storage_oss_secret' => 'example', 21 | 'storage_oss_is_https' => 'https',//域名前缀 22 | ], 23 | ]; 24 | -------------------------------------------------------------------------------- /config/template.php: -------------------------------------------------------------------------------- 1 | root(); 5 | $uriRoot = rtrim(preg_match('/\.php$/', $appRoot) ? dirname($appRoot) : $appRoot, '\\/'); 6 | 7 | return [ 8 | // 模板引擎类型 支持 php think 支持扩展 9 | 'type' => 'Think', 10 | // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 11 | 'auto_rule' => 1, 12 | // 模板路径 13 | 'view_path' => '', 14 | // 模板后缀 15 | 'view_suffix' => 'html', 16 | // 模板文件名分隔符 17 | 'view_depr' => DIRECTORY_SEPARATOR, 18 | // 模板引擎普通标签开始标记 19 | 'tpl_begin' => '{', 20 | // 模板引擎普通标签结束标记 21 | 'tpl_end' => '}', 22 | // 标签库标签开始标记 23 | 'taglib_begin' => '{', 24 | // 标签库标签结束标记 25 | 'taglib_end' => '}', 26 | // 定义模板替换字符串 27 | 'tpl_replace_string' => [ 28 | '__APP__' => $appRoot, 29 | '__ROOT__' => $uriRoot, 30 | '__STATIC__' => $uriRoot . "/static", 31 | ], 32 | ]; 33 | -------------------------------------------------------------------------------- /config/trace.php: -------------------------------------------------------------------------------- 1 | 'Html', 6 | ]; 7 | -------------------------------------------------------------------------------- /config/upload.php: -------------------------------------------------------------------------------- 1 | 'static/upload/', 5 | 'default' => 'default', 6 | 'editor_img' => 'editor/img', 7 | 'member_avatar' => 'member/avatar', 8 | 'image' => 'image/default', 9 | 10 | 'file' => 'file/default', 11 | 'file_temp' => 'file/temp', 12 | ]; 13 | -------------------------------------------------------------------------------- /config/wechat.php: -------------------------------------------------------------------------------- 1 | 'https://x.x.com', 5 | // 下面参数用作微信支付 6 | 'appid' => '', 7 | 'mch_id' => '', 8 | 'mch_key' => '', 9 | ]; 10 | -------------------------------------------------------------------------------- /crontab.bat: -------------------------------------------------------------------------------- 1 | php application\common\Plugins\GateWayWorker\crontab.php 2 | -------------------------------------------------------------------------------- /crontab.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | php application/common/Plugins/GateWayWorker/crontab.php start& 3 | -------------------------------------------------------------------------------- /crontab_stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | php application/common/Plugins/GateWayWorker/crontab.php stop& 3 | -------------------------------------------------------------------------------- /data/2.2.0/2.1.0 - 2.2.0.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | ALTER TABLE `pearproject`.`pear_task_tag` ENGINE = InnoDB, COMMENT = '任务标签表', ROW_FORMAT = Compact; 4 | 5 | ALTER TABLE `pearproject`.`pear_task_tag` DROP COLUMN `color_value`; 6 | 7 | ALTER TABLE `pearproject`.`pear_task_to_tag` ENGINE = InnoDB, COMMENT = '任务标签映射表', ROW_FORMAT = Compact; 8 | 9 | SET FOREIGN_KEY_CHECKS=1; 10 | -------------------------------------------------------------------------------- /data/2.3.0/2.3.6 - 2.3.0.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | ALTER TABLE `pearproject`.`pear_project` ADD COLUMN `open_begin_time` tinyint(1) NULL DEFAULT 0 COMMENT '是否开启任务开始时间' AFTER `archive_time`; 4 | 5 | ALTER TABLE `pearproject`.`pear_project` ADD COLUMN `open_task_private` tinyint(1) NULL DEFAULT 0 COMMENT '是否开启新任务默认开启隐私模式' AFTER `open_begin_time`; 6 | 7 | ALTER TABLE `pearProject`.`pear_project` ADD COLUMN `task_board_theme` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'default' COMMENT '看板风格' AFTER `open_task_private`; 8 | 9 | ALTER TABLE `pearproject`.`pear_task` ADD COLUMN `schedule` int(3) NULL DEFAULT 0 COMMENT '进度百分比' AFTER `path`; 10 | 11 | SET FOREIGN_KEY_CHECKS=1; 12 | -------------------------------------------------------------------------------- /data/2.5.0/2.4.0-2.5.0.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | ALTER TABLE `pearproject`.`pear_member` ADD COLUMN `dingtalk_openid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '钉钉openid' AFTER `code`; 4 | 5 | ALTER TABLE `pearproject`.`pear_member` ADD COLUMN `dingtalk_unionid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '钉钉unionid' AFTER `dingtalk_openid`; 6 | 7 | ALTER TABLE `pearproject`.`pear_member` ADD COLUMN `dingtalk_userid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '钉钉用户id' AFTER `dingtalk_unionid`; 8 | 9 | SET FOREIGN_KEY_CHECKS=1; 10 | -------------------------------------------------------------------------------- /data/2.8.0/2.6.0-2.8.0.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | ALTER TABLE `pearProject`.`pear_project` ADD COLUMN `begin_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目开始日期' AFTER `task_board_theme`; 4 | 5 | ALTER TABLE `pearProject`.`pear_project` ADD COLUMN `end_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目截止日期' AFTER `begin_time`; 6 | 7 | ALTER TABLE `pearProject`.`pear_task` ADD COLUMN `work_time` int(5) NULL DEFAULT 0 COMMENT '预估工时' AFTER `features_code`; 8 | 9 | CREATE TABLE `pearProject`.`pear_task_work_time` ( 10 | `id` int(11) NOT NULL AUTO_INCREMENT, 11 | `task_code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '任务ID', 12 | `member_code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '成员id', 13 | `create_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 14 | `content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述', 15 | `begin_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开始时间', 16 | `num` int(5) NULL DEFAULT 0 COMMENT '工时', 17 | `code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'id', 18 | PRIMARY KEY (`id`) USING BTREE, 19 | UNIQUE INDEX `id`(`id`) USING BTREE 20 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务工时表' ROW_FORMAT = Compact; 21 | 22 | SET FOREIGN_KEY_CHECKS=1; 23 | -------------------------------------------------------------------------------- /data/2.8.0/2.8.0-2.8.1.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | CREATE TABLE `pearProject`.`pear_project_report` ( 4 | `id` int(11) NOT NULL AUTO_INCREMENT, 5 | `project_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目编号', 6 | `date` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期', 7 | `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, 8 | `create_time` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, 9 | `update_time` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, 10 | PRIMARY KEY (`id`) USING BTREE, 11 | UNIQUE INDEX `union`(`project_code`, `date`) USING BTREE 12 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '项目报表统计表' ROW_FORMAT = Compact; 13 | 14 | SET FOREIGN_KEY_CHECKS=1; 15 | -------------------------------------------------------------------------------- /data/2.8.0/2.8.13-2.8.14.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | INSERT INTO `pearProject`.`pear_system_config`(`name`, `value`) VALUES ('single_mode', '0'); 4 | INSERT INTO `pearProject`.`pear_system_config`(`name`, `value`) VALUES ('single_org_code', ''); 5 | 6 | SET FOREIGN_KEY_CHECKS=1; 7 | -------------------------------------------------------------------------------- /data/2.8.0/2.8.15-2.8.16.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | update pear_project_menu set url = 'project/list', file_path = 'project/list', params = ':type', `values` = 'deleted' where id = 152; 4 | update pear_project_menu set url = 'project/list', file_path = 'project/list', params = ':type', `values` = 'archive' where id = 159; 5 | 6 | 7 | SET FOREIGN_KEY_CHECKS=1; 8 | -------------------------------------------------------------------------------- /data/2.8.0/2.8.5-2.8.6.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | ALTER TABLE `pearProject`.`pear_project` ADD COLUMN `auto_update_schedule` tinyint(1) NULL DEFAULT 0 COMMENT '自动更新项目进度' AFTER `end_time`; 4 | 5 | ALTER TABLE `pearProject`.`pear_project_features` ADD INDEX `project_code`(`project_code`) USING BTREE; 6 | 7 | ALTER TABLE `pearProject`.`pear_project_features` ADD INDEX `organization_code`(`organization_code`) USING BTREE; 8 | 9 | ALTER TABLE `pearProject`.`pear_project_log` ADD INDEX `member_code`(`member_code`) USING BTREE; 10 | 11 | ALTER TABLE `pearProject`.`pear_project_log` ADD INDEX `source_code`(`source_code`) USING BTREE; 12 | 13 | ALTER TABLE `pearProject`.`pear_project_version` ADD INDEX `organization_code`(`organization_code`) USING BTREE; 14 | 15 | ALTER TABLE `pearProject`.`pear_project_version` ADD INDEX `features_code`(`features_code`) USING BTREE; 16 | 17 | ALTER TABLE `pearProject`.`pear_project_version_log` ADD INDEX `project_code`(`project_code`) USING BTREE; 18 | 19 | ALTER TABLE `pearProject`.`pear_project_version_log` ADD INDEX `features_code`(`features_code`) USING BTREE; 20 | 21 | ALTER TABLE `pearProject`.`pear_task` ADD INDEX `stage_code`(`stage_code`) USING BTREE; 22 | 23 | ALTER TABLE `pearProject`.`pear_task` ADD INDEX `project_code`(`project_code`) USING BTREE; 24 | 25 | ALTER TABLE `pearProject`.`pear_task` ADD INDEX `pcode`(`pcode`) USING BTREE; 26 | 27 | ALTER TABLE `pearProject`.`pear_task` ADD INDEX `sort`(`sort`) USING BTREE; 28 | 29 | SET FOREIGN_KEY_CHECKS=1; 30 | -------------------------------------------------------------------------------- /data/2.8.0/2.8.6-2.8.8.sql: -------------------------------------------------------------------------------- 1 | SET NAMES utf8mb4; 2 | SET FOREIGN_KEY_CHECKS = 0; 3 | 4 | -- ---------------------------- 5 | -- Table structure for pear_project_info 6 | -- ---------------------------- 7 | DROP TABLE IF EXISTS `pear_project_info`; 8 | CREATE TABLE `pear_project_info` ( 9 | `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 10 | `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称', 11 | `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '值', 12 | `description` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '描述', 13 | `create_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 14 | `update_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 15 | `organization_code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '组织id', 16 | `project_code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '项目id', 17 | `sort` int(11) NULL DEFAULT 0 COMMENT '排序', 18 | `code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'code', 19 | PRIMARY KEY (`id`) USING BTREE, 20 | UNIQUE INDEX `code`(`code`) USING BTREE, 21 | INDEX `project_code`(`project_code`) USING BTREE, 22 | INDEX `organization_code`(`organization_code`) USING BTREE 23 | ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目自定义信息表' ROW_FORMAT = Compact; 24 | 25 | SET FOREIGN_KEY_CHECKS = 1; 26 | -------------------------------------------------------------------------------- /data/2.8.0/2.8.8-2.8.9.sql: -------------------------------------------------------------------------------- 1 | SET NAMES utf8mb4; 2 | SET FOREIGN_KEY_CHECKS = 0; 3 | 4 | update pear_project_menu set params = ':org' where id = 120; 5 | update pear_project_node set is_auth = 0 where id = 512; 6 | 7 | SET FOREIGN_KEY_CHECKS = 1; 8 | -------------------------------------------------------------------------------- /data/2.8.0/2.8.9-2.8.13.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | ALTER TABLE `pearProject`.`pear_task` ADD COLUMN `done_by` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '完成人' AFTER `create_by`; 4 | 5 | ALTER TABLE `pearProject`.`pear_task` ADD COLUMN `done_time` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '完成时间' AFTER `done_by`; 6 | 7 | ALTER TABLE `pearProject`.`pear_task` ADD COLUMN `status` tinyint(2) NULL DEFAULT 0 COMMENT '执行状态。0:未开始,1:已完成,2:进行中,3:挂起,4:测试中' AFTER `work_time`; 8 | 9 | SET FOREIGN_KEY_CHECKS=1; 10 | -------------------------------------------------------------------------------- /data/template/importMember.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/data/template/importMember.xlsx -------------------------------------------------------------------------------- /data/template/importTask.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/data/template/importTask.xlsx -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | # How to use ? 2 | 3 | You need build PearProject docker image. 4 | 5 | choise php version , and `cd` to dir. 6 | 7 | ``` 8 | # build 9 | docker build -t pear-docker:1.0.0 . 10 | 11 | # cd to root path 12 | cd ../.. 13 | 14 | # attach container install composer vendor 15 | docker run --rm -it --mount type=bind,source="$(pwd)",target=/app pear-docker:1.0.0 /bin/bash 16 | composer install 17 | exit 18 | 19 | # run your docker 20 | docker run --mount type=bind,source="$(pwd)",target=/app -p 1234:8081 pear-docker:1.0.0 21 | ``` 22 | 23 | Right , now visit http://127.0.0.1:1234 -------------------------------------------------------------------------------- /docker/php72/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.2-cli 2 | 3 | # change package source for aliyun 4 | run cp /etc/apt/sources.list /etc/apt/sources.list.bak \ 5 | && echo "deb http://mirrors.aliyun.com/debian buster main" > /etc/apt/sources.list \ 6 | && echo "deb http://mirrors.aliyun.com/debian buster-updates main" >> /etc/apt/sources.list \ 7 | && apt clean; 8 | 9 | # update package 10 | RUN apt-get update; 11 | 12 | # install php ext 13 | RUN apt-get install -y libzip-dev libzip4 \ 14 | && pecl install redis-5.2.0 \ 15 | && pecl install igbinary-3.1.2 \ 16 | && pecl install zip-1.17.2 \ 17 | && docker-php-ext-enable redis igbinary zip 18 | 19 | # install php ext PDO 20 | RUN docker-php-ext-install pdo pdo_mysql 21 | 22 | # install php gd ext 23 | RUN apt-get install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev \ 24 | && docker-php-ext-configure gd --with-gd --with-webp-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir \ 25 | && docker-php-ext-install -j$(nproc) gd 26 | 27 | # install wget 28 | RUN apt-get install wget -y 29 | 30 | # install composer 31 | RUN cd /tmp \ 32 | && wget https://mirrors.aliyun.com/composer/composer.phar \ 33 | && mv composer.phar /usr/local/bin/composer \ 34 | && chmod +x /usr/local/bin/composer \ 35 | && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \ 36 | && composer self-update \ 37 | && composer clear 38 | 39 | WORKDIR /app 40 | 41 | CMD ["php", "-S", "0.0.0.0:8081"] -------------------------------------------------------------------------------- /docker/php74/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.4-cli 2 | 3 | 4 | # change package source for aliyun 5 | run cp /etc/apt/sources.list /etc/apt/sources.list.bak \ 6 | && echo "deb http://mirrors.aliyun.com/debian buster main" > /etc/apt/sources.list \ 7 | && echo "deb http://mirrors.aliyun.com/debian buster-updates main" >> /etc/apt/sources.list \ 8 | && apt clean; 9 | 10 | # update package 11 | RUN apt-get update; 12 | 13 | # install php gd ext 14 | RUN apt-get install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev\ 15 | && docker-php-ext-configure gd --with-freetype --with-jpeg \ 16 | && docker-php-ext-install -j$(nproc) gd 17 | 18 | # install php ext 19 | RUN apt-get install -y libzip-dev libzip4 \ 20 | && pecl install redis-5.2.0 \ 21 | && pecl install igbinary-3.1.2 \ 22 | && pecl install zip-1.17.2 \ 23 | && docker-php-ext-enable redis igbinary zip 24 | 25 | # install php ext PDO 26 | RUN docker-php-ext-install pdo pdo_mysql 27 | 28 | # install wget 29 | RUN apt-get install wget -y 30 | 31 | # install composer 32 | RUN cd /tmp \ 33 | && wget https://mirrors.aliyun.com/composer/composer.phar \ 34 | && mv composer.phar /usr/local/bin/composer \ 35 | && chmod +x /usr/local/bin/composer \ 36 | && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \ 37 | && composer self-update \ 38 | && composer clear 39 | 40 | WORKDIR /app 41 | 42 | CMD ["php", "-S", "0.0.0.0:8081"] -------------------------------------------------------------------------------- /extend/controller/BasicApi.php: -------------------------------------------------------------------------------- 1 | request = app('request'); 33 | // try { 34 | // ApiService::write(); 35 | // } catch (\Exception $e) { 36 | // $this->error($e->getMessage(), $e->getCode());; 37 | // } 38 | } 39 | 40 | /** 41 | * 返回成功的操作 42 | * @param mixed $msg 消息内容 43 | * @param array $data 返回数据 44 | * @param integer $code 返回代码 45 | */ 46 | protected function success($msg = '', $data = [], $code = 200) 47 | { 48 | ToolsService::success($msg, $data, $code); 49 | } 50 | 51 | /** 52 | * 返回失败的请求 53 | * @param mixed $msg 消息内容 54 | * @param array $data 返回数据 55 | * @param integer $code 返回代码 56 | */ 57 | protected function error($msg, $code = 201, $data = []) 58 | { 59 | $code < 200 && $code += 200; 60 | ToolsService::error($msg, $data, $code); 61 | } 62 | 63 | /** 64 | * 返回资源不存在 65 | * @param integer $code 返回代码 66 | */ 67 | protected function notAllow($code = 403) 68 | { 69 | ToolsService::error('', [], $code); 70 | } 71 | 72 | /** 73 | * 返回资源不存在 74 | * @param integer $code 返回代码 75 | */ 76 | protected function notFound($code = 4041) 77 | { 78 | ToolsService::error('', [], $code); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /extend/mail/Mail.php: -------------------------------------------------------------------------------- 1 | SMTPDebug = 2; // Enable verbose debug output 21 | $mail->isSMTP(); // Set mailer to use SMTP 22 | $mail->Host = config('mail.Host'); // Specify main and backup SMTP servers 23 | $mail->SMTPAuth = config('mail.SMTPAuth'); // Enable SMTP authentication 24 | $mail->Username = config('mail.Username'); // SMTP username 25 | $mail->Password = config('mail.Password'); // SMTP password 26 | $mail->SMTPSecure = config('mail.SMTPSecure'); // Enable TLS encryption, `ssl` also accepted 27 | $mail->Port = config('mail.Port'); // TCP port to connect to 28 | $this->mail = $mail; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /extend/message/DingTalk.php: -------------------------------------------------------------------------------- 1 | app = $app; 28 | $this->agentId = $agentId ? $agentId : config('dingtalk.agent_id'); 29 | } 30 | 31 | public function sendCorporationMessage($userIdList, $msg, $agentId = '') 32 | { 33 | $params = [ 34 | 'agent_id' => $agentId ? $agentId : $this->agentId, 35 | 'userid_list' => $userIdList, 36 | 'msg' => is_array($msg) ? json_encode($msg) : $msg 37 | ]; 38 | return $this->app->conversation->sendCorporationMessage($params); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /extend/service/LogService.php: -------------------------------------------------------------------------------- 1 | module(), $request->controller(), $request->action()])); 39 | $data = [ 40 | 'ip' => $request->ip(), 41 | 'node' => $node, 42 | 'action' => $action, 43 | 'content' => $content, 44 | 'username' => session('user.username') . '', 45 | ]; 46 | return self::db()->insert($data) !== false; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /extend/service/SoapService.php: -------------------------------------------------------------------------------- 1 | soap = new \SoapClient($wsdl, $params); 35 | } 36 | 37 | /** 38 | * @param string $name SOAP调用方法名 39 | * @param array|string $arguments SOAP调用参数 40 | * @return array|string|bool 41 | * @throws \think\Exception 42 | */ 43 | public function __call($name, $arguments) 44 | { 45 | try { 46 | return $this->soap->__soapCall($name, $arguments); 47 | } catch (\Exception $e) { 48 | Log::error("Soap Error. Call {$name} Method --- " . $e->getMessage()); 49 | throw new Exception($e->getMessage(), $e->getCode()); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /extend/sms/Sms.php: -------------------------------------------------------------------------------- 1 | send($to, $message, $gateways); 37 | } catch (InvalidArgumentException $e) { 38 | // Log::write($e->getResults(), "sms-exception"); 39 | return error(1); 40 | } catch (NoGatewayAvailableException $e) { 41 | // Log::write($e->getResults(), "sms-exception"); 42 | return error(1); 43 | } 44 | logRecord($result, 'info', 'sms'); 45 | return $result; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/favicon.ico -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | run()->send(); 12 | -------------------------------------------------------------------------------- /route/demo.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/route/demo.php -------------------------------------------------------------------------------- /route/route.php: -------------------------------------------------------------------------------- 1 | h3{font-size:16px;margin-bottom:20px}.user-layout-register .getCaptcha{display:block;width:100%;height:40px}.user-layout-register .register-button{width:50%}.user-layout-register .login{float:right;line-height:40px}.user-register.error{color:red}.user-register.warning{color:#ff7e05}.user-register.success{color:#52c41a}.user-layout-register .ant-input-group-addon:first-child{background-color:#fff}.user-layout-forgot>h3{font-size:16px;margin-bottom:20px}.user-layout-forgot .getCaptcha{display:block;width:100%;height:40px}.user-layout-forgot .forgot-button{width:50%}.user-layout-forgot .login{float:right;line-height:40px} -------------------------------------------------------------------------------- /static/dist/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/static/dist/favicon.ico -------------------------------------------------------------------------------- /static/dist/img/logo.b83ac094.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/static/dist/img/logo.b83ac094.png -------------------------------------------------------------------------------- /static/dist/js/chunk-1d0b0df0.202359c3.js: -------------------------------------------------------------------------------- 1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1d0b0df0"],{"3f52":function(t,s,e){"use strict";e("c62b")},"7fa2":function(t,s,e){"use strict";e.r(s);var a=function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",{staticClass:"page-403"},[a("ErrorPage",{attrs:{code:"403",desc:"抱歉,你无权访问该页面"}},[a("img",{attrs:{slot:"img",src:e("b0ad"),alt:""},slot:"img"})])],1)},c=[],n=e("8685"),i={components:{ErrorPage:n["a"]}},r=i,o=e("2877"),l=Object(o["a"])(r,a,c,!1,null,null,null);s["default"]=l.exports},8685:function(t,s,e){"use strict";var a=function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"error-page"},[e("div",{staticClass:"exception"},[e("div",{staticClass:"imgBlock"},[e("div",{staticClass:"img-exception"},[t._t("img")],2)]),e("div",{staticClass:"content"},[e("h1",[t._v(t._s(t.code))]),e("div",{staticClass:"desc"},[t._v(t._s(t.desc))]),e("div",{staticClass:"actions"},[e("router-link",{attrs:{to:t.url}},[e("Button",{attrs:{type:"primary"}},[t._v(t._s(t.urlText))])],1)],1)])])])},c=[],n=e("5efb"),i=e("68fe"),r=Object(i["a"])("currentOrganization",!0),o={components:{Button:n["a"]},props:{code:{default:"500"},desc:{default:"抱歉,服务器出错了"},url:{default:r?"/home/"+r.code:"/home"},urlText:{default:"返回首页"}},data:function(){return{}}},l=o,u=(e("3f52"),e("2877")),d=Object(u["a"])(l,a,c,!1,null,null,null);s["a"]=d.exports},b0ad:function(t,s,e){t.exports=e.p+"img/403.41acc6f2.svg"},c62b:function(t,s,e){}}]); -------------------------------------------------------------------------------- /static/dist/js/chunk-48aea94b.0c46d36e.js: -------------------------------------------------------------------------------- 1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-48aea94b"],{2754:function(t,e,s){"use strict";s.r(e);var a=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"page-403"},[a("ErrorPage",{attrs:{code:"404",desc:"抱歉,你访问的页面不存在"}},[a("img",{attrs:{slot:"img",src:s("f1d3"),alt:""},slot:"img"})])],1)},c=[],n=s("8685"),i={components:{ErrorPage:n["a"]}},r=i,o=s("2877"),l=Object(o["a"])(r,a,c,!1,null,null,null);e["default"]=l.exports},"3f52":function(t,e,s){"use strict";s("c62b")},8685:function(t,e,s){"use strict";var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"error-page"},[s("div",{staticClass:"exception"},[s("div",{staticClass:"imgBlock"},[s("div",{staticClass:"img-exception"},[t._t("img")],2)]),s("div",{staticClass:"content"},[s("h1",[t._v(t._s(t.code))]),s("div",{staticClass:"desc"},[t._v(t._s(t.desc))]),s("div",{staticClass:"actions"},[s("router-link",{attrs:{to:t.url}},[s("Button",{attrs:{type:"primary"}},[t._v(t._s(t.urlText))])],1)],1)])])])},c=[],n=s("5efb"),i=s("68fe"),r=Object(i["a"])("currentOrganization",!0),o={components:{Button:n["a"]},props:{code:{default:"500"},desc:{default:"抱歉,服务器出错了"},url:{default:r?"/home/"+r.code:"/home"},urlText:{default:"返回首页"}},data:function(){return{}}},l=o,u=(s("3f52"),s("2877")),d=Object(u["a"])(l,a,c,!1,null,null,null);e["a"]=d.exports},c62b:function(t,e,s){},f1d3:function(t,e,s){t.exports=s.p+"img/404.77e1571b.svg"}}]); -------------------------------------------------------------------------------- /static/dist/js/chunk-4de77fa6.b838892d.js: -------------------------------------------------------------------------------- 1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4de77fa6"],{"27f0":function(t,s,a){"use strict";a.r(s);var e=function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"userLayout"},[e("div",{staticClass:"container"},[e("div",{staticClass:"top"},[e("div",{staticClass:"header"},[e("a-badge",[e("a",{attrs:{href:"/"}},[e("img",{staticClass:"logo",attrs:{src:a("bae8"),alt:"logo"}}),e("span",{staticClass:"title"},[t._v("Pear Project")])])])],1),e("div",{staticClass:"desc"},[t._v(t._s(t.desc))])]),e("router-view"),t._t("default"),t._m(0)],2)])},r=[function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",{staticClass:"footer"},[a("div",{staticClass:"copyright"},[t._v("\n Copyright © 2019 Pear Project\n ")])])}],i={name:"UserLayout",props:{desc:{type:[String],default:function(){return"欢迎使用Pear Project项目管理系统"}}}},c=i,n=(a("f421"),a("2877")),o=Object(n["a"])(c,e,r,!1,null,null,null);s["default"]=o.exports},9794:function(t,s,a){},f421:function(t,s,a){"use strict";a("9794")}}]); -------------------------------------------------------------------------------- /static/dist/js/chunk-6142efe4.5d0cff8f.js: -------------------------------------------------------------------------------- 1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6142efe4"],{"1a0f":function(s,t,c){"use strict";c("ac99")},ac99:function(s,t,c){},c0d8:function(s,t,c){"use strict";c.r(t);var e=function(){var s=this,t=s.$createElement,c=s._self._c||t;return c("div",{staticClass:"reset-mail",staticStyle:{height:"100%"}},[c("div",{staticClass:"content"},[s.loading?s._e():c("a-card",{attrs:{title:s.isSuccess?"验证成功":"验证失败"}},[c("div",{staticClass:"header m-b-lg text-center"},[c("p",[c("a-icon",{class:{icon:!0,isSuccess:s.isSuccess,error:!s.isSuccess},attrs:{type:s.isSuccess?"check-circle":"close-circle"}})],1),s.isSuccess?c("span",[s._v("\n 您已成功绑定邮箱\n ")]):c("span",[s.tips?c("span",[s._v(s._s(s.tips))]):c("span",[s._v("绑定邮箱失败")])])]),c("a-button",{staticClass:"middle-btn",attrs:{type:"primary",block:"",size:"large"},on:{click:s.toHome}},[c("span",[s._v("进入首页")])])],1)],1)])},i=[],n=c("c24f"),a=c("2f14"),r={data:function(){return{loading:!0,isSuccess:!1,tips:""}},created:function(){this.checkBindMail()},methods:{checkBindMail:function(){var s=this;Object(n["e"])({token:this.$route.query.token}).then((function(t){if(s.loading=!1,!Object(a["a"])(t))return s.tips=t.msg,!1;s.isSuccess=!0}))}}},l=r,o=(c("1a0f"),c("2877")),u=Object(o["a"])(l,e,i,!1,null,null,null);t["default"]=u.exports}}]); -------------------------------------------------------------------------------- /static/dist/js/chunk-8401588e.8410feb8.js: -------------------------------------------------------------------------------- 1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-8401588e"],{"3f52":function(t,e,s){"use strict";s("c62b")},8685:function(t,e,s){"use strict";var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"error-page"},[s("div",{staticClass:"exception"},[s("div",{staticClass:"imgBlock"},[s("div",{staticClass:"img-exception"},[t._t("img")],2)]),s("div",{staticClass:"content"},[s("h1",[t._v(t._s(t.code))]),s("div",{staticClass:"desc"},[t._v(t._s(t.desc))]),s("div",{staticClass:"actions"},[s("router-link",{attrs:{to:t.url}},[s("Button",{attrs:{type:"primary"}},[t._v(t._s(t.urlText))])],1)],1)])])])},n=[],c=s("5efb"),i=s("68fe"),r=Object(i["a"])("currentOrganization",!0),o={components:{Button:c["a"]},props:{code:{default:"500"},desc:{default:"抱歉,服务器出错了"},url:{default:r?"/home/"+r.code:"/home"},urlText:{default:"返回首页"}},data:function(){return{}}},l=o,u=(s("3f52"),s("2877")),d=Object(u["a"])(l,a,n,!1,null,null,null);e["a"]=d.exports},a769:function(t,e,s){t.exports=s.p+"img/500.5e6bf3ad.svg"},b3ff:function(t,e,s){"use strict";s.r(e);var a=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"page-403"},[a("ErrorPage",[a("img",{attrs:{slot:"img",src:s("a769"),alt:""},slot:"img"})])],1)},n=[],c=s("8685"),i={components:{ErrorPage:c["a"]}},r=i,o=s("2877"),l=Object(o["a"])(r,a,n,!1,null,null,null);e["default"]=l.exports},c62b:function(t,e,s){}}]); -------------------------------------------------------------------------------- /static/image/default/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/static/image/default/cover.png -------------------------------------------------------------------------------- /static/image/default/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/static/image/default/logo.png -------------------------------------------------------------------------------- /static/image/default/project-cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/static/image/default/project-cover.png -------------------------------------------------------------------------------- /stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | php application/common/Plugins/GateWayWorker/start_register.php stop& 3 | php application/common/Plugins/GateWayWorker/start_gateway.php stop& 4 | php application/common/Plugins/GateWayWorker/start_businessworker.php stop; 5 | -------------------------------------------------------------------------------- /think: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | initialize(); 11 | Console::init(); 12 | -------------------------------------------------------------------------------- /thinkphp/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.phar 3 | composer.lock 4 | .DS_Store 5 | Thumbs.db 6 | /phpunit.xml 7 | /.idea 8 | /.vscode -------------------------------------------------------------------------------- /thinkphp/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all -------------------------------------------------------------------------------- /thinkphp/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 3 | 版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn) 4 | All rights reserved。 5 | ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 6 | 7 | Apache Licence是著名的非盈利开源组织Apache采用的协议。 8 | 该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, 9 | 允许代码修改,再作为开源或商业软件发布。需要满足 10 | 的条件: 11 | 1. 需要给代码的用户一份Apache Licence ; 12 | 2. 如果你修改了代码,需要在被修改的文件中说明; 13 | 3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 14 | 带有原来代码中的协议,商标,专利声明和其他原来作者规 15 | 定需要包含的说明; 16 | 4. 如果再发布的产品中包含一个Notice文件,则在Notice文 17 | 件中需要带有本协议内容。你可以在Notice中增加自己的 18 | 许可,但不可以表现为对Apache Licence构成更改。 19 | 具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /thinkphp/base.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace think; 12 | 13 | // 载入Loader类 14 | require __DIR__ . '/library/think/Loader.php'; 15 | 16 | // 注册自动加载 17 | Loader::register(); 18 | 19 | // 注册错误和异常处理机制 20 | Error::register(); 21 | 22 | // 实现日志接口 23 | if (interface_exists('Psr\Log\LoggerInterface')) { 24 | interface LoggerInterface extends \Psr\Log\LoggerInterface 25 | {} 26 | } else { 27 | interface LoggerInterface 28 | {} 29 | } 30 | 31 | // 注册类库别名 32 | Loader::addClassAlias([ 33 | 'App' => facade\App::class, 34 | 'Build' => facade\Build::class, 35 | 'Cache' => facade\Cache::class, 36 | 'Config' => facade\Config::class, 37 | 'Cookie' => facade\Cookie::class, 38 | 'Db' => Db::class, 39 | 'Debug' => facade\Debug::class, 40 | 'Env' => facade\Env::class, 41 | 'Facade' => Facade::class, 42 | 'Hook' => facade\Hook::class, 43 | 'Lang' => facade\Lang::class, 44 | 'Log' => facade\Log::class, 45 | 'Request' => facade\Request::class, 46 | 'Response' => facade\Response::class, 47 | 'Route' => facade\Route::class, 48 | 'Session' => facade\Session::class, 49 | 'Url' => facade\Url::class, 50 | 'Validate' => facade\Validate::class, 51 | 'View' => facade\View::class, 52 | ]); 53 | -------------------------------------------------------------------------------- /thinkphp/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "topthink/framework", 3 | "description": "the new thinkphp framework", 4 | "type": "think-framework", 5 | "keywords": [ 6 | "framework", 7 | "thinkphp", 8 | "ORM" 9 | ], 10 | "homepage": "http://thinkphp.cn/", 11 | "license": "Apache-2.0", 12 | "authors": [ 13 | { 14 | "name": "liu21st", 15 | "email": "liu21st@gmail.com" 16 | }, 17 | { 18 | "name": "yunwuxin", 19 | "email": "448901948@qq.com" 20 | } 21 | ], 22 | "require": { 23 | "php": ">=5.6.0", 24 | "topthink/think-installer": "2.*" 25 | }, 26 | "require-dev": { 27 | "phpunit/phpunit": "^5.0|^6.0", 28 | "johnkary/phpunit-speedtrap": "^1.0", 29 | "mikey179/vfsStream": "~1.6", 30 | "phploc/phploc": "2.*", 31 | "sebastian/phpcpd": "2.*", 32 | "squizlabs/php_codesniffer": "2.*", 33 | "phpdocumentor/reflection-docblock": "^2.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /thinkphp/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 | * @access protected 37 | * @param string $label 数据分类,用于异常页面显示 38 | * @param array $data 需要显示的数据,必须为关联数组 39 | */ 40 | final protected function setData($label, array $data) 41 | { 42 | $this->data[$label] = $data; 43 | } 44 | 45 | /** 46 | * 获取异常额外Debug数据 47 | * 主要用于输出到异常页面便于调试 48 | * @access public 49 | * @return array 由setData设置的Debug数据 50 | */ 51 | final public function getData() 52 | { 53 | return $this->data; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /thinkphp/library/think/config/driver/Ini.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\config\driver; 13 | 14 | class Ini 15 | { 16 | protected $config; 17 | 18 | public function __construct($config) 19 | { 20 | $this->config = $config; 21 | } 22 | 23 | public function parse() 24 | { 25 | if (is_file($this->config)) { 26 | return parse_ini_file($this->config, true); 27 | } else { 28 | return parse_ini_string($this->config, true); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /thinkphp/library/think/config/driver/Json.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\config\driver; 13 | 14 | class Json 15 | { 16 | protected $config; 17 | 18 | public function __construct($config) 19 | { 20 | if (is_file($config)) { 21 | $config = file_get_contents($config); 22 | } 23 | 24 | $this->config = $config; 25 | } 26 | 27 | public function parse() 28 | { 29 | return json_decode($this->config, true); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /thinkphp/library/think/config/driver/Xml.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\config\driver; 13 | 14 | class Xml 15 | { 16 | protected $config; 17 | 18 | public function __construct($config) 19 | { 20 | $this->config = $config; 21 | } 22 | 23 | public function parse() 24 | { 25 | if (is_file($this->config)) { 26 | $content = simplexml_load_file($this->config); 27 | } else { 28 | $content = simplexml_load_string($this->config); 29 | } 30 | 31 | $result = (array) $content; 32 | foreach ($result as $key => $val) { 33 | if (is_object($val)) { 34 | $result[$key] = (array) $val; 35 | } 36 | } 37 | 38 | return $result; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2016 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /thinkphp/library/think/console/bin/README.md: -------------------------------------------------------------------------------- 1 | console 工具使用 hiddeninput.exe 在 windows 上隐藏密码输入,该二进制文件由第三方提供,相关源码和其他细节可以在 [Hidden Input](https://github.com/Seldaek/hidden-input) 找到。 2 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/bin/hiddeninput.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/thinkphp/library/think/console/bin/hiddeninput.exe -------------------------------------------------------------------------------- /thinkphp/library/think/console/command/Build.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\console\command; 13 | 14 | use think\console\Command; 15 | use think\console\Input; 16 | use think\console\input\Option; 17 | use think\console\Output; 18 | use think\facade\App; 19 | use think\facade\Build as AppBuild; 20 | 21 | class Build extends Command 22 | { 23 | /** 24 | * {@inheritdoc} 25 | */ 26 | protected function configure() 27 | { 28 | $this->setName('build') 29 | ->setDefinition([ 30 | new Option('config', null, Option::VALUE_OPTIONAL, "build.php path"), 31 | new Option('module', null, Option::VALUE_OPTIONAL, "module name"), 32 | ]) 33 | ->setDescription('Build Application Dirs'); 34 | } 35 | 36 | protected function execute(Input $input, Output $output) 37 | { 38 | if ($input->hasOption('module')) { 39 | AppBuild::module($input->getOption('module')); 40 | $output->writeln("Successed"); 41 | return; 42 | } 43 | 44 | if ($input->hasOption('config')) { 45 | $build = include $input->getOption('config'); 46 | } else { 47 | $build = include App::getAppPath() . 'build.php'; 48 | } 49 | 50 | if (empty($build)) { 51 | $output->writeln("Build Config Is Empty"); 52 | return; 53 | } 54 | 55 | AppBuild::run($build); 56 | $output->writeln("Successed"); 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/command/Version.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace think\console\command; 12 | 13 | use think\console\Command; 14 | use think\console\Input; 15 | use think\console\Output; 16 | use think\facade\App; 17 | 18 | class Version extends Command 19 | { 20 | protected function configure() 21 | { 22 | // 指令配置 23 | $this->setName('version') 24 | ->setDescription('show thinkphp framework version'); 25 | } 26 | 27 | protected function execute(Input $input, Output $output) 28 | { 29 | $output->writeln('v' . App::version()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/command/make/Command.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\console\command\make; 13 | 14 | use think\console\command\Make; 15 | use think\console\input\Argument; 16 | use think\facade\App; 17 | 18 | class Command extends Make 19 | { 20 | protected $type = "Command"; 21 | 22 | protected function configure() 23 | { 24 | parent::configure(); 25 | $this->setName('make:command') 26 | ->addArgument('commandName', Argument::OPTIONAL, "The name of the command") 27 | ->setDescription('Create a new command class'); 28 | } 29 | 30 | protected function buildClass($name) 31 | { 32 | $commandName = $this->input->getArgument('commandName') ?: strtolower(basename($name)); 33 | $namespace = trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); 34 | 35 | $class = str_replace($namespace . '\\', '', $name); 36 | $stub = file_get_contents($this->getStub()); 37 | 38 | return str_replace(['{%commandName%}', '{%className%}', '{%namespace%}', '{%app_namespace%}'], [ 39 | $commandName, 40 | $class, 41 | $namespace, 42 | App::getNamespace(), 43 | ], $stub); 44 | } 45 | 46 | protected function getStub() 47 | { 48 | return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'command.stub'; 49 | } 50 | 51 | protected function getNamespace($appNamespace, $module) 52 | { 53 | return $appNamespace . '\\command'; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/command/make/Controller.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\console\command\make; 13 | 14 | use think\console\command\Make; 15 | use think\console\input\Option; 16 | use think\facade\Config; 17 | 18 | class Controller extends Make 19 | { 20 | protected $type = "Controller"; 21 | 22 | protected function configure() 23 | { 24 | parent::configure(); 25 | $this->setName('make:controller') 26 | ->addOption('api', null, Option::VALUE_NONE, 'Generate an api controller class.') 27 | ->addOption('plain', null, Option::VALUE_NONE, 'Generate an empty controller class.') 28 | ->setDescription('Create a new resource controller class'); 29 | } 30 | 31 | protected function getStub() 32 | { 33 | $stubPath = __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR; 34 | 35 | if ($this->input->getOption('api')) { 36 | return $stubPath . 'controller.api.stub'; 37 | } 38 | 39 | if ($this->input->getOption('plain')) { 40 | return $stubPath . 'controller.plain.stub'; 41 | } 42 | 43 | return $stubPath . 'controller.stub'; 44 | } 45 | 46 | protected function getClassName($name) 47 | { 48 | return parent::getClassName($name) . (Config::get('controller_suffix') ? ucfirst(Config::get('url_controller_layer')) : ''); 49 | } 50 | 51 | protected function getNamespace($appNamespace, $module) 52 | { 53 | return parent::getNamespace($appNamespace, $module) . '\controller'; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/command/make/Middleware.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\console\command\make; 13 | 14 | use think\console\command\Make; 15 | 16 | class Middleware extends Make 17 | { 18 | protected $type = "Middleware"; 19 | 20 | protected function configure() 21 | { 22 | parent::configure(); 23 | $this->setName('make:middleware') 24 | ->setDescription('Create a new middleware class'); 25 | } 26 | 27 | protected function getStub() 28 | { 29 | return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'middleware.stub'; 30 | } 31 | 32 | protected function getNamespace($appNamespace, $module) 33 | { 34 | return parent::getNamespace($appNamespace, 'http') . '\middleware'; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/command/make/Model.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\console\command\make; 13 | 14 | use think\console\command\Make; 15 | 16 | class Model extends Make 17 | { 18 | protected $type = "Model"; 19 | 20 | protected function configure() 21 | { 22 | parent::configure(); 23 | $this->setName('make:model') 24 | ->setDescription('Create a new model class'); 25 | } 26 | 27 | protected function getStub() 28 | { 29 | return __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . 'model.stub'; 30 | } 31 | 32 | protected function getNamespace($appNamespace, $module) 33 | { 34 | return parent::getNamespace($appNamespace, $module) . '\model'; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/command/make/Validate.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\console\command\make; 13 | 14 | use think\console\command\Make; 15 | 16 | class Validate extends Make 17 | { 18 | protected $type = "Validate"; 19 | 20 | protected function configure() 21 | { 22 | parent::configure(); 23 | $this->setName('make:validate') 24 | ->setDescription('Create a validate class'); 25 | } 26 | 27 | protected function getStub() 28 | { 29 | $stubPath = __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR; 30 | 31 | return $stubPath . 'validate.stub'; 32 | } 33 | 34 | protected function getNamespace($appNamespace, $module) 35 | { 36 | return parent::getNamespace($appNamespace, $module) . '\validate'; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/command/make/stubs/command.stub: -------------------------------------------------------------------------------- 1 | setName('{%commandName%}'); 15 | // 设置参数 16 | 17 | } 18 | 19 | protected function execute(Input $input, Output $output) 20 | { 21 | // 指令输出 22 | $output->writeln('{%commandName%}'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/command/make/stubs/controller.api.stub: -------------------------------------------------------------------------------- 1 | ['规则1','规则2'...] 12 | * 13 | * @var array 14 | */ 15 | protected $rule = []; 16 | 17 | /** 18 | * 定义错误信息 19 | * 格式:'字段名.规则名' => '错误信息' 20 | * 21 | * @var array 22 | */ 23 | protected $message = []; 24 | } 25 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/output/driver/Buffer.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\console\output\driver; 13 | 14 | use think\console\Output; 15 | 16 | class Buffer 17 | { 18 | /** 19 | * @var string 20 | */ 21 | private $buffer = ''; 22 | 23 | public function __construct(Output $output) 24 | { 25 | // do nothing 26 | } 27 | 28 | public function fetch() 29 | { 30 | $content = $this->buffer; 31 | $this->buffer = ''; 32 | return $content; 33 | } 34 | 35 | public function write($messages, $newline = false, $options = Output::OUTPUT_NORMAL) 36 | { 37 | $messages = (array) $messages; 38 | 39 | foreach ($messages as $message) { 40 | $this->buffer .= $message; 41 | } 42 | if ($newline) { 43 | $this->buffer .= "\n"; 44 | } 45 | } 46 | 47 | public function renderException(\Exception $e) 48 | { 49 | // do nothing 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/output/driver/Nothing.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\console\output\driver; 13 | 14 | use think\console\Output; 15 | 16 | class Nothing 17 | { 18 | 19 | public function __construct(Output $output) 20 | { 21 | // do nothing 22 | } 23 | 24 | public function write($messages, $newline = false, $options = Output::OUTPUT_NORMAL) 25 | { 26 | // do nothing 27 | } 28 | 29 | public function renderException(\Exception $e) 30 | { 31 | // do nothing 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /thinkphp/library/think/console/output/question/Confirmation.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\console\output\question; 13 | 14 | use think\console\output\Question; 15 | 16 | class Confirmation extends Question 17 | { 18 | 19 | private $trueAnswerRegex; 20 | 21 | /** 22 | * 构造方法 23 | * @param string $question 问题 24 | * @param bool $default 默认答案 25 | * @param string $trueAnswerRegex 验证正则 26 | */ 27 | public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i') 28 | { 29 | parent::__construct($question, (bool) $default); 30 | 31 | $this->trueAnswerRegex = $trueAnswerRegex; 32 | $this->setNormalizer($this->getDefaultNormalizer()); 33 | } 34 | 35 | /** 36 | * 获取默认的答案回调 37 | * @return callable 38 | */ 39 | private function getDefaultNormalizer() 40 | { 41 | $default = $this->getDefault(); 42 | $regex = $this->trueAnswerRegex; 43 | 44 | return function ($answer) use ($default, $regex) { 45 | if (is_bool($answer)) { 46 | return $answer; 47 | } 48 | 49 | $answerIsTrue = (bool) preg_match($regex, $answer); 50 | if (false === $default) { 51 | return $answer && $answerIsTrue; 52 | } 53 | 54 | return !$answer || $answerIsTrue; 55 | }; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /thinkphp/library/think/db/Expression.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db; 13 | 14 | class Expression 15 | { 16 | /** 17 | * 查询表达式 18 | * 19 | * @var string 20 | */ 21 | protected $value; 22 | 23 | /** 24 | * 创建一个查询表达式 25 | * 26 | * @param string $value 27 | * @return void 28 | */ 29 | public function __construct($value) 30 | { 31 | $this->value = $value; 32 | } 33 | 34 | /** 35 | * 获取表达式 36 | * 37 | * @return string 38 | */ 39 | public function getValue() 40 | { 41 | return $this->value; 42 | } 43 | 44 | public function __toString() 45 | { 46 | return (string) $this->value; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /thinkphp/library/think/db/exception/BindParamException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\exception; 13 | 14 | use think\exception\DbException; 15 | 16 | /** 17 | * PDO参数绑定异常 18 | */ 19 | class BindParamException extends DbException 20 | { 21 | 22 | /** 23 | * BindParamException constructor. 24 | * @access public 25 | * @param string $message 26 | * @param array $config 27 | * @param string $sql 28 | * @param array $bind 29 | * @param int $code 30 | */ 31 | public function __construct($message, $config, $sql, $bind, $code = 10502) 32 | { 33 | $this->setData('Bind Param', $bind); 34 | parent::__construct($message, $config, $sql, $code); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /thinkphp/library/think/db/exception/DataNotFoundException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\exception; 13 | 14 | use think\exception\DbException; 15 | 16 | class DataNotFoundException extends DbException 17 | { 18 | protected $table; 19 | 20 | /** 21 | * DbException constructor. 22 | * @access public 23 | * @param string $message 24 | * @param string $table 25 | * @param array $config 26 | */ 27 | public function __construct($message, $table = '', array $config = []) 28 | { 29 | $this->message = $message; 30 | $this->table = $table; 31 | 32 | $this->setData('Database Config', $config); 33 | } 34 | 35 | /** 36 | * 获取数据表名 37 | * @access public 38 | * @return string 39 | */ 40 | public function getTable() 41 | { 42 | return $this->table; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /thinkphp/library/think/db/exception/ModelNotFoundException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\db\exception; 13 | 14 | use think\exception\DbException; 15 | 16 | class ModelNotFoundException extends DbException 17 | { 18 | protected $model; 19 | 20 | /** 21 | * 构造方法 22 | * @access public 23 | * @param string $message 24 | * @param string $model 25 | * @param array $config 26 | */ 27 | public function __construct($message, $model = '', array $config = []) 28 | { 29 | $this->message = $message; 30 | $this->model = $model; 31 | 32 | $this->setData('Database Config', $config); 33 | } 34 | 35 | /** 36 | * 获取模型类名 37 | * @access public 38 | * @return string 39 | */ 40 | public function getModel() 41 | { 42 | return $this->model; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/ClassNotFoundException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\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 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/DbException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\exception; 13 | 14 | use think\Exception; 15 | 16 | /** 17 | * Database相关异常处理类 18 | */ 19 | class DbException extends Exception 20 | { 21 | /** 22 | * DbException constructor. 23 | * @access public 24 | * @param string $message 25 | * @param array $config 26 | * @param string $sql 27 | * @param int $code 28 | */ 29 | public function __construct($message, array $config = [], $sql = '', $code = 10500) 30 | { 31 | $this->message = $message; 32 | $this->code = $code; 33 | 34 | $this->setData('Database Status', [ 35 | 'Error Code' => $code, 36 | 'Error Message' => $message, 37 | 'Error SQL' => $sql, 38 | ]); 39 | 40 | unset($config['username'], $config['password']); 41 | $this->setData('Database Config', $config); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/ErrorException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\exception; 13 | 14 | use think\Exception; 15 | 16 | /** 17 | * ThinkPHP错误异常 18 | * 主要用于封装 set_error_handler 和 register_shutdown_function 得到的错误 19 | * 除开从 think\Exception 继承的功能 20 | * 其他和PHP系统\ErrorException功能基本一样 21 | */ 22 | class ErrorException extends Exception 23 | { 24 | /** 25 | * 用于保存错误级别 26 | * @var integer 27 | */ 28 | protected $severity; 29 | 30 | /** 31 | * 错误异常构造函数 32 | * @access public 33 | * @param integer $severity 错误级别 34 | * @param string $message 错误详细信息 35 | * @param string $file 出错文件路径 36 | * @param integer $line 出错行号 37 | */ 38 | public function __construct($severity, $message, $file, $line) 39 | { 40 | $this->severity = $severity; 41 | $this->message = $message; 42 | $this->file = $file; 43 | $this->line = $line; 44 | $this->code = 0; 45 | } 46 | 47 | /** 48 | * 获取错误级别 49 | * @access public 50 | * @return integer 错误级别 51 | */ 52 | final public function getSeverity() 53 | { 54 | return $this->severity; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/HttpException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\exception; 13 | 14 | class HttpException extends \RuntimeException 15 | { 16 | private $statusCode; 17 | private $headers; 18 | 19 | public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = [], $code = 0) 20 | { 21 | $this->statusCode = $statusCode; 22 | $this->headers = $headers; 23 | 24 | parent::__construct($message, $code, $previous); 25 | } 26 | 27 | public function getStatusCode() 28 | { 29 | return $this->statusCode; 30 | } 31 | 32 | public function getHeaders() 33 | { 34 | return $this->headers; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/HttpResponseException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\exception; 13 | 14 | use think\Response; 15 | 16 | class HttpResponseException extends \RuntimeException 17 | { 18 | /** 19 | * @var Response 20 | */ 21 | protected $response; 22 | 23 | public function __construct(Response $response) 24 | { 25 | $this->response = $response; 26 | } 27 | 28 | public function getResponse() 29 | { 30 | return $this->response; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/PDOException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\exception; 13 | 14 | /** 15 | * PDO异常处理类 16 | * 重新封装了系统的\PDOException类 17 | */ 18 | class PDOException extends DbException 19 | { 20 | /** 21 | * PDOException constructor. 22 | * @access public 23 | * @param \PDOException $exception 24 | * @param array $config 25 | * @param string $sql 26 | * @param int $code 27 | */ 28 | public function __construct(\PDOException $exception, array $config, $sql, $code = 10501) 29 | { 30 | $error = $exception->errorInfo; 31 | 32 | $this->setData('PDO Error Info', [ 33 | 'SQLSTATE' => $error[0], 34 | 'Driver Error Code' => isset($error[1]) ? $error[1] : 0, 35 | 'Driver Error Message' => isset($error[2]) ? $error[2] : '', 36 | ]); 37 | 38 | parent::__construct($exception->getMessage(), $config, $sql, $code); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/RouteNotFoundException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\exception; 13 | 14 | class RouteNotFoundException extends HttpException 15 | { 16 | 17 | public function __construct() 18 | { 19 | parent::__construct(404, 'Route Not Found'); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/TemplateNotFoundException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\exception; 13 | 14 | class TemplateNotFoundException extends \RuntimeException 15 | { 16 | protected $template; 17 | 18 | public function __construct($message, $template = '') 19 | { 20 | $this->message = $message; 21 | $this->template = $template; 22 | } 23 | 24 | /** 25 | * 获取模板文件 26 | * @access public 27 | * @return string 28 | */ 29 | public function getTemplate() 30 | { 31 | return $this->template; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/ThrowableError.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\exception; 13 | 14 | class ThrowableError extends \ErrorException 15 | { 16 | public function __construct(\Throwable $e) 17 | { 18 | 19 | if ($e instanceof \ParseError) { 20 | $message = 'Parse error: ' . $e->getMessage(); 21 | $severity = E_PARSE; 22 | } elseif ($e instanceof \TypeError) { 23 | $message = 'Type error: ' . $e->getMessage(); 24 | $severity = E_RECOVERABLE_ERROR; 25 | } else { 26 | $message = 'Fatal error: ' . $e->getMessage(); 27 | $severity = E_ERROR; 28 | } 29 | 30 | parent::__construct( 31 | $message, 32 | $e->getCode(), 33 | $severity, 34 | $e->getFile(), 35 | $e->getLine() 36 | ); 37 | 38 | $this->setTrace($e->getTrace()); 39 | } 40 | 41 | protected function setTrace($trace) 42 | { 43 | $traceReflector = new \ReflectionProperty('Exception', 'trace'); 44 | $traceReflector->setAccessible(true); 45 | $traceReflector->setValue($this, $trace); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /thinkphp/library/think/exception/ValidateException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\exception; 13 | 14 | class ValidateException extends \RuntimeException 15 | { 16 | protected $error; 17 | 18 | public function __construct($error, $code = 0) 19 | { 20 | $this->error = $error; 21 | $this->message = is_array($error) ? implode("\n\r", $error) : $error; 22 | $this->code = $code; 23 | } 24 | 25 | /** 26 | * 获取验证错误信息 27 | * @access public 28 | * @return array|string 29 | */ 30 | public function getError() 31 | { 32 | return $this->error; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Build.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Build 18 | * @mixin \think\Build 19 | * @method void run(array $build = [], string $namespace = 'app', bool $suffix = false) static 根据传入的build资料创建目录和文件 20 | * @method void module(string $module = '', array $list = [], string $namespace = 'app', bool $suffix = false) static 创建模块 21 | */ 22 | class Build extends Facade 23 | { 24 | /** 25 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 26 | * @access protected 27 | * @return string 28 | */ 29 | protected static function getFacadeClass() 30 | { 31 | return 'build'; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Cache.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Cache 18 | * @mixin \think\Cache 19 | * @method \think\cache\Driver connect(array $options = [], mixed $name = false) static 连接缓存 20 | * @method \think\cache\Driver init(array $options = []) static 初始化缓存 21 | * @method \think\cache\Driver store(string $name = '') static 切换缓存类型 22 | * @method bool has(string $name) static 判断缓存是否存在 23 | * @method mixed get(string $name, mixed $default = false) static 读取缓存 24 | * @method mixed pull(string $name) static 读取缓存并删除 25 | * @method mixed set(string $name, mixed $value, int $expire = null) static 设置缓存 26 | * @method mixed remember(string $name, mixed $value, int $expire = null) static 如果不存在则写入缓存 27 | * @method mixed inc(string $name, int $step = 1) static 自增缓存(针对数值缓存) 28 | * @method mixed dec(string $name, int $step = 1) static 自减缓存(针对数值缓存) 29 | * @method bool rm(string $name) static 删除缓存 30 | * @method bool clear(string $tag = null) static 清除缓存 31 | * @method mixed tag(string $name, mixed $keys = null, bool $overlay = false) static 缓存标签 32 | * @method object handler() static 返回句柄对象,可执行其它高级方法 33 | */ 34 | class Cache extends Facade 35 | { 36 | /** 37 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 38 | * @access protected 39 | * @return string 40 | */ 41 | protected static function getFacadeClass() 42 | { 43 | return 'cache'; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Config.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Config 18 | * @mixin \think\Config 19 | * @method array load(string $file, string $name = '') static 加载配置文件 20 | * @method bool has(string $name) static 检测配置是否存在 21 | * @method array pull(string $name) static 获取一级配置参数 22 | * @method mixed get(string $name,mixed $default = null) static 获取配置参数 23 | * @method array set(mixed $name, mixed $value = null) static 设置配置参数 24 | * @method array reset(string $name ='') static 重置配置参数 25 | * @method void remove(string $name = '') static 移除配置 26 | * @method void setYaconf(mixed $yaconf) static 设置开启Yaconf 或者指定配置文件名 27 | */ 28 | class Config extends Facade 29 | { 30 | /** 31 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 32 | * @access protected 33 | * @return string 34 | */ 35 | protected static function getFacadeClass() 36 | { 37 | return 'config'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Cookie.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Cookie 18 | * @mixin \think\Cookie 19 | * @method void init(array $config = []) static 初始化 20 | * @method bool has(string $name,string $prefix = null) static 判断Cookie数据 21 | * @method mixed prefix(string $prefix = '') static 设置或者获取cookie作用域(前缀) 22 | * @method mixed get(string $name,string $prefix = null) static Cookie获取 23 | * @method mixed set(string $name, mixed $value = null, mixed $option = null) static 设置Cookie 24 | * @method void forever(string $name, mixed $value = null, mixed $option = null) static 永久保存Cookie数据 25 | * @method void delete(string $name, string $prefix = null) static Cookie删除 26 | * @method void clear($prefix = null) static Cookie清空 27 | */ 28 | class Cookie extends Facade 29 | { 30 | /** 31 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 32 | * @access protected 33 | * @return string 34 | */ 35 | protected static function getFacadeClass() 36 | { 37 | return 'cookie'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Debug.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Debug 18 | * @mixin \think\Debug 19 | * @method void remark(string $name, mixed $value = '') static 记录时间(微秒)和内存使用情况 20 | * @method int getRangeTime(string $start, string $end, mixed $dec = 6) static 统计某个区间的时间(微秒)使用情况 21 | * @method int getUseTime(int $dec = 6) static 统计从开始到统计时的时间(微秒)使用情况 22 | * @method string getThroughputRate(string $start, string $end, mixed $dec = 6) static 获取当前访问的吞吐率情况 23 | * @method string getRangeMem(string $start, string $end, mixed $dec = 2) static 记录区间的内存使用情况 24 | * @method int getUseMem(int $dec = 2) static 统计从开始到统计时的内存使用情况 25 | * @method string getMemPeak(string $start, string $end, mixed $dec = 2) static 统计区间的内存峰值情况 26 | * @method mixed getFile(bool $detail = false) static 获取文件加载信息 27 | * @method mixed dump(mixed $var, bool $echo = true, string $label = null, int $flags = ENT_SUBSTITUTE) static 浏览器友好的变量输出 28 | */ 29 | class Debug extends Facade 30 | { 31 | /** 32 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 33 | * @access protected 34 | * @return string 35 | */ 36 | protected static function getFacadeClass() 37 | { 38 | return 'debug'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Env.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Env 18 | * @mixin \think\Env 19 | * @method void load(string $file) static 读取环境变量定义文件 20 | * @method mixed get(string $name = null, mixed $default = null) static 获取环境变量值 21 | * @method void set(mixed $env, string $value = null) static 设置环境变量值 22 | */ 23 | class Env extends Facade 24 | { 25 | /** 26 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 27 | * @access protected 28 | * @return string 29 | */ 30 | protected static function getFacadeClass() 31 | { 32 | return 'env'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Hook.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Hook 18 | * @mixin \think\Hook 19 | * @method \think\Hook alias(mixed $name, mixed $behavior = null) static 指定行为标识 20 | * @method void add(string $tag, mixed $behavior, bool $first = false) static 动态添加行为扩展到某个标签 21 | * @method void import(array $tags, bool $recursive = true) static 批量导入插件 22 | * @method array get(string $tag = '') static 获取插件信息 23 | * @method mixed listen(string $tag, mixed $params = null, bool $once = false) static 监听标签的行为 24 | * @method mixed exec(mixed $class, mixed $params = null) static 执行行为 25 | */ 26 | class Hook extends Facade 27 | { 28 | /** 29 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 30 | * @access protected 31 | * @return string 32 | */ 33 | protected static function getFacadeClass() 34 | { 35 | return 'hook'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Lang.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Lang 18 | * @mixin \think\Lang 19 | * @method mixed range($range = '') static 设定当前的语言 20 | * @method mixed set(mixed $name, string $value = null, string $range = '') static 设置语言定义 21 | * @method array load(mixed $file, string $range = '') static 加载语言定义 22 | * @method mixed get(string $name = null, array $vars = [], string $range = '') static 获取语言定义 23 | * @method mixed has(string $name, string $range = '') static 获取语言定义 24 | * @method string detect() static 自动侦测设置获取语言选择 25 | * @method void saveToCookie(string $lang = null) static 设置当前语言到Cookie 26 | * @method void setLangDetectVar(string $var) static 设置语言自动侦测的变量 27 | * @method void setLangCookieVar(string $var) static 设置语言的cookie保存变量 28 | * @method void setAllowLangList(array $list) static 设置允许的语言列表 29 | */ 30 | class Lang extends Facade 31 | { 32 | /** 33 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 34 | * @access protected 35 | * @return string 36 | */ 37 | protected static function getFacadeClass() 38 | { 39 | return 'lang'; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Middleware.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Middleware 18 | * @mixin \think\Middleware 19 | * @method void import(array $middlewares = []) static 批量设置中间件 20 | * @method void add(mixed $middleware) static 添加中间件到队列 21 | * @method void unshift(mixed $middleware) static 添加中间件到队列开头 22 | * @method array all() static 获取中间件队列 23 | * @method \think\Response dispatch(\think\Request $request) static 执行中间件调度 24 | */ 25 | class Middleware extends Facade 26 | { 27 | /** 28 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 29 | * @access protected 30 | * @return string 31 | */ 32 | protected static function getFacadeClass() 33 | { 34 | return 'middleware'; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Response.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Response 18 | * @mixin \think\Response 19 | * @method \think\response create(mixed $data = '', string $type = '', int $code = 200, array $header = [], array $options = []) static 创建Response对象 20 | * @method void send() static 发送数据到客户端 21 | * @method \think\Response options(mixed $options = []) static 输出的参数 22 | * @method \think\Response data(mixed $data) static 输出数据设置 23 | * @method \think\Response header(mixed $name, string $value = null) static 设置响应头 24 | * @method \think\Response content(mixed $content) static 设置页面输出内容 25 | * @method \think\Response code(int $code) static 发送HTTP状态 26 | * @method \think\Response lastModified(string $time) static LastModified 27 | * @method \think\Response expires(string $time) static expires 28 | * @method \think\Response eTag(string $eTag) static eTag 29 | * @method \think\Response cacheControl(string $cache) static 页面缓存控制 30 | * @method \think\Response contentType(string $contentType, string $charset = 'utf-8') static 页面输出类型 31 | * @method mixed getHeader(string $name) static 获取头部信息 32 | * @method mixed getData() static 获取原始数据 33 | * @method mixed getContent() static 获取输出数据 34 | * @method int getCode() static 获取状态码 35 | */ 36 | class Response extends Facade 37 | { 38 | /** 39 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 40 | * @access protected 41 | * @return string 42 | */ 43 | protected static function getFacadeClass() 44 | { 45 | return 'response'; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Session.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Session 18 | * @mixin \think\Session 19 | * @method void init(array $config = []) static session初始化 20 | * @method bool has(string $name,string $prefix = null) static 判断session数据 21 | * @method mixed prefix(string $prefix = '') static 设置或者获取session作用域(前缀) 22 | * @method mixed get(string $name = '',string $prefix = null) static session获取 23 | * @method mixed pull(string $name,string $prefix = null) static session获取并删除 24 | * @method void push(string $key, mixed $value) static 添加数据到一个session数组 25 | * @method void set(string $name, mixed $value , string $prefix = null) static 设置session数据 26 | * @method void flash(string $name, mixed $value = null) static session设置 下一次请求有效 27 | * @method void flush() static 清空当前请求的session数据 28 | * @method void delete(string $name, string $prefix = null) static 删除session数据 29 | * @method void clear($prefix = null) static 清空session数据 30 | * @method void start() static 启动session 31 | * @method void destroy() static 销毁session 32 | * @method void pause() static 暂停session 33 | * @method void regenerate(bool $delete = false) static 重新生成session_id 34 | */ 35 | class Session extends Facade 36 | { 37 | /** 38 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 39 | * @access protected 40 | * @return string 41 | */ 42 | protected static function getFacadeClass() 43 | { 44 | return 'session'; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Template.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Template 18 | * @mixin \think\Template 19 | * @method void assign(mixed $name, mixed $value = '') static 模板变量赋值 20 | * @method mixed get(string $name = '') static 获取模板变量 21 | * @method void fetch(string $template, array $vars = [], array $config = []) static 渲染模板文件 22 | * @method void display(string $content, array $vars = [], array $config = []) static 渲染模板内容 23 | * @method mixed layout(string $name, string $replace = '') static 设置模板布局 24 | */ 25 | class Template extends Facade 26 | { 27 | /** 28 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 29 | * @access protected 30 | * @return string 31 | */ 32 | protected static function getFacadeClass() 33 | { 34 | return 'template'; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/Url.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Url 18 | * @mixin \think\Url 19 | * @method string build(string $url = '', mixed $vars = '', mixed $suffix = true, mixed $domain = false) static URL生成 支持路由反射 20 | * @method void root(string $root) static 指定当前生成URL地址的root 21 | */ 22 | class Url extends Facade 23 | { 24 | /** 25 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 26 | * @access protected 27 | * @return string 28 | */ 29 | protected static function getFacadeClass() 30 | { 31 | return 'url'; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /thinkphp/library/think/facade/View.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\View 18 | * @mixin \think\View 19 | * @method \think\View init(mixed $engine = [], array $replace = []) static 初始化 20 | * @method \think\View share(mixed $name, mixed $value = '') static 模板变量静态赋值 21 | * @method \think\View assign(mixed $name, mixed $value = '') static 模板变量赋值 22 | * @method \think\View config(mixed $name, mixed $value = '') static 配置模板引擎 23 | * @method \think\View exists(mixed $name) static 检查模板是否存在 24 | * @method \think\View filter(Callable $filter) static 视图内容过滤 25 | * @method \think\View engine(mixed $engine = []) static 设置当前模板解析的引擎 26 | * @method string fetch(string $template = '', array $vars = [], array $config = [], bool $renderContent = false) static 解析和获取模板内容 27 | * @method string display(string $content = '', array $vars = [], array $config = []) static 渲染内容输出 28 | */ 29 | class View extends Facade 30 | { 31 | /** 32 | * 获取当前Facade对应类名(或者已经绑定的容器对象标识) 33 | * @access protected 34 | * @return string 35 | */ 36 | protected static function getFacadeClass() 37 | { 38 | return 'view'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /thinkphp/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 array|object $data 数据 28 | * @param Model $parent 上级模型 29 | * @param string $table 中间数据表名 30 | */ 31 | public function __construct($data = [], Model $parent = null, $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 | } 43 | -------------------------------------------------------------------------------- /thinkphp/library/think/process/exception/Faild.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\process\exception; 13 | 14 | use think\Process; 15 | 16 | class Faild extends \RuntimeException 17 | { 18 | 19 | private $process; 20 | 21 | public function __construct(Process $process) 22 | { 23 | if ($process->isSuccessful()) { 24 | throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); 25 | } 26 | 27 | $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); 28 | 29 | if (!$process->isOutputDisabled()) { 30 | $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput()); 31 | } 32 | 33 | parent::__construct($error); 34 | 35 | $this->process = $process; 36 | } 37 | 38 | public function getProcess() 39 | { 40 | return $this->process; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /thinkphp/library/think/process/exception/Failed.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\process\exception; 13 | 14 | use think\Process; 15 | 16 | class Failed extends \RuntimeException 17 | { 18 | 19 | private $process; 20 | 21 | public function __construct(Process $process) 22 | { 23 | if ($process->isSuccessful()) { 24 | throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); 25 | } 26 | 27 | $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); 28 | 29 | if (!$process->isOutputDisabled()) { 30 | $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput()); 31 | } 32 | 33 | parent::__construct($error); 34 | 35 | $this->process = $process; 36 | } 37 | 38 | public function getProcess() 39 | { 40 | return $this->process; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /thinkphp/library/think/process/exception/Timeout.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\process\exception; 13 | 14 | use think\Process; 15 | 16 | class Timeout extends \RuntimeException 17 | { 18 | 19 | const TYPE_GENERAL = 1; 20 | const TYPE_IDLE = 2; 21 | 22 | private $process; 23 | private $timeoutType; 24 | 25 | public function __construct(Process $process, $timeoutType) 26 | { 27 | $this->process = $process; 28 | $this->timeoutType = $timeoutType; 29 | 30 | parent::__construct(sprintf('The process "%s" exceeded the timeout of %s seconds.', $process->getCommandLine(), $this->getExceededTimeout())); 31 | } 32 | 33 | public function getProcess() 34 | { 35 | return $this->process; 36 | } 37 | 38 | public function isGeneralTimeout() 39 | { 40 | return $this->timeoutType === self::TYPE_GENERAL; 41 | } 42 | 43 | public function isIdleTimeout() 44 | { 45 | return $this->timeoutType === self::TYPE_IDLE; 46 | } 47 | 48 | public function getExceededTimeout() 49 | { 50 | switch ($this->timeoutType) { 51 | case self::TYPE_GENERAL: 52 | return $this->process->getTimeout(); 53 | 54 | case self::TYPE_IDLE: 55 | return $this->process->getIdleTimeout(); 56 | 57 | default: 58 | throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType)); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /thinkphp/library/think/response/Json.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\response; 13 | 14 | use think\Response; 15 | 16 | class Json extends Response 17 | { 18 | // 输出参数 19 | protected $options = [ 20 | 'json_encode_param' => JSON_UNESCAPED_UNICODE, 21 | ]; 22 | 23 | protected $contentType = 'application/json'; 24 | 25 | /** 26 | * 处理数据 27 | * @access protected 28 | * @param mixed $data 要处理的数据 29 | * @return mixed 30 | * @throws \Exception 31 | */ 32 | protected function output($data) 33 | { 34 | try { 35 | // 返回JSON数据格式到客户端 包含状态信息 36 | $data = json_encode($data, $this->options['json_encode_param']); 37 | 38 | if (false === $data) { 39 | throw new \InvalidArgumentException(json_last_error_msg()); 40 | } 41 | 42 | return $data; 43 | } catch (\Exception $e) { 44 | if ($e->getPrevious()) { 45 | throw $e->getPrevious(); 46 | } 47 | throw $e; 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /thinkphp/library/think/response/Jsonp.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\response; 13 | 14 | use think\Response; 15 | 16 | class Jsonp extends Response 17 | { 18 | // 输出参数 19 | protected $options = [ 20 | 'var_jsonp_handler' => 'callback', 21 | 'default_jsonp_handler' => 'jsonpReturn', 22 | 'json_encode_param' => JSON_UNESCAPED_UNICODE, 23 | ]; 24 | 25 | protected $contentType = 'application/javascript'; 26 | 27 | /** 28 | * 处理数据 29 | * @access protected 30 | * @param mixed $data 要处理的数据 31 | * @return mixed 32 | * @throws \Exception 33 | */ 34 | protected function output($data) 35 | { 36 | try { 37 | // 返回JSON数据格式到客户端 包含状态信息 [当url_common_param为false时是无法获取到$_GET的数据的,故使用Request来获取] 38 | $var_jsonp_handler = $this->app['request']->param($this->options['var_jsonp_handler'], ""); 39 | $handler = !empty($var_jsonp_handler) ? $var_jsonp_handler : $this->options['default_jsonp_handler']; 40 | 41 | $data = json_encode($data, $this->options['json_encode_param']); 42 | 43 | if (false === $data) { 44 | throw new \InvalidArgumentException(json_last_error_msg()); 45 | } 46 | 47 | $data = $handler . '(' . $data . ');'; 48 | 49 | return $data; 50 | } catch (\Exception $e) { 51 | if ($e->getPrevious()) { 52 | throw $e->getPrevious(); 53 | } 54 | throw $e; 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /thinkphp/library/think/response/Jump.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\response; 13 | 14 | use think\Response; 15 | 16 | class Jump extends Response 17 | { 18 | protected $contentType = 'text/html'; 19 | 20 | /** 21 | * 处理数据 22 | * @access protected 23 | * @param mixed $data 要处理的数据 24 | * @return mixed 25 | * @throws \Exception 26 | */ 27 | protected function output($data) 28 | { 29 | $data = $this->app['view']->fetch($this->options['jump_template'], $data); 30 | return $data; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /thinkphp/library/think/route/dispatch/Callback.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\route\Dispatch; 15 | 16 | class Callback extends Dispatch 17 | { 18 | public function exec() 19 | { 20 | // 执行回调方法 21 | $vars = array_merge($this->request->param(), $this->param); 22 | 23 | return $this->app->invoke($this->dispatch, $vars); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /thinkphp/library/think/route/dispatch/Controller.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\route\Dispatch; 15 | 16 | class Controller extends Dispatch 17 | { 18 | public function exec() 19 | { 20 | // 执行控制器的操作方法 21 | $vars = array_merge($this->request->param(), $this->param); 22 | 23 | return $this->app->action( 24 | $this->dispatch, $vars, 25 | $this->rule->getConfig('url_controller_layer'), 26 | $this->rule->getConfig('controller_suffix') 27 | ); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /thinkphp/library/think/route/dispatch/Redirect.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\Response; 15 | use think\route\Dispatch; 16 | 17 | class Redirect extends Dispatch 18 | { 19 | public function exec() 20 | { 21 | return Response::create($this->dispatch, 'redirect')->code($this->code); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /thinkphp/library/think/route/dispatch/Response.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\route\Dispatch; 15 | 16 | class Response extends Dispatch 17 | { 18 | public function exec() 19 | { 20 | return $this->dispatch; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /thinkphp/library/think/route/dispatch/View.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\Response; 15 | use think\route\Dispatch; 16 | 17 | class View extends Dispatch 18 | { 19 | public function exec() 20 | { 21 | // 渲染模板输出 22 | $vars = array_merge($this->request->param(), $this->param); 23 | 24 | return Response::create($this->dispatch, 'view')->assign($vars); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /thinkphp/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/thinkphp/logo.png -------------------------------------------------------------------------------- /thinkphp/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ./library/think/*/tests/ 27 | 28 | 29 | 30 | 31 | 32 | ./library/ 33 | 34 | ./library/think/*/tests 35 | ./library/think/*/assets 36 | ./library/think/*/resources 37 | ./library/think/*/vendor 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /thinkphp/tpl/default_index.tpl: -------------------------------------------------------------------------------- 1 | *{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px } :) ThinkPHP V5.112载初心不改(2006-2018) - 你值得信赖的PHP框架'; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /vendor.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a54552239/pearProjectApi/a320554f415c94b8b258ddd44ba6959380a5019d/vendor.zip --------------------------------------------------------------------------------
ThinkPHP V5.112载初心不改(2006-2018) - 你值得信赖的PHP框架