Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pay
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
pay
Commits
7136ee5d
Commit
7136ee5d
authored
Jul 15, 2021
by
万继龙
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'test'
Develop See merge request bp/pay!14
parents
95bb1a5f
3d1fe678
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
13 deletions
+28
-13
ExceptionHandler.php
application/exception/ExceptionHandler.php
+6
-5
Daemon.php
application/modules/Cli/controllers/Daemon.php
+1
-1
PayService.php
application/services/pay/PayService.php
+2
-0
cli.ini
conf/cli.ini
+3
-3
cli.php
public/cli.php
+16
-4
No files found.
application/exception/ExceptionHandler.php
View file @
7136ee5d
...
@@ -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
application/modules/Cli/controllers/Daemon.php
View file @
7136ee5d
...
@@ -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 进程别名,默认同脚本类名
...
...
application/services/pay/PayService.php
View file @
7136ee5d
...
@@ -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
]);
}
}
}
}
...
...
conf/cli.ini
View file @
7136ee5d
[common]
[common]
application.directory
=
APP
LICATION_PATH"/application"
application.directory
=
APP
_PATH
application.library
=
APP
LICATION_PATH"/application
/library"
application.library
=
APP
_PATH"
/library"
application.bootstrap
=
APP
LICATION_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
\\
"
...
...
public/cli.php
View file @
7136ee5d
...
@@ -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
)
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment