前台支付页路径地址:
application/index/view/recharge/recharge.html
后台接口对接地址
application/index/controller/Recharge.php
前台功能代码
后台功能代码通过get_addon_config('recharge'),取到中名为 recharge 的插件配置信息,路径是addons/recharge/config.php并将结果存储在变量 $config 中。此函数 get_addon_config 的具体逻辑取决于其实现,通常是从配置文件、数据库或其他存储中读取指定插件的配置数据。<div class="row row-recharge row-paytype"> {foreach name="paytypeList" id="paytype"} <div class="col-xs-6 col-sm-4 col-md-4 col-lg-2 text-center">
<label class="{:$paytype.default?'active':''}" data-value="{$paytype.value}">
<img src="__CDN__{$paytype.image}" alt="">
</label> </div> {/foreach} </div>
名为public function recharge()
{
$config = get_addon_config('recharge'); $moneyList = []; foreach ($config['moneylist'] as $index => $item) { $moneyList[] = ['value' => $item, 'text' => $index, 'default' => $item === $config['defaultmoney']]; } $paytypeList = []; foreach (explode(',', $config['paytypelist']) as $index => $item) { $paytypeList[] = ['value' => $item, 'image' => '/assets/addons/recharge/img/' . $item . '.png', 'default' => $item === $config['defaultpaytype']]; } $this->view->assign('addonConfig', $config); $this->view->assign('moneyList', $moneyList); $this->view->assign('paytypeList', $paytypeList); $this->view->assign('title', __('Recharge')); return $this->view->fetch(); }
recharge
的插件配置信息路径addons/recharge/config.php
[
'name' => 'paytypelist',
'title' => '支付方式',
'type' => 'checkbox',
'content' => [
'wechat' => '微信支付',
'alipay' => '支付宝支付',
],
'value' => 'wechat',
'rule' => 'required',
'msg' => '',
'tip' => '',
'ok' => '',
'extend' => '',
],
发表留言 取消回复