Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
1f546e18
Commit
1f546e18
authored
Aug 31, 2018
by
wwccw0591
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pc
parent
d882cfc3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
254 additions
and
190 deletions
+254
-190
AlipayTradeRefundRequest.php
...n/library/Alipay/aop/request/AlipayTradeRefundRequest.php
+12
-11
ApiConst.php
application/library/Our/ApiConst.php
+2
-1
PayConst.php
application/library/Our/PayConst.php
+3
-0
Alipay.php
application/library/Payment/Alipay.php
+50
-0
OrderService.php
application/models/Business/Order/OrderService.php
+185
-175
Order.php
application/models/DAO/Order/Order.php
+2
-2
RefundReturn.php
application/models/DAO/Order/RefundReturn.php
+0
-1
No files found.
application/library/Alipay/aop/request/AlipayTradeRefundRequest.php
View file @
1f546e18
<?php
namespace
Alipay\aop\request
;
/**
* ALIPAY API: alipay.trade.refund request
*
...
...
@@ -6,10 +7,10 @@
* @since 1.0, 2018-03-22 17:12:24
*/
class
AlipayTradeRefundRequest
{
/**
* 统一收单交易退款接口
**/
{
/**
* 统一收单交易退款接口
**/
private
$bizContent
;
private
$apiParas
=
array
();
...
...
@@ -21,16 +22,16 @@ class AlipayTradeRefundRequest
private
$returnUrl
;
private
$needEncrypt
=
false
;
public
function
setBizContent
(
$bizContent
)
{
$this
->
bizContent
=
$bizContent
;
$this
->
apiParas
[
"biz_content"
]
=
$bizContent
;
{
$this
->
bizContent
=
$bizContent
;
$this
->
apiParas
[
"biz_content"
]
=
$bizContent
;
}
public
function
getBizContent
()
{
return
$this
->
bizContent
;
{
return
$this
->
bizContent
;
}
public
function
getApiMethodName
()
...
...
application/library/Our/ApiConst.php
View file @
1f546e18
...
...
@@ -26,7 +26,8 @@ class ApiConst
const
oneMinute
=
60
;
//八小时秒数
const
EightHoursSecond
=
28800
;
const
hundred
=
100
;
//1分钟秒数
const
hundred
=
100
;
//1分钟秒数
const
oneMinSecond
=
60
;
//成功状态码
const
returnSuccess
=
1
;
...
...
application/library/Our/PayConst.php
View file @
1f546e18
...
...
@@ -29,6 +29,9 @@ class PayConst {
const
alipayAppId
=
'2017102509512276'
;
const
merchantPrivateKey
=
'MIIEpQIBAAKCAQEAuuiMPUDWb2KDrMOL+Nxd2V8t5KVCKH2RwnHWzcWsdUbpbIGRDrdG6CztQr0sbD6QXcquQWxeX8niTMg+AgL2tOADqRmhGs4SnWsHFM5U117tMp8l0UFVJdi77ipKmqZ3wrauCdmF8R6g1MbAm52mi72fykIV2j1elDeHu8VBASKczRRvfI22mekq86jIxO+/6qwj+nGCoDkQ001zsUHuGNXmGprt2Tr08JaenDJWTRH+mfOQtIAvrC6iUTHQL1pvg/oPIEAxlImF2XUN8ENaoci7tMKTrQBjvnpXUy8o6SNL1kkp6rd4nhuuSIy6+aNtsHrfA68aZzXB3QFQon//ZwIDAQABAoIBAQCGS6rgJCMvWxiDXOnIwQXJtuKxw7AaicbecI9HwL2ecnor1ZjVewi+r/E2H9i4Wee/DG9SYLwalWM9ii9LoLeE1OSsbtbb/K9RXmJzJ6G8Md+6nLE+fnPgwq6dfNOn9O5eAIZiW2IrEre6yqf/6DGPfItAd2VeLvQzCQdE+oEvf2QGlhYujfPMHFffbLYzP8Cnyt0vft7RnGB/dgcRjVXRL/NwAsKnwgmWydIxY/R61pvIQFKqdtOzvmAgh2z8WFON2kuu8+S1QY7m9/zv1h3d0XEgqGUDkmzIfX9jokzkavVYRTOPCkmj2AuXjqGG3VnVSIVQLW7LJtl9ivqrQ+Y5AoGBAPN7yAqBnUUHgXzi/cBvAh96V1Ag6SSdauvN8xCEFHS32RhkV9qhT8xzc0gLeDTgGRpLSVA5i5BhGOw/0YZJKp5zveXntX+7vqov+59pEfHF5MqZ5MWfysNFlTf7hK3BnFyX+d1mT+2BpOdsfvB52qphHxBJRmj0HF6Uum4hAgC9AoGBAMSEPk3kr9WN8kBXWbh9Yv8CacC3eP22HH1X6Lv0//wdAVLGumcmYzMu8qd9/JInJSnV62SDwSz0crbffNgIWoP9LkuEuzvXT+6jVOjmSGQweFIla9oWlcfRFw1R1vWzTPjC8QDk3CRdpOBFopwUWpwkU6IZ+S9bKKDZRYeqcTzzAoGBAMyB3WWltHj0cvh4l/X3x2q1EX1GB00vw0zIMS5gIeZfPUNVlM0XzLTHC78pkw+mYq9JKQzvKKBeTdaxS8Vk0x0/zfK7CiF9igncP5aHZAEU3LSnShYLvv0BBvJ8mdZv1muXYtFpTB0LVXzkDkLhtp6A8Nx3D2K8FtACUAyMQOhpAoGAL+k173Oz0tL6nuks/KfFPPrvoYaZvvFpXL3UBg8jYeoIao/83i0jvlTR4Df9HfzhOKPo8eaVcEpgtWkjXOAcgVV2tf60T1CdMkcr6mRKffK7QvvQoakj90Vo41xylhCS0YtlipxBd7RFAFC55men9617nmfKstr8usp+Aydw2DUCgYEAju/kuN8//IVoZZOatkb4/DmAyLfGJ1ZJwowY0uksFrTOOfGxYSCDxfK2PHDrfgtaRCT6mb3nQIBljELvwAN6N/fFFMK+PuaMLvkevII6QbGgqNkXewCQyHZDxsqAxtEEJazz6a+Nqra8LS0nXmr2iFRKgw6JIY4wDXMW3g39Ihk='
;
const
alipaySignType
=
'RSA2'
;
const
alipayCharset
=
"UTF-8"
;
const
format
=
'json'
;
const
alipayApiVersion
=
'1.0'
;
const
alipayGatewayUrl
=
'https://openapi.alipay.com/gateway.do'
;
const
alipayPublicKey
=
'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlnxDEAQLq9g9KBL8N+Kwr83b4xAl2GNa8E9lKjrgObsnIHwxCei4eASWvGFyFtau418aQvdFD9scR0mxw8NOB2QSmvJpeh2Ov5Cihh3dmR6jIDIEP7iCTHZQHv2tvM3DuxuUZSBK4oKD7kughmhVbu/fy4PGYLKcoHNuFVqajRxCS5/GXfce9dOGIk5+UFMzOi1m377qqpRK2SLMHO2tse0MTNznyKUgGHUGUlhvQwCnxF8FZx/RUUJPHcuaWxTnY8C9aQL2iaWKrwE3JPiE18m8g0NfBu/4E0VpLzPZCsoH2naHt1ORtMy0gnFH4FusdFapGatuMIb0LKJxhzsBTQIDAQAB'
;
...
...
application/library/Payment/Alipay.php
View file @
1f546e18
<?php
namespace
Payment
;
use
Our\ApiConst
;
/**
* User: liuyuzhen
* Date: 2018/7/3
...
...
@@ -47,6 +49,54 @@ class Alipay {
return
$returnData
;
}
private
function
getRandomString
(
$len
,
$chars
=
null
)
{
if
(
is_null
(
$chars
))
{
$chars
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
}
mt_srand
(
10000000
*
(
double
)
microtime
());
for
(
$i
=
0
,
$str
=
''
,
$lc
=
strlen
(
$chars
)
-
1
;
$i
<
$len
;
$i
++
)
{
$str
.=
$chars
[
mt_rand
(
0
,
$lc
)];
}
return
$str
;
}
public
function
refund
(
$order
){
$refundAmount
=
round
(
$order
[
'refundAmount'
]
/
\Our\ApiConst
::
hundred
,
\Our\ApiConst
::
two
);
if
(
APP_ENV
==
'develop'
||
APP_ENV
==
'test'
||
APP_ENV
==
'pre'
){
$refundAmount
=
0.01
;
}
$aop
=
new
\Alipay\aop\AopClient
();
$aop
->
gatewayUrl
=
\Our\PayConst
::
alipayGatewayUrl
;
$aop
->
appId
=
\Our\PayConst
::
alipayAppId
;
$aop
->
rsaPrivateKey
=
\Our\PayConst
::
merchantPrivateKey
;
$aop
->
alipayrsaPublicKey
=
\Our\PayConst
::
alipayPublicKey
;
$aop
->
apiVersion
=
\Our\PayConst
::
alipayApiVersion
;
$aop
->
signType
=
\Our\PayConst
::
alipaySignType
;
$aop
->
postCharset
=
\Our\PayConst
::
alipayCharset
;
$aop
->
format
=
\Our\PayConst
::
format
;
$outRequestNo
=
$this
->
getRandomString
(
ApiConst
::
nine
);
// require_once BASE_ROOT_PATH.'/core/payment/alipay/aop/request/AlipayTradeRefundRequest.php';
// //require_once 'aop/request/AlipayTradeRefundRequest.php';
$request
=
new
\Alipay\aop\request\AlipayTradeAppPayRequest
();
$request
->
setBizContent
(
"{"
.
"
\"
out_trade_no
\"
:
\"
{
$order
[
'outTradeNo'
]
}
\"
,"
.
"
\"
refund_amount
\"
:
{
$refundAmount
}
,"
.
"
\"
refund_reason
\"
:
\"
正常退款
\"
,"
.
"
\"
out_request_no
\"
:
\"
{
$outRequestNo
}
\"
,"
.
"
\"
store_id
\"
:
\"
{
$order
[
'storeId'
]
}
\"
"
.
"}"
);
$result
=
$aop
->
execute
(
$request
);
$responseNode
=
str_replace
(
"."
,
"_"
,
$request
->
getApiMethodName
())
.
"_response"
;
$result
=
$result
->
$responseNode
;
return
$result
;
// $resultCode = $result->$responseNode->code;
// if(!empty($resultCode)&&$resultCode == 10000){
// return true;
// } else {
// return false;
// }
}
/**
* 类实例
...
...
application/models/Business/Order/OrderService.php
View file @
1f546e18
This diff is collapsed.
Click to expand it.
application/models/DAO/Order/Order.php
View file @
1f546e18
...
...
@@ -85,8 +85,8 @@ class OrderModel extends \DAO\AbstractModel
{
$begin
=
strtotime
(
date
(
"Y-m-d"
),
time
());
$end
=
TIMESTAMP
;
$notInState
=
"
{
ApiConst::orderStateCancel},{ApiConst::orderStateClose
}
"
;
$where
=
Common
::
format
(
" store_id=
{
0
}
and order_state not in
{
1
}
"
,
$storeId
,
$notInState
);
$notInState
=
ApiConst
::
orderStateCancel
.
','
.
ApiConst
::
orderStateClose
;
$where
=
Common
::
format
(
" store_id=
{
0
}
and order_state not in
(
{
1
}
)
"
,
$storeId
,
$notInState
);
$orderTotal
=
$this
->
getOrderCounts
(
$where
,
$this
->
countField
);
$where
.=
Common
::
format
(
" and add_time between
{
0
}
and
{
1
}
"
,
$begin
,
$end
);
$todayTotal
=
$this
->
getOrderCounts
(
$where
,
$this
->
countField
);
...
...
application/models/DAO/Order/RefundReturn.php
View file @
1f546e18
...
...
@@ -359,7 +359,6 @@ class RefundReturnModel extends \DAO\AbstractModel {
}
/**
* 类实例
*
...
...
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