Commit 4607ae47 authored by wanjilong's avatar wanjilong

add: 调整cli 参数格式

parent 71f1acca
......@@ -8,6 +8,7 @@ namespace App\Exception;
* 重写Handle的render方法,实现自定义异常消息
*/
use Api\PhpUtils\Log\FileLog;
use Helpers\ApiResponse;
use Yaf\Registry;
......@@ -48,16 +49,16 @@ class ExceptionHandler
*/
private function recordErrorLog($e)
{
if($e instanceof \ErrorException || $e instanceof \Exception){
if($e instanceof \ErrorException || $e instanceof \Exception || $e instanceof \Error){
$message = $e->getMessage();
$file_name = $e->getFile();
$line_num = $e->getLine();
$msg = ' file_name : '.$file_name . ' line_num : '.$line_num . ' message : ' . $message;
// LogUtil::error('exception handler', $msg);
}
if(is_string($e) || is_int($e)){
// LogUtil::error('exception handler', $e);
FileLog::error(get_class($e) . ' handler', $msg, $e, 'wanjilong@yidian-inc.com');
}elseif( is_string($e) || is_int($e)){
FileLog::error('exception handler', $e);
}
}
}
\ No newline at end of file
......@@ -317,6 +317,7 @@ class PayService
}
PayOrderItem::update([
'notify_account_status' => 2,
'notify_account_times[+]' => 1,
'notify_account_success_time' => date('Y-m-d H:i:s')
], ['order_item_id' => $order_item_id, 'can_notify_account' => 1]);
......@@ -325,6 +326,7 @@ class PayService
//补偿处理
PayOrderItem::update([
'notify_account_status' => 0,
'notify_account_times[+]' => 1,
], ['order_item_id' => $order_item_id, 'can_notify_account' => 1]);
}
}
......
[common]
application.directory = APPLICATION_PATH"/application"
application.library = APPLICATION_PATH"/application/library"
application.bootstrap = APPLICATION_PATH"/application/BootstrapCli.php"
application.directory = APP_PATH
application.library = APP_PATH"/library"
application.bootstrap = APP_PATH"/BootstrapCli.php"
application.dispatcher.catchException = true
application.dispatcher.throwException = true
daemon.script_dir = "\\Daemon\\"
......
......@@ -14,23 +14,34 @@ if( !substr(php_sapi_name(), 0, 3) == 'cli' ) {
die;
}
/* 定义这个常量是为了在cli.ini中引用*/
define('ROOT_PATH', realpath(__DIR__.'/../'));
define('APPLICATION_PATH', realpath(__DIR__.'/../'));
define('APP_PATH', realpath(__DIR__.'/../application'));
define('APP_START', microtime(true));
require ROOT_PATH . '/vendor/autoload.php';
$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";
$controller = $argv[1] ?? "";
$method = $argv[2] ?? "";
$controller = "daemon";
$method = "run";
$param = [];
$param['t'] = $argv[1] ?? "Wallet";
$param['j'] = $argv[2] ?? "sync_wallet";
$param['n'] = $argv[3] ?? 2;
/*
if (!empty($argv[3]))
{
parse_str($argv[3], $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