Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
starsw001
ShopXO
提交
cb37f8fe
ShopXO
项目概览
starsw001
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cb37f8fe
编写于
11月 22, 2018
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pay
上级
d2171d6e
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
674 addition
and
523 deletion
+674
-523
alipay/app.acss
alipay/app.acss
+2
-0
alipay/app.js
alipay/app.js
+1
-1
alipay/pages/buy/buy.acss
alipay/pages/buy/buy.acss
+45
-2
alipay/pages/buy/buy.axml
alipay/pages/buy/buy.axml
+26
-2
alipay/pages/buy/buy.js
alipay/pages/buy/buy.js
+51
-69
alipay/pages/paytips/paytips.axml
alipay/pages/paytips/paytips.axml
+1
-3
alipay/pages/paytips/paytips.js
alipay/pages/paytips/paytips.js
+6
-1
alipay/pages/user-order/user-order.js
alipay/pages/user-order/user-order.js
+37
-30
service/Application/Admin/Controller/PaymentController.class.php
.../Application/Admin/Controller/PaymentController.class.php
+2
-2
service/Application/Admin/Lang/zh-cn/power.php
service/Application/Admin/Lang/zh-cn/power.php
+1
-1
service/Application/Admin/View/Default/Payment/Index.html
service/Application/Admin/View/Default/Payment/Index.html
+2
-2
service/Application/Admin/View/Default/Payment/SaveInfo.html
service/Application/Admin/View/Default/Payment/SaveInfo.html
+1
-1
service/Application/Admin/View/Default/Power/Index.html
service/Application/Admin/View/Default/Power/Index.html
+2
-2
service/Application/Api/Controller/BuyController.class.php
service/Application/Api/Controller/BuyController.class.php
+17
-239
service/Application/Api/Controller/OrderController.class.php
service/Application/Api/Controller/OrderController.class.php
+62
-45
service/Application/Common/Lang/zh-cn.php
service/Application/Common/Lang/zh-cn.php
+0
-7
service/Application/Home/Controller/BuyController.class.php
service/Application/Home/Controller/BuyController.class.php
+0
-3
service/Application/Home/View/Default/Buy/Index.html
service/Application/Home/View/Default/Buy/Index.html
+0
-22
service/Application/Library/Payment/AlipayMini.class.php
service/Application/Library/Payment/AlipayMini.class.php
+325
-0
service/Application/Library/Payment/CashPayment.class.php
service/Application/Library/Payment/CashPayment.class.php
+1
-1
service/Application/Library/Payment/DeliveryPayment.class.php
...ice/Application/Library/Payment/DeliveryPayment.class.php
+1
-1
service/Application/Service/BuyService.class.php
service/Application/Service/BuyService.class.php
+0
-6
service/Application/Service/OrderService.class.php
service/Application/Service/OrderService.class.php
+14
-1
service/Application/Service/ResourcesService.class.php
service/Application/Service/ResourcesService.class.php
+2
-24
service/Install/shopxo.sql
service/Install/shopxo.sql
+26
-26
service/Public/Admin/Default/Css/Payment.css
service/Public/Admin/Default/Css/Payment.css
+1
-0
service/Public/Admin/Default/Js/Order.js
service/Public/Admin/Default/Js/Order.js
+4
-8
service/Public/Home/Default/Js/Buy.js
service/Public/Home/Default/Js/Buy.js
+1
-23
service/core.php
service/core.php
+1
-1
service/payment_order_alipaymini_notify.php
service/payment_order_alipaymini_notify.php
+21
-0
service/payment_order_alipaymini_respond.php
service/payment_order_alipaymini_respond.php
+21
-0
未找到文件。
alipay/app.acss
浏览文件 @
cb37f8fe
...
...
@@ -53,6 +53,7 @@ textarea {
.spacing { padding-top: 20rpx; }
.spacing-10 { padding-top: 10rpx; }
.spacing-mb { margin-bottom: 20rpx; }
.spacing-mt { margin-top: 20rpx; }
/* 在线客服 */
.customer-service {
...
...
@@ -77,6 +78,7 @@ textarea {
/* 边框 */
.br { border: solid 1rpx #efefef; }
.br-b { border-bottom: solid 1rpx #efefef; }
.br-t { border-top: solid 1rpx #efefef; }
.br-l { border-left: solid 1rpx #efefef; }
...
...
alipay/app.js
浏览文件 @
cb37f8fe
...
...
@@ -47,7 +47,7 @@ App({
// 请求地址
request_url
:
"
https://demo.shopxo.net/
"
,
request_url
:
'
http://localhost/project/shopxo/service/
'
,
//
request_url: 'http://localhost/project/shopxo/service/',
// 基础信息
application_title
:
"
ShopXO电商系统
"
,
...
...
alipay/pages/buy/buy.acss
浏览文件 @
cb37f8fe
.page {
padding-bottom: 120rpx;
}
/**
* 地址
*/
.address {
padding: 10rpx;
}
...
...
@@ -24,6 +31,9 @@
line-height: 85rpx;
}
/**
* 商品
*/
.goods .goods-item:not(:last-child) {
border-bottom: 1px dashed #efefef;
}
...
...
@@ -50,6 +60,9 @@
min-height: 160rpx;
}
/**
* 导航
*/
.buy-nav {
position: fixed;
left: 0;
...
...
@@ -71,6 +84,36 @@
.nav-submit button {
border-radius: 0;
}
.page {
padding-bottom: 120rpx;
/**
* 支付方式
*/
.payment-list .item {
width: 50%;
}
.payment-list .item-content {
margin: 20rpx;
padding: 20rpx 10rpx;
}
.payment-list .item-content image {
width: 50rpx;
height: 50rpx !important;
vertical-align: middle;
margin-right: 10rpx;
}
/**
* 扩展数据
*/
.extension-list {
background-color: #ffffeb;
}
.extension-list .item {
padding: 20rpx 10rpx;
}
.extension-list .item:not(:last-child) {
border-bottom: 1px dashed #ffe2cf;
}
.extension-list .item .text-tips {
color: #ff8f44;
}
\ No newline at end of file
alipay/pages/buy/buy.axml
浏览文件 @
cb37f8fe
<view a:if="{{goods_list.length > 0}}" class="page">
<!-- 地址 -->
<view class="address bg-white arrow-right">
<navigator url="/pages/user-address/user-address?is_back=1" hover-class="none">
<view a:if="{{address != null}}">
...
...
@@ -18,6 +19,7 @@
</view>
<view class="address-divider spacing-mb"></view>
<!-- 商品 -->
<view class="goods bg-white spacing-mb">
<view a:for="{{goods_list}}" class="goods-item oh">
<image class="goods-image fl" src="{{item.images}}" mode="aspectFill" />
...
...
@@ -33,14 +35,36 @@
</text>
<text a:if="{{item.original_price > 0}}" class="original-price">¥{{item.original_price}}
</text>
<text class="buy-number
">x{{item.buy_number
}}
<text class="buy-number
cr-888">x{{item.stock
}}
</text>
</view>
</view>
</view>
<textarea onInput="bind_user_note_event" maxlength="60" auto-height placeholder="留言" />
<!-- 留言 -->
<textarea onInput="bind_user_note_event" maxlength="60" auto-height placeholder="留言" class="spacing-mb" />
<!-- 扩展数据展示 -->
<view a:if="{{extension_list.length > 0}}" class="extension-list spacing-mb">
<view a:for="{{extension_list}}" class="item oh">
<text class="cr-666">{{item.name}}
</text>
<text class="text-tips fr">{{item.tips}}
</text>
</view>
</view>
<!-- 支付方式 -->
<view a:if="{{payment_list.length > 0}}" class="payment-list bg-white oh">
<view class="item tc fl" a:for="{{payment_list}}">
<view class="item-content br" data-value="{{item.id}}" onTap="payment_event">
<image a:if="{{(item.logo || null) != null}}" class="icon" src="{{item.logo}}" mode="widthFix" />
<text>{{item.name}}</text>
</view>
</view>
</view>
<!-- 导航 -->
<view class="buy-nav oh wh-auto">
<view class="nav-base bg-white fl single-text">
<text>合计:</text>
...
...
alipay/pages/buy/buy.js
浏览文件 @
cb37f8fe
...
...
@@ -5,12 +5,15 @@ Page({
buy_submit_disabled_status
:
false
,
data_list_loding_msg
:
''
,
params
:
null
,
payment_list
:
[],
goods_list
:
[],
address
:
null
,
is_first
:
1
,
address_id
:
0
,
total_price
:
0
,
user_note_value
:
''
,
is_first
:
1
,
extension_list
:
[],
payment_id
:
0
,
},
onLoad
(
params
)
{
if
((
params
.
data
||
null
)
==
null
||
app
.
get_length
(
JSON
.
parse
(
params
.
data
))
==
0
)
...
...
@@ -78,10 +81,16 @@ Page({
this
.
setData
({
goods_list
:
data
.
goods_list
,
total_price
:
data
.
base
.
total_price
,
address
:
data
.
base
.
address
,
address_id
:
((
data
.
base
.
address
||
null
)
==
null
)
?
0
:
data
.
base
.
address
.
id
,
payment_list
:
data
.
payment_list
||
[]
,
extension_list
:
data
.
extension_list
||
[]
,
data_list_loding_status
:
3
,
});
if
(
this
.
data
.
address
==
null
||
this
.
data
.
address_id
==
0
)
{
this
.
setData
({
address
:
data
.
base
.
address
,
address_id
:
((
data
.
base
.
address
||
null
)
==
null
)
?
0
:
data
.
base
.
address
.
id
,
});
}
}
}
else
{
this
.
setData
({
...
...
@@ -116,81 +125,54 @@ Page({
// 提交订单
buy_submit_event
(
e
)
{
if
((
this
.
data
.
address_id
||
0
)
==
0
)
{
my
.
showToast
({
type
:
"
fail
"
,
content
:
"
请选择地址
"
});
return
false
;
}
var
self
=
this
;
// 加载loding
my
.
showLoading
({
content
:
'
提交中...
'
});
this
.
setData
({
buy_submit_disabled_status
:
true
,
});
// 表单数据
var
data
=
this
.
data
.
params
;
data
[
'
address_id
'
]
=
this
.
data
.
address_id
;
data
[
'
payment_id
'
]
=
this
.
data
.
payment_id
;
data
[
'
user_note
'
]
=
this
.
data
.
user_note_value
;
my
.
httpRequest
({
url
:
app
.
get_request_url
(
"
Submit
"
,
"
Buy
"
),
method
:
"
POST
"
,
data
:
{
goods
:
this
.
data
.
params
,
address_id
:
this
.
data
.
address_id
,
user_note
:
this
.
data
.
user_note_value
,
},
dataType
:
"
json
"
,
success
:
res
=>
{
my
.
hideLoading
(
);
// 数据验证
var
validation
=
[
{
fields
:
'
address_id
'
,
msg
:
'
请选择地址
'
}
,
{
fields
:
'
payment_id
'
,
msg
:
'
请选择支付方式
'
}
];
if
(
app
.
fields_check
(
data
,
validation
))
{
// 加载loding
my
.
showLoading
({
content
:
'
提交中...
'
});
this
.
setData
({
buy_submit_disabled_status
:
true
,
}
);
if
(
res
.
data
.
code
==
0
)
{
var
data
=
res
.
data
.
data
;
if
(
data
.
status
==
1
)
{
my
.
confirm
({
title
:
''
,
content
:
res
.
data
.
msg
,
confirmButtonText
:
'
立即支付
'
,
cancelButtonText
:
'
进入订单
'
,
success
:
(
result
)
=>
{
self
.
setData
({
buy_submit_disabled_status
:
false
});
var
is_pay
=
(
result
.
confirm
)
?
1
:
0
;
my
.
redirectTo
({
url
:
'
/pages/user-order/user-order?is_pay=
'
+
is_pay
+
'
&order_id=
'
+
res
.
data
.
data
.
id
});
},
});
}
else
{
my
.
showToast
({
type
:
"
success
"
,
content
:
res
.
data
.
msg
my
.
httpRequest
({
url
:
app
.
get_request_url
(
"
Add
"
,
"
Buy
"
),
method
:
"
POST
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
res
=>
{
my
.
hideLoading
();
if
(
res
.
data
.
code
==
0
)
{
my
.
redirectTo
({
url
:
'
/pages/user-order/user-order?is_pay=1
'
+
'
&order_id=
'
+
res
.
data
.
data
.
order
.
id
});
setTimeout
(
function
()
{
self
.
setData
({
buy_submit_disabled_status
:
false
});
my
.
redirectTo
({
url
:
'
/pages/user-order/user-order
'
});
},
1000
);
}
}
else
{
},
fail
:
()
=>
{
my
.
hideLoading
();
self
.
setData
({
buy_submit_disabled_status
:
false
});
my
.
showToast
({
type
:
"
fail
"
,
content
:
res
.
data
.
msg
content
:
"
服务器请求出错
"
});
}
},
fail
:
()
=>
{
my
.
hideLoading
();
self
.
setData
({
buy_submit_disabled_status
:
false
});
my
.
showToast
({
type
:
"
fail
"
,
content
:
"
服务器请求出错
"
});
}
});
});
}
},
// 支付方式选择
payment_event
(
e
)
{
var
payment_id
=
e
.
currentTarget
.
dataset
.
value
||
0
;
this
.
setData
({
payment_id
:
payment_id
});
}
});
alipay/pages/paytips/paytips.axml
浏览文件 @
cb37f8fe
...
...
@@ -9,9 +9,7 @@
</view>
<view class="btn-box">
<navigator class="dy-wib" open-type="navigateBack">
<button class="my-btn-default" type="default" hover-class="none" size="mini">返回</button>
</navigator>
<button class="my-btn-default dy-wib" type="default" hover-class="none" size="mini" onTap="back_event">返回</button>
<navigator a:if="{{(params.page || null) != null && (params.title || null) != null}}" class="dy-wib" url="/pages/{{params.page}}/{{params.page}}" open-type="redirect">
<button class="my-btn-default" type="default" hover-class="none" size="mini">{{params.title}}</button>
</navigator>
...
...
alipay/pages/paytips/paytips.js
浏览文件 @
cb37f8fe
...
...
@@ -51,10 +51,15 @@ Page({
options
[
'
msg
'
]
=
msg
;
// 支付成功返回的信息
var
pay
=
((
options
.
result
||
null
)
==
null
)
?
{}
:
JSON
.
parse
(
options
.
result
);
;
var
pay
=
((
options
.
result
||
null
)
==
null
||
options
.
result
==
'
undefined
'
)
?
{}
:
JSON
.
parse
(
options
.
result
)
;
options
[
'
pay
'
]
=
pay
.
alipay_trade_app_pay_response
;
// 设置信息
this
.
setData
({
params
:
options
});
},
// 返回
back_event
(
e
)
{
my
.
navigateBack
();
}
});
alipay/pages/user-order/user-order.js
浏览文件 @
cb37f8fe
...
...
@@ -90,7 +90,7 @@ Page({
{
if
(
this
.
data
.
params
.
order_id
==
temp_data_list
[
i
][
'
id
'
])
{
this
.
pay_
fun
(
this
.
data
.
params
.
order_id
,
0
);
this
.
pay_
handle
(
this
.
data
.
params
.
order_id
,
i
);
break
;
}
}
...
...
@@ -170,11 +170,11 @@ Page({
pay_event
(
e
,
order_id
,
index
)
{
var
id
=
e
.
target
.
dataset
.
value
;
var
index
=
e
.
target
.
dataset
.
index
;
this
.
pay_
fun
(
id
,
index
);
this
.
pay_
handle
(
id
,
index
);
},
// 支付方法
pay_
fun
(
order_id
,
index
)
{
pay_
handle
(
order_id
,
index
)
{
// 加载loding
my
.
showLoading
({
content
:
"
请求中...
"
});
...
...
@@ -187,35 +187,42 @@ Page({
dataType
:
"
json
"
,
success
:
res
=>
{
my
.
hideLoading
();
if
(
res
.
data
.
code
==
0
)
{
my
.
tradePay
({
orderStr
:
res
.
data
.
data
,
success
:
res
=>
{
// 数据设置
if
(
res
.
resultCode
==
"
9000
"
)
{
var
temp_data_list
=
this
.
data
.
data_list
;
temp_data_list
[
index
][
"
status
"
]
=
2
;
temp_data_list
[
index
][
'
status_text
'
]
=
'
已支付
'
;
this
.
setData
({
data_list
:
temp_data_list
});
}
// 线下支付成功
if
(
res
.
data
.
data
.
is_under_line
==
1
)
{
var
temp_data_list
=
this
.
data
.
data_list
;
temp_data_list
[
index
][
"
status
"
]
=
2
;
temp_data_list
[
index
][
'
status_name
'
]
=
'
待发货
'
;
this
.
setData
({
data_list
:
temp_data_list
});
}
else
{
my
.
tradePay
({
orderStr
:
res
.
data
.
data
.
data
,
success
:
res
=>
{
// 数据设置
if
(
res
.
resultCode
==
"
9000
"
)
{
var
temp_data_list
=
this
.
data
.
data_list
;
temp_data_list
[
index
][
"
status
"
]
=
2
;
temp_data_list
[
index
][
'
status_text
'
]
=
'
待发货
'
;
this
.
setData
({
data_list
:
temp_data_list
});
}
// 跳转支付页面
my
.
navigateTo
({
url
:
"
/pages/paytips/paytips?code=
"
+
res
.
resultCode
+
"
&result=
"
+
res
.
result
});
},
fail
:
res
=>
{
my
.
showToast
({
type
:
"
fail
"
,
content
:
"
唤起支付模块失败
"
});
}
});
// 跳转支付页面
my
.
navigateTo
({
url
:
"
/pages/paytips/paytips?code=
"
+
res
.
resultCode
+
"
&result=
"
+
res
.
result
});
},
fail
:
res
=>
{
my
.
showToast
({
type
:
"
fail
"
,
content
:
"
唤起支付模块失败
"
});
}
});
}
}
else
{
my
.
showToast
({
type
:
"
fail
"
,
...
...
service/Application/Admin/Controller/PaymentController.class.php
浏览文件 @
cb37f8fe
...
...
@@ -135,7 +135,7 @@ class PaymentController extends CommonController
'is_enable'
=>
0
,
'is_open_user'
=>
0
,
'is_install'
=>
0
,
'apply_terminal'
=>
array_column
(
L
(
'common_
apply_terminal_list
'
),
'value'
),
'apply_terminal'
=>
array_column
(
L
(
'common_
platform_type
'
),
'value'
),
'config'
=>
''
,
];
}
...
...
@@ -181,7 +181,7 @@ class PaymentController extends CommonController
$this
->
assign
(
'data'
,
$data
);
// 适用平台
$this
->
assign
(
'common_
apply_terminal_list'
,
L
(
'common_apply_terminal_list
'
));
$this
->
assign
(
'common_
platform_type'
,
L
(
'common_platform_type
'
));
// 参数
$this
->
assign
(
'param'
,
array_merge
(
$_POST
,
$_GET
));
...
...
service/Application/Admin/Lang/zh-cn/power.php
浏览文件 @
cb37f8fe
...
...
@@ -30,6 +30,6 @@ return array(
'role_edit_name'
=>
'角色编辑'
,
'power_icon_text'
=>
'图标class'
,
'power_icon_format'
=>
'图标格式 0~30 个字符之间'
,
'power_icon_tips'
=>
'参考
[http://amazeui.org/css/icon]
'
,
'power_icon_tips'
=>
'参考
http://www.iconfont.cn/ 将icon放到 [ /Public/Admin/Default/Css/IconfontMenu.css ] 文件中
'
,
);
?>
\ No newline at end of file
service/Application/Admin/View/Default/Payment/Index.html
浏览文件 @
cb37f8fe
...
...
@@ -49,8 +49,8 @@
<td>
<if
condition=
"!empty($v['apply_terminal'])"
>
<foreach
name=
"v.apply_terminal"
key=
"terminal_k"
item=
"terminal_v"
>
{{:L('common_
apply_terminal_list
')[$terminal_v]['name']}}
<if
condition=
"$terminal_k LT count($v['apply_terminal'])-1"
>
,
</if>
{{:L('common_
platform_type
')[$terminal_v]['name']}}
<if
condition=
"$terminal_k LT count($v['apply_terminal'])-1"
>
<br
/>
</if>
</foreach>
<else
/>
<span
class=
"cr-ddd"
>
{{:L('common_on_fill_in_the_text')}}
</span>
...
...
service/Application/Admin/View/Default/Payment/SaveInfo.html
浏览文件 @
cb37f8fe
...
...
@@ -17,7 +17,7 @@
<div
class=
"am-form-group"
>
<label>
{{:L('payment_apply_terminal_text')}}
</label>
<select
name=
"apply_terminal"
class=
"am-radius c-p chosen-select"
multiple=
"multiple"
minchecked=
"1"
data-placeholder=
"{{:L('common_select_can_choose')}}"
data-validation-message=
"{{:L('payment_apply_terminal_format')}}"
required
>
<foreach
name=
"common_
apply_terminal_list
"
item=
"v"
>
<foreach
name=
"common_
platform_type
"
item=
"v"
>
<option
value=
"{{$v.value}}"
<
if
condition=
"isset($data['apply_terminal']) and in_array($v['value'], $data['apply_terminal'])"
>
selected
</if>
>{{$v.name}}
</option>
</foreach>
</select>
...
...
service/Application/Admin/View/Default/Power/Index.html
浏览文件 @
cb37f8fe
...
...
@@ -70,7 +70,7 @@
<else
/>
<label
class=
"c-p m-l-20"
>
</if>
<span><if
condition=
"!empty($v['icon'])"
><span
class=
"{{$v.icon}}"
></span></if>
{{$v.name}}
</span>
<span><if
condition=
"!empty($v['icon'])"
><span
class=
"
iconfont
{{$v.icon}}"
></span></if>
{{$v.name}}
</span>
</label>
<div
class=
"fr m-r-20 list-submit"
>
<span
class=
"am-icon-edit am-icon-md c-p submit-edit <if condition="
!
empty
($
v
['
item
'])"
>
m-r-5
</if>
" data-am-modal="{target: '#power-save-win'}" data-json='{{:json_encode($v)}}' data-tag="power-save-win" data-item="
<if
condition=
"!empty($v['item'])"
>
ok
<else
/>
no
</if>
">
</span>
...
...
@@ -84,7 +84,7 @@
<foreach
name=
"v.item"
item=
"vs"
>
<li
id=
"data-list-{{$vs.id}}"
<
if
condition=
"$vs['is_show'] eq 0"
>
class="bk-cr-ffd"
</if>
>
<label
class=
"c-p"
>
<span><if
condition=
"!empty($vs['icon'])"
><span
class=
"{{$vs.icon}}"
></span></if>
{{$vs.name}}
</span>
<span><if
condition=
"!empty($vs['icon'])"
><span
class=
"
iconfont
{{$vs.icon}}"
></span></if>
{{$vs.name}}
</span>
</label>
<div
class=
"fr m-l-10 find-submit"
>
<span
class=
"am-icon-edit am-icon-sm c-p submit-edit"
data-am-modal=
"{target: '#power-save-win'}"
data-json=
'{{:json_encode($vs)}}'
data-tag=
"power-save-win"
data-item=
"no"
></span>
...
...
service/Application/Api/Controller/BuyController.class.php
浏览文件 @
cb37f8fe
...
...
@@ -62,14 +62,21 @@ class BuyController extends CommonController
'address'
=>
UserService
::
UserDefaultAddress
([
'user'
=>
$this
->
user
])[
'data'
],
];
// 数据返回组装
$express_list
=
ResourcesService
::
ExpressList
([
'is_enable'
=>
1
,
'is_open_user'
=>
1
]);
// 支付方式
$payment_list
=
ResourcesService
::
BuyPaymentList
([
'is_enable'
=>
1
,
'is_open_user'
=>
1
]);
// 扩展展示数据
$extension_list
=
[
// ['name'=>'感恩节9折', 'tips'=>'-¥23元'],
// ['name'=>'运费', 'tips'=>'+¥10元'],
];
// 数据返回组装
$result
=
[
'goods_list'
=>
$ret
[
'data'
],
'express_list'
=>
$express_list
,
'payment_list'
=>
$payment_list
,
'base'
=>
$base
,
'extension_list'
=>
$extension_list
,
];
$this
->
ajaxReturn
(
L
(
'common_operation_success'
),
0
,
$result
);
}
else
{
...
...
@@ -78,248 +85,19 @@ class BuyController extends CommonController
}
/**
*
获取用户地址
*
订单添加
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-0
7-20
* @date 2018-0
9-25
* @desc description
*/
p
rivate
function
GetBuyUserAddress
()
p
ublic
function
Add
()
{
$where
=
[
'user_id'
=>
$this
->
user
[
'id'
],
'is_delete_time'
=>
0
];
if
(
empty
(
$this
->
data_post
[
'address_id'
]))
{
$where
[
'is_default'
]
=
1
;
}
else
{
$where
[
'id'
]
=
intval
(
$this
->
data_post
[
'address_id'
]);
}
$data
=
M
(
'UserAddress'
)
->
where
(
$where
)
->
find
();
if
(
!
empty
(
$data
))
{
$data
[
'province_name'
]
=
ResourcesService
::
RegionName
(
$data
[
'province'
]);
$data
[
'city_name'
]
=
ResourcesService
::
RegionName
(
$data
[
'city'
]);
$data
[
'county_name'
]
=
ResourcesService
::
RegionName
(
$data
[
'county'
]);
}
return
$data
;
}
/**
* 获取清单商品
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-07-20
* @desc description
*/
private
function
GetBuyGoods
()
{
// 请求参数
$params
=
[
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'goods'
,
'error_msg'
=>
'商品信息有误'
,
]
];
$ret
=
params_checked
(
$this
->
data_post
,
$params
);
if
(
$ret
!==
true
)
{
$this
->
ajaxReturn
(
$ret
);
}
// 商品信息
$data
=
json_decode
(
$_POST
[
'goods'
],
true
);
if
(
empty
(
$data
))
{
$this
->
ajaxReturn
(
'商品信息有误'
);
}
$result
=
[];
$total_price
=
0
;
$m
=
M
(
'Goods'
);
$attr_type_m
=
M
(
'GoodsAttributeType'
);
$attr_m
=
M
(
'GoodsAttribute'
);
$image_host
=
C
(
'IMAGE_HOST'
);
foreach
(
$data
as
$v
)
{
$goods
=
$m
->
find
(
$v
[
'goods_id'
]);
// 基础判断
if
(
empty
(
$goods
))
{
$this
->
ajaxReturn
(
'['
.
$v
[
'goods_id'
]
.
']商品不存在'
);
}
if
(
$goods
[
'is_shelves'
]
!=
1
)
{
$this
->
ajaxReturn
(
'['
.
$v
[
'goods_id'
]
.
']商品已下架'
);
}
if
(
$v
[
'buy_number'
]
>
$goods
[
'inventory'
])
{
$this
->
ajaxReturn
(
'['
.
$v
[
'goods_id'
]
.
']商品超过库存数量['
.
$v
[
'buy_number'
]
.
'>'
.
$goods
[
'inventory'
]
.
']'
);
}
if
(
$goods
[
'buy_min_number'
]
>
1
&&
$v
[
'buy_number'
]
<
$goods
[
'buy_min_number'
])
{
$this
->
ajaxReturn
(
'['
.
$v
[
'goods_id'
]
.
']商品购买低于起购数量['
.
$v
[
'buy_number'
]
.
'<'
.
$goods
[
'buy_min_number'
]
.
']'
);
}
if
(
$goods
[
'buy_max_number'
]
>
1
&&
$v
[
'buy_number'
]
>
$goods
[
'buy_max_number'
])
{
$this
->
ajaxReturn
(
'['
.
$v
[
'goods_id'
]
.
']商品购买超过限购数量['
.
$v
[
'buy_number'
]
.
'>'
.
$goods
[
'buy_max_number'
]
.
']'
);
}
// 属性
$attribute_all
=
[];
if
(
!
empty
(
$v
[
'attribute'
]))
{
$attribute
=
explode
(
','
,
$v
[
'attribute'
]);
if
(
!
empty
(
$attribute
))
{
foreach
(
$attribute
as
$vs
)
{
$attr
=
explode
(
':'
,
$vs
);
if
(
empty
(
$attr
)
||
count
(
$attr
)
<
2
)
{
$this
->
ajaxReturn
(
'['
.
$v
[
'goods_id'
]
.
']商品属性有误-'
.
$vs
);
}
// 属性类型
$attr_type
=
$attr_type_m
->
find
(
$attr
[
0
]);
if
(
empty
(
$attr_type
))
{
$this
->
ajaxReturn
(
'['
.
$v
[
'goods_id'
]
.
']商品属性类型有误-'
.
$attr
[
0
]);
}
// 具体属性
$attr_content
=
$attr_m
->
find
(
$attr
[
1
]);
if
(
empty
(
$attr_content
))
{
$this
->
ajaxReturn
(
'['
.
$v
[
'goods_id'
]
.
']商品属性有误-'
.
$attr
[
1
]);
}
// 属性组装
$attribute_all
[]
=
$attr_type
[
'name'
]
.
':'
.
$attr_content
[
'name'
];
}
}
}
$goods
[
'attribute'
]
=
empty
(
$attribute_all
)
?
''
:
implode
(
','
,
$attribute_all
);
// 数据处理
$goods
[
'images_url'
]
=
empty
(
$goods
[
'images'
])
?
null
:
$image_host
.
$goods
[
'images'
];
$goods
[
'buy_number'
]
=
$v
[
'buy_number'
];
// 总价
$total_price
+=
$goods
[
'price'
]
*
$v
[
'buy_number'
];
$result
[]
=
$goods
;
}
return
[
'goods'
=>
$result
,
'total_price'
=>
round
(
$total_price
,
2
),
];
}
/**
* 订单提交
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-07-20
* @desc description
*/
public
function
Submit
()
{
// 清单商品
$goods
=
$this
->
GetBuyGoods
();
// 用户地址
$address
=
$this
->
GetBuyUserAddress
();
if
(
empty
(
$address
))
{
$this
->
ajaxReturn
(
'地址有误'
);
}
// 优惠金额
$preferential_price
=
0.00
;
// 店铺
$shop_id
=
0
;
// 订单写入
$order
=
[
'user_id'
=>
$this
->
user
[
'id'
],
'shop_id'
=>
$shop_id
,
'receive_address_id'
=>
$address
[
'id'
],
'receive_name'
=>
$address
[
'name'
],
'receive_tel'
=>
$address
[
'tel'
],
'receive_province'
=>
$address
[
'province'
],
'receive_city'
=>
$address
[
'city'
],
'receive_county'
=>
$address
[
'county'
],
'receive_address'
=>
$address
[
'address'
],
'user_note'
=>
I
(
'user_note'
),
'status'
=>
1
,
'preferential_price'
=>
$preferential_price
,
'price'
=>
$goods
[
'total_price'
],
'total_price'
=>
$goods
[
'total_price'
]
-
$preferential_price
,
'add_time'
=>
time
(),
'confirm_time'
=>
time
(),
];
// 开始事务
$m
=
M
(
'Order'
);
$m
->
startTrans
();
// 订单添加
$order_id
=
$m
->
add
(
$order
);
if
(
$order_id
>
0
)
{
$detail_m
=
M
(
'OrderDetail'
);
foreach
(
$goods
[
'goods'
]
as
$v
)
{
$detail
=
[
'order_id'
=>
$order_id
,
'user_id'
=>
$this
->
user
[
'id'
],
'shop_id'
=>
$shop_id
,
'goods_id'
=>
$v
[
'id'
],
'title'
=>
$v
[
'title'
],
'images'
=>
$v
[
'images'
],
'original_price'
=>
$v
[
'original_price'
],
'price'
=>
$v
[
'price'
],
'attribute'
=>
$v
[
'attribute'
],
'buy_number'
=>
$v
[
'buy_number'
],
'add_time'
=>
time
(),
];
if
(
$detail_m
->
add
(
$detail
)
<=
0
)
{
$m
->
rollback
();
$this
->
ajaxReturn
(
'订单详情添加失败'
);
}
}
}
else
{
$m
->
rollback
();
$this
->
ajaxReturn
(
'订单添加失败'
);
}
$m
->
commit
();
// 获取订单信息
$data
=
$m
->
find
(
$order_id
);
switch
(
$order
[
'status'
])
{
// 预约成功
case
0
:
$msg
=
L
(
'common_booking_success'
);
break
;
// 提交成功
case
1
:
$msg
=
L
(
'common_submit_success'
);
break
;
// 默认操作成功
default
:
$msg
=
L
(
'common_operation_success'
);
}
$this
->
ajaxReturn
(
$msg
,
0
,
$data
);
$params
=
$this
->
data_post
;
$params
[
'user'
]
=
$this
->
user
;
$ret
=
BuyService
::
OrderAdd
(
$params
);
$this
->
ajaxReturn
(
$ret
[
'msg'
],
$ret
[
'code'
],
$ret
[
'data'
]);
}
}
?>
\ No newline at end of file
service/Application/Api/Controller/OrderController.class.php
浏览文件 @
cb37f8fe
...
...
@@ -100,6 +100,23 @@ class OrderController extends CommonController
$this
->
ajaxReturn
(
L
(
'common_not_data_tips'
),
-
100
);
}
/**
* 订单支付
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-28
* @desc description
*/
public
function
Pay
()
{
$params
=
$this
->
data_post
;
$params
[
'user'
]
=
$this
->
user
;
$ret
=
OrderService
::
Pay
(
$params
);
$this
->
ajaxReturn
(
$ret
[
'msg'
],
$ret
[
'code'
],
$ret
[
'data'
]);
}
/**
* [Cancel 订单取消]
* @author Devil
...
...
@@ -170,53 +187,53 @@ class OrderController extends CommonController
$this
->
ajaxReturn
(
L
(
'common_confirm_error'
));
}
/**
* [Pay 订单支付]
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-07-22T22:10:46+0800
*/
public
function
Pay
()
{
if
(
empty
(
$this
->
data_post
[
'id'
]))
{
$this
->
ajaxReturn
(
'请选择订单'
);
}
/
/ /
**
//
* [Pay 订单支付]
//
* @author Devil
//
* @blog http://gong.gg/
//
* @version 1.0.0
//
* @datetime 2018-07-22T22:10:46+0800
//
*/
//
public function Pay()
//
{
//
if(empty($this->data_post['id']))
//
{
//
$this->ajaxReturn('请选择订单');
//
}
$m
=
M
(
'Order'
);
$where
=
[
'id'
=>
intval
(
$this
->
data_post
[
'id'
]),
'user_id'
=>
$this
->
user
[
'id'
]];
$data
=
$m
->
where
(
$where
)
->
field
(
'id,status,total_price'
)
->
find
();
if
(
empty
(
$data
))
{
$this
->
ajaxReturn
(
L
(
'common_data_no_exist_error'
));
}
if
(
$data
[
'total_price'
]
<=
0.00
)
{
$this
->
ajaxReturn
(
'金额不能为0'
);
}
if
(
$data
[
'status'
]
!=
1
)
{
$status_text
=
L
(
'common_order_user_status'
)[
$data
[
'status'
]][
'name'
];
$this
->
ajaxReturn
(
'状态不可操作['
.
$status_text
.
']'
);
}
//
$m = M('Order');
//
$where = ['id'=>intval($this->data_post['id']), 'user_id' => $this->user['id']];
//
$data = $m->where($where)->field('id,status,total_price')->find();
//
if(empty($data))
//
{
//
$this->ajaxReturn(L('common_data_no_exist_error'));
//
}
//
if($data['total_price'] <= 0.00)
//
{
//
$this->ajaxReturn('金额不能为0');
//
}
//
if($data['status'] != 1)
//
{
//
$status_text = L('common_order_user_status')[$data['status']]['name'];
//
$this->ajaxReturn('状态不可操作['.$status_text.']');
//
}
// 发起支付
$notify_url
=
__MY_URL__
.
'Notify/order.php'
;
$pay_data
=
array
(
'out_user'
=>
md5
(
$this
->
user
[
'id'
]),
'order_sn'
=>
$data
[
'id'
]
.
GetNumberCode
(
6
),
'name'
=>
'订单支付'
,
'total_price'
=>
$data
[
'total_price'
],
'notify_url'
=>
$notify_url
,
);
$pay
=
(
new
\
Library\Alipay
())
->
SoonPay
(
$pay_data
,
C
(
"alipay_key_secret"
));
if
(
empty
(
$pay
))
{
$this
->
ajaxReturn
(
'支付接口异常'
);
}
$this
->
ajaxReturn
(
L
(
'common_operation_success'
),
0
,
$pay
);
}
//
// 发起支付
//
$notify_url = __MY_URL__.'Notify/order.php';
//
$pay_data = array(
//
'out_user' => md5($this->user['id']),
//
'order_sn' => $data['id'].GetNumberCode(6),
//
'name' => '订单支付',
//
'total_price' => $data['total_price'],
//
'notify_url' => $notify_url,
//
);
//
$pay = (new \Library\Alipay())->SoonPay($pay_data, C("alipay_key_secret"));
//
if(empty($pay))
//
{
//
$this->ajaxReturn('支付接口异常');
//
}
//
$this->ajaxReturn(L('common_operation_success'), 0, $pay);
//
}
/**
* 确认
...
...
service/Application/Common/Lang/zh-cn.php
浏览文件 @
cb37f8fe
...
...
@@ -511,13 +511,6 @@ return array(
2
=>
array
(
'id'
=>
2
,
'name'
=>
'禁止登录'
,
'tips'
=>
'用户被禁止登录'
),
),
// 适用终端
'common_apply_terminal_list'
=>
array
(
'pc'
=>
array
(
'value'
=>
'pc'
,
'name'
=>
'电脑端'
),
'wap'
=>
array
(
'value'
=>
'wap'
,
'name'
=>
'WAP手机端'
),
'app'
=>
array
(
'value'
=>
'app'
,
'name'
=>
'APP手机端'
),
),
// 是否已评价
'common_comments_status_list'
=>
array
(
0
=>
array
(
'value'
=>
0
,
'name'
=>
'待评价'
),
...
...
service/Application/Home/Controller/BuyController.class.php
浏览文件 @
cb37f8fe
...
...
@@ -56,9 +56,6 @@ class BuyController extends CommonController
// 用户地址
$this
->
assign
(
'user_address_list'
,
UserService
::
UserAddressList
([
'user'
=>
$this
->
user
])[
'data'
]);
// 快递
$this
->
assign
(
'express_list'
,
ResourcesService
::
ExpressList
([
'is_enable'
=>
1
,
'is_open_user'
=>
1
]));
// 支付方式
$this
->
assign
(
'payment_list'
,
ResourcesService
::
BuyPaymentList
([
'is_enable'
=>
1
,
'is_open_user'
=>
1
]));
...
...
service/Application/Home/View/Default/Buy/Index.html
浏览文件 @
cb37f8fe
...
...
@@ -70,27 +70,6 @@
</empty>
</div>
<!-- 物流 -->
<div
class=
"business-item logistics"
data-type=
"logistics"
>
<h3>
选择快递
</h3>
<notempty
name=
"express_list"
>
<ul
class=
"logistics-list"
>
<foreach
name=
"express_list"
item=
"express"
>
<li
data-value=
"{{$express.id}}"
>
<notempty
name=
"express.icon"
>
<img
src=
"{{$express.icon}}"
/>
</notempty>
<span>
{{$express.name}}
</span>
<i
class=
"icon-active"
></i>
</li>
</foreach>
</ul>
</notempty>
<empty
name=
"express_list"
>
<div
class=
"table-no"
><i
class=
"am-icon-warning"
></i>
{{:L('buy_express_not_data_tips')}}
</div>
</empty>
</div>
<!-- 支付方式 -->
<div
class=
"business-item payment"
data-type=
"payment"
>
<h3>
选择支付
</h3>
...
...
@@ -243,7 +222,6 @@
<input
type=
"hidden"
name=
"attr"
value=
'<if condition="isset($params['
attr
'])"
>
{{$params.attr}}
</if>
' />
<input
type=
"hidden"
name=
"ids"
value=
"<if condition="
isset
($
params
['
ids
'])"
>
{{$params.ids}}
</if>
" />
<input
type=
"hidden"
name=
"address_id"
value=
"0"
/>
<input
type=
"hidden"
name=
"express_id"
value=
"0"
/>
<input
type=
"hidden"
name=
"payment_id"
value=
"0"
/>
<input
type=
"hidden"
name=
"user_note"
value=
""
/>
<div
class=
"go-btn-wrap"
>
...
...
service/Application/Library/Payment/AlipayMini.class.php
0 → 100644
浏览文件 @
cb37f8fe
<?php
namespace
Library\Payment
;
/**
* 支付宝小程序支付
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-19
* @desc description
*/
class
AlipayMini
{
// 插件配置参数
private
$config
;
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-17
* @desc description
* @param [array] $params [输入参数(支付配置参数)]
*/
public
function
__construct
(
$params
=
[])
{
$this
->
config
=
$params
;
}
/**
* 配置信息
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-19
* @desc description
*/
public
function
Config
()
{
// 基础信息
$base
=
[
'name'
=>
'支付宝'
,
// 插件名称
'version'
=>
'0.0.1'
,
// 插件版本
'apply_version'
=>
'不限'
,
// 适用系统版本描述
'desc'
=>
'即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 <a href="http://www.alipay.com/" target="_blank">立即申请</a>'
,
// 插件描述(支持html)
'author'
=>
'Devil'
,
// 开发者
'author_url'
=>
'http://shopxo.net/'
,
// 开发者主页
];
// 配置信息
$element
=
[
[
'element'
=>
'input'
,
'type'
=>
'text'
,
'default'
=>
''
,
'name'
=>
'appid'
,
'placeholder'
=>
'appid'
,
'title'
=>
'appid'
,
'is_required'
=>
1
,
'message'
=>
'请填写小程序appid'
,
],
[
'element'
=>
'input'
,
'type'
=>
'text'
,
'default'
=>
''
,
'name'
=>
'account'
,
'placeholder'
=>
'支付宝账号'
,
'title'
=>
'支付宝账号'
,
'is_required'
=>
1
,
'message'
=>
'请填写支付宝账号'
,
],
[
'element'
=>
'input'
,
'type'
=>
'text'
,
'default'
=>
''
,
'name'
=>
'partner'
,
'placeholder'
=>
'合作者身份 partner ID'
,
'title'
=>
'合作者身份 partner ID'
,
'is_required'
=>
1
,
'message'
=>
'请填写合作者身份 partner ID'
,
],
[
'element'
=>
'input'
,
'type'
=>
'text'
,
'default'
=>
''
,
'name'
=>
'key'
,
'placeholder'
=>
'交易安全校验码 key'
,
'title'
=>
'交易安全校验码 key'
,
'is_required'
=>
1
,
'message'
=>
'请填写交易安全校验码 key'
,
],
[
'element'
=>
'textarea'
,
'name'
=>
'rsa_public'
,
'placeholder'
=>
'应用公钥'
,
'title'
=>
'应用公钥'
,
'is_required'
=>
1
,
'rows'
=>
6
,
],
[
'element'
=>
'textarea'
,
'name'
=>
'rsa_private'
,
'placeholder'
=>
'应用私钥'
,
'title'
=>
'应用私钥'
,
'is_required'
=>
1
,
'rows'
=>
6
,
],
[
'element'
=>
'textarea'
,
'name'
=>
'out_rsa_public'
,
'placeholder'
=>
'支付宝公钥'
,
'title'
=>
'支付宝公钥'
,
'is_required'
=>
1
,
'rows'
=>
6
,
],
];
return
[
'base'
=>
$base
,
'element'
=>
$element
,
];
}
/**
* 支付入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-19
* @desc description
* @param [array] $params [输入参数]
*/
public
function
Pay
(
$params
=
[])
{
$parameter
=
array
(
'app_id'
=>
$this
->
config
[
'appid'
],
'method'
=>
'alipay.trade.app.pay'
,
'format'
=>
'JSON'
,
'charset'
=>
'utf-8'
,
'sign_type'
=>
'RSA2'
,
'timestamp'
=>
date
(
'Y-m-d H:i:s'
),
'version'
=>
'1.0'
,
'notify_url'
=>
$params
[
'notify_url'
],
);
$biz_content
=
array
(
'subject'
=>
$params
[
'name'
],
'out_trade_no'
=>
$params
[
'order_no'
],
'total_amount'
=>
$params
[
'total_price'
],
'product_code'
=>
'QUICK_MSECURITY_PAY'
,
);
$parameter
[
'biz_content'
]
=
json_encode
(
$biz_content
,
JSON_UNESCAPED_UNICODE
);
// 生成签名参数+签名
$params
=
$this
->
GetParamSign
(
$parameter
);
$params
[
'param'
]
.
=
'&sign='
.
urlencode
(
$this
->
MyRsaSign
(
$params
[
'value'
]));
// 直接返回支付信息
return
DataReturn
(
'处理成功'
,
0
,
$params
[
'param'
]);
}
/**
* 支付回调处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-19
* @desc description
* @param [array] $params [输入参数]
*/
public
function
Respond
(
$params
=
[])
{
$data
=
empty
(
$_POST
)
?
$_GET
:
array_merge
(
$_GET
,
$_POST
);
ksort
(
$data
);
// 参数字符串
foreach
(
$data
AS
$key
=>
$val
)
{
if
(
$key
!=
'sign'
&&
$key
!=
'sign_type'
&&
$key
!=
'code'
)
{
$sign
.
=
"
$key
=
$val
&"
;
}
}
$sign
=
substr
(
$sign
,
0
,
-
1
);
// 签名
if
(
!
$this
->
OutRsaVerify
(
$sign
,
$data
[
'sign'
]))
{
return
DataReturn
(
'签名校验失败'
,
-
1
);
}
// 支付状态
$status
=
isset
(
$data
[
'trade_status'
])
?
$data
[
'trade_status'
]
:
$data
[
'result'
];
switch
(
$status
)
{
case
'TRADE_SUCCESS'
:
case
'TRADE_FINISHED'
:
case
'success'
:
return
DataReturn
(
'支付成功'
,
0
,
$this
->
ReturnData
(
$data
));
break
;
}
return
DataReturn
(
'处理异常错误'
,
-
100
);
}
/**
* [ReturnData 返回数据统一格式]
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-10-06T16:54:24+0800
* @param [array] $data [返回数据]
*/
private
function
ReturnData
(
$data
)
{
// 兼容web版本支付参数
$buyer_user
=
isset
(
$data
[
'buyer_logon_id'
])
?
$data
[
'buyer_logon_id'
]
:
(
isset
(
$data
[
'buyer_email'
])
?
$data
[
'buyer_email'
]
:
''
);
$pay_price
=
isset
(
$data
[
'total_amount'
])
?
$data
[
'total_amount'
]
:
(
isset
(
$data
[
'total_fee'
])
?
$data
[
'total_fee'
]
:
''
);
// 返回数据固定基础参数
$data
[
'trade_no'
]
=
$data
[
'trade_no'
];
// 支付平台 - 订单号
$data
[
'buyer_user'
]
=
$buyer_user
;
// 支付平台 - 用户
$data
[
'out_trade_no'
]
=
$data
[
'out_trade_no'
];
// 本系统发起支付的 - 订单号
$data
[
'subject'
]
=
$data
[
'subject'
];
// 本系统发起支付的 - 商品名称
$data
[
'pay_price'
]
=
$pay_price
;
// 本系统发起支付的 - 总价
return
$data
;
}
/**
* [GetParamSign 生成参数和签名]
* @param [array] $data [待生成的参数]
* @return [array] [生成好的参数和签名]
*/
private
function
GetParamSign
(
$data
)
{
$param
=
''
;
$sign
=
''
;
ksort
(
$data
);
foreach
(
$data
AS
$key
=>
$val
)
{
$param
.
=
"
$key
="
.
urlencode
(
$val
)
.
"&"
;
$sign
.
=
"
$key
=
$val
&"
;
}
$result
=
array
(
'param'
=>
substr
(
$param
,
0
,
-
1
),
'value'
=>
substr
(
$sign
,
0
,
-
1
),
);
$result
[
'sign'
]
=
$result
[
'value'
]
.
$this
->
config
[
'key'
];
return
$result
;
}
/**
* [MyRsaSign 签名字符串]
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2017-09-24T08:38:28+0800
* @param [string] $prestr [需要签名的字符串]
* @return [string] [签名结果]
*/
private
function
MyRsaSign
(
$prestr
)
{
$res
=
"-----BEGIN RSA PRIVATE KEY-----
\n
"
;
$res
.
=
wordwrap
(
$this
->
config
[
'rsa_private'
],
64
,
"
\n
"
,
true
);
$res
.
=
"
\n
-----END RSA PRIVATE KEY-----"
;
return
openssl_sign
(
$prestr
,
$sign
,
$res
,
OPENSSL_ALGO_SHA256
)
?
base64_encode
(
$sign
)
:
null
;
}
/**
* [MyRsaDecrypt RSA解密]
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2017-09-24T09:12:06+0800
* @param [string] $content [需要解密的内容,密文]
* @return [string] [解密后内容,明文]
*/
private
function
MyRsaDecrypt
(
$content
)
{
$res
=
"-----BEGIN PUBLIC KEY-----
\n
"
;
$res
.
=
wordwrap
(
$this
->
config
[
'rsa_public'
],
64
,
"
\n
"
,
true
);
$res
.
=
"
\n
-----END PUBLIC KEY-----"
;
$res
=
openssl_get_privatekey
(
$res
);
$content
=
base64_decode
(
$content
);
$result
=
''
;
for
(
$i
=
0
;
$i
<
strlen
(
$content
)
/
128
;
$i
++
)
{
$data
=
substr
(
$content
,
$i
*
128
,
128
);
openssl_private_decrypt
(
$data
,
$decrypt
,
$res
,
OPENSSL_ALGO_SHA256
);
$result
.
=
$decrypt
;
}
openssl_free_key
(
$res
);
return
$result
;
}
/**
* [OutRsaVerify 支付宝验证签名]
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2017-09-24T08:39:50+0800
* @param [string] $prestr [需要签名的字符串]
* @param [string] $sign [签名结果]
* @return [boolean] [正确true, 错误false]
*/
private
function
OutRsaVerify
(
$prestr
,
$sign
)
{
$res
=
"-----BEGIN PUBLIC KEY-----
\n
"
;
$res
.
=
wordwrap
(
$this
->
config
[
'out_rsa_public'
],
64
,
"
\n
"
,
true
);
$res
.
=
"
\n
-----END PUBLIC KEY-----"
;
$pkeyid
=
openssl_pkey_get_public
(
$res
);
$sign
=
base64_decode
(
$sign
);
if
(
$pkeyid
)
{
$verify
=
openssl_verify
(
$prestr
,
$sign
,
$pkeyid
,
OPENSSL_ALGO_SHA256
);
openssl_free_key
(
$pkeyid
);
}
return
(
isset
(
$verify
)
&&
$verify
==
1
)
?
true
:
false
;
}
}
?>
\ No newline at end of file
service/Application/Library/Payment/CashPayment.class.php
浏览文件 @
cb37f8fe
...
...
@@ -46,7 +46,7 @@ class CashPayment
'apply_version'
=>
'不限'
,
// 适用系统版本描述
'desc'
=>
'现金方式支付货款'
,
// 插件描述(支持html)
'author'
=>
'Devil'
,
// 开发者
'author_url'
=>
'http://
gong.gg
/'
,
// 开发者主页
'author_url'
=>
'http://
shopxo.net
/'
,
// 开发者主页
];
// 配置信息
...
...
service/Application/Library/Payment/DeliveryPayment.class.php
浏览文件 @
cb37f8fe
...
...
@@ -46,7 +46,7 @@ class DeliveryPayment
'apply_version'
=>
'不限'
,
// 适用系统版本描述
'desc'
=>
'送货上门后收取货款'
,
// 插件描述(支持html)
'author'
=>
'Devil'
,
// 开发者
'author_url'
=>
'http://
gong.gg
/'
,
// 开发者主页
'author_url'
=>
'http://
shopxo.net
/'
,
// 开发者主页
];
// 配置信息
...
...
service/Application/Service/BuyService.class.php
浏览文件 @
cb37f8fe
...
...
@@ -549,11 +549,6 @@ class BuyService
'key_name'
=>
'address_id'
,
'error_msg'
=>
'地址有误'
,
],
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'express_id'
,
'error_msg'
=>
'快递有误'
,
],
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'payment_id'
,
...
...
@@ -608,7 +603,6 @@ class BuyService
'preferential_price'
=>
$preferential_price
,
'price'
=>
$check
[
'data'
][
'total_price'
],
'total_price'
=>
$check
[
'data'
][
'total_price'
]
-
$preferential_price
,
'express_id'
=>
intval
(
$params
[
'express_id'
]),
'payment_id'
=>
intval
(
$params
[
'payment_id'
]),
'add_time'
=>
time
(),
];
...
...
service/Application/Service/OrderService.class.php
浏览文件 @
cb37f8fe
...
...
@@ -87,12 +87,25 @@ class OrderService
{
// 非线上支付处理
$params
[
'user'
][
'user_name_view'
]
=
'用户-'
.
$params
[
'user'
][
'user_name_view'
];
self
::
OrderPaymentUnderLine
([
$pay_result
=
self
::
OrderPaymentUnderLine
([
'order'
=>
$order
,
'payment'
=>
$payment
[
0
],
'user'
=>
$params
[
'user'
],
'subject'
=>
$params
,
]);
if
(
$pay_result
[
'code'
]
!=
0
)
{
return
$pay_result
;
}
// 支付信息返回
$ret
[
'data'
]
=
[
// 是否为线下支付类型
'is_under_line'
=>
in_array
(
$payment
[
0
][
'payment'
],
C
(
'under_line_list'
))
?
1
:
0
,
// 支付模块处理数据
'data'
=>
$ret
[
'data'
],
];
return
$ret
;
}
...
...
service/Application/Service/ResourcesService.class.php
浏览文件 @
cb37f8fe
...
...
@@ -124,31 +124,9 @@ class ResourcesService
foreach
(
$data
as
$v
)
{
// 根据终端类型筛选
switch
(
APPLICATION
)
if
(
in_array
(
APPLICATION_CLIENT_TYPE
,
$v
[
'apply_terminal'
])
)
{
// pc, wap
case
'web'
:
if
(
IsMobile
())
{
if
(
in_array
(
'wap'
,
$v
[
'apply_terminal'
]))
{
$result
[]
=
$v
;
}
}
else
{
if
(
in_array
(
'pc'
,
$v
[
'apply_terminal'
]))
{
$result
[]
=
$v
;
}
}
break
;
// app
case
'app'
:
if
(
in_array
(
'app'
,
$v
[
'apply_terminal'
]))
{
$result
[]
=
$v
;
}
break
;
$result
[]
=
$v
;
}
}
}
...
...
service/Install/shopxo.sql
浏览文件 @
cb37f8fe
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
service/Public/Admin/Default/Css/Payment.css
浏览文件 @
cb37f8fe
...
...
@@ -4,6 +4,7 @@
table
.am-table
.th-desc
{
width
:
20%
;
}
table
.am-table
.td-desc
,
table
.am-table
.td-version
{
font-size
:
12px
;
}
table
.am-table
.td-version
{
color
:
#d2364c
;
margin
:
0
;
}
.am-form-file
input
[
type
=
"file"
]
{
margin-top
:
0
;
}
/**
* 插件部分
...
...
service/Public/Admin/Default/Js/Order.js
浏览文件 @
cb37f8fe
...
...
@@ -7,15 +7,11 @@ $(function()
$
(
'
form.delivery-form input[name=express_number]
'
).
val
(
''
);
var
express_id
=
$
(
this
).
data
(
'
express-id
'
)
||
0
;
var
user_id
=
$
(
this
).
data
(
'
user-id
'
)
||
0
;
if
(
$
(
'
.express-items-
'
+
express_id
).
length
>
0
)
{
$
(
'
form.delivery-form input[name=express_id]
'
).
val
(
express_id
);
$
(
'
form.delivery-form input[name=user_id]
'
).
val
(
user_id
);
$
(
'
form.delivery-form input[name=express_id]
'
).
val
(
express_id
);
$
(
'
form.delivery-form input[name=user_id]
'
).
val
(
user_id
);
$
(
'
ul.express-list li.selected
'
).
removeClass
(
'
selected
'
);
if
(
express_id
!=
0
)
{
$
(
'
.express-items-
'
+
express_id
).
addClass
(
'
selected
'
).
siblings
(
'
li
'
).
removeClass
(
'
selected
'
);
}
else
{
$
(
'
form.delivery-form input[name=express_id]
'
).
val
(
0
);
$
(
'
form.delivery-form input[name=user_id]
'
).
val
(
0
);
$
(
'
ul.express-list li.selected
'
).
removeClass
(
'
selected
'
);
}
});
...
...
service/Public/Home/Default/Js/Buy.js
浏览文件 @
cb37f8fe
...
...
@@ -3,7 +3,6 @@ if(store.enabled)
// 选择缓存key
var
store_address_key
=
'
store-buy-address-selected-index
'
;
var
store_use_new_address_status_key
=
'
store-buy-use-new-address-status-count
'
;
var
store_logistics_key
=
'
store-lbuy-ogistics-selected-index
'
;
var
store_payment_key
=
'
store-buy-payment-selected-index
'
;
}
...
...
@@ -30,13 +29,7 @@ $(function()
{
$
(
'
ul.address-list li
'
).
eq
(
store_address_value
).
addClass
(
'
address-default
'
).
siblings
().
removeClass
(
'
address-default
'
);
}
// 快递
var
store_logistics_value
=
store
.
get
(
store_logistics_key
);
if
(
store_logistics_value
!==
undefined
)
{
$
(
'
ul.logistics-list li
'
).
eq
(
store_logistics_value
).
addClass
(
'
selected
'
);
}
// 快递
// 支付方式
var
store_payment_value
=
store
.
get
(
store_payment_key
);
if
(
store_payment_value
!==
undefined
)
{
...
...
@@ -67,10 +60,6 @@ $(function()
case
'
payment
'
:
temp_store_key
=
store_payment_key
;
break
;
case
'
logistics
'
:
temp_store_key
=
store_logistics_key
;
break
;
}
if
(
$
(
this
).
hasClass
(
'
selected
'
))
{
$
(
this
).
removeClass
(
'
selected
'
);
...
...
@@ -146,16 +135,6 @@ $(function()
msg
=
'
请选择地址
'
;
}
if
(
status
===
true
)
{
var
express_id
=
$
(
'
ul.logistics-list li.selected
'
).
data
(
'
value
'
)
||
null
;
if
(
express_id
===
null
)
{
status
=
false
;
msg
=
'
请选择快递
'
;
}
}
if
(
status
===
true
)
{
var
payment_id
=
$
(
'
ul.payment-list li.selected
'
).
data
(
'
value
'
)
||
null
;
...
...
@@ -178,7 +157,6 @@ $(function()
}
$
(
'
form.nav-buy input[name=address_id]
'
).
val
(
address_id
);
$
(
'
form.nav-buy input[name=express_id]
'
).
val
(
express_id
);
$
(
'
form.nav-buy input[name=payment_id]
'
).
val
(
payment_id
);
$
(
'
form.nav-buy input[name=user_note]
'
).
val
(
$
(
'
.order-user-info input.memo-input
'
).
val
());
});
...
...
service/core.php
浏览文件 @
cb37f8fe
...
...
@@ -60,7 +60,7 @@ define('APPLICATION', empty($_REQUEST['application']) ? 'web' : trim($_REQUEST['
// 请求客户端 [default, ...] 默认default
define
(
'APPLICATION_CLIENT'
,
empty
(
$_REQUEST
[
'application_client'
])
?
'default'
:
trim
(
$_REQUEST
[
'application_client'
]));
// 请求客户端 [pc,
h5, alipay, wechat
] 默认pc
// 请求客户端 [pc,
wap/h5, alipay, wechat, baidu
] 默认pc
define
(
'APPLICATION_CLIENT_TYPE'
,
empty
(
$_REQUEST
[
'application_client_type'
])
?
'pc'
:
trim
(
$_REQUEST
[
'application_client_type'
]));
?>
\ No newline at end of file
service/payment_order_alipaymini_notify.php
0 → 100644
浏览文件 @
cb37f8fe
<?php
/**
* 订单支付异步入口
*/
// 默认绑定模块
$_GET
[
'm'
]
=
'Api'
;
$_GET
[
'c'
]
=
'OrderNotify'
;
$_GET
[
'a'
]
=
'Notify'
;
// 支付模块标记
define
(
'PAYMENT_TYPE'
,
'AlipayMini'
);
// 引入公共入口文件
require
'./core.php'
;
// 引入ThinkPHP入口文件
require
'./ThinkPHP/ThinkPHP.php'
;
?>
\ No newline at end of file
service/payment_order_alipaymini_respond.php
0 → 100644
浏览文件 @
cb37f8fe
<?php
/**
* 订单支付同步入口
*/
// 默认绑定模块
$_GET
[
'm'
]
=
'Home'
;
$_GET
[
'c'
]
=
'Order'
;
$_GET
[
'a'
]
=
'Respond'
;
// 支付模块标记
define
(
'PAYMENT_TYPE'
,
'AlipayMini'
);
// 引入公共入口文件
require
'./core.php'
;
// 引入ThinkPHP入口文件
require
'./ThinkPHP/ThinkPHP.php'
;
?>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录