您的位置:首页 > 移动开发 > 微信开发

微擎开发-公众号支付配置代码解析

2017-12-27 14:35 197 查看
       最近的项目是微信订阅号报名活动,老板说基于微擎开发。于是了解微擎去了,看过之后觉得微擎是一个很强大的公众号管理应用。尤其是他各种各样以及非常多的插件。真的很实用。今天弄公众号支付配置。

模板文件在web\themes\default\profile\payment.html中

<div class="form-group">
<label for="" class="control-label col-sm-2">微信支付商户号</label>
<div class="form-controls col-sm-10">
<input type="text" name="" ng-model="paysetting.wechat.mchid" class="form-control" placeholder="">
<span class="help-block">
财付通商户权限密钥
</span>
</div>
</div>


<script>
4000

angular.module('profileApp').value('config', {
'paysetting' : {php echo json_encode($pay_setting)},
'saveurl' : "{php echo url('profile/payment/save_setting')}",
'text_alipay_url' : "{php echo url('profile/payment/test_alipay')}",
'borrows' : {php echo json_encode($proxy_wechatpay_account['borrow'])},
'get_setting_url' : "{php echo url('profile/payment/get_setting')}",
'account_level' : "{$accounts[$_W['acid']]['level']}"
});
angular.bootstrap($('.js-profile-payment'), ['profileApp']);
</script>


<input type="text" name="" ng-model="xxxxxx" class="form-control" placeholder="">


AngularJS 
ng-model
 指令   :http://www.runoob.com/angularjs/ng-ng-model.html

控制器代码在\web\source\profile\payment.ctrl.php中

if ($do == 'display') {
$proxy_wechatpay_account = account_wechatpay_proxy();
//$_W['uniacid']是当前公众号id
$setting = uni_setting_load('payment', $_W['uniacid']);
$pay_setting = is_array($setting['payment']) ? $setting['payment'] : array();
if (empty($pay_setting['delivery'])) {
$pay_setting['delivery'] = array('switch' => false);
}
if (empty($pay_setting['credit'])) {
$pay_setting['delivery'] = array('switch' => false);
}
if (empty($pay_setting['alipay'])) {
$pay_setting['alipay'] = array('switch' => false);
}
........


主要的就是   $setting = uni_setting_load('payment', $_W['uniacid']);   这行代码

uni_setting_load()这个函数执行后获取指定公号的设置项函数。

写的很仔细的微擎社区文档    http://www.phpos.net/weiqing/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐