细节优化
parent
7bd32c03d0
commit
1dc1d4b72d
|
|
@ -119,5 +119,26 @@ class Theme extends Common
|
|||
// 开始处理
|
||||
return ThemeService::ThemeUpload(input());
|
||||
}
|
||||
|
||||
/**
|
||||
* 主题打包
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-03-22
|
||||
* @desc description
|
||||
*/
|
||||
public function Download()
|
||||
{
|
||||
// 开始处理
|
||||
$ret = ThemeService::ThemeDownload(input());
|
||||
if(isset($ret['code']) && $ret['code'] != 0)
|
||||
{
|
||||
$this->assign('msg', $ret['msg']);
|
||||
return $this->fetch('public/tips_error');
|
||||
} else {
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -121,13 +121,20 @@
|
|||
<!-- win form start -->
|
||||
<form class="am-form form-validation" action="{{:MyUrl('admin/payment/upload')}}" method="POST" request-type="ajax-reload" enctype="multipart/form-data">
|
||||
<div class="am-alert am-radius am-alert-tips m-t-0" data-am-alert>
|
||||
<p class="m-t-10">1 类名必须于文件名一致(去除 .php ),如 Alipay.php 则取 Alipay <br />2 类必须定义三个方法<br /> 2.1 Config 配置方法<br /> 2.2 Pay 支付方法<br /> 2.3 Respond 回调方法</p>
|
||||
<p class="cr-red">PS:以上条件不满足则无法查看插件</p>
|
||||
<p class="m-t-10">
|
||||
1 类名必须于文件名一致(去除 .php ),如 Alipay.php 则取 Alipay<br />
|
||||
2 类必须定义三个方法<br />
|
||||
2.1 Config 配置方法<br />
|
||||
2.2 Pay 支付方法<br />
|
||||
2.3 Respond 回调方法<br />
|
||||
2.4 Refund 退款方法(可选)
|
||||
</p>
|
||||
<p class="cr-red">PS:以上条件不满足则无法查看插件,将插件放入.zip压缩包中、支持一个压缩中包含多个支付插件</p>
|
||||
</div>
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-radius"><i class="am-icon-cloud-upload"></i> 选择文件</button>
|
||||
<input type="file" name="file" class="file-event" data-tips-tag="#form-payment-tips" multiple data-validation-message="请选择需要上传的文件" accept=".php" required />
|
||||
<div id="form-payment-tips"></div>
|
||||
<input type="file" name="file" class="file-event" data-tips-tag="#form-payment-tips" data-validation-message="请选择需要上传的文件" accept=".zip" multiple required />
|
||||
<div id="form-payment-tips" class="am-margin-top-xs"></div>
|
||||
</div>
|
||||
<div class="am-form-group am-form-group-refreshing">
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">确认</button>
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
<!-- nav end -->
|
||||
|
||||
<!-- form start -->
|
||||
<form class="am-form form-validation view-save m-t-10" action="{{:MyUrl('admin/pluginsadmin/upload')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/pluginsadmin/index')}}" enctype="multipart/form-data">
|
||||
<form class="am-form form-validation view-save" action="{{:MyUrl('admin/pluginsadmin/upload')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/pluginsadmin/index')}}" enctype="multipart/form-data">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-radius">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件</button>
|
||||
<input type="file" name="file" class="file-event" data-tips-tag="#form-file-tips" multiple data-validation-message="请选择需要上传的文件" required />
|
||||
<input type="file" name="file" class="file-event" data-tips-tag="#form-file-tips" data-validation-message="请选择需要上传的文件" accept=".zip" multiple required />
|
||||
<span class="tips fs-12">上传一个zip压缩格式的应用安装包</span>
|
||||
<div id="form-file-tips"></div>
|
||||
<div id="form-file-tips" class="am-margin-top-xs"></div>
|
||||
</div>
|
||||
<div class="am-form-group am-form-group-refreshing">
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm" data-am-loading="{loadingText:'上传中...'}">上传</button>
|
||||
|
|
|
|||
|
|
@ -19,9 +19,14 @@
|
|||
<div class="am-gallery-item-bottom">
|
||||
<h3 class="am-gallery-title">
|
||||
{{$v.name}}
|
||||
{{if $v.is_delete eq 1}}
|
||||
<a href="javascript:;" class="am-icon-trash-o fr submit-delete" data-url="{{:MyUrl('admin/theme/delete')}}" data-id="{{$v.theme}}"></a>
|
||||
{{/if}}
|
||||
<div class="am-fr am-text-right">
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<a href="{{:MyUrl('admin/theme/download', array('id'=>$v['theme']))}}" class="am-icon-trash-o am-icon-download" title="打包" data-url="{{:MyUrl('admin/theme/download')}}" data-id="{{$v.theme}}"></a>
|
||||
{{/if}}
|
||||
{{if $v.is_delete eq 1}}
|
||||
<a href="javascript:;" class="am-icon-trash-o submit-delete am-margin-left-sm" title="删除" data-url="{{:MyUrl('admin/theme/delete')}}" data-id="{{$v.theme}}"></a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</h3>
|
||||
<div class="am-gallery-desc">作者:
|
||||
{{if empty($v['home'])}}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
<!-- nav end -->
|
||||
|
||||
<!-- form start -->
|
||||
<form class="am-form form-validation view-save m-t-10" action="{{:MyUrl('admin/theme/upload')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/theme/index')}}" enctype="multipart/form-data">
|
||||
<form class="am-form form-validation view-save" action="{{:MyUrl('admin/theme/upload')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/theme/index')}}" enctype="multipart/form-data">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-radius">
|
||||
<i class="am-icon-cloud-upload"></i> 选择文件</button>
|
||||
<input type="file" name="theme" class="file-event" data-tips-tag="#form-theme-tips" multiple data-validation-message="请选择需要上传的文件" required />
|
||||
<input type="file" name="theme" class="file-event" data-tips-tag="#form-theme-tips" data-validation-message="请选择需要上传的文件" accept=".zip" multiple required />
|
||||
<span class="tips fs-12">上传一个zip压缩格式的主题安装包</span>
|
||||
<div id="form-theme-tips"></div>
|
||||
<div id="form-theme-tips" class="am-margin-top-xs"></div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm" data-am-loading="{loadingText:'上传中...'}">上传</button>
|
||||
|
|
|
|||
|
|
@ -424,37 +424,78 @@ class PaymentService
|
|||
}
|
||||
|
||||
// 文件格式化校验
|
||||
$type = array('text/php');
|
||||
$type = array('application/zip', 'application/octet-stream', 'application/x-zip-compressed');
|
||||
if(!in_array($_FILES['file']['type'], $type))
|
||||
{
|
||||
return DataReturn('文件格式有误,必须php文件', -2);
|
||||
return DataReturn('文件格式有误,请上传zip压缩包', -2);
|
||||
}
|
||||
|
||||
// 是否已有存在插件
|
||||
if(file_exists(self::$payment_dir.$_FILES['file']['name']))
|
||||
// 开始解压文件
|
||||
$resource = zip_open($_FILES['file']['tmp_name']);
|
||||
if(!is_resource($resource))
|
||||
{
|
||||
return DataReturn('已存在相同插件', -3);
|
||||
return DataReturn('压缩包打开失败['.$resource.']', -10);
|
||||
}
|
||||
|
||||
// 文件名称过滤
|
||||
$name = substr($_FILES['file']['name'], 0, strlen($_FILES['file']['name'])-4);
|
||||
$payment = str_replace(array('.', '/', '\\', ':'), '', $name);
|
||||
|
||||
// 存储文件
|
||||
$file = self::$payment_dir.$payment.'.php';
|
||||
if(!move_uploaded_file($_FILES['file']['tmp_name'], $file))
|
||||
$success = 0;
|
||||
$error = 0;
|
||||
while(($temp_resource = zip_read($resource)) !== false)
|
||||
{
|
||||
return DataReturn('上传失败', -100);
|
||||
if(zip_entry_open($resource, $temp_resource))
|
||||
{
|
||||
// 当前压缩包中项目名称
|
||||
$file = zip_entry_name($temp_resource);
|
||||
|
||||
// 排除临时文件和临时目录
|
||||
if(strpos($file, '/.') === false && strpos($file, '__') === false)
|
||||
{
|
||||
// 忽略非php文件
|
||||
if(substr($file, -4) != '.php')
|
||||
{
|
||||
$error++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 文件名称
|
||||
$payment = str_replace(array('.', '/', '\\', ':'), '', substr($file, 0, -4));
|
||||
|
||||
// 是否已有存在插件
|
||||
if(file_exists(self::$payment_dir.$payment))
|
||||
{
|
||||
$error++;
|
||||
continue;
|
||||
} else {
|
||||
$file = self::$payment_dir.$payment.'.php';
|
||||
}
|
||||
|
||||
// 如果不是目录则写入文件
|
||||
if(!is_dir($file))
|
||||
{
|
||||
// 读取这个文件
|
||||
$file_size = zip_entry_filesize($temp_resource);
|
||||
$file_content = zip_entry_read($temp_resource, $file_size);
|
||||
if(@file_put_contents($file, $file_content) !== false)
|
||||
{
|
||||
// 文件校验
|
||||
$config = self::GetPaymentConfig($payment);
|
||||
if($config === false)
|
||||
{
|
||||
$error++;
|
||||
@unlink($file);
|
||||
} else {
|
||||
$success++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 文件校验
|
||||
$config = self::GetPaymentConfig($payment);
|
||||
if($config === false)
|
||||
if($success > 0)
|
||||
{
|
||||
@unlink($file);
|
||||
return DataReturn('插件编写有误,请参考文档编写', -10);
|
||||
return DataReturn('上传成功[成功'.$success.'个, 失败'.$error.'个]', 0);
|
||||
}
|
||||
return DataReturn('上传成功');
|
||||
return DataReturn('上传失败'.$error.'个', -10);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1065,7 +1065,7 @@ php;
|
|||
* @version 1.0.0
|
||||
* @date 2019-03-22
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function PluginsDownload($params = [])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ class ThemeService
|
|||
{
|
||||
return DataReturn('模板id有误', -1);
|
||||
}
|
||||
|
||||
// 防止路径回溯
|
||||
$id = htmlentities(str_replace(array('.', '/', '\\', ':'), '', strip_tags($params['id'])));
|
||||
if(empty($id))
|
||||
|
|
@ -221,5 +222,86 @@ class ThemeService
|
|||
}
|
||||
return DataReturn('删除失败或资源不存在', -100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主题打包
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-03-22
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function ThemeDownload($params = [])
|
||||
{
|
||||
// 请求参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'id',
|
||||
'error_msg' => '模板id有误',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 是否开启开发者模式
|
||||
if(config('shopxo.is_develop') !== true)
|
||||
{
|
||||
return DataReturn('请先开启开发者模式', -1);
|
||||
}
|
||||
|
||||
// 防止路径回溯
|
||||
$theme = htmlentities(str_replace(array('.', '/', '\\', ':'), '', strip_tags($params['id'])));
|
||||
if(empty($theme))
|
||||
{
|
||||
return DataReturn('主题名称有误', -1);
|
||||
}
|
||||
|
||||
// 目录不存在则创建
|
||||
$new_dir = ROOT.'runtime'.DS.'data'.DS.'theme_package'.DS.$theme;
|
||||
\base\FileUtil::CreateDir($new_dir);
|
||||
|
||||
// 复制包目录 - 视图
|
||||
$old_dir = ROOT.self::$html_path.$theme;
|
||||
if(is_dir($old_dir))
|
||||
{
|
||||
if(\base\FileUtil::CopyDir($old_dir, $new_dir.DS.'_html_') != true)
|
||||
{
|
||||
return DataReturn('项目包复制失败[视图]', -2);
|
||||
}
|
||||
}
|
||||
|
||||
// 复制包目录 - 静态文件
|
||||
$old_dir = ROOT.self::$static_path.$theme;
|
||||
if(is_dir($old_dir))
|
||||
{
|
||||
if(\base\FileUtil::CopyDir($old_dir, $new_dir.DS.'_static_') != true)
|
||||
{
|
||||
return DataReturn('项目包复制失败[静态文件]', -2);
|
||||
}
|
||||
}
|
||||
|
||||
// 生成压缩包
|
||||
$zip = new \base\ZipFolder();
|
||||
if(!$zip->zip($new_dir.'.zip', $new_dir))
|
||||
{
|
||||
return DataReturn('压缩包生成失败', -100);
|
||||
}
|
||||
|
||||
// 生成成功删除目录
|
||||
\base\FileUtil::UnlinkDir($new_dir);
|
||||
|
||||
// 开始下载
|
||||
if(\base\FileUtil::DownloadFile($new_dir.'.zip', $theme.'.zip'))
|
||||
{
|
||||
@unlink($new_dir.'.zip');
|
||||
} else {
|
||||
return DataReturn('下载失败', -100);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -50,7 +50,7 @@ class Alipay
|
|||
// 基础信息
|
||||
$base = [
|
||||
'name' => '支付宝', // 插件名称
|
||||
'version' => '0.0.2', // 插件版本
|
||||
'version' => '0.0.1', // 插件版本
|
||||
'apply_version' => '不限', // 适用系统版本描述
|
||||
'apply_terminal'=> ['pc','h5'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'weixin', 'baidu']
|
||||
'desc' => '2.0版本,适用PC+H5,即时到帐支付方式,买家的交易资金直接打入卖家支付宝账户,快速回笼交易资金。 <a href="http://www.alipay.com/" target="_blank">立即申请</a>', // 插件描述(支持html)
|
||||
|
|
|
|||
|
|
@ -1,249 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Devil
|
||||
// +----------------------------------------------------------------------
|
||||
namespace payment;
|
||||
|
||||
/**
|
||||
* 码支付-支付宝
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-19
|
||||
* @desc description
|
||||
*/
|
||||
class CodePayAlipay
|
||||
{
|
||||
// 插件配置参数
|
||||
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' => '不限', // 适用系统版本描述
|
||||
'apply_terminal'=> ['pc','h5'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'weixin', 'baidu']
|
||||
'desc' => '适用PC+H5,即时到帐支付方式,免费帮助个人实现支付后立即通知。 <a href="https://codepay.fateqq.com/" target="_blank">立即申请</a>', // 插件描述(支持html)
|
||||
'author' => 'Devil', // 开发者
|
||||
'author_url' => 'http://shopxo.net/', // 开发者主页
|
||||
];
|
||||
|
||||
// 配置信息
|
||||
$element = [
|
||||
[
|
||||
'element' => 'input',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'id',
|
||||
'placeholder' => '码支付ID',
|
||||
'title' => '码支付ID',
|
||||
'is_required' => 0,
|
||||
'message' => '请填写码支付ID',
|
||||
],
|
||||
[
|
||||
'element' => 'input',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'key',
|
||||
'placeholder' => '通信密钥',
|
||||
'title' => '通信密钥',
|
||||
'is_required' => 0,
|
||||
'message' => '请填写通信密钥',
|
||||
],
|
||||
];
|
||||
|
||||
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 = [])
|
||||
{
|
||||
// 参数
|
||||
if(empty($params))
|
||||
{
|
||||
return DataReturn('参数不能为空', -1);
|
||||
}
|
||||
|
||||
// 配置信息
|
||||
if(empty($this->config))
|
||||
{
|
||||
return DataReturn('支付缺少配置', -1);
|
||||
}
|
||||
|
||||
// 处理支付
|
||||
$parameter = array(
|
||||
'id' => $this->config['id'],
|
||||
'type' => 1,
|
||||
'notify_url' => $params['notify_url'],
|
||||
'return_url' => $params['call_back_url'],
|
||||
|
||||
/* 业务参数 */
|
||||
'pay_id' => $params['order_no'].GetNumberCode(6),
|
||||
'price' => $params['total_price'],
|
||||
'param' => $params['name']
|
||||
);
|
||||
|
||||
$param = $this->GetParamSign($parameter);
|
||||
$url = 'http://api2.fateqq.com:52888/creat_order/?'.$param['urls'].'&sign='.md5($param['sign'].$this->config['key']);
|
||||
return DataReturn('处理成功', 0, $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetParamSign 签名生成]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2018-09-28T00:28:07+0800
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
private function GetParamSign($params = [])
|
||||
{
|
||||
$sign = '';
|
||||
$urls = '';
|
||||
ksort($params);
|
||||
reset($params);
|
||||
|
||||
foreach($params AS $key => $val)
|
||||
{
|
||||
// 跳过这些不参数签名
|
||||
if($val == '' || $key == 'sign')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//后面追加&拼接URL
|
||||
if($sign != '')
|
||||
{
|
||||
$sign .= "&";
|
||||
$urls .= "&";
|
||||
}
|
||||
$sign .= "$key=$val"; //拼接为url参数形式
|
||||
$urls .= "$key=" . urlencode($val); //拼接为url参数形式并URL编码参数值
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'urls' => $urls,
|
||||
'sign' => $sign,
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付回调处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-19
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public function Respond($params = [])
|
||||
{
|
||||
if(empty($this->config))
|
||||
{
|
||||
return DataReturn('配置有误', -1);
|
||||
}
|
||||
if(empty($params['pay_no']))
|
||||
{
|
||||
return DataReturn('支付失败', -1);
|
||||
}
|
||||
|
||||
// 签名验证
|
||||
$param = $this->GetParamSign($params);
|
||||
if(md5($param['sign'].$this->config['key']) != $params['sign'])
|
||||
{
|
||||
return DataReturn('签名错误', -1);
|
||||
}
|
||||
|
||||
// 支付状态
|
||||
if(isset($params['status']))
|
||||
{
|
||||
switch($params['status'])
|
||||
{
|
||||
// 成功
|
||||
case 0 :
|
||||
$ret = DataReturn('支付成功', 0, $this->ReturnData($params));
|
||||
break;
|
||||
|
||||
// 失败
|
||||
case 1 :
|
||||
$ret = DataReturn('支付失败', -100);
|
||||
break;
|
||||
|
||||
// 参数有误
|
||||
case 2 :
|
||||
$ret = DataReturn('支付参数有误', -1001);
|
||||
break;
|
||||
|
||||
// 默认
|
||||
default :
|
||||
$ret = DataReturn('支付异常错误', -1002);
|
||||
}
|
||||
} else {
|
||||
$ret = DataReturn('支付异常错误', -1003);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* [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)
|
||||
{
|
||||
// 返回数据固定基础参数
|
||||
$data['trade_no'] = isset($data['pay_no']) ? $data['pay_no'] : ''; // 支付平台 - 订单号
|
||||
$data['buyer_user'] = isset($data['pay_id']) ? $data['pay_id'] : ''; // 支付平台 - 用户
|
||||
$data['out_trade_no'] = substr($data['pay_id'], 0, strlen($data['pay_id'])-6); // 本系统发起支付的 - 订单号
|
||||
$data['subject'] = isset($data['param']) ? $data['param'] : ''; // 本系统发起支付的 - 商品名称
|
||||
$data['pay_price'] = $data['money']; // 本系统发起支付的 - 总价
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,249 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Devil
|
||||
// +----------------------------------------------------------------------
|
||||
namespace payment;
|
||||
|
||||
/**
|
||||
* 码支付-QQ
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-19
|
||||
* @desc description
|
||||
*/
|
||||
class CodePayQQ
|
||||
{
|
||||
// 插件配置参数
|
||||
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' => '码支付-QQ', // 插件名称
|
||||
'version' => '0.0.1', // 插件版本
|
||||
'apply_version' => '不限', // 适用系统版本描述
|
||||
'apply_terminal'=> ['pc','h5'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'weixin', 'baidu']
|
||||
'desc' => '适用PC+H5,即时到帐支付方式,免费帮助个人实现支付后立即通知。 <a href="https://codepay.fateqq.com/" target="_blank">立即申请</a>', // 插件描述(支持html)
|
||||
'author' => 'Devil', // 开发者
|
||||
'author_url' => 'http://shopxo.net/', // 开发者主页
|
||||
];
|
||||
|
||||
// 配置信息
|
||||
$element = [
|
||||
[
|
||||
'element' => 'input',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'id',
|
||||
'placeholder' => '码支付ID',
|
||||
'title' => '码支付ID',
|
||||
'is_required' => 0,
|
||||
'message' => '请填写码支付ID',
|
||||
],
|
||||
[
|
||||
'element' => 'input',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'key',
|
||||
'placeholder' => '通信密钥',
|
||||
'title' => '通信密钥',
|
||||
'is_required' => 0,
|
||||
'message' => '请填写通信密钥',
|
||||
],
|
||||
];
|
||||
|
||||
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 = [])
|
||||
{
|
||||
// 参数
|
||||
if(empty($params))
|
||||
{
|
||||
return DataReturn('参数不能为空', -1);
|
||||
}
|
||||
|
||||
// 配置信息
|
||||
if(empty($this->config))
|
||||
{
|
||||
return DataReturn('支付缺少配置', -1);
|
||||
}
|
||||
|
||||
// 处理支付
|
||||
$parameter = array(
|
||||
'id' => $this->config['id'],
|
||||
'type' => 2,
|
||||
'notify_url' => $params['notify_url'],
|
||||
'return_url' => $params['call_back_url'],
|
||||
|
||||
/* 业务参数 */
|
||||
'pay_id' => $params['order_no'].GetNumberCode(6),
|
||||
'price' => $params['total_price'],
|
||||
'param' => $params['name']
|
||||
);
|
||||
|
||||
$param = $this->GetParamSign($parameter);
|
||||
$url = 'http://api2.fateqq.com:52888/creat_order/?'.$param['urls'].'&sign='.md5($param['sign'].$this->config['key']);
|
||||
return DataReturn('处理成功', 0, $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetParamSign 签名生成]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2018-09-28T00:28:07+0800
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
private function GetParamSign($params = [])
|
||||
{
|
||||
$sign = '';
|
||||
$urls = '';
|
||||
ksort($params);
|
||||
reset($params);
|
||||
|
||||
foreach($params AS $key => $val)
|
||||
{
|
||||
// 跳过这些不参数签名
|
||||
if($val == '' || $key == 'sign')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//后面追加&拼接URL
|
||||
if($sign != '')
|
||||
{
|
||||
$sign .= "&";
|
||||
$urls .= "&";
|
||||
}
|
||||
$sign .= "$key=$val"; //拼接为url参数形式
|
||||
$urls .= "$key=" . urlencode($val); //拼接为url参数形式并URL编码参数值
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'urls' => $urls,
|
||||
'sign' => $sign,
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付回调处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-19
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public function Respond($params = [])
|
||||
{
|
||||
if(empty($this->config))
|
||||
{
|
||||
return DataReturn('配置有误', -1);
|
||||
}
|
||||
if(empty($params['pay_no']))
|
||||
{
|
||||
return DataReturn('支付失败', -1);
|
||||
}
|
||||
|
||||
// 签名验证
|
||||
$param = $this->GetParamSign($params);
|
||||
if(md5($param['sign'].$this->config['key']) != $params['sign'])
|
||||
{
|
||||
return DataReturn('签名错误', -1);
|
||||
}
|
||||
|
||||
// 支付状态
|
||||
if(isset($params['status']))
|
||||
{
|
||||
switch($params['status'])
|
||||
{
|
||||
// 成功
|
||||
case 0 :
|
||||
$ret = DataReturn('支付成功', 0, $this->ReturnData($params));
|
||||
break;
|
||||
|
||||
// 失败
|
||||
case 1 :
|
||||
$ret = DataReturn('支付失败', -100);
|
||||
break;
|
||||
|
||||
// 参数有误
|
||||
case 2 :
|
||||
$ret = DataReturn('支付参数有误', -1001);
|
||||
break;
|
||||
|
||||
// 默认
|
||||
default :
|
||||
$ret = DataReturn('支付异常错误', -1002);
|
||||
}
|
||||
} else {
|
||||
$ret = DataReturn('支付异常错误', -1003);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* [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)
|
||||
{
|
||||
// 返回数据固定基础参数
|
||||
$data['trade_no'] = isset($data['pay_no']) ? $data['pay_no'] : ''; // 支付平台 - 订单号
|
||||
$data['buyer_user'] = isset($data['pay_id']) ? $data['pay_id'] : ''; // 支付平台 - 用户
|
||||
$data['out_trade_no'] = substr($data['pay_id'], 0, strlen($data['pay_id'])-6); // 本系统发起支付的 - 订单号
|
||||
$data['subject'] = isset($data['param']) ? $data['param'] : ''; // 本系统发起支付的 - 商品名称
|
||||
$data['pay_price'] = $data['money']; // 本系统发起支付的 - 总价
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,249 +0,0 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Devil
|
||||
// +----------------------------------------------------------------------
|
||||
namespace payment;
|
||||
|
||||
/**
|
||||
* 码支付-微信
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-19
|
||||
* @desc description
|
||||
*/
|
||||
class CodePayWeixin
|
||||
{
|
||||
// 插件配置参数
|
||||
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' => '不限', // 适用系统版本描述
|
||||
'apply_terminal'=> ['pc','h5'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'weixin', 'baidu']
|
||||
'desc' => '适用PC+H5,即时到帐支付方式,免费帮助个人实现支付后立即通知。 <a href="https://codepay.fateqq.com/" target="_blank">立即申请</a>', // 插件描述(支持html)
|
||||
'author' => 'Devil', // 开发者
|
||||
'author_url' => 'http://shopxo.net/', // 开发者主页
|
||||
];
|
||||
|
||||
// 配置信息
|
||||
$element = [
|
||||
[
|
||||
'element' => 'input',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'id',
|
||||
'placeholder' => '码支付ID',
|
||||
'title' => '码支付ID',
|
||||
'is_required' => 0,
|
||||
'message' => '请填写码支付ID',
|
||||
],
|
||||
[
|
||||
'element' => 'input',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'key',
|
||||
'placeholder' => '通信密钥',
|
||||
'title' => '通信密钥',
|
||||
'is_required' => 0,
|
||||
'message' => '请填写通信密钥',
|
||||
],
|
||||
];
|
||||
|
||||
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 = [])
|
||||
{
|
||||
// 参数
|
||||
if(empty($params))
|
||||
{
|
||||
return DataReturn('参数不能为空', -1);
|
||||
}
|
||||
|
||||
// 配置信息
|
||||
if(empty($this->config))
|
||||
{
|
||||
return DataReturn('支付缺少配置', -1);
|
||||
}
|
||||
|
||||
// 处理支付
|
||||
$parameter = array(
|
||||
'id' => $this->config['id'],
|
||||
'type' => 3,
|
||||
'notify_url' => $params['notify_url'],
|
||||
'return_url' => $params['call_back_url'],
|
||||
|
||||
/* 业务参数 */
|
||||
'pay_id' => $params['order_no'].GetNumberCode(6),
|
||||
'price' => $params['total_price'],
|
||||
'param' => $params['name']
|
||||
);
|
||||
|
||||
$param = $this->GetParamSign($parameter);
|
||||
$url = 'http://api2.fateqq.com:52888/creat_order/?'.$param['urls'].'&sign='.md5($param['sign'].$this->config['key']);
|
||||
return DataReturn('处理成功', 0, $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetParamSign 签名生成]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2018-09-28T00:28:07+0800
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
private function GetParamSign($params = [])
|
||||
{
|
||||
$sign = '';
|
||||
$urls = '';
|
||||
ksort($params);
|
||||
reset($params);
|
||||
|
||||
foreach($params AS $key => $val)
|
||||
{
|
||||
// 跳过这些不参数签名
|
||||
if($val == '' || $key == 'sign')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//后面追加&拼接URL
|
||||
if($sign != '')
|
||||
{
|
||||
$sign .= "&";
|
||||
$urls .= "&";
|
||||
}
|
||||
$sign .= "$key=$val"; //拼接为url参数形式
|
||||
$urls .= "$key=" . urlencode($val); //拼接为url参数形式并URL编码参数值
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'urls' => $urls,
|
||||
'sign' => $sign,
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付回调处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-19
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public function Respond($params = [])
|
||||
{
|
||||
if(empty($this->config))
|
||||
{
|
||||
return DataReturn('配置有误', -1);
|
||||
}
|
||||
if(empty($params['pay_no']))
|
||||
{
|
||||
return DataReturn('支付失败', -1);
|
||||
}
|
||||
|
||||
// 签名验证
|
||||
$param = $this->GetParamSign($params);
|
||||
if(md5($param['sign'].$this->config['key']) != $params['sign'])
|
||||
{
|
||||
return DataReturn('签名错误', -1);
|
||||
}
|
||||
|
||||
// 支付状态
|
||||
if(isset($params['status']))
|
||||
{
|
||||
switch($params['status'])
|
||||
{
|
||||
// 成功
|
||||
case 0 :
|
||||
$ret = DataReturn('支付成功', 0, $this->ReturnData($params));
|
||||
break;
|
||||
|
||||
// 失败
|
||||
case 1 :
|
||||
$ret = DataReturn('支付失败', -100);
|
||||
break;
|
||||
|
||||
// 参数有误
|
||||
case 2 :
|
||||
$ret = DataReturn('支付参数有误', -1001);
|
||||
break;
|
||||
|
||||
// 默认
|
||||
default :
|
||||
$ret = DataReturn('支付异常错误', -1002);
|
||||
}
|
||||
} else {
|
||||
$ret = DataReturn('支付异常错误', -1003);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* [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)
|
||||
{
|
||||
// 返回数据固定基础参数
|
||||
$data['trade_no'] = isset($data['pay_no']) ? $data['pay_no'] : ''; // 支付平台 - 订单号
|
||||
$data['buyer_user'] = isset($data['pay_id']) ? $data['pay_id'] : ''; // 支付平台 - 用户
|
||||
$data['out_trade_no'] = substr($data['pay_id'], 0, strlen($data['pay_id'])-6); // 本系统发起支付的 - 订单号
|
||||
$data['subject'] = isset($data['param']) ? $data['param'] : ''; // 本系统发起支付的 - 商品名称
|
||||
$data['pay_price'] = $data['money']; // 本系统发起支付的 - 总价
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -53,7 +53,7 @@ class Weixin
|
|||
'version' => '0.0.1', // 插件版本
|
||||
'apply_version' => '不限', // 适用系统版本描述
|
||||
'apply_terminal'=> ['pc', 'h5', 'weixin'], // 适用终端 默认全部 ['pc', 'h5', 'app', 'alipay', 'weixin', 'baidu']
|
||||
'desc' => '适用微信web/h5(非微信环境)/小程序,即时到帐支付方式,买家的交易资金直接打入卖家账户,快速回笼交易资金。 <a href="https://pay.weixin.qq.com/" target="_blank">立即申请</a>', // 插件描述(支持html)
|
||||
'desc' => '适用微信公众号/PC/H5/小程序,即时到帐支付方式,买家的交易资金直接打入卖家账户,快速回笼交易资金。 <a href="https://pay.weixin.qq.com/" target="_blank">立即申请</a>', // 插件描述(支持html)
|
||||
'author' => 'Devil', // 开发者
|
||||
'author_url' => 'http://shopxo.net/', // 开发者主页
|
||||
];
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ function FromInit(form_name)
|
|||
{
|
||||
// 错误信息
|
||||
var $field = $(validity.field);
|
||||
var msg = $field.attr('data-validationMessage') || this.getValidationMessage(validity);
|
||||
var msg = $field.data('validationMessage') || this.getValidationMessage(validity);
|
||||
Prompt(msg);
|
||||
},
|
||||
|
||||
|
|
@ -277,7 +277,8 @@ function FromInit(form_name)
|
|||
editor.focus();
|
||||
|
||||
// 错误信息
|
||||
var msg = $editor_tag.attr('data-validationMessage') || $editor_tag.getValidationMessage(validity);
|
||||
var msg = $editor_tag.data('validationMessage') || $editor_tag.getValidationMessage(validity);
|
||||
console.log(msg);
|
||||
Prompt(msg);
|
||||
}
|
||||
}
|
||||
|
|
@ -1480,7 +1481,7 @@ $(function()
|
|||
}
|
||||
|
||||
// 填充数据
|
||||
var data = FunSaveWinAdditional($(this).attr('data-json'), 'edit');
|
||||
var data = FunSaveWinAdditional($(this).data('json'), 'edit');
|
||||
|
||||
// 开始填充数据
|
||||
FormDataFill(data, '#'+tag);
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ fieldset legend{margin-left:15px;padding-left:3px;padding-right:3px;color:#333;}
|
|||
.tb-detail-price dd {display: inline-block;}
|
||||
.goods-favor-count { color: #999; }
|
||||
.iteminfo_parameter a:hover{text-decoration: none;color:initial ;}
|
||||
.tm-indcon .tm-label,.tb-detail-price dt{ white-space:nowrap; color:#888;}
|
||||
.tm-indcon .tm-label, .tb-detail-price dt, .specpara-title { white-space:nowrap; color:#666; font-weight: 400; }
|
||||
.tb-detail-price{ background: #fcf1e3 url(../images/goods-meta-bg.png); background-size: cover; -moz-background-size: cover; background-repeat: no-repeat; height:75px;padding:10px; }
|
||||
.tb-detail-price .items {display: block;margin-left:0 !important;}
|
||||
.tb-detail-price .items dt { float:left; text-align: left;}
|
||||
|
|
|
|||
Loading…
Reference in New Issue