Commit 7136ee5d authored by 万继龙's avatar 万继龙

Merge branch 'develop' into 'test'

Develop

See merge request bp/pay!14
parents 95bb1a5f 3d1fe678
...@@ -8,6 +8,7 @@ namespace App\Exception; ...@@ -8,6 +8,7 @@ namespace App\Exception;
* 重写Handle的render方法,实现自定义异常消息 * 重写Handle的render方法,实现自定义异常消息
*/ */
use Api\PhpUtils\Log\FileLog;
use Helpers\ApiResponse; use Helpers\ApiResponse;
use Yaf\Registry; use Yaf\Registry;
...@@ -48,16 +49,16 @@ class ExceptionHandler ...@@ -48,16 +49,16 @@ class ExceptionHandler
*/ */
private function recordErrorLog($e) private function recordErrorLog($e)
{ {
if($e instanceof \ErrorException || $e instanceof \Exception){ if($e instanceof \ErrorException || $e instanceof \Exception || $e instanceof \Error){
$message = $e->getMessage(); $message = $e->getMessage();
$file_name = $e->getFile(); $file_name = $e->getFile();
$line_num = $e->getLine(); $line_num = $e->getLine();
$msg = ' file_name : '.$file_name . ' line_num : '.$line_num . ' message : ' . $message; $msg = ' file_name : '.$file_name . ' line_num : '.$line_num . ' message : ' . $message;
// LogUtil::error('exception handler', $msg); FileLog::error(get_class($e) . ' handler', $msg, $e, 'wanjilong@yidian-inc.com');
}
if(is_string($e) || is_int($e)){ }elseif( is_string($e) || is_int($e)){
// LogUtil::error('exception handler', $e); FileLog::error('exception handler', $e);
} }
} }
} }
\ No newline at end of file
...@@ -27,7 +27,7 @@ class DaemonController extends Cli ...@@ -27,7 +27,7 @@ class DaemonController extends Cli
if(empty($task_name)){ if(empty($task_name)){
echo <<<EOD echo <<<EOD
usage: php cli.php daemon run "t=Wallet&n=2&j=sync_wallet" usage: php cli.php Wallet 2 sync_wallet
t daemo 脚本类名 t daemo 脚本类名
n 进程数 n 进程数
j 进程别名,默认同脚本类名 j 进程别名,默认同脚本类名
......
...@@ -317,6 +317,7 @@ class PayService ...@@ -317,6 +317,7 @@ class PayService
} }
PayOrderItem::update([ PayOrderItem::update([
'notify_account_status' => 2, 'notify_account_status' => 2,
'notify_account_times[+]' => 1,
'notify_account_success_time' => date('Y-m-d H:i:s') 'notify_account_success_time' => date('Y-m-d H:i:s')
], ['order_item_id' => $order_item_id, 'can_notify_account' => 1]); ], ['order_item_id' => $order_item_id, 'can_notify_account' => 1]);
...@@ -325,6 +326,7 @@ class PayService ...@@ -325,6 +326,7 @@ class PayService
//补偿处理 //补偿处理
PayOrderItem::update([ PayOrderItem::update([
'notify_account_status' => 0, 'notify_account_status' => 0,
'notify_account_times[+]' => 1,
], ['order_item_id' => $order_item_id, 'can_notify_account' => 1]); ], ['order_item_id' => $order_item_id, 'can_notify_account' => 1]);
} }
} }
......
[common] [common]
application.directory = APPLICATION_PATH"/application" application.directory = APP_PATH
application.library = APPLICATION_PATH"/application/library" application.library = APP_PATH"/library"
application.bootstrap = APPLICATION_PATH"/application/BootstrapCli.php" application.bootstrap = APP_PATH"/BootstrapCli.php"
application.dispatcher.catchException = true application.dispatcher.catchException = true
application.dispatcher.throwException = true application.dispatcher.throwException = true
daemon.script_dir = "\\Daemon\\" daemon.script_dir = "\\Daemon\\"
......
...@@ -14,23 +14,35 @@ if( !substr(php_sapi_name(), 0, 3) == 'cli' ) { ...@@ -14,23 +14,35 @@ if( !substr(php_sapi_name(), 0, 3) == 'cli' ) {
die; die;
} }
/* 定义这个常量是为了在cli.ini中引用*/
define('ROOT_PATH', realpath(__DIR__.'/../')); define('ROOT_PATH', realpath(__DIR__.'/../'));
define('APPLICATION_PATH', realpath(__DIR__.'/../'));
define('APP_PATH', realpath(__DIR__.'/../application')); define('APP_PATH', realpath(__DIR__.'/../application'));
define('APP_START', microtime(true));
require ROOT_PATH . '/vendor/autoload.php'; require ROOT_PATH . '/vendor/autoload.php';
$application = new Yaf\Application( ROOT_PATH . "/conf/cli.ini"); $application = new Yaf\Application( ROOT_PATH . "/conf/cli.ini");
/** /**
* 获取模块/控制器/方法 * 获取模块/控制器/方法
usage: php cli.php "t=Wallet&n=2&j=sync_wallet"
usage: php cli.php Wallet sync_wallet 2
*
*/ */
$module = "cli"; $module = "cli";
$controller = $argv[1] ?? ""; $controller = "daemon";
$method = $argv[2] ?? ""; $method = "run";
$param = []; $param = [];
$param['t'] = $argv[1] ?? "Wallet";
$param['n'] = $argv[2] ?? 2;
$param['j'] = $argv[3] ?? "sync_wallet";
/*
if (!empty($argv[3])) if (!empty($argv[3]))
{ {
parse_str($argv[3], $param); parse_str($argv[3], $param);
} }
*/
$application->bootstrap()->getDispatcher()->dispatch( new Yaf\Request\Simple("", $module, $controller,$method,$param) ); $application->bootstrap()->getDispatcher()->dispatch( new Yaf\Request\Simple("", $module, $controller,$method,$param) );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment