-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64798b2
commit 98ff421
Showing
5 changed files
with
204 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
.idea/**/* | ||
data/**/* | ||
!data/config.php | ||
attachment/**/* | ||
!attachment/images/global/**/* | ||
addons/**/* | ||
!addons/index.html | ||
/.php_cs.cache | ||
data/logs/ | ||
data/tpl/ | ||
data/install.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{template 'common/header'} | ||
<table class="table we7-table" style="margin-bottom: -15px"> | ||
<tr><th class="text-left" colspan="1">商品管理(请添加<a class="color-default" href="javascript:;" onclick="openUrl('https://console.w7.cc/api/deploy/thirdparty_pay/redirect')">支付应用</a>->商品管理列表下的商品)</th></tr> | ||
{loop $w7pay_setting['goods'] $item} | ||
<tr> | ||
<td class="table-label text-left"> | ||
<div class="form-group"> | ||
<div class="col-sm-1">商品ID:{$item['id']}</div> | ||
<div class="col-sm-1">金额:{$item['fee']}</div> | ||
<div class="col-sm-9">商品名称:{$item['name']}</div> | ||
<div class="col-sm-1"><a class="color-default" href="{php echo $this->createWebUrl('delete_good', ['id' => $item['id']])}">删除</a></div> | ||
</div> | ||
</td> | ||
</tr> | ||
{/loop} | ||
<tr> | ||
<td class="table-label"> | ||
<form class="we7-form form" action="{php echo $this->createWebUrl('w7pay_goods');}" method="post" enctype="multipart/form-data"> | ||
<div class="form-group"> | ||
<label class="col-sm-1 control-label">商品ID:</label> | ||
<div class="col-sm-1"><input type="number" class="form-control" name="goods_id"></div> | ||
<label class="col-sm-1 control-label">商品名称:</label> | ||
<div class="col-sm-3"><input type="text" class="form-control" name="goods_name"></div> | ||
<label class="col-sm-1 control-label">金额:</label> | ||
<div class="col-sm-1"><input type="number" class="form-control" min="0.01" step="0.01" name="goods_fee"></div> | ||
<div class="col-sm-1"> | ||
<input type="submit" class="btn btn-primary" name="goods" value="添加" /> | ||
<input type="hidden" name="token" value="{$_W['token']}" /> | ||
</div> | ||
</div> | ||
</form> | ||
</td> | ||
</tr> | ||
</table> | ||
{template 'common/footer'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
{template 'common/header'} | ||
<div> | ||
<div class="alert we7-page-alert"> | ||
<p><i class="wi wi-info"></i>参数配置完成后选择测试支付</p> | ||
</div> | ||
<table class="table we7-table"> | ||
<tr><th class="text-left" colspan="2"></th></tr> | ||
<tr> | ||
<td class="table-label text-left"> | ||
<strong style="font-size: 14px">js发起支付:</strong> | ||
<select onchange="jsPay()" id="fuwufei"> | ||
<option value="0">请选择商品 </option> | ||
{loop $w7pay_setting['goods'] $item} | ||
<option value="{$item['id']}">{$item['name']}</option> | ||
{/loop} | ||
</select> | ||
<span class="help-block">选择任一商品发起js支付</span> | ||
</td> | ||
<td class="table-label text-left"> | ||
<strong style="font-size: 14px">后端发起支付:</strong> | ||
<a href="javascript:;" class="color-default" onclick="backCodePay()">点我发起</a> | ||
<span class="help-block">从商品中选取第一个发起后端支付,若需实现选取任一商品,开发者可自行实现</span> | ||
</td> | ||
</tr> | ||
</table> | ||
<table class="table we7-table table-hover vertical-middle"> | ||
<col width="200px"/> | ||
<col width="200px" /> | ||
<col width="250px" /> | ||
<col width="100px" /> | ||
<col width="50px" /> | ||
<tr> | ||
<th>订单号(可 <a href="" class="color-default">刷新</a> 查看支付及退款状态)</th> | ||
<th>外部订单号(支付应用)</th> | ||
<th>创建时间</th> | ||
<th>状态</th> | ||
<th class="text-center"onclick='refund(1,2)'>操作</th> | ||
</tr> | ||
{loop $order $item} | ||
<tr> | ||
<td>{$item['no']}</td> | ||
<td>{$item['code']}</td> | ||
<td>{$item['createtime']}</td> | ||
<td> | ||
{if 1 == $item['status']}<span>已支付</span>{/if} | ||
{if 2 == $item['status']}<span>已退款</span>{/if} | ||
{if 0 == $item['status']}<span>未支付</span>{/if} | ||
</td> | ||
<td class="text-center"> | ||
<div class="link-group"> | ||
{if 1 == $item['status']}<a href="javascript:;" onclick='refund("{$item[no]}", "{$item[code]}")'>退款</a>{/if} | ||
{if 2 == $item['status']}<a href="javascript:;">-</a>{/if} | ||
</div> | ||
</td> | ||
</tr> | ||
{/loop} | ||
</table> | ||
</div> | ||
<script> | ||
var links = { | ||
'can_pay': "{php echo $can_pay}", | ||
'pay_url': "{php echo $this->createWebUrl('w7pay')}", | ||
'refund_url': "{php echo $this->createWebUrl('w7refund')}", | ||
'back_code_pay_url': "{php echo $this->createWebUrl('w7back_code_pay')}", | ||
'back_code_pay_callback_url': "{php echo $this->createWebUrl('w7back_code_pay_callback')}", | ||
}; | ||
function backCodePay() { | ||
window.w7.ready(function() { | ||
$.post(links.back_code_pay_url, {}, function (data) { | ||
if (data.message.errno == -1) { | ||
util.message(data.message.message, data.redirect, 'error'); | ||
} | ||
$.post(links.back_code_pay_callback_url, {'pay_sn': data.message.message.pay_sn}, function (callback) {}); | ||
window.w7.pay(data.message.message.ticket, (res) => { | ||
window.location.reload(); | ||
}); | ||
}, 'json'); | ||
}) | ||
} | ||
function jsPay(id = 0) { | ||
if (!links.can_pay) { | ||
util.message('请先确认是否设置好参数配置及添加好商品!'); | ||
} | ||
window.w7.ready(function(){ | ||
goodId = document.getElementById('fuwufei').value; | ||
if(0 == goodId) { | ||
return true; | ||
} | ||
var data = { | ||
goods_ids: [goodId], //支付应用 商品id | ||
account_id: "{php echo $w7pay_setting['id']}", //支付 应用接口id | ||
version: 2, | ||
pay_sn: "{php echo date('YmdHis') . random(14, 1)}", | ||
}; | ||
$.post(links.pay_url, {'pay_sn': data.pay_sn, 'good_id': goodId}, function () {}); | ||
//js 支付 | ||
window.w7.payment(data,function() { | ||
window.location.reload(); | ||
}) | ||
}) | ||
} | ||
|
||
function refund(no, code) { | ||
$.post(links.refund_url, {'no': no, 'code': code}, function (data) { | ||
if (data.message.errno == 0) { | ||
util.message(data.message.message, '', 'success'); | ||
} else { | ||
util.message(data.message.message, '', 'error'); | ||
} | ||
}, 'json'); | ||
} | ||
</script> | ||
{template 'common/footer'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{template 'common/header'} | ||
<div class="alert we7-page-alert"> | ||
<i class="wi wi-info"></i>内购功能开发文档,请点击以下链接: | ||
<a href="javascript:;" onclick="openUrl('https://wiki.w7.com/document/1621/7656')" class="color-red">如何做内购</a>、 | ||
<a href="javascript:;" onclick="openUrl('https://wiki.w7.com/document/1621/5921')" class="color-red">如何使用支付</a>、 | ||
<a href="javascript:;" onclick="openUrl('https://wiki.w7.com/document/1621/5963')" class="color-red">支付接口</a> | ||
</div> | ||
<div> | ||
<table class="table we7-table" style="margin-bottom: -15px"> | ||
<tr><th class="text-left" colspan="1">参数配置(下列各值见<a class="color-default" href="javascript:;" onclick="openUrl('https://console.w7.cc/api/deploy/thirdparty_pay/redirect')">支付应用</a>->应用接口)</th></tr> | ||
<tr> | ||
<td class="table-label text-left"> | ||
<form class="we7-form form" action="{php echo $this->createWebUrl('w7pay_setting');}" method="post" enctype="multipart/form-data"> | ||
<div class="form-group"> | ||
<label class="col-sm-1 control-label">支付通知地址:</label> | ||
<div class="col-sm-11">{$pay_notify_url}</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="col-sm-1 control-label">退款通知地址:</label> | ||
<div class="col-sm-11">{$refund_notify_url}</div> | ||
</div> | ||
<div class="form-group required"> | ||
<label class="col-sm-1 control-label">支付appid:</label> | ||
<div class="col-sm-11"> | ||
<input type="text" class="form-control" name="w7pay_appid" value="{$w7pay_setting['appid']}"> | ||
</div> | ||
</div> | ||
<div class="form-group required"> | ||
<label class="col-sm-1 control-label">支付密钥:</label> | ||
<div class="col-sm-11"> | ||
<input type="text" class="form-control" name="w7pay_appsecret" value="{$w7pay_setting['appsecret']}"> | ||
</div> | ||
</div> | ||
<div class="form-group required"> | ||
<label class="col-sm-1 control-label">商户号:</label> | ||
<div class="col-sm-11"> | ||
<input type="text" class="form-control" name="w7pay_id" value="{$w7pay_setting['id']}"> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="col-sm-1 control-label"></label> | ||
<div class="col-sm-11"> | ||
<input type="submit" class="btn btn-primary" name="submit" value="保存" /> | ||
<input type="hidden" name="token" value="{$_W['token']}" /> | ||
</div> | ||
</div> | ||
</form> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
{template 'common/footer'} |