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
c6f6a040
Commit
c6f6a040
authored
Sep 26, 2021
by
wanjilong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 梳理报错信息及文案
parent
5cba5d0c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
44 deletions
+57
-44
Code.php
application/exception/custom/Code.php
+1
-0
MerchantException.php
application/exception/custom/MerchantException.php
+18
-0
PayOrder.php
application/models/order/mysql/PayOrder.php
+0
-26
PayService.php
application/services/pay/PayService.php
+10
-10
PlatformAccountService.php
application/services/pay/PlatformAccountService.php
+1
-1
MerchantAccountService.php
application/services/wallet/MerchantAccountService.php
+27
-7
No files found.
application/exception/custom/Code.php
View file @
c6f6a040
...
@@ -17,4 +17,5 @@ class Code
...
@@ -17,4 +17,5 @@ class Code
const
SDK
=
104000
;
const
SDK
=
104000
;
const
FUNDS
=
105000
;
const
FUNDS
=
105000
;
const
P_ACCOUNT
=
106000
;
const
P_ACCOUNT
=
106000
;
const
MERCHANT
=
107000
;
}
}
\ No newline at end of file
application/exception/custom/MerchantException.php
0 → 100644
View file @
c6f6a040
<?php
namespace
App\Exception\custom
;
use
App\Exception\BaseException
;
class
MerchantException
extends
BaseException
{
protected
$base_code
=
Code
::
MERCHANT
;
protected
$cus
=
[
0
=>
'系统异常请联系管理员'
,
1
=>
'interface.ini 缺少配置,请管理员关注'
,
2
=>
'account返回异常,请管理员关注'
,
];
}
application/models/order/mysql/PayOrder.php
View file @
c6f6a040
...
@@ -8,30 +8,4 @@ class PayOrder extends MysqlBase
...
@@ -8,30 +8,4 @@ class PayOrder extends MysqlBase
{
{
const
TABLE_NAME
=
'pay_order'
;
const
TABLE_NAME
=
'pay_order'
;
const
CONFIG_INDEX
=
'pay'
;
const
CONFIG_INDEX
=
'pay'
;
/**
* @param $order_id
* @param $pay_order
* @return array
*/
public
static
function
get_valid_order
(
$order_id
,
$pay_order
)
{
self
::
beginTransaction
();
try
{
$order
=
self
::
getMaster
(
'*'
,
[
'order_id'
=>
$order_id
]);
if
(
empty
(
$order
))
{
$cnt
=
self
::
insert
(
$pay_order
,
[
'rowCount'
=>
true
]);
if
(
$cnt
)
{
$order
=
$pay_order
;
}
}
self
::
commit
();
}
catch
(
\PDOException
$e
)
{
self
::
rollback
();
}
return
$order
;
}
}
}
application/services/pay/PayService.php
View file @
c6f6a040
...
@@ -448,7 +448,6 @@ class PayService
...
@@ -448,7 +448,6 @@ class PayService
if
(
!
empty
(
$order_item_ids
)
&&
!
in_array
(
$item
[
'order_item_id'
],
$order_item_ids
))
{
if
(
!
empty
(
$order_item_ids
)
&&
!
in_array
(
$item
[
'order_item_id'
],
$order_item_ids
))
{
continue
;
//部分核销,且不再核销子单列表,不处理
continue
;
//部分核销,且不再核销子单列表,不处理
}
}
if
(
in_array
(
$item
[
'refund_order_status'
],
[
1
,
2
]))
{
if
(
in_array
(
$item
[
'refund_order_status'
],
[
1
,
2
]))
{
continue
;
//退款中、已退款不允许再次申请
continue
;
//退款中、已退款不允许再次申请
}
}
...
@@ -546,7 +545,7 @@ class PayService
...
@@ -546,7 +545,7 @@ class PayService
}
}
*/
*/
//平台收入入账
//平台收入入账
$p
=
WriteOffPlatformRecord
::
selec
tMaster
(
'*'
,
$p
=
WriteOffPlatformRecord
::
ge
tMaster
(
'*'
,
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status[<]'
=>
2
]);
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status[<]'
=>
2
]);
if
(
$p
)
{
if
(
$p
)
{
$p_cnt
=
$p_cnt
&&
PlatformAccountService
::
credit
([
'trade_id'
=>
$writeOff_order_id
,
'amount'
=>
$p
[
'payment'
]]);
$p_cnt
=
$p_cnt
&&
PlatformAccountService
::
credit
([
'trade_id'
=>
$writeOff_order_id
,
'amount'
=>
$p
[
'payment'
]]);
...
@@ -557,7 +556,7 @@ class PayService
...
@@ -557,7 +556,7 @@ class PayService
}
}
//团长分销入账
//团长分销入账
$us
=
WriteOffPersonalRecord
::
ge
tMaster
(
'*'
,
$us
=
WriteOffPersonalRecord
::
selec
tMaster
(
'*'
,
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status[<]'
=>
2
]);
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status[<]'
=>
2
]);
if
(
$us
)
{
if
(
$us
)
{
$w_list
=
[];
$w_list
=
[];
...
@@ -586,7 +585,7 @@ class PayService
...
@@ -586,7 +585,7 @@ class PayService
}
}
//商家收益
//商家收益
$m
=
WriteOffMerchantRecord
::
selec
tMaster
(
'*'
,
$m
=
WriteOffMerchantRecord
::
ge
tMaster
(
'*'
,
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status[<]'
=>
2
]);
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status[<]'
=>
2
]);
if
(
$m
)
{
if
(
$m
)
{
try
{
//MerchantAccountService
try
{
//MerchantAccountService
...
@@ -620,12 +619,12 @@ class PayService
...
@@ -620,12 +619,12 @@ class PayService
],
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status'
=>
1
]);
],
[
'writeoff_order_id'
=>
$writeOff_order_id
,
'notify_account_status'
=>
1
]);
}
else
{
}
else
{
$info
=
WriteOffOrder
::
selec
tMaster
(
'*'
,
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
$info
=
WriteOffOrder
::
ge
tMaster
(
'*'
,
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
$next
=
$this
->
getNextTime
(
$info
[
'
can_notify_account_time
'
]);
$next
=
$this
->
getNextTime
(
$info
[
'
notify_account_times
'
]);
WriteOffOrder
::
update
([
WriteOffOrder
::
update
([
'notify_account_status'
=>
0
,
'notify_account_status'
=>
0
,
'
can_notify_account_time
[+]'
=>
1
,
'
notify_account_times
[+]'
=>
1
,
'
notify_account_times
'
=>
date
(
'Y-m-d H:i:s'
,
$next
),
'
can_notify_account_time
'
=>
date
(
'Y-m-d H:i:s'
,
$next
),
],
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
],
[
'writeoff_order_id'
=>
$writeOff_order_id
]);
}
}
}
}
...
@@ -985,10 +984,11 @@ class PayService
...
@@ -985,10 +984,11 @@ class PayService
* @param $merchant_cash
* @param $merchant_cash
* @return mixed
* @return mixed
* 计算商户清分信息, 存在结算价则需要二次平台收入
* 计算商户清分信息, 存在结算价则需要二次平台收入
* @throws \App\Exception\custom\MerchantException
*/
*/
private
function
make_merchant_clearing
(
$merchant_cash
,
$platform
)
private
function
make_merchant_clearing
(
$merchant_cash
,
$platform
)
{
{
$m
=
$this
->
get_merchant_account
(
$this
->
pay_order
);
$m
=
MerchantAccountService
::
get_merchant_account
(
$this
->
pay_order
);
$merchant
[
'account_id'
]
=
$m
[
'account_id'
];
//商户
$merchant
[
'account_id'
]
=
$m
[
'account_id'
];
//商户
$merchant
[
'account_type'
]
=
2
;
//商户
$merchant
[
'account_type'
]
=
2
;
//商户
...
@@ -1125,7 +1125,7 @@ class PayService
...
@@ -1125,7 +1125,7 @@ class PayService
throw new CodeSpecialException("failed" . __METHOD__);
throw new CodeSpecialException("failed" . __METHOD__);
}
}
*/
*/
$url
=
"http://account.dev.yidian-inc.com
/account/account/get_account"
;
$url
=
'http://account.dev.yidian-inc.com'
.
"
/account/account/get_account"
;
$ret
=
Sdk
::
call
(
$url
,
[
$ret
=
Sdk
::
call
(
$url
,
[
'life_account_id'
=>
$params
[
'life_account_id'
],
'life_account_id'
=>
$params
[
'life_account_id'
],
'shop_id'
=>
$params
[
'shop_id'
],
'shop_id'
=>
$params
[
'shop_id'
],
...
...
application/services/pay/PlatformAccountService.php
View file @
c6f6a040
...
@@ -28,7 +28,7 @@ class PlatformAccountService
...
@@ -28,7 +28,7 @@ class PlatformAccountService
$cnt
=
true
;
$cnt
=
true
;
$cnt
=
$cnt
&&
PlatformAccount
::
update
([
$cnt
=
$cnt
&&
PlatformAccount
::
update
([
'receivable_amount[+]'
=>
$data
[
'amount'
]
'receivable_amount[+]'
=>
$data
[
'amount'
]
],
[
'platform_
funds_id'
=>
$info
[
'platform_funds
_id'
]]);
],
[
'platform_
account_id'
=>
$info
[
'platform_account
_id'
]]);
$cnt
=
$cnt
&&
PlatformAccountLog
::
insert
([
$cnt
=
$cnt
&&
PlatformAccountLog
::
insert
([
'platform_account_id'
=>
$info
[
'platform_account_id'
],
'platform_account_id'
=>
$info
[
'platform_account_id'
],
...
...
application/services/wallet/MerchantAccountService.php
View file @
c6f6a040
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
namespace
App\Services\wallet
;
namespace
App\Services\wallet
;
use
App\Exception\custom\CodeSpecialException
;
use
App\Exception\custom\CodeSpecialException
;
use
App\Exception\custom\MerchantException
;
use
Helpers\Sdk
;
use
Helpers\Sdk
;
...
@@ -17,14 +18,13 @@ class MerchantAccountService
...
@@ -17,14 +18,13 @@ class MerchantAccountService
* 钱包记录同步
* 钱包记录同步
*/
*/
public
static
function
sync
(
$params
)
{
public
static
function
sync
(
$params
)
{
/*
///account/billrecord/create
$url
=
config
(
'interface'
,
'account.billrecord.create'
);
$url = config('interface', 'account.account.transfer');
if
(
!
$url
)
{
if
(
!
$url
)
{
throw new
CodeSpecialException("failed"
);
throw
new
MerchantException
([
'cus'
=>
1
]
);
}
}
*/
$url
=
'http://account.dev.yidian-inc.com/account/billrecord/create'
;
//
$url = 'http://account.dev.yidian-inc.com/account/billrecord/create';
// 服务增加签名
// 服务增加签名
$appid
=
\Yaf\Application
::
app
()
->
getConfig
()
->
get
(
'wallet.appid'
);
$appid
=
\Yaf\Application
::
app
()
->
getConfig
()
->
get
(
'wallet.appid'
);
...
@@ -37,9 +37,29 @@ class MerchantAccountService
...
@@ -37,9 +37,29 @@ class MerchantAccountService
return
Sdk
::
call
(
$url
,
$params
);
return
Sdk
::
call
(
$url
,
$params
);
}
}
private
function
sign
(
$params
,
$secret
)
{
private
static
function
sign
(
$params
,
$secret
)
{
$sign
=
md5
(
$params
[
'time'
]
.
$secret
);
$sign
=
md5
(
$params
[
'time'
]
.
$secret
);
return
$sign
;
return
$sign
;
}
}
public
static
function
get_merchant_account
(
$params
)
{
$url
=
config
(
'interface'
,
'account.account.get_account'
);
if
(
!
$url
)
{
throw
new
MerchantException
([
'cus'
=>
1
]);
}
$ret
=
Sdk
::
call
(
$url
,
[
'life_account_id'
=>
$params
[
'life_account_id'
],
'shop_id'
=>
$params
[
'shop_id'
],
'source_name'
=>
$params
[
'source_name'
],
'service_name'
=>
$params
[
'service_name'
],
]);
if
(
empty
(
$ret
[
'result'
]))
{
throw
new
MerchantException
([
'cus'
=>
2
]);
}
return
$ret
[
'result'
];
}
}
}
\ No newline at end of file
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