Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
ShopXO
提交
5f926928
ShopXO
项目概览
纵之格
/
ShopXO
通知
394
Star
16
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5f926928
编写于
12月 24, 2018
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
支付方式
上级
1d81c854
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
962 addition
and
734 deletion
+962
-734
application/admin/controller/Order.php
application/admin/controller/Order.php
+3
-3
application/admin/controller/Payment.php
application/admin/controller/Payment.php
+56
-455
application/admin/view/default/payment/index.html
application/admin/view/default/payment/index.html
+19
-19
application/admin/view/default/payment/save_info.html
application/admin/view/default/payment/save_info.html
+70
-48
application/index/controller/Buy.php
application/index/controller/Buy.php
+2
-2
application/index/controller/Order.php
application/index/controller/Order.php
+3
-3
application/service/GoodsService.php
application/service/GoodsService.php
+1
-1
application/service/OrderService.php
application/service/OrderService.php
+6
-6
application/service/PaymentService.php
application/service/PaymentService.php
+711
-0
application/service/ResourcesService.php
application/service/ResourcesService.php
+0
-79
application/service/SlideService.php
application/service/SlideService.php
+1
-0
extend/payment/Alipay.php
extend/payment/Alipay.php
+88
-87
extend/payment/AlipayMini.php
extend/payment/AlipayMini.php
+2
-31
未找到文件。
application/admin/controller/Order.php
浏览文件 @
5f926928
...
...
@@ -2,7 +2,7 @@
namespace
app\admin\controller
;
use
app\service\OrderService
;
use
app\service\
Resources
Service
;
use
app\service\
Payment
Service
;
use
app\service\ExpressService
;
/**
...
...
@@ -89,10 +89,10 @@ class Order extends Common
$pay_where
=
[
'where'
=>
[
'is_enable'
=>
1
,
'is_open_user'
=>
1
,
'payment'
=>
config
(
'under_line_list'
)],
];
$this
->
assign
(
'buy_payment_list'
,
Resources
Service
::
BuyPaymentList
(
$pay_where
));
$this
->
assign
(
'buy_payment_list'
,
Payment
Service
::
BuyPaymentList
(
$pay_where
));
// 支付方式
$this
->
assign
(
'payment_list'
,
Resources
Service
::
PaymentList
());
$this
->
assign
(
'payment_list'
,
Payment
Service
::
PaymentList
());
// 评价状态
$this
->
assign
(
'common_comments_status_list'
,
lang
(
'common_comments_status_list'
));
...
...
application/admin/controller/Payment.php
浏览文件 @
5f926928
<?php
namespace
app\admin\controller
;
use
Service\Resources
Service
;
use
app\service\Payment
Service
;
/**
* 支付方式管理
...
...
@@ -13,10 +12,6 @@ use Service\ResourcesService;
*/
class
Payment
extends
Common
{
private
$payment_dir
;
private
$payment_business_type_all
;
private
$cannot_deleted_list
;
/**
* 构造方法
* @author Devil
...
...
@@ -34,15 +29,6 @@ class Payment extends Common
// 权限校验
$this
->
Is_Power
();
// 插件目录
$this
->
payment_dir
=
APP_PATH
.
'Library'
.
DS
.
'Payment'
.
DS
;
// 支付业务类型
$this
->
payment_business_type_all
=
config
(
'payment_business_type_all'
);
// 不删除的支付方式
$this
->
cannot_deleted_list
=
[
'DeliveryPayment'
,
'CashPayment'
];
}
/**
...
...
@@ -54,114 +40,17 @@ class Payment extends Common
*/
public
function
Index
()
{
$this
->
assign
(
'list'
,
$this
->
GetPaymentList
());
$this
->
assign
(
'cannot_deleted_list'
,
$this
->
cannot_deleted_list
);
$this
->
display
(
'Index'
);
}
/**
* 获取支付插件列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-17
* @desc description
*/
private
function
GetPaymentList
()
{
$data
=
[];
if
(
is_dir
(
$this
->
payment_dir
))
{
if
(
$dh
=
opendir
(
$this
->
payment_dir
))
{
while
((
$temp_file
=
readdir
(
$dh
))
!==
false
)
{
if
(
substr
(
$temp_file
,
0
,
1
)
!=
'.'
)
{
// 获取模块配置信息
$payment
=
htmlentities
(
str_replace
(
'.class.php'
,
''
,
$temp_file
));
$config
=
$this
->
GetPaymentConfig
(
$payment
);
if
(
$config
!==
false
)
{
// 数据组装
$temp
=
$this
->
DataAnalysis
(
$config
);
$temp
[
'id'
]
=
date
(
'YmdHis'
)
.
GetNumberCode
(
8
);
$temp
[
'payment'
]
=
$payment
;
// 插件列表
$this
->
assign
(
'data_list'
,
PaymentService
::
PlugPaymentList
());
// 获取数据库配置信息
$db_config
=
ResourcesService
::
PaymentList
([
'where'
=>
[
'payment'
=>
$payment
]]);
if
(
!
empty
(
$db_config
[
0
]))
{
$temp
[
'is_install'
]
=
1
;
$temp
[
'id'
]
=
$db_config
[
0
][
'id'
];
$temp
[
'name'
]
=
$db_config
[
0
][
'name'
];
$temp
[
'logo'
]
=
$db_config
[
0
][
'logo'
];
$temp
[
'apply_terminal'
]
=
$db_config
[
0
][
'apply_terminal'
];
$temp
[
'config'
]
=
$db_config
[
0
][
'config'
];
$temp
[
'is_enable'
]
=
$db_config
[
0
][
'is_enable'
];
$temp
[
'is_open_user'
]
=
$db_config
[
0
][
'is_open_user'
];
}
$data
[]
=
$temp
;
}
}
}
closedir
(
$dh
);
}
}
return
$data
;
}
/**
* 数据解析
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-17
* @desc description
* @param [array] $data [插件配置信息]
*/
private
function
DataAnalysis
(
$data
)
{
return
[
'name'
=>
isset
(
$data
[
'base'
][
'name'
])
?
htmlentities
(
$data
[
'base'
][
'name'
])
:
$payment
,
'version'
=>
isset
(
$data
[
'base'
][
'version'
])
?
htmlentities
(
$data
[
'base'
][
'version'
])
:
''
,
'apply_version'
=>
isset
(
$data
[
'base'
][
'apply_version'
])
?
htmlentities
(
$data
[
'base'
][
'apply_version'
])
:
''
,
'desc'
=>
isset
(
$data
[
'base'
][
'desc'
])
?
$data
[
'base'
][
'desc'
]
:
''
,
'author'
=>
isset
(
$data
[
'base'
][
'author'
])
?
htmlentities
(
$data
[
'base'
][
'author'
])
:
''
,
'author_url'
=>
isset
(
$data
[
'base'
][
'author_url'
])
?
htmlentities
(
$data
[
'base'
][
'author_url'
])
:
''
,
'element'
=>
isset
(
$data
[
'element'
])
?
$data
[
'element'
]
:
[],
// 不删除的支付方式
$this
->
assign
(
'cannot_deleted_list'
,
PaymentService
::
$cannot_deleted_list
);
'logo'
=>
''
,
'is_enable'
=>
0
,
'is_open_user'
=>
0
,
'is_install'
=>
0
,
'apply_terminal'
=>
array_column
(
lang
(
'common_platform_type'
),
'value'
),
'config'
=>
''
,
];
}
// 适用平台
$this
->
assign
(
'common_platform_type'
,
lang
(
'common_platform_type'
));
/**
* 获取支付模块配置信息
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-17
* @desc description
* @param [string] $payment [模块名称]
*/
private
function
GetPaymentConfig
(
$payment
)
{
$payment
=
'\base\Payment\\'
.
$payment
;
if
(
class_exists
(
$payment
))
{
$obj
=
new
$payment
();
if
(
method_exists
(
$obj
,
'Config'
)
&&
method_exists
(
$obj
,
'Pay'
)
&&
method_exists
(
$obj
,
'Respond'
))
{
return
$obj
->
Config
();
}
}
return
false
;
}
return
$this
->
fetch
();
}
/**
* [SaveInfo 添加/编辑页面]
...
...
@@ -172,21 +61,32 @@ class Payment extends Common
*/
public
function
SaveInfo
()
{
// 轮播图片信息
$data
=
empty
(
$_REQUEST
[
'id'
])
?
array
()
:
db
(
'Payment'
)
->
find
(
I
(
'id'
));
$data
[
'apply_terminal'
]
=
empty
(
$data
[
'apply_terminal'
])
?
[]
:
json_decode
(
$data
[
'apply_terminal'
],
true
);
$data
[
'element'
]
=
empty
(
$data
[
'element'
])
?
[]
:
json_decode
(
$data
[
'element'
],
true
);
$data
[
'config'
]
=
empty
(
$data
[
'config'
])
?
[]
:
json_decode
(
$data
[
'config'
],
true
);
//print_r($data['config']);
$this
->
assign
(
'data'
,
$data
);
// 参数
$params
=
input
();
// 商品信息
if
(
!
empty
(
$params
[
'id'
]))
{
$data_params
=
[
'where'
=>
[
'id'
=>
$params
[
'id'
]],
'm'
=>
0
,
'n'
=>
1
,
];
$data
=
PaymentService
::
PaymentList
(
$data_params
);
if
(
empty
(
$data
[
0
]))
{
return
$this
->
error
(
'没有相关支付方式'
,
url
(
'admin/payment/index'
));
}
$this
->
assign
(
'data'
,
$data
[
0
]);
}
// 适用平台
$this
->
assign
(
'common_platform_type'
,
lang
(
'common_platform_type'
));
// 参数
$this
->
assign
(
'param
'
,
array_merge
(
$_POST
,
$_GET
)
);
$this
->
assign
(
'param
s'
,
$params
);
$this
->
display
(
'SaveInfo'
);
return
$this
->
fetch
(
);
}
/**
...
...
@@ -199,67 +99,15 @@ class Payment extends Common
public
function
Save
()
{
// 是否ajax请求
if
(
!
IS_AJAX
)
{
$this
->
error
(
'非法访问'
);
}
// 图片
$this
->
FileSave
(
'logo'
,
'file_logo'
,
'payment'
);
// id为空则表示是新增
$m
=
D
(
'Payment'
);
// 公共额外数据处理
$_POST
[
'is_enable'
]
=
intval
(
I
(
'is_enable'
,
0
));
$_POST
[
'is_open_user'
]
=
intval
(
I
(
'is_open_user'
,
0
));
// 编辑
if
(
$m
->
create
(
$_POST
,
2
))
{
// 额外数据处理
$m
->
upd_time
=
time
();
$m
->
apply_terminal
=
empty
(
$_POST
[
'apply_terminal'
])
?
''
:
json_encode
(
explode
(
','
,
I
(
'apply_terminal'
)));
$m
->
name
=
I
(
'name'
);
$m
->
sort
=
intval
(
I
(
'sort'
));
// 插件配置信息处理
$m
->
config
=
json_encode
(
$this
->
GetPlugConfig
());
// 移除 id
unset
(
$m
->
id
);
// 更新数据库
if
(
$m
->
where
(
array
(
'id'
=>
I
(
'id'
)))
->
save
())
{
$this
->
ajaxReturn
(
'编辑成功'
);
}
else
{
$this
->
ajaxReturn
(
'编辑失败或数据未改变'
,
-
100
);
}
}
else
{
$this
->
ajaxReturn
(
$m
->
getError
(),
-
1
);
}
}
/**
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-18
* @desc description
*/
private
function
GetPlugConfig
()
{
$data
=
[];
foreach
(
$_POST
as
$k
=>
$v
)
if
(
!
IS_AJAX
)
{
if
(
substr
(
$k
,
0
,
8
)
==
'plugins_'
)
{
$data
[
substr
(
$k
,
8
)]
=
$v
;
}
$this
->
error
(
'非法访问'
);
}
return
$data
;
}
// 开始操作
$ret
=
PaymentService
::
PaymentUpdate
(
input
());
return
json
(
$ret
);
}
/**
* [StatusUpdate 状态更新]
...
...
@@ -270,47 +118,15 @@ class Payment extends Common
*/
public
function
StatusUpdate
()
{
// 是否ajax请求
if
(
!
IS_AJAX
)
{
$this
->
error
(
'非法访问'
);
}
// 参数
if
(
empty
(
$_POST
[
'id'
])
||
!
isset
(
$_POST
[
'state'
]))
{
$this
->
ajaxReturn
(
'参数错误'
,
-
1
);
}
$field
=
I
(
'field'
,
'is_enable'
);
// 数据更新
if
(
db
(
'Payment'
)
->
where
(
array
(
'payment'
=>
I
(
'id'
)))
->
save
(
array
(
$field
=>
I
(
'state'
))))
{
$this
->
ajaxReturn
(
'编辑成功'
);
}
else
{
$this
->
ajaxReturn
(
'编辑失败或数据未改变'
,
-
100
);
}
}
/**
* [PowerCheck 权限校验]
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-09-29T00:01:49+0800
*/
private
function
PowerCheck
()
{
// 主目录权限
if
(
!
is_writable
(
ROOT_PATH
))
{
$this
->
ajaxReturn
(
'服务器用户没操作权限'
.
'['
.
ROOT_PATH
.
']'
,
-
3
);
}
// 插件权限
if
(
!
is_writable
(
$this
->
payment_dir
))
{
$this
->
ajaxReturn
(
'服务器用户没操作权限'
.
'['
.
$this
->
payment_dir
.
']'
,
-
3
);
}
// 开始操作
$ret
=
PaymentService
::
PaymentStatusUpdate
(
input
());
return
json
(
$ret
);
}
/**
...
...
@@ -323,50 +139,15 @@ class Payment extends Common
*/
public
function
Install
()
{
// 是否ajax请求
if
(
!
IS_AJAX
)
{
$this
->
error
(
'非法访问'
);
}
// 权限
$this
->
PowerCheck
();
// 参数
if
(
empty
(
$_POST
[
'id'
]))
{
$this
->
ajaxReturn
(
'参数错误'
,
-
1
);
}
// 数据处理
$payment
=
I
(
'id'
);
$config
=
$this
->
GetPaymentConfig
(
$payment
);
if
(
$config
!==
false
)
{
$data
=
$this
->
DataAnalysis
(
$config
);
$data
[
'payment'
]
=
$payment
;
$data
[
'element'
]
=
empty
(
$data
[
'element'
])
?
''
:
json_encode
(
$data
[
'element'
]);
$data
[
'apply_terminal'
]
=
empty
(
$data
[
'apply_terminal'
])
?
''
:
json_encode
(
$data
[
'apply_terminal'
]);
$data
[
'add_time'
]
=
time
();
// 开始安装
$m
=
D
(
'Payment'
);
if
(
$m
->
create
(
$data
,
1
))
{
if
(
$m
->
add
(
$data
))
{
// 入口文件生成
$this
->
PaymentEntranceCreated
(
$payment
);
$this
->
ajaxReturn
(
'安装成功'
);
}
else
{
$this
->
ajaxReturn
(
'安装失败'
,
-
100
);
}
}
else
{
$this
->
ajaxReturn
(
$m
->
getError
(),
-
1
);
}
}
else
{
$this
->
ajaxReturn
(
'插件配置有误'
,
-
10
);
}
// 开始操作
$ret
=
PaymentService
::
Install
(
input
());
return
json
(
$ret
);
}
/**
...
...
@@ -379,28 +160,15 @@ class Payment extends Common
*/
public
function
Uninstall
()
{
// 是否ajax请求
if
(
!
IS_AJAX
)
{
$this
->
error
(
'非法访问'
);
}
// 参数
if
(
empty
(
$_POST
[
'id'
]))
{
$this
->
ajaxReturn
(
'参数错误'
,
-
1
);
}
// 开始卸载
$payment
=
I
(
'id'
);
if
(
db
(
'Payment'
)
->
where
([
'payment'
=>
$payment
])
->
delete
())
{
// 删除入口文件
$this
->
PaymentEntranceDelete
(
$payment
);
$this
->
ajaxReturn
(
'卸载成功'
);
}
else
{
$this
->
ajaxReturn
(
'卸载失败'
,
-
100
);
}
// 开始操作
$ret
=
PaymentService
::
Uninstall
(
input
());
return
json
(
$ret
);
}
/**
...
...
@@ -413,49 +181,15 @@ class Payment extends Common
*/
public
function
Delete
()
{
// 是否ajax请求
if
(
!
IS_AJAX
)
{
$this
->
error
(
'非法访问'
);
}
// 权限
$this
->
PowerCheck
();
// 参数
if
(
empty
(
$_POST
[
'id'
]))
{
$this
->
ajaxReturn
(
'参数错误'
,
-
1
);
}
// 是否禁止删除
$payment
=
I
(
'id'
);
if
(
in_array
(
$payment
,
$this
->
cannot_deleted_list
))
{
$this
->
ajaxReturn
(
'该支付方式禁止删除'
,
-
10
);
}
// 是否存在
$file
=
$this
->
payment_dir
.
$payment
.
'.class.php'
;
if
(
!
file_exists
(
$file
))
{
$this
->
ajaxReturn
(
'资源不存在或已被删除'
,
-
2
);
}
// 权限
if
(
!
is_writable
(
$file
))
{
$this
->
ajaxReturn
(
'服务器用户没操作权限'
,
-
3
);
}
// 删除
if
(
!@
unlink
(
$file
))
{
$this
->
ajaxReturn
(
'删除失败或资源不存在'
,
-
100
);
}
// 删除入口文件
$this
->
PaymentEntranceDelete
(
$payment
);
$this
->
ajaxReturn
(
'删除成功'
);
// 开始操作
$ret
=
PaymentService
::
Delete
(
input
());
return
json
(
$ret
);
}
/**
...
...
@@ -468,148 +202,15 @@ class Payment extends Common
*/
public
function
Upload
()
{
// 是否ajax
// 是否ajax
请求
if
(
!
IS_AJAX
)
{
$this
->
error
(
'非法访问'
);
}
// 权限
$this
->
PowerCheck
();
// 文件上传校验
$error
=
FileUploadError
(
'file'
);
if
(
$error
!==
true
)
{
$this
->
ajaxReturn
(
$error
,
-
1
);
}
// 文件格式化校验
$type
=
array
(
'text/php'
);
if
(
!
in_array
(
$_FILES
[
'file'
][
'type'
],
$type
))
{
$this
->
ajaxReturn
(
'文件格式有误,必须php文件'
,
-
2
);
}
// 是否已有存在插件
if
(
file_exists
(
$this
->
payment_dir
.
$_FILES
[
'file'
][
'name'
]))
{
$this
->
ajaxReturn
(
'已存在相同插件'
,
-
3
);
}
// 存储文件
if
(
!
move_uploaded_file
(
$_FILES
[
'file'
][
'tmp_name'
],
$this
->
payment_dir
.
$_FILES
[
'file'
][
'name'
]))
{
$this
->
ajaxReturn
(
'上传失败'
,
-
100
);
}
// 文件校验
$payment
=
htmlentities
(
str_replace
(
'.class.php'
,
''
,
$_FILES
[
'file'
][
'name'
]));
$config
=
$this
->
GetPaymentConfig
(
$payment
);
if
(
$config
===
false
)
{
@
unlink
(
$this
->
payment_dir
.
$_FILES
[
'file'
][
'name'
]);
$this
->
ajaxReturn
(
'插件编写有误,请参考文档编写'
,
-
10
);
}
$this
->
ajaxReturn
(
'上传成功'
);
}
/**
* [PaymentEntranceCreated 入口文件创建]
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-09-28T23:38:52+0800
* @param [string] $payment [支付唯一标记]
*/
private
function
PaymentEntranceCreated
(
$payment
)
{
// 批量创建
foreach
(
$this
->
payment_business_type_all
as
$v
)
{
// 异步
$notify
=
<<<php
<?php
/**
* {$v['desc']}支付异步入口
*/
// 默认绑定模块
\$_GET['m'] = 'Api';
\$_GET['c'] = '{$v['name']}Notify';
\$_GET['a'] = 'Notify';
// 支付模块标记
define('PAYMENT_TYPE', '{$payment}');
// 引入公共入口文件
require './core.php';
// 引入ThinkPHP入口文件
require './ThinkPHP/ThinkPHP.php';
?>
php;
// 同步
$respond
=
<<<php
<?php
/**
* {$v['desc']}支付同步入口
*/
// 默认绑定模块
\$_GET['m'] = 'Home';
\$_GET['c'] = '{$v['name']}';
\$_GET['a'] = 'Respond';
// 支付模块标记
define('PAYMENT_TYPE', '{$payment}');
// 引入公共入口文件
require './core.php';
// 引入ThinkPHP入口文件
require './ThinkPHP/ThinkPHP.php';
?>
php;
$name
=
strtolower
(
$v
[
'name'
]);
@
file_put_contents
(
ROOT_PATH
.
'payment_'
.
$name
.
'_'
.
strtolower
(
$payment
)
.
'_respond.php'
,
$respond
);
// 线下支付不生成异步入口文件
if
(
!
in_array
(
$payment
,
config
(
'under_line_list'
)))
{
@
file_put_contents
(
ROOT_PATH
.
'payment_'
.
$name
.
'_'
.
strtolower
(
$payment
)
.
'_notify.php'
,
$notify
);
}
}
}
/**
* [PaymentEntranceDelete 入口文件删除]
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-09-28T23:38:52+0800
* @param [string] $payment [支付唯一标记]
*/
private
function
PaymentEntranceDelete
(
$payment
)
{
$payment
=
strtolower
(
$payment
);
foreach
(
$this
->
payment_business_type_all
as
$v
)
{
$name
=
strtolower
(
$v
[
'name'
]);
if
(
file_exists
(
ROOT_PATH
.
'payment_'
.
$name
.
'_'
.
$payment
.
'_notify.php'
))
{
@
unlink
(
ROOT_PATH
.
'payment_'
.
$name
.
'_'
.
$payment
.
'_notify.php'
);
}
if
(
file_exists
(
ROOT_PATH
.
'payment_'
.
$name
.
'_'
.
$payment
.
'_respond.php'
))
{
@
unlink
(
ROOT_PATH
.
'payment_'
.
$name
.
'_'
.
$payment
.
'_respond.php'
);
}
}
// 开始操作
$ret
=
PaymentService
::
Upload
(
input
());
return
json
(
$ret
);
}
}
?>
\ No newline at end of file
application/admin/view/default/payment/index.html
浏览文件 @
5f926928
...
...
@@ -10,7 +10,7 @@
<!-- operation end -->
<!-- list start -->
<table
class=
"am-table am-table-striped am-table-hover am-text-middle m-t-1
)}}
<table
class=
"am-table am-table-striped am-table-hover am-text-middle m-t-1
0"
>
<thead>
<tr>
<th>
名称
</th>
...
...
@@ -25,9 +25,9 @@
</tr>
</thead>
<tbody>
{{if !empty($list)}}
<foreach
name=
"list"
item=
"v"
>
<tr
id=
"data-list-{{$v.payment}}"
{{
if
$
v
['
is_install
']
eq
0
)}}
class=
"am-warning"
<
elseif
condition=
"$v['is_enable'] eq 0"
/>
class="am-active"{{/if}} >
{{if !empty($
data_
list)}}
{{foreach $data_list as $v}}
<tr
id=
"data-list-{{$v.payment}}"
{{
if
$
v
['
is_install
']
eq
0
}}
class=
"am-warning"
{{
elseif
$
v
['
is_enable
']
eq
0
/}}
class=
"am-active"
{{/
if
}}
>
<td>
{{$v.name}}
{{if !empty($v['version'])}}
...
...
@@ -40,7 +40,7 @@
<img
src=
"{{$v['logo']}}"
class=
"am-radius"
width=
"100"
/>
</a>
{{else /}}
<span
class=
"cr-ddd"
>
暂无
图片
</span>
<span
class=
"cr-ddd"
>
暂无
LOGO
</span>
{{/if}}
</td>
<td
class=
"am-hide-sm-only"
>
...
...
@@ -48,9 +48,9 @@
</td>
<td>
{{if !empty($v['apply_terminal'])}}
<foreach
name=
"v.apply_terminal"
key=
"terminal_k"
item=
"terminal_v"
>
{{
:lang('common_platform_type')
[$terminal_v]['name']}}
{{if $terminal_k LT count($v['apply_terminal'])-1
)
}}
<br
/>
{{/if}}
{{foreach $v.apply_terminal as $terminal_k=>$terminal_v}}
{{
$common_platform_type
[$terminal_v]['name']}}
{{if $terminal_k LT count($v['apply_terminal'])-1}}
<br
/>
{{/if}}
{{/foreach}}
{{else /}}
<span
class=
"cr-ddd"
>
未填写
</span>
...
...
@@ -69,35 +69,35 @@
{{/if}}
</td>
<td
class=
"am-hide-sm-only td-desc"
>
{{if empty($v['desc'])}}
<span
class=
"cr-ddd"
>
未填写
</span>
{{else /}}{{$v.desc}}{{/if}}
{{if empty($v['desc'])}}
<span
class=
"cr-ddd"
>
未填写
</span>
{{else /}}{{$v.desc
||raw
}}{{/if}}
</td>
<td>
{{if $v['is_install'] eq 1
)
}}
<a
href=
"javascript:;"
class=
"am-icon-btn am-icon-check submit-state {{if $v['is_enable'] eq 1
)}}am-success{{else /}}am-default{{/if}}"
data-url=
"{{:url('Admin/Payment/StatusUpdate')}}"
data-id=
"{{$v.payment}}"
data-field=
"is_enable"
data-state=
"{{$v['is_enable']}}"
data-is-update-status=
"1)}}
</a>
{{if $v['is_install'] eq 1}}
<a
href=
"javascript:;"
class=
"am-icon-btn am-icon-check submit-state {{if $v['is_enable'] eq 1
}}am-success{{else /}}am-default{{/if}}"
data-url=
"{{:url('admin/payment/StatusUpdate')}}"
data-id=
"{{$v.payment}}"
data-field=
"is_enable"
data-state=
"{{$v['is_enable']}}"
data-is-update-status=
"1"
>
</a>
{{else /}}
<span
class=
"cr-ddd"
>
未安装
</span>
{{/if}}
</td>
<td>
{{if $v['is_install'] eq 1
)
}}
<a
href=
"javascript:;"
class=
"am-icon-btn am-icon-check submit-state {{if $v['is_open_user'] eq 1
)}}am-success{{else /}}am-default{{/if}}"
data-url=
"{{:url('Admin/P
ayment/StatusUpdate')}}"
data-id=
"{{$v.payment}}"
data-field=
"is_open_user"
data-state=
"{{$v['is_open_user']}}"
></a>
{{if $v['is_install'] eq 1}}
<a
href=
"javascript:;"
class=
"am-icon-btn am-icon-check submit-state {{if $v['is_open_user'] eq 1
}}am-success{{else /}}am-default{{/if}}"
data-url=
"{{:url('admin/p
ayment/StatusUpdate')}}"
data-id=
"{{$v.payment}}"
data-field=
"is_open_user"
data-state=
"{{$v['is_open_user']}}"
></a>
{{else /}}
<span
class=
"cr-ddd"
>
未安装
</span>
{{/if}}
</td>
<td
class=
"view-operation"
>
{{if $v['is_install'] eq 0
)
}}
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-cubes submit-ajax"
data-url=
"{{:url('
Admin/Payment/I
nstall')}}"
data-id=
"{{$v.payment}}"
data-view=
"reload"
data-msg=
"安装进行中、确认操作吗?"
>
安装
</button>
{{if $v['is_install'] eq 0}}
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-cubes submit-ajax"
data-url=
"{{:url('
admin/payment/i
nstall')}}"
data-id=
"{{$v.payment}}"
data-view=
"reload"
data-msg=
"安装进行中、确认操作吗?"
>
安装
</button>
{{if !in_array($v['payment'], $cannot_deleted_list)}}
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete"
data-url=
"{{:url('
Admin/P
ayment/Delete')}}"
data-id=
"{{$v.payment}}"
>
删除
</button>
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete"
data-url=
"{{:url('
admin/p
ayment/Delete')}}"
data-id=
"{{$v.payment}}"
>
删除
</button>
{{/if}}
{{else /}}
<a
href=
"{{:url('
Admin/Payment/SaveI
nfo', array('id'=>$v['id']))}}"
>
<a
href=
"{{:url('
admin/payment/savei
nfo', array('id'=>$v['id']))}}"
>
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-edit"
>
编辑
</button>
</a>
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-genderless submit-ajax"
data-url=
"{{:url('
Admin/Payment/U
ninstall')}}"
data-id=
"{{$v.payment}}"
data-view=
"reload"
data-msg=
"卸载后不可恢复、确认操作吗?"
>
卸载
</button>
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-genderless submit-ajax"
data-url=
"{{:url('
admin/payment/u
ninstall')}}"
data-id=
"{{$v.payment}}"
data-view=
"reload"
data-msg=
"卸载后不可恢复、确认操作吗?"
>
卸载
</button>
{{/if}}
</td>
</tr>
...
...
@@ -118,7 +118,7 @@
</div>
<div
class=
"am-popup-bd"
>
<!-- win form start -->
<form
class=
"am-form form-validation"
action=
"{{:url('
Admin/Payment/U
pload')}}"
method=
"POST"
request-type=
"ajax-reload"
enctype=
"multipart/form-data"
>
<form
class=
"am-form form-validation"
action=
"{{:url('
admin/payment/u
pload')}}"
method=
"POST"
request-type=
"ajax-reload"
enctype=
"multipart/form-data"
>
<input
type=
"hidden"
name=
"max_file_size"
value=
"{{:MyC('home_max_limit_file', 51200000)}}"
/>
<div
class=
"am-alert am-radius am-alert-tips m-t-0"
data-am-alert
>
<p
class=
"m-t-1)}}1 类名必须于文件名一致(去除 .class.php ),如 Alipay.class.php 则取 Alipay <br />2 类必须定义三个方法<br /> 2.1 Config 配置方法<br /> 2.2 Pay 支付方法<br /> 2.3 Respond 回调方法</p>
...
...
application/admin/view/default/payment/save_info.html
浏览文件 @
5f926928
...
...
@@ -4,20 +4,20 @@
<div
class=
"content-right"
>
<div
class=
"content"
>
<!-- form start -->
<form
class=
"am-form form-validation view-save"
action=
"{{:url('
Admin/Payment/Save')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:url('Admin/Payment/I
ndex')}}"
enctype=
"multipart/form-data"
>
<form
class=
"am-form form-validation view-save"
action=
"{{:url('
admin/payment/save')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:url('admin/payment/i
ndex')}}"
enctype=
"multipart/form-data"
>
<input
type=
"hidden"
name=
"max_file_size"
value=
"{{:MyC('home_max_limit_image', 2048000)}}"
/>
<legend>
<span
class=
"fs-16
)}}
支付方式编辑</span>
<a href="
{{
:url
('
Admin
/
Payment
/
I
ndex
')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
<span
class=
"fs-16
"
>
支付方式编辑
</span>
<a
href=
"{{:url('
admin/payment/i
ndex')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"am-form-group"
>
<label>
名称
</label>
<input
type=
"text"
name=
"name"
placeholder=
"名称"
minlength=
"2"
maxlength=
"60"
data-validation-message=
"名称格式 2~30 个字符"
class=
"am-radius"
<
notempty
name=
"data"
>
value="{{$data.name}}"{{/if}} required />
<input
type=
"text"
name=
"name"
placeholder=
"名称"
minlength=
"2"
maxlength=
"60"
data-validation-message=
"名称格式 2~30 个字符"
class=
"am-radius"
{{
if
!
empty
($
data
)}}
value=
"{{$data.name}}"
{{/
if
}}
required
/>
</div>
<div
class=
"am-form-group"
>
<label>
适用终端
</label>
<select
name=
"apply_terminal"
class=
"am-radius c-p chosen-select"
multiple=
"multiple"
minchecked=
"1"
data-placeholder=
"可选择..."
data-validation-message=
"至少选择一个适用终端"
required
>
<foreach
name=
"common_platform_type"
item=
"v"
>
{{foreach $common_platform_type as $v}}
<option
value=
"{{$v.value}}"
{{
if
isset
($
data
['
apply_terminal
'])
and
in_array
($
v
['
value
'],
$
data
['
apply_terminal
'])}}
selected
{{/
if
}}
>
{{$v.name}}
</option>
{{/foreach}}
</select>
...
...
@@ -25,36 +25,46 @@
<div
class=
"am-form-group am-form-file"
>
<label
class=
"block"
>
LOGO
</label>
<button
type=
"button"
class=
"am-btn am-btn-default am-btn-sm am-radius"
>
<i
class=
"am-icon-cloud-upload"
></i>
选择图片
</button>
<input
type=
"text"
name=
"logo"
class=
"am-radius js-choice-one original-images-url"
data-choice-one-to=
".images-file-event"
<
notempty
name=
"data"
>
value="{{$data.logo}}"{{/if}}" data-validation-message="请选择需要上传的图片" readonly="readonly"
<notempty
name=
"data"
>
value="{{$data.logo}}"{{/if}} />
<input
type=
"file"
name=
"file_logo"
multiple
data-validation-message=
"请选择需要上传的图片"
accept=
"image/gif,image/jpeg,image/jpg,image/png"
class=
"js-choice-one images-file-event"
data-choice-one-to=
".original-images-url"
data-tips-tag=
"#form-logo-tips"
data-image-tag=
"#form-img-logo"
/>
<div
id=
"form-logo-tips"
class=
"m-t-5)}}</div>
<img src="
{{
if
!
empty
($
data
['
logo
'])}}{{$
image_host
}}{{$
data.logo
}}{{
else
/}}{{$
image_host
}}/
Public
/
Admin
/
Default
/
Images
/
default-images.png
{{/
if
}}"
id=
"form-img-logo"
class=
"block m-t-5 am-img-thumbnail am-radius"
width=
"100"
data-default=
"{{if !empty($data['logo'])}}{{$image_host}}{{$data.logo}}{{else /}}{{$image_host}}/Public/Admin/Default/Images/default-images.png{{/if}}"
/>
<ul
class=
"plug-file-upload-view logo-images-view"
data-form-name=
"logo"
data-max-number=
"1"
data-dialog-type=
"images"
>
{{if !empty($data['logo'])}}
<li>
<input
type=
"text"
name=
"logo"
value=
"{{$data.logo}}"
/>
<img
src=
"{{$data.logo}}"
/>
<i>
×
</i>
</li>
{{/if}}
</ul>
<div
class=
"plug-file-upload-submit"
data-view-tag=
"ul.logo-images-view"
>
+上传图片
</div>
</div>
<!-- plugins config start -->
<notempty
name=
"data.element"
>
{{if !empty($data['element'])}}
<div
class=
"plugins-element"
>
<p
class=
"tips"
>
该区域为插件配置填写项,请按照插件文档填写相应的值。
</p>
<foreach
name=
"data.element"
item=
"element"
>
{{foreach $data.element as $element}}
<div
class=
"am-form-group"
>
<label
class=
"block"
>
{{$element.title}}
</label>
<switch
name=
"element.element"
>
<case
value=
"input"
>
{{switch element.element}}
{{case input}}
{{if in_array($element['type'], ['radio', 'checkbox']) and !empty($element['element_data']) and is_array($element['element_data'])}}
<foreach
name=
"element.element_data"
key=
"element_data_key"
item=
"element_data"
>
<label
class=
"{{if isset($element['is_block']) and $element['is_block'] eq 1
)
}}am-{{$element.type}}{{else /}}am-{{$element.type}}-inline{{/if}}"
>
{{foreach $element.element_data as $element_data_key=>$element_data}}
<label
class=
"{{if isset($element['is_block']) and $element['is_block'] eq 1}}am-{{$element.type}}{{else /}}am-{{$element.type}}-inline{{/if}}"
>
<input
type=
"{{$element.type}}"
name=
"plugins_{{$element.name}}"
value=
"{{$element_data.value}}"
{{
if
(
isset
($
element_data
['
is_checked
'])
and
$
element_data
['
is_checked
']
eq
1)
or
(
isset
($
data
['
config
'][$
element
['
name
']])
and
in_array
($
element_data
['
value
'],
explode
(',',
$
data
['
config
'][$
element
['
name
']])))}}
checked
{{/
if
}}
{{
if
isset
($
element
['
minchecked
'])
and
$
element
['
type
']
eq
'
checkbox
'"
>
minchecked="{{$element.minchecked}}"{{/if}}
{{if isset($element['maxchecked']) and $element['type'] eq 'checkbox'">maxchecked="{{$element.maxchecked}}"{{/if}}
{{if isset($element['message'])}}data-validation-message="{{$element.message}}"{{/if}}
{{if $element_data_key eq 0 and isset($element['is_required']) and $element['is_required'] eq 1)}}required{{/if}}
data-am-ucheck />{{$element_data.name}}
{{
if
isset
($
data
['
config
'][$
element
['
name
']])
and
in_array
($
element_data
['
value
'],
explode
(',',
$
data
['
config
'][$
element
['
name
']]))}}
checked
{{/
if
}}
{{
if
isset
($
element
['
minchecked
'])
and
$
element
['
type
']
eq
'
checkbox
'}}
minchecked=
"{{$element.minchecked}}"
{{/
if
}}
{{
if
isset
($
element
['
maxchecked
'])
and
$
element
['
type
']
eq
'
checkbox
'}}
maxchecked=
"{{$element.maxchecked}}"
{{/
if
}}
{{
if
isset
($
element
['
message
'])}}
data-validation-message=
"{{$element.message}}"
{{/
if
}}
{{
if
$
element_data_key
eq
0
and
isset
($
element
['
is_required
'])
and
$
element
['
is_required
']
eq
1}}
required
{{/
if
}}
data-am-ucheck
/>
{{$element_data.name}}
</label>
{{/foreach}}
{{else /}}
...
...
@@ -63,52 +73,64 @@
type=
"{{$element.type}}"
name=
"plugins_{{$element.name}}"
value=
"{{if isset($data['config'][$element['name']])}}{{$data['config'][$element['name']]}}{{else /}}{{if isset($element['default'])}}{{$element.default}}{{/if}}{{/if}}"
{{
if
isset
($
element
['
placeholder
'])}}
placeholder=
"{{$element.placeholder}}"
{{/
if
}}
{{
if
isset
($
element
['
message
'])}}
data-validation-message=
"{{$element.message}}"
{{/
if
}}
{{
if
isset
($
element
['
is_required
'])
and
$
element
['
is_required
']
eq
1)}}
required
{{/
if
}}
{{
if
isset
($
element
['
placeholder
'])}}
placeholder=
"{{$element.placeholder}}"
{{/
if
}}
{{
if
isset
($
element
['
message
'])}}
data-validation-message=
"{{$element.message}}"
{{/
if
}}
{{
if
isset
($
element
['
is_required
'])
and
$
element
['
is_required
']
eq
1}}
required
{{/
if
}}
/>
{{/if}}
</case>
<case
value=
"select"
>
{{/case}}
{{case select}}
{{if !empty($element['element_data']) and is_array($element['element_data'])}}
<select
class=
"chosen-select am-radius"
name=
"plugins_{{$element.name}}"
{{
if
isset
($
element
['
message
'])}}
data-validation-message=
"{{$element.message}}"
{{/
if
}}
{{
if
isset
($
element
['
placeholder
'])}}
data-placeholder=
"{{$element.placeholder}}"
{{
else
/}}
可选择...
{{/
if
}}
{{
if
isset
($
element
['
is_multiple
'])
and
$
element
['
is_multiple
']
eq
1)}}
{{
if
isset
($
element
['
message
'])}}
data-validation-message=
"{{$element.message}}"
{{/
if
}}
{{
if
isset
($
element
['
placeholder
'])}}
data-placeholder=
"{{$element.placeholder}}"
{{
else
/}}
可选择...
{{/
if
}}
{{
if
isset
($
element
['
is_multiple
'])
and
$
element
['
is_multiple
']
eq
1}}
multiple
{{
if
isset
($
element
['
minchecked
'])}}
minchecked=
"{{$element.minchecked}}"
{{/
if
}}
{{
if
isset
($
element
['
maxchecked
'])}}
maxchecked=
"{{$element.maxchecked}}"
{{/
if
}}
{{
if
isset
($
element
['
minchecked
'])}}
minchecked=
"{{$element.minchecked}}"
{{/
if
}}
{{
if
isset
($
element
['
maxchecked
'])}}
maxchecked=
"{{$element.maxchecked}}"
{{/
if
}}
{{/
if
}}
{{
if
isset
($
element
['
is_required
'])
and
$
element
['
is_required
']
eq
1)}}
required
{{/
if
}}
{{
if
isset
($
element
['
is_required
'])
and
$
element
['
is_required
']
eq
1}}
required
{{/
if
}}
>
{{if !isset($element['is_multiple']) or $element['is_multiple'] neq 1)}}
<option
value=
""
>
{{if isset($element['placeholder'])}}{{$element.placeholder}}{{else /}}可选择...{{/if}}
</option>
{{if !isset($element['is_multiple']) or $element['is_multiple'] neq 1}}
<option
value=
""
>
{{if isset($element['placeholder'])}}{{$element.placeholder}}{{else /}}可选择...{{/if}}
</option>
{{/if}}
<foreach
name=
"element.element_data"
key=
"element_data_key"
item=
"element_data"
>
{{foreach $element.element_data as $element_data_key=>$element_data}}
<option
value=
"{{$element_data.value}}"
{{
if
(
isset
($
element_data
['
is_selected
'])
and
$
element_data
['
is_selected
']
eq
1)
or
(
isset
($
data
['
config
'][$
element
['
name
']])
and
in_array
($
element_data
['
value
'],
explode
(',',
$
data
['
config
'][$
element
['
name
']])
))}}
selected
{{/
if
}}
{{
if
isset
($
data
['
config
'][$
element
['
name
']])
and
in_array
($
element_data
['
value
'],
explode
(',',
$
data
['
config
'][$
element
['
name
']]
))}}
selected
{{/
if
}}
>
{{$element_data.name}}
</option>
{{/foreach}}
</select>
{{/if}}
</case>
<case
value=
"textarea"
>
{{/case}}
{{case textarea}}
<textarea
class=
"am-radius"
name=
"plugins_{{$element.name}}"
{{
if
isset
($
element
['
rows
'])}}
rows=
"{{$element.rows}}"
{{/
if
}}
{{
if
isset
($
element
['
placeholder
'])}}
placeholder=
"{{$element.placeholder}}"
{{/
if
}}
{{
if
isset
($
element
['
is_required
'])
and
$
element
['
is_required
']
eq
1)}}
{{
if
isset
($
element
['
minlength
'])}}
minlength=
"{{$element.minlength}}"
{{/
if
}}
{{
if
isset
($
element
['
maxlength
'])}}
maxlength=
"{{$element.maxlength}}"
{{/
if
}}
{{
if
isset
($
element
['
rows
'])}}
rows=
"{{$element.rows}}"
{{/
if
}}
{{
if
isset
($
element
['
placeholder
'])}}
placeholder=
"{{$element.placeholder}}"
{{/
if
}}
{{
if
isset
($
element
['
is_required
'])
and
$
element
['
is_required
']
eq
1}}
{{
if
isset
($
element
['
minlength
'])}}
minlength=
"{{$element.minlength}}"
{{/
if
}}
{{
if
isset
($
element
['
maxlength
'])}}
maxlength=
"{{$element.maxlength}}"
{{/
if
}}
required
{{/
if
}}
>
{{if isset($data['config'][$element['name']])}}{{$data['config'][$element['name']]}}{{else /}}{{if isset($element['default'])}}{{$element.default}}{{/if}}{{/if}}
</textarea>
</case>
</switch>
{{/case}}
{{/switch}}
</div>
{{/foreach}}
</div>
...
...
@@ -130,7 +152,7 @@
<input
name=
"is_enable"
value=
"1"
type=
"checkbox"
data-off-text=
"否"
data-on-text=
"是"
data-size=
"xs"
data-on-color=
"success"
data-off-color=
"default"
data-handle-width=
"50"
data-am-switch
{{
if
(
isset
($
data
['
is_enable
'])
and
$
data
['
is_enable
']
eq
1)
or
!
isset
($
data
['
is_enable
'])}}
checked=
"true"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<input
type=
"hidden"
name=
"id"
<
notempty
name=
"data"
>
value="{{$data.id}}"{{/if}} />
<input
type=
"hidden"
name=
"id"
{{
if
!
empty
($
data
)}}
value=
"{{$data.id}}"
{{/
if
}}
/>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
</div>
</form>
...
...
application/index/controller/Buy.php
浏览文件 @
5f926928
...
...
@@ -3,7 +3,7 @@ namespace app\index\controller;
use
app\service\GoodsService
;
use
app\service\UserService
;
use
app\service\
Resources
Service
;
use
app\service\
Payment
Service
;
use
app\service\BuyService
;
/**
...
...
@@ -57,7 +57,7 @@ class Buy extends Common
$this
->
assign
(
'user_address_list'
,
UserService
::
UserAddressList
([
'user'
=>
$this
->
user
])[
'data'
]);
// 支付方式
$this
->
assign
(
'payment_list'
,
Resources
Service
::
BuyPaymentList
([
'is_enable'
=>
1
,
'is_open_user'
=>
1
]));
$this
->
assign
(
'payment_list'
,
Payment
Service
::
BuyPaymentList
([
'is_enable'
=>
1
,
'is_open_user'
=>
1
]));
// 商品/基础信息
$base
=
[
...
...
application/index/controller/Order.php
浏览文件 @
5f926928
...
...
@@ -2,7 +2,7 @@
namespace
app\index\controller
;
use
app\service\OrderService
;
use
app\service\
Resources
Service
;
use
app\service\
Payment
Service
;
/**
* 订单管理
...
...
@@ -74,7 +74,7 @@ class Order extends Common
$this
->
assign
(
'data_list'
,
$data
[
'data'
]);
// 支付方式
$this
->
assign
(
'payment_list'
,
Resources
Service
::
PaymentList
());
$this
->
assign
(
'payment_list'
,
Payment
Service
::
PaymentList
());
// 订单状态
$this
->
assign
(
'common_order_user_status'
,
lang
(
'common_order_user_status'
));
...
...
@@ -118,7 +118,7 @@ class Order extends Common
if
(
!
empty
(
$data
[
'data'
][
0
]))
{
// 发起支付 - 支付方式
$this
->
assign
(
'buy_payment_list'
,
Resources
Service
::
BuyPaymentList
([
'is_enable'
=>
1
,
'is_open_user'
=>
1
]));
$this
->
assign
(
'buy_payment_list'
,
Payment
Service
::
BuyPaymentList
([
'is_enable'
=>
1
,
'is_open_user'
=>
1
]));
$this
->
assign
(
'data'
,
$data
[
'data'
][
0
]);
...
...
application/service/GoodsService.php
浏览文件 @
5f926928
...
...
@@ -1461,7 +1461,7 @@ class GoodsService
}
/**
* 商品
上下架
状态更新
* 商品状态更新
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
...
...
application/service/OrderService.php
浏览文件 @
5f926928
...
...
@@ -3,7 +3,7 @@ namespace app\service;
use
think\Db
;
use
app\service\GoodsService
;
use
app\service\
Resources
Service
;
use
app\service\
Payment
Service
;
use
app\service\BuyService
;
use
app\service\IntegralService
;
use
app\service\RegionService
;
...
...
@@ -67,7 +67,7 @@ class OrderService
// 支付方式
$payment_id
=
empty
(
$params
[
'payment_id'
])
?
$order
[
'payment_id'
]
:
intval
(
$params
[
'payment_id'
]);
$payment
=
Resources
Service
::
PaymentList
([
'where'
=>
[
'id'
=>
$payment_id
]]);
$payment
=
Payment
Service
::
PaymentList
([
'where'
=>
[
'id'
=>
$payment_id
]]);
if
(
empty
(
$payment
[
0
]))
{
return
DataReturn
(
'支付方式有误'
,
-
1
);
...
...
@@ -170,7 +170,7 @@ class OrderService
// 支付方式
$payment_id
=
empty
(
$params
[
'payment_id'
])
?
$order
[
'payment_id'
]
:
intval
(
$params
[
'payment_id'
]);
$payment
=
Resources
Service
::
PaymentList
([
'where'
=>
[
'id'
=>
$payment_id
]]);
$payment
=
Payment
Service
::
PaymentList
([
'where'
=>
[
'id'
=>
$payment_id
]]);
if
(
empty
(
$payment
[
0
]))
{
return
DataReturn
(
'支付方式有误'
,
-
1
);
...
...
@@ -242,7 +242,7 @@ class OrderService
}
// 支付方式
$payment
=
Resources
Service
::
PaymentList
([
'where'
=>
[
'payment'
=>
PAYMENT_TYPE
]]);
$payment
=
Payment
Service
::
PaymentList
([
'where'
=>
[
'payment'
=>
PAYMENT_TYPE
]]);
if
(
empty
(
$payment
[
0
]))
{
return
DataReturn
(
'支付方式有误'
,
-
1
);
...
...
@@ -280,7 +280,7 @@ class OrderService
public
static
function
Notify
(
$params
=
[])
{
// 支付方式
$payment
=
Resources
Service
::
PaymentList
([
'where'
=>
[
'payment'
=>
PAYMENT_TYPE
]]);
$payment
=
Payment
Service
::
PaymentList
([
'where'
=>
[
'payment'
=>
PAYMENT_TYPE
]]);
if
(
empty
(
$payment
[
0
]))
{
return
DataReturn
(
'支付方式有误'
,
-
1
);
...
...
@@ -550,7 +550,7 @@ class OrderService
$v
[
'express_name'
]
=
ExpressService
::
ExpressName
(
$v
[
'express_id'
]);
// 支付方式
$v
[
'payment_name'
]
=
(
$v
[
'status'
]
<=
1
)
?
null
:
Resources
Service
::
OrderPaymentName
(
$v
[
'id'
]);
$v
[
'payment_name'
]
=
(
$v
[
'status'
]
<=
1
)
?
null
:
Payment
Service
::
OrderPaymentName
(
$v
[
'id'
]);
// 收件人地址
$v
[
'receive_province_name'
]
=
RegionService
::
RegionName
(
$v
[
'receive_province'
]);
...
...
application/service/PaymentService.php
0 → 100644
浏览文件 @
5f926928
此差异已折叠。
点击以展开。
application/service/ResourcesService.php
浏览文件 @
5f926928
...
...
@@ -12,85 +12,6 @@ use think\Db;
*/
class
ResourcesService
{
/**
* 获取订单支付名称
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-19
* @desc description
* @param [int] $order_id [订单id]
*/
public
static
function
OrderPaymentName
(
$order_id
=
0
)
{
return
empty
(
$order_id
)
?
null
:
Db
::
name
(
'PayLog'
)
->
where
([
'order_id'
=>
intval
(
$order_id
)])
->
value
(
'payment_name'
);
}
/**
* 支付方式列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-19
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
PaymentList
(
$params
=
[])
{
$where
=
empty
(
$params
[
'where'
])
?
[]
:
$params
[
'where'
];
if
(
isset
(
$params
[
'is_enable'
]))
{
$where
[
'is_enable'
]
=
intval
(
$params
[
'is_enable'
]);
}
if
(
isset
(
$params
[
'is_open_user'
]))
{
$where
[
'is_open_user'
]
=
intval
(
$params
[
'is_open_user'
]);
}
$data
=
Db
::
name
(
'Payment'
)
->
where
(
$where
)
->
field
(
'id,logo,name,sort,payment,config,apply_terminal,apply_terminal,element,is_enable,is_open_user'
)
->
order
(
'sort asc'
)
->
select
();
if
(
!
empty
(
$data
)
&&
is_array
(
$data
))
{
$images_host
=
config
(
'IMAGE_HOST'
);
foreach
(
$data
as
&
$v
)
{
$v
[
'logo_old'
]
=
$v
[
'logo'
];
$v
[
'logo'
]
=
empty
(
$v
[
'logo'
])
?
null
:
$images_host
.
$v
[
'logo'
];
$v
[
'element'
]
=
empty
(
$v
[
'element'
])
?
''
:
json_decode
(
$v
[
'element'
],
true
);
$v
[
'config'
]
=
empty
(
$v
[
'config'
])
?
''
:
json_decode
(
$v
[
'config'
],
true
);
$v
[
'apply_terminal'
]
=
empty
(
$v
[
'apply_terminal'
])
?
''
:
json_decode
(
$v
[
'apply_terminal'
],
true
);
}
}
return
$data
;
}
/**
* 获取支付方式列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-19
* @desc 下订单根据终端自动筛选支付方式
* @param [array] $params [输入参数]
*/
public
static
function
BuyPaymentList
(
$params
=
[])
{
$data
=
self
::
PaymentList
(
$params
);
$result
=
[];
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
$v
)
{
// 根据终端类型筛选
if
(
in_array
(
APPLICATION_CLIENT_TYPE
,
$v
[
'apply_terminal'
]))
{
$result
[]
=
$v
;
}
}
}
return
$result
;
}
/**
* [ContentStaticReplace 编辑器中内容的静态资源替换]
* @author Devil
...
...
application/service/SlideService.php
浏览文件 @
5f926928
...
...
@@ -2,6 +2,7 @@
namespace
app\service
;
use
think\Db
;
use
app\service\ResourcesService
;
/**
* 轮播图服务层
...
...
extend/payment/Alipay.php
浏览文件 @
5f926928
...
...
@@ -43,9 +43,10 @@ class Alipay
'name'
=>
'支付宝'
,
// 插件名称
'version'
=>
'0.0.1'
,
// 插件版本
'apply_version'
=>
'1.0~1.3'
,
// 适用系统版本描述
'desc'
=>
'即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 <a href="http://www.alipay.com/" target="_blank">立即申请</a>'
,
// 插件描述(支持html)
'apply_terminal'
=>
[
'pc'
,
'h5'
],
// 适用终端 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu']
'desc'
=>
'适用PC+H5,即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 <a href="http://www.alipay.com/" target="_blank">立即申请</a>'
,
// 插件描述(支持html)
'author'
=>
'Devil'
,
// 开发者
'author_url'
=>
'http://
gong.gg
/'
,
// 开发者主页
'author_url'
=>
'http://
shopxo.net
/'
,
// 开发者主页
];
// 配置信息
...
...
@@ -80,91 +81,91 @@ class Alipay
'is_required'
=>
1
,
'message'
=>
'请填写交易安全校验码 key'
,
],
[
'element'
=>
'input'
,
// 表单标签
'type'
=>
'text'
,
// input类型
'default'
=>
''
,
// 默认值
'name'
=>
'testinput'
,
// name名称
'placeholder'
=>
'测试输入框不需要验证'
,
// input默认显示文字
'title'
=>
'测试输入框不需要验证'
,
// 展示title名称
'is_required'
=>
0
,
// 是否需要强制填写/选择
'message'
=>
'请填写测试输入框不需要验证'
,
// 错误提示(is_required=1方可有效)
],
[
'element'
=>
'textarea'
,
'default'
=>
''
,
'name'
=>
'rsa_private'
,
'placeholder'
=>
'RSA证书'
,
'title'
=>
'RSA证书'
,
'is_required'
=>
0
,
'minlength'
=>
10
,
// 最小输入字符(is_required=1方可有效)
//'maxlength' => 300, // 最大输入字符, 填则不限(is_required=1方可有效)
'rows'
=>
6
,
],
[
'element'
=>
'input'
,
'type'
=>
'checkbox'
,
'element_data'
=>
[
[
'value'
=>
1
,
'name'
=>
'选项1'
],
[
'value'
=>
2
,
'name'
=>
'选项2'
,
'is_checked'
=>
1
],
[
'value'
=>
3
,
'name'
=>
'选项3'
],
[
'value'
=>
4
,
'name'
=>
'选项4'
]
],
'is_block'
=>
1
,
// 是否每个选项行内展示(默认0)
'minchecked'
=>
2
,
// 最小选项(默认以is_required=1至少一项,则0)
'maxchecked'
=>
3
,
// 最大选项
'name'
=>
'checkbox'
,
'title'
=>
'多选项测试'
,
// 展示title名称
'is_required'
=>
1
,
// 是否需要强制填写/选择
'message'
=>
'请选择多选项测试选择 至少选择2项最多选择3项'
,
// 错误提示信息
],
[
'element'
=>
'input'
,
'type'
=>
'radio'
,
'element_data'
=>
[
[
'value'
=>
1
,
'name'
=>
'选项1'
,
'is_checked'
=>
1
],
[
'value'
=>
2
,
'name'
=>
'选项2'
],
[
'value'
=>
3
,
'name'
=>
'选项3'
],
[
'value'
=>
4
,
'name'
=>
'选项4'
]
],
'is_block'
=>
1
,
// 是否每个选项行内展示(默认0)
'name'
=>
'radio'
,
'title'
=>
'单选项测试'
,
// 展示title名称
'is_required'
=>
1
,
// 是否需要强制填写/选择
'message'
=>
'请选择单选项测试'
,
],
[
'element'
=>
'select'
,
'placeholder'
=>
'选一个撒1'
,
'is_multiple'
=>
0
,
// 是否开启多选(默认0 关闭)
'element_data'
=>
[
[
'value'
=>
1
,
'name'
=>
'选项1'
],
[
'value'
=>
2
,
'name'
=>
'选项2'
],
[
'value'
=>
3
,
'name'
=>
'选项3'
],
[
'value'
=>
4
,
'name'
=>
'选项4'
]
],
'name'
=>
'select1'
,
'title'
=>
'下拉单选测试'
,
// 展示title名称
'is_required'
=>
1
,
// 是否需要强制填写/选择
'message'
=>
'请选择下拉单选测试'
,
],
[
'element'
=>
'select'
,
'placeholder'
=>
'选一个撒2'
,
'is_multiple'
=>
1
,
// 是否开启多选(默认0 关闭)
'element_data'
=>
[
[
'value'
=>
1
,
'name'
=>
'选项1'
],
[
'value'
=>
2
,
'name'
=>
'选项2'
],
[
'value'
=>
3
,
'name'
=>
'选项3'
],
[
'value'
=>
4
,
'name'
=>
'选项4'
]
],
'minchecked'
=>
2
,
// 最小选项(默认以is_required=1至少一项,则0)
'maxchecked'
=>
3
,
// 最大选项
'name'
=>
'select2'
,
'title'
=>
'下拉多选测试'
,
// 展示title名称
'is_required'
=>
1
,
// 是否需要强制填写/选择
'message'
=>
'请选择下拉多选测试 至少选择2项最多选择3项'
,
],
//
[
//
'element' => 'input', // 表单标签
//
'type' => 'text', // input类型
//
'default' => '', // 默认值
//
'name' => 'testinput', // name名称
//
'placeholder' => '测试输入框不需要验证', // input默认显示文字
//
'title' => '测试输入框不需要验证', // 展示title名称
//
'is_required' => 0, // 是否需要强制填写/选择
//
'message' => '请填写测试输入框不需要验证', // 错误提示(is_required=1方可有效)
//
],
//
[
//
'element' => 'textarea',
//
'default' => '',
//
'name' => 'rsa_private',
//
'placeholder' => 'RSA证书',
//
'title' => 'RSA证书',
//
'is_required' => 0,
//
'minlength' => 10, // 最小输入字符(is_required=1方可有效)
//
//'maxlength' => 300, // 最大输入字符, 填则不限(is_required=1方可有效)
//
'rows' => 6,
//
],
//
[
//
'element' => 'input',
//
'type' => 'checkbox',
//
'element_data' => [
//
['value'=>1, 'name'=>'选项1'],
// ['value'=>2, 'name'=>'选项2',
],
//
['value'=>3, 'name'=>'选项3'],
//
['value'=>4, 'name'=>'选项4']
//
],
//
'is_block' => 1, // 是否每个选项行内展示(默认0)
//
'minchecked' => 2, // 最小选项(默认以is_required=1至少一项,则0)
//
'maxchecked' => 3, // 最大选项
//
'name' => 'checkbox',
//
'title' => '多选项测试', // 展示title名称
//
'is_required' => 1, // 是否需要强制填写/选择
//
'message' => '请选择多选项测试选择 至少选择2项最多选择3项', // 错误提示信息
//
],
//
[
//
'element' => 'input',
//
'type' => 'radio',
//
'element_data' => [
// ['value'=>1, 'name'=>'选项1',
],
//
['value'=>2, 'name'=>'选项2'],
//
['value'=>3, 'name'=>'选项3'],
//
['value'=>4, 'name'=>'选项4']
//
],
//
'is_block' => 1, // 是否每个选项行内展示(默认0)
//
'name' => 'radio',
//
'title' => '单选项测试', // 展示title名称
//
'is_required' => 1, // 是否需要强制填写/选择
//
'message' => '请选择单选项测试',
//
],
//
[
//
'element' => 'select',
//
'placeholder' => '选一个撒1',
//
'is_multiple' => 0, // 是否开启多选(默认0 关闭)
//
'element_data' => [
//
['value'=>1, 'name'=>'选项1'],
//
['value'=>2, 'name'=>'选项2'],
//
['value'=>3, 'name'=>'选项3'],
//
['value'=>4, 'name'=>'选项4']
//
],
//
'name' => 'select1',
//
'title' => '下拉单选测试', // 展示title名称
//
'is_required' => 1, // 是否需要强制填写/选择
//
'message' => '请选择下拉单选测试',
//
],
//
[
//
'element' => 'select',
//
'placeholder' => '选一个撒2',
//
'is_multiple' => 1, // 是否开启多选(默认0 关闭)
//
'element_data' => [
//
['value'=>1, 'name'=>'选项1'],
//
['value'=>2, 'name'=>'选项2'],
//
['value'=>3, 'name'=>'选项3'],
//
['value'=>4, 'name'=>'选项4']
//
],
//
'minchecked' => 2, // 最小选项(默认以is_required=1至少一项,则0)
//
'maxchecked' => 3, // 最大选项
//
'name' => 'select2',
//
'title' => '下拉多选测试', // 展示title名称
//
'is_required' => 1, // 是否需要强制填写/选择
//
'message' => '请选择下拉多选测试 至少选择2项最多选择3项',
//
],
];
return
[
...
...
extend/payment/AlipayMini.php
浏览文件 @
5f926928
...
...
@@ -43,7 +43,8 @@ class AlipayMini
'name'
=>
'支付宝'
,
// 插件名称
'version'
=>
'0.0.1'
,
// 插件版本
'apply_version'
=>
'不限'
,
// 适用系统版本描述
'desc'
=>
'即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 <a href="http://www.alipay.com/" target="_blank">立即申请</a>'
,
// 插件描述(支持html)
'apply_terminal'
=>
[
'alipay'
],
// 适用终端 ['pc', 'h5', 'app', 'alipay', 'wechat', 'baidu']
'desc'
=>
'适用支付宝小程序,即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 <a href="http://www.alipay.com/" target="_blank">立即申请</a>'
,
// 插件描述(支持html)
'author'
=>
'Devil'
,
// 开发者
'author_url'
=>
'http://shopxo.net/'
,
// 开发者主页
];
...
...
@@ -60,36 +61,6 @@ class AlipayMini
'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'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录