Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
services
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tencent
services
Commits
f538efe9
Commit
f538efe9
authored
Aug 06, 2018
by
王召彬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.2b3.cn/hdllbackend/services
parents
d452f6dc
32f3b022
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
76 additions
and
12 deletions
+76
-12
.gitignore
+1
-0
src/Buyer/Enum/BuyerError.php
+7
-7
src/Buyer/Lib/BuyerInterface.php
+1
-1
src/Buyer/Lib/CommissionInterface.php
+1
-1
src/Common/Exception/CommonException.php
+9
-2
src/Common/Exception/ExceptionData.php
+54
-0
src/Common/Exception/ExceptionParseData.php
+3
-1
No files found.
.gitignore
View file @
f538efe9
...
...
@@ -11,3 +11,4 @@ temp/
.phpintel/
.env
.DS_Store
/vendor
src/Buyer/Enum/BuyerError.php
View file @
f538efe9
...
...
@@ -9,13 +9,13 @@ namespace Hdll\Services\Buyer\Enum;
class
BuyerError
{
const
PARAMETER_ERR
=
[
"msg"
=>
"参数错误"
,
"code"
=>
400
,
"errorCode"
=>
24001
];
const
REGISTERED
=
[
"msg"
=>
"用户已存在,无需创建"
,
"code"
=>
400
,
"errorCode"
=>
24101
];
const
DB_ERROR
=
[
"msg"
=>
"数据库操作错误"
,
"code"
=>
500
,
"errorCode"
=>
24102
];
const
SCORE_ERR
=
[
"msg"
=>
"你无权创建该用户"
,
"code"
=>
403
,
"errorCode"
=>
24103
];
const
NOT_FOUND_COMMISSION
=
[
"msg"
=>
"获取佣金信息失败"
,
"code"
=>
404
,
"errorCode"
=>
24104
];
const
INSUFFICIENT_COMMISSION
=
[
"msg"
=>
"可提现金额不足,无法提现"
,
"code"
=>
400
,
"errorCode"
=>
24105
];
const
PARAMETER_ERR
=
[
"msg"
=>
"参数错误"
,
"code"
=>
400
,
"errorCode"
=>
24001
,
'rpcCode'
=>
"PARAMETER_ERR"
];
const
REGISTERED
=
[
"msg"
=>
"用户已存在,无需创建"
,
"code"
=>
400
,
"errorCode"
=>
24101
,
"rpcCode"
=>
"REGISTERED"
];
const
DB_ERROR
=
[
"msg"
=>
"数据库操作错误"
,
"code"
=>
500
,
"errorCode"
=>
24102
,
"rpcCode"
=>
"DB_ERROR"
];
const
SCORE_ERR
=
[
"msg"
=>
"你无权创建该用户"
,
"code"
=>
403
,
"errorCode"
=>
24103
,
"rpcCode"
=>
"SCORE_ERR"
];
const
NOT_FOUND_COMMISSION
=
[
"msg"
=>
"获取佣金信息失败"
,
"code"
=>
404
,
"errorCode"
=>
24104
,
"rpcCode"
=>
"NOT_FOUND_COMMISSION"
];
const
INSUFFICIENT_COMMISSION
=
[
"msg"
=>
"可提现金额不足,无法提现"
,
"code"
=>
400
,
"errorCode"
=>
24105
,
"rpcCode"
=>
"INSUFFICIENT_COMMISSION"
];
const
NOT_FOUND_BUYER
=
[
"msg"
=>
"获取买家信息失败"
,
"code"
=>
400
,
"errorCode"
=>
24106
,
"rpcCode"
=>
"NOT_FOUND_BUYER"
];
public
static
function
atranslate
(
$message
,
$param
)
...
...
src/Buyer/Lib/BuyerInterface.php
View file @
f538efe9
...
...
@@ -17,7 +17,7 @@ use Swoft\Core\ResultInterface;
*/
interface
BuyerInterface
{
public
function
getUser
(
string
$token
);
public
function
getUser
(
int
$stroeId
,
int
$BuyerId
);
public
function
updateProfile
(
string
$token
,
array
$data
);
...
...
src/Buyer/Lib/CommissionInterface.php
View file @
f538efe9
...
...
@@ -19,7 +19,7 @@ interface CommissionInterface
* @param $storeId
* @param $buyerId
* @param $money
* @return bool
* @return
mixed|
bool
*/
public
function
reduceBalanceCommission
(
$storeId
,
$buyerId
,
$money
);
...
...
src/Common/Exception/CommonException.php
View file @
f538efe9
...
...
@@ -15,7 +15,7 @@ class CommonException extends Exception
public
$errorCode
=
-
1
;
//异常调用路径
protected
$path
;
protected
$path
=
[]
;
public
function
__construct
(
$params
=
[])
{
...
...
@@ -36,9 +36,16 @@ class CommonException extends Exception
}
if
(
isset
(
$params
[
'path'
])
)
{
$this
->
path
=
json_encode
(
$params
[
'path'
])
;
$this
->
path
=
$params
[
'path'
]
;
}
//将此次异常信息入栈
array_unshift
(
$this
->
path
,
'Service:'
.
APP_NAME
.
' file:'
.
$this
->
file
.
$this
->
line
)
//将本次错误调用加入path
//json序列化path
&&
$this
->
path
=
json_encode
(
$this
->
path
);
parent
::
__construct
(
$this
->
message
,
$this
->
code
);
}
...
...
src/Common/Exception/ExceptionData.php
0 → 100644
View file @
f538efe9
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/8/3
* Time: 17:21
*/
namespace
Hdll\Services\Common\Exception
;
class
ExceptionData
{
public
static
function
getExceptionData
(
$errData
,
array
$param
=
[])
{
return
[
"code"
=>
$errData
[
'code'
],
"msg"
=>
$errData
[
'msg'
],
"errorCode"
=>
$errData
[
"errCode"
],
"data"
=>
$errData
[
'data'
],
"path"
=>
$errData
[
'path'
]
];
}
/**
* 组装抛出的rpc信息
* @param \Throwable $e
* @return array
*/
public
static
function
getRpcErrData
(
\Throwable
$e
)
{
//初始化异常数据
$data
=
[
"code"
=>
$e
->
getCode
(),
"msg"
=>
$e
->
getMessage
(),
"errCode"
=>
is_callable
([
$e
,
'getErrCode'
])
?
$e
->
getErrcode
()
:
''
,
'path'
=>
[],
];
if
(
is_callable
([
$e
,
"getPath"
])
)
{
$data
[
'path'
]
=
json_decode
(
$e
->
getPath
(),
true
);
}
//获取调用堆栈信息
$info
=
debug_backtrace
(
DEBUG_BACKTRACE_IGNORE_ARGS
,
1
)[
0
];
//将此次异常信息入站
array_unshift
(
$data
[
'path'
],
'Service:'
.
APP_NAME
.
' file:'
.
$info
[
'file'
]
.
$info
[
'line'
]);
return
[
'msg'
=>
json_encode
(
$data
),
'code'
=>
$data
[
'code'
]];
}
}
\ No newline at end of file
src/Common/Exception/ExceptionParseData.php
View file @
f538efe9
...
...
@@ -11,9 +11,10 @@ class ExceptionParseData
{
public
static
function
parseData
(
\Exception
$e
)
{
if
(
is_callable
(
$e
,
'getResponse'
)
)
{
if
(
is_callable
(
[
$e
,
'getResponse'
]
)
)
{
$response
=
$e
->
getResponse
();
preg_match
(
"/
{
.*
}
/"
,
$response
[
'msg'
],
$data
);
$msg
=
isset
(
$data
[
'0'
])
?
$data
[
'0'
]
:
''
;
...
...
@@ -22,6 +23,7 @@ class ExceptionParseData
$data
[
'msg'
]
=
$e
->
getMessage
();
$data
[
'code'
]
=
$e
->
getCode
();
$data
[
'file'
]
=
$e
->
getFile
()
.
' '
.
$e
->
getLine
();
$data
[
'path'
]
=
[
$e
->
getFile
()
.
' '
.
$e
->
getLine
()];
}
return
$data
;
...
...
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