public function paymentAction() { $a = new Account(); $accounts = array(); $weixins = $a->table('__PLATFORM_WEIXIN__')->field('`id`, `appid`, `secret`')->where("`level`=2")->select(); if (!empty($weixins)) { $weixins = coll_key($weixins, 'id'); $ids = coll_neaten($weixins, 'id'); $accounts = $a->table('__PLATFORMS__')->field('`id`,`title`')->where('`id` IN (' . implode(',', $ids) . ')')->select(); foreach ($accounts as &$acc) { $acc['appid'] = $weixins[$acc['id']]['appid']; $acc['secret'] = $weixins[$acc['id']]['secret']; } } Pay::loadSettings(); $setting = C('PAY'); if (IS_POST) { $input = array(); $input['alipay'] = I('post.alipay'); $input['alipay']['enable'] = $input['alipay']['enable'] == 'true' ? 1 : 0; if (!empty($input['alipay']['enable'])) { if (empty($input['alipay']['partner']) || empty($input['alipay']['account']) || empty($input['alipay']['secret'])) { $this->error('支付宝支付资料输入不完整'); } } $setting[Pay::OPT_ALIPAY] = $input['alipay']; $input['weixin'] = I('post.weixin'); $input['weixin']['enable'] = $input['weixin']['enable'] == 'true' ? 1 : 0; if (!empty($input['weixin']['enable'])) { if (empty($input['weixin']['partner']) || empty($input['weixin']['key']) || empty($input['weixin']['mchid'])) { $this->error('微信支付资料输入不完整'); } } $setting[Pay::OPT_WEIXIN] = $input['weixin']; if (Pay::saveSettings($setting)) { $this->success('操作成功'); exit; } else { $this->error('操作失败, 请稍后重试'); } } $pay = array(); $pay['weixin'] = $setting[Pay::OPT_WEIXIN]; $pay['alipay'] = $setting[Pay::OPT_ALIPAY]; $this->assign('pay', $pay); $this->assign('accounts', $accounts); $this->display(); }
public function installAction() { $a = I('get.addon'); if (!empty($a)) { $this->doInstall($a); exit; } $type = I('get.t') == 'nocompat' ? 'nocompat' : 'compat'; $extends = Addon::getAddons(); $names = coll_neaten($extends, 'name'); $addons = array(); $path = MB_ROOT . 'addons/'; if (is_dir($path)) { if ($handle = opendir($path)) { while (false !== ($addonpath = readdir($handle))) { if ($addonpath != '.' && $addonpath != '..' && !in_array($addonpath, $names)) { $addons[] = $addonpath; } } } } $entities = array(); if (!empty($addons)) { foreach ($addons as $addon) { $define = Addon::getAddon($addon, true); if (is_error($define)) { $define['name'] = $addon; $entities['nocompat'][] = $define; } else { $entities['compat'][] = $define; } } } $this->assign('types', Addon::types()); $this->assign('type', $type); $this->assign('entities', $entities); C('FRAME_ACTIVE', 'extend'); C('FRAME_CURRENT', U('control/extend/install')); $this->display(); }
public function passportAction() { $a = new Account(); $accounts = array(); $weixins = $a->table('__PLATFORM_WEIXIN__')->field('id')->where("`level`=2")->select(); if (!empty($weixins)) { $ids = coll_neaten($weixins, 'id'); if (IS_POST) { $select = I('post.select'); if ($select == '0' || in_array($select, $ids)) { Member::loadSettings(); $setting = C('MS'); $setting[Member::OPT_AUTH_WEIXIN] = $select; Member::saveSettings($setting); $this->success('处理成功'); exit; } } $accounts = $a->table('__PLATFORMS__')->where('`id` IN (' . implode(',', $ids) . ')')->select(); } Member::loadSettings(); $setting = C('MS'); $auth = $setting[Member::OPT_AUTH_WEIXIN]; $this->assign('auth', $auth); $this->assign('accounts', $accounts); C('FRAME_CURRENT', U('control/member/passport')); $this->display(); }