Skip to content

Commit

Permalink
init source
Browse files Browse the repository at this point in the history
  • Loading branch information
weichaoduo committed Mar 27, 2018
1 parent c5d6ce0 commit 3a59065
Show file tree
Hide file tree
Showing 8,118 changed files with 787,352 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file added .DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
.idea
*.log
!.gitignore
/composer.lock
/vendor
/app/config/development/database.cfg.php
11 changes: 11 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
stages:
- deploy
deploy:
stage: deploy
script:
- /usr/bin/php /data/www/ismond/xphp/composer.phar update
- /home/gitlab-runner/.local/bin/deploy ismond xphp
only:
- master
tags:
- shell
1 change: 1 addition & 0 deletions .php_cs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"7.0.4","version":"2.7.1","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":{"ensure_fully_multiline":true},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true},"hashes":{"app\\config\\map.cfg.php":77549327,"app\\ctrl\\admin\\Project.php":-491003010,"lib\\Page.php":1537062123,"app\\function\\web.php":-436522078,"app\\classes\\LogLogic.php":209611330,"app\\classes\\IssueTypeLogic.php":-528527283,"app\\ctrl\\admin\\IssueType.php":-1526650003,"app\\model\\user\\GroupModel.php":2064657329,"app\\model\\issue\\IssueTypeModel.php":-822379227,"app\\model\\project\\ProjectIssueTypeSchemeDataModel.php":1489939663,"app\\model\\issue\\IssueTypeSchemeItemsModel.php":77490948,"app\\model\\issue\\IssueTypeSchemeModel.php":-2116140847,"lib\\MyPdo.php":-1517307087,"app\\classes\\WorkflowLogic.php":1533782467,"app\\ctrl\\admin\\Workflow.php":574273016,"app\\classes\\UserAuth.php":-1442207328}}
Binary file added app/.DS_Store
Binary file not shown.
41 changes: 41 additions & 0 deletions app/api/BaseApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace main\app\api;

use main\app\classes\B2bcrypt;
use main\app\classes\Sign;
use main\lib\phpcurl\Curl;

/**
* api 基类, 提供对外接口的接入操作
*
* @author jesen
*
*/
class BaseApi
{

/**
* 允许的请求方式
* */
protected static $method_type = array('get', 'post', 'put', 'patch', 'delete');

/**
* 参数处理
*/
public function __construct()
{

}


protected function validateRestfulHandler( )
{
foreach( self::$method_type as $method ) {
if( !method_exists( $this,$method . 'Handler') ) {
throw new \Exception( 'Restful '.$method . 'Handler not exists',500 );
}
}
}

}
19 changes: 19 additions & 0 deletions app/api/FirstApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* Created by PhpStorm.
* User: sven
* Date: 2017/6/28 0028
* Time: 下午 5:59
*/

namespace main\app\api;

class FirstApi extends BaseApi
{
public function get( ){
$ret = [];
$ret['data'] = ["1","2","3"];
$ret['msg'] = "ok";
return $ret;
}
}
172 changes: 172 additions & 0 deletions app/api/Framework.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<?php
/**
* Created by PhpStorm.
* User: sven
* Date: 2017/6/28 0028
* Time: 下午 5:59
*/

namespace main\app\api;


/**
* 测试开发框架 api
* Class framework
* @package main\app\api\mod_test
*/
class Framework extends BaseApi
{

/**
* 测试路由
* @return string
*/
public function route( )
{
return 'route';
}

/**
* 触发错误异常
* @return bool
*/
public function show_error( )
{
try {

timezone_open(1202229163);

$z = new \DateTimeZone(1202229163);

}
catch (Exception $e) {
echo "caught ".$e->getMessage();
return false;
}


return true;

}

/**
* 触发错误异常
* @return bool
*/
public function show_exception( )
{
timezone_open(1202229163);
//100/0;
new \DateTimeZone(1202229163);
echo 'ok';
}


/**
* 故意返回不符合期望的格式
* @require_type []
* @return array
*/
public function not_expect_json( )
{
$arr = [ 9,1,8,3,4,1,8,5,7 ];
// 注意,经过 array_unique 处理后返回值不是一个纯粹的数组,
// 而是以字符串下标的新数组 ["0": 9,"1": 1,"2": 8,"3": 3,"4": 4,"7": 5,"8": 7]
$arr = array_unique( $arr );
return $arr;
}

/**
* 返回符合期望的格式
* @require_type []
* @return array
*/
public function expect_json( )
{
$arr = [ 9,1,8,3,4,1,8,5,7 ];
$arr = array_unique( $arr );
$new_arr = [];
// 或者使用 array_values 函数
foreach( $arr as $k =>$v ){
$new_arr[] = $v;
}
return $new_arr;
}

/**
* 返回不符合的期望格式
* @require_type {"name":"","id":121,"fish":[1,3,4],"props":{"x":123,"y":128}}
* @return array
*/
public function not_expect_mix_json( )
{
$obj = new \stdClass();
$obj->id = 12333;
$obj->name = "sven";
$obj->fish = [232,4,34,5];
$obj->props = [];

return $obj;
}

/**
* 返回符合期望的格式
* @require_type {"name":"","id":121,"fish":[1,3,4],"props":{"x":123,"y":128}}
* @return array
*/
public function expect_mix_json( )
{
//return json_decode( '[]' );
$obj = new \stdClass();
$obj->id = 12333;
$obj->name = "sven";
$obj->fish = [232,4,34,5];
$obj_props = new \stdClass();
$obj_props->x = 123;
$obj_props->y = 128;
$obj->props = $obj_props;

return $obj;
}


public function user_add( )
{


}

public function user_query( )
{


}

public function user_get( )
{


}

public function user_delete( )
{


}

public function user_commit( )
{


}

public function user_rollback( )
{


}




}
Loading

0 comments on commit 3a59065

Please sign in to comment.