payment.ctrl.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. $dos = array('get_setting', 'display', 'save_setting');
  8. $do = in_array($do, $dos) ? $do : 'display';
  9. permission_check_account_user('wxapp_payment_pay');
  10. $pay_setting = miniapp_payment_param();
  11. $wxapp_info = miniapp_fetch($_W['uniacid']);
  12. if ($do == 'get_setting') {
  13. iajax(0, $pay_setting, '');
  14. }
  15. if ($do == 'display') {
  16. if (empty($pay_setting) || empty($pay_setting['wechat'])) {
  17. $pay_setting = array(
  18. 'wechat' => array('mchid' => '', 'signkey' => '')
  19. );
  20. }
  21. }
  22. if ($do == 'save_setting') {
  23. if (!$_W['isajax'] || !$_W['ispost']) {
  24. iajax(-1, '非法访问');
  25. }
  26. $type = $_GPC['type'];
  27. if ($type != 'wechat') {
  28. iajax(-1, '参数错误');
  29. }
  30. $param = $_GPC['param'];
  31. $param['account'] = $_W['acid'];
  32. $pay_setting[$type] = $param;
  33. $payment = iserializer($pay_setting);
  34. uni_setting_save('payment', $payment);
  35. iajax(0, '设置成功', url('account/display', array('do' => 'switch', 'uniacid' => $_W['uniacid'])));
  36. }
  37. template('wxapp/payment');