小程序微信后台和代理后台使用同一个域名
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
'orderid' : randomChar(6),
|
||||
'fee' : 1,
|
||||
'title' : 'test',
|
||||
'notice_url' : 'https://api.tscce.cn/1.php',
|
||||
'notice_url' : window.location.origin + '/1.php',
|
||||
'paytype' : paytype,
|
||||
'version' : 1,
|
||||
'sign' : '',
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
require_once dirname(dirname(dirname(__DIR__))) . '/env_config.php';
|
||||
|
||||
define('USEDCHARSET', 'utf-8');
|
||||
$_api2_base = env('SDK_API2_URL');
|
||||
|
||||
/// 这里定义公共变量
|
||||
//$app_id = '14936872341446'; /// appid
|
||||
@@ -254,7 +256,7 @@ function SendPost($url, $data)
|
||||
);
|
||||
|
||||
$data['sign'] = SignParameter($data, $sign_key);
|
||||
$result = new ResultObject(rawurldecode(SendPost('https://api2.tscce.cn/api/newpay/querylist', $data)));
|
||||
$result = new ResultObject(rawurldecode(SendPost($_api2_base . '/api/newpay/querylist', $data)));
|
||||
if (0 == $result->error && count($result->data) > 0) /// 调用成功, 并且有支援的支付方式
|
||||
{
|
||||
/// 这里只获取第一种支付方式
|
||||
@@ -282,7 +284,7 @@ function SendPost($url, $data)
|
||||
$data['sign'] = SignParameter($data, $sign_key); /// 生成签名
|
||||
|
||||
/// 调用接口
|
||||
$result = new ResultObject(rawurldecode(SendPost('https://api2.tscce.cn/api/newpay/pay/offline/', $data)));
|
||||
$result = new ResultObject(rawurldecode(SendPost($_api2_base . '/api/newpay/pay/offline/', $data)));
|
||||
|
||||
if (0 != $result->error) /// error不为0表示有错误发生
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//var g_appid = '14919772144482';
|
||||
//var g_devkey = '14915485974028';
|
||||
var g_RequestAddress = 'https://api.daoqijuyou77.cn';
|
||||
var g_RequestAddress = window.location.origin;
|
||||
|
||||
/**
|
||||
* @note 字符串格式化
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<script src='source/login/js/common.js'></script>
|
||||
|
||||
<body id="mainbody">
|
||||
<!--form style='display:none;' id='form_next' name='form_next' method='post' action='https://api.tscce.cn/api/newpay/pay/online/'>
|
||||
<!--form style='display:none;' id='form_next' name='form_next' method='post' action='/api/newpay/pay/online/'>
|
||||
<input name='appid' type='text' value='14936872341446' /> /// 应用标识
|
||||
<input name='devkey' type='text' value='14915485974028'/> /// 开发者key
|
||||
<input name='sid' type='text' value='0000'/> /// 用户登录后的sid
|
||||
@@ -14,8 +14,8 @@
|
||||
<input name='orderid' type='text' value='10016'/> /// 订单编号
|
||||
<input name='fee' type='text' value='1' /> /// 支付金额 单位分
|
||||
<input name='title' type='text' value='test'/> /// 支付标题
|
||||
<input name='notice_url' type='text' value='https://api.tscce.cn/1.php'/> /// 支付成功后的通知页面(异步通知)
|
||||
<input name='return_url' type='text' value='https://api.tscce.cn/1.php'/> /// 支付成功后的跳转页面(同步跳转)
|
||||
<input name='notice_url' type='text' value='/1.php'/> /// 支付成功后的通知页面(异步通知)
|
||||
<input name='return_url' type='text' value='/1.php'/> /// 支付成功后的跳转页面(同步跳转)
|
||||
<input name='paytype' type='text' value='1'/> /// 支付类型 1:微信网页支付;2:支付宝网页支付;3:威富通聚合支付-微信网页支付;4:威富通聚合支付-支付宝网页支付
|
||||
/// 以下为附加参数,会在通知回调时返回。
|
||||
<input name='p1' type='text' value='参数一'/>
|
||||
@@ -41,8 +41,9 @@
|
||||
}
|
||||
|
||||
if (sid && scode) {
|
||||
var _origin = window.location.origin;
|
||||
var form =
|
||||
'<form style="display:none;" id="form_next" name="form_next" method="post" action="https://api.tscce.cn/api/newpay/pay/online/">\r\n' +
|
||||
'<form style="display:none;" id="form_next" name="form_next" method="post" action="' + _origin + '/api/newpay/pay/online/">\r\n' +
|
||||
' <input name="appid" type="text" value="14936872341446" />\r\n' +
|
||||
' <input name="devkey" type="text" value="14915485974028"/>\r\n' +
|
||||
' <input name="sid" type="text" value="{v_sid}"/>\r\n' +
|
||||
@@ -50,8 +51,8 @@
|
||||
' <input name="orderid" type="text" value="10018"/>\r\n' +
|
||||
' <input name="fee" type="text" value="1" />\r\n' +
|
||||
' <input name="title" type="text" value="test"/>\r\n' +
|
||||
' <input name="notice_url" type="text" value="https://api.tscce.cn/1.php"/>\r\n' +
|
||||
' <input name="return_url" type="text" value="https://api.tscce.cn/1.php"/>\r\n' +
|
||||
' <input name="notice_url" type="text" value="' + _origin + '/1.php"/>\r\n' +
|
||||
' <input name="return_url" type="text" value="' + _origin + '/1.php"/>\r\n' +
|
||||
' <input name="paytype" type="text" value="1"/>\r\n' +
|
||||
' <input name="p1" type="text" value="参数一"/>\r\n' +
|
||||
' <input name="p2" type="text" value="参数二"/>\r\n' +
|
||||
@@ -61,7 +62,7 @@
|
||||
$('#mainbody').append(form.format({'v_sid':sid, 'v_scode':scode}));
|
||||
load_submit();
|
||||
} else {
|
||||
window.location = 'https://api.tscce.cn/source/login/login.php?' +
|
||||
window.location = window.location.origin + '/source/login/login.php?' +
|
||||
'app_id=14936872341446&' +
|
||||
'dev_key=14915485974028&' +
|
||||
'market_key=test&' +
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
require_once dirname(dirname(dirname(__DIR__))) . '/env_config.php';
|
||||
define('USEDCHARSET', 'utf-8');
|
||||
$_api_base = env('SDK_API_URL');
|
||||
|
||||
/// 这里定义公共变量
|
||||
$app_id = '14992192722868'; /// appid
|
||||
@@ -244,7 +246,7 @@ function SendPost($url, $data)
|
||||
/// 判断是否有sid和scode, 什么数据都没有则先跳转到登录页面授权
|
||||
if (empty($sid) || empty($scode))
|
||||
{
|
||||
$url = "https://api.tscce.cn/source/login/login.php?app_id={$app_id}&dev_key={$dev_key}&market_key={$market_key}&redirect_uri=" . rawurlencode(getLocaleUrl());
|
||||
$url = "{$_api_base}/source/login/login.php?app_id={$app_id}&dev_key={$dev_key}&market_key={$market_key}&redirect_uri=" . rawurlencode(getLocaleUrl());
|
||||
header("Location: {$url}");
|
||||
exit;
|
||||
}
|
||||
@@ -293,7 +295,7 @@ EOL;
|
||||
);
|
||||
|
||||
$data['sign'] = SignParameter($data, $sign_key);
|
||||
$result = new ResultObject(rawurldecode(SendPost('https://api.tscce.cn/api/newpay/querylist', $data)));
|
||||
$result = new ResultObject(rawurldecode(SendPost($_api_base . '/api/newpay/querylist', $data)));
|
||||
|
||||
if (0 == $result->error && count($result->data) > 0) /// 成功
|
||||
{
|
||||
@@ -323,7 +325,7 @@ EOL;
|
||||
$data['sign'] = SignParameter($data, $sign_key);
|
||||
|
||||
$html = <<<EOF
|
||||
<form style="display:none;" id="frm" name="frm" method="post" action="https://api.tscce.cn/api/newpay/pay/online/">
|
||||
<form style="display:none;" id="frm" name="frm" method="post" action="{$_api_base}/api/newpay/pay/online/">
|
||||
<input name="appid" type="text" value="{$data['appid']}" />
|
||||
<input name="devkey" type="text" value="{$data['devkey']}" />
|
||||
<input name="sid" type="text" value="{$data['sid']}" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//var g_appid = '14919772144482';
|
||||
//var g_devkey = '14915485974028';
|
||||
var g_RequestAddress = 'https://api.tscce.cn';
|
||||
var g_RequestAddress = window.location.origin;
|
||||
|
||||
/**
|
||||
* @note 字符串格式化
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/// https://api.tscce.cn/sample/onlinepay/test.php
|
||||
require_once dirname(dirname(dirname(__DIR__))) . '/env_config.php';
|
||||
/// sample/onlinepay/test.php
|
||||
define('USEDCHARSET', 'utf-8');
|
||||
$_api_base = env('SDK_API_URL');
|
||||
|
||||
/// 这里定义公共变量
|
||||
$app_id = '14992192722868'; /// appid
|
||||
@@ -230,7 +232,7 @@ $return_url = dirname(getLocaleUrl()) . '/return.php'; /// 通知页面地址
|
||||
|
||||
|
||||
/// 登录
|
||||
$url = 'https://api.tscce.cn/api/login/ylnn';
|
||||
$url = $_api_base . '/api/login/ylnn';
|
||||
$data = array(
|
||||
'appid' => $app_id, /// appid
|
||||
'devkey' => $dev_key, /// 开发者key
|
||||
@@ -266,7 +268,7 @@ $tdy_token = 1;
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form style="display:none;" id="frm" name="frm" method="post" action="https://api.tscce.cn/api/newpay/pay/online/">
|
||||
<form style="display:none;" id="frm" name="frm" method="post" action="<?php echo $_api_base; ?>/api/newpay/pay/online/">
|
||||
<input name="appid" type="text" value="<?php echo $app_id; ?>" />
|
||||
<input name="devkey" type="text" value="<?php echo $dev_key; ?>" />
|
||||
<input name="sid" type="text" value="<?php echo $sid; ?>" />
|
||||
@@ -302,7 +304,7 @@ $tdy_token = 1;
|
||||
frmPost.id = '____frmPost____';
|
||||
frmPost.name = '____frmPost____';
|
||||
frmPost.method = 'post';
|
||||
frmPost.action = 'https://api.tscce.cn/api/newpay/pay/online/';
|
||||
frmPost.action = $_api_base . '/api/newpay/pay/online/';
|
||||
var add_formchild = function (name, value) {
|
||||
var edt = document.createElement('input');
|
||||
edt.type = 'text';
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
require_once dirname(dirname(dirname(__DIR__))) . '/env_config.php';
|
||||
|
||||
define('USEDCHARSET', 'utf-8');
|
||||
$_api_base = env('SDK_API_URL');
|
||||
$_api2_base = env('SDK_API2_URL');
|
||||
|
||||
/// 这里定义公共变量
|
||||
//$app_id = '14936872341446'; /// appid
|
||||
@@ -246,14 +249,14 @@ function SendPost($url, $data)
|
||||
{
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'],"MicroMessenger "))
|
||||
{
|
||||
$url = "https://api2.daoqijuyou77.cn/source/login/login.php?app_id={$app_id}&dev_key={$dev_key}&market_key={$market_key}&redirect_uri=" . rawurlencode(getLocaleUrl());
|
||||
$url = "{$_api2_base}/source/login/login.php?app_id={$app_id}&dev_key={$dev_key}&market_key={$market_key}&redirect_uri=" . rawurlencode(getLocaleUrl());
|
||||
header("Location: {$url}");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// 登录
|
||||
$url = 'https://api2.daoqijuyou77.cn/api/login/ylnn';
|
||||
$url = $_api2_base . '/api/login/ylnn';
|
||||
$data = array(
|
||||
'appid' => $app_id, /// appid
|
||||
'devkey' => $dev_key, /// 开发者key
|
||||
@@ -332,7 +335,7 @@ EOF;
|
||||
);
|
||||
|
||||
$data['sign'] = SignParameter($data, $sign_key);
|
||||
$result = new ResultObject(rawurldecode(SendPost('https://api.daoqijuyou77.cn/api/newpay/refund/', $data)));
|
||||
$result = new ResultObject(rawurldecode(SendPost($_api_base . '/api/newpay/refund/', $data)));
|
||||
|
||||
if (0 != $result->error) /// error不为0表示有错误发生
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//var g_appid = '14919772144482';
|
||||
//var g_devkey = '14915485974028';
|
||||
var g_RequestAddress = 'https://api2.daoqijuyou77.cn';
|
||||
var g_RequestAddress = window.location.origin;
|
||||
|
||||
/**
|
||||
* @note 字符串格式化
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
require_once dirname(dirname(dirname(__DIR__))) . '/env_config.php';
|
||||
define('USEDCHARSET', 'utf-8');
|
||||
$_api2_base = env('SDK_API2_URL');
|
||||
|
||||
/// 这里定义公共变量
|
||||
$app_id = '14992192722868'; /// appid
|
||||
@@ -563,7 +565,7 @@ EOL;
|
||||
$sign = SignParameter($data, $sign_key); /// 对参数进行签名(必须)
|
||||
|
||||
$html = <<<EOL
|
||||
<form style="display:none;" id="frm" name="frm" method="post" action="https://api2.daoqijuyou77.cn/api/transfer/transfer/">
|
||||
<form style="display:none;" id="frm" name="frm" method="post" action="{$_api2_base}/api/transfer/transfer/">
|
||||
<input name='appid' type='text' value='{$data["appid"]}' />
|
||||
<input name='devkey' type='text' value='{$data["devkey"]}' />
|
||||
<input name='market_key' type='text' value='{$data["market_key"]}' />
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
require_once dirname(dirname(dirname(__DIR__))) . '/env_config.php';
|
||||
define('USEDCHARSET', 'utf-8');
|
||||
$_api2_base = env('SDK_API2_URL');
|
||||
|
||||
/// 这里定义公共变量
|
||||
$app_id = '14992192722868'; /// appid
|
||||
@@ -261,7 +263,7 @@ function SendPost($url, $data)
|
||||
$sign = SignParameter($data, $sign_key); /// 对参数进行签名(必须)
|
||||
|
||||
$html = <<<EOL
|
||||
<form style="display:none;" id="frm" name="frm" method="post" action="https://api2.tscce.cn/api/transfer/transfer/">
|
||||
<form style="display:none;" id="frm" name="frm" method="post" action="{$_api2_base}/api/transfer/transfer/">
|
||||
<input name='appid' type='text' value='{$data["appid"]}' />
|
||||
<input name='devkey' type='text' value='{$data["devkey"]}' />
|
||||
<input name='market_key' type='text' value='{$data["market_key"]}' />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//var g_appid = '14919772144482';
|
||||
//var g_devkey = '14915485974028';
|
||||
var g_RequestAddress = 'https://api2.tscce.cn';
|
||||
var g_RequestAddress = window.location.origin;
|
||||
|
||||
/**
|
||||
* @note 字符串格式化
|
||||
|
||||
Reference in New Issue
Block a user