function uni_accounts($uniacid = 0) { global $_W; $uniacid = empty($uniacid) ? $_W['uniacid'] : intval($uniacid); $types = account_types(); $accountlist = array(); foreach ($types as $type) { $list = pdo_fetchall("SELECT a.*,b.isconnect FROM " . tablename($type['table']) . " AS a LEFT JOIN " . tablename('account') . " AS b ON a.acid = b.acid WHERE a.uniacid = :uniacid ORDER BY a.level DESC", array(':uniacid' => $uniacid), 'acid'); if (!empty($list)) { foreach ($list as $row) { $row['type'] = $type['sn']; $accountlist[$row['acid']] = $row; } } } return $accountlist; }
$updatedata['notify'] = $notify; } pdo_update('uni_settings', $updatedata, array('uniacid' => $id)); pdo_update('uni_account', $uniaccount, array('uniacid' => $id)); module_build_privileges(); message('更新公众号成功!', referer(), 'success'); } $account = array(); if (!empty($id)) { $account = pdo_fetch("SELECT * FROM " . tablename('uni_account') . " WHERE uniacid = :id", array(':id' => $id)); $settings = uni_setting($id, array('notify', 'groupdata')); $groupdata = $settings['groupdata'] ? $settings['groupdata'] : array('isexpire' => 0, 'oldgroupid' => '', 'endtime' => TIMESTAMP); $notify = $settings['notify'] ? $settings['notify'] : array(); } else { $groupdata = array('isexpire' => 0, 'oldgroupid' => '', 'endtime' => TIMESTAMP); } $group = array(); if (empty($_W['isfounder'])) { $group = pdo_fetch("SELECT * FROM " . tablename('users_group') . " WHERE id = '{$_W['user']['groupid']}'"); $group['package'] = uni_groups((array) iunserializer($group['package'])); } else { $group['package'] = uni_groups(); } template('account/post'); } if ($do == 'list') { $_W['page']['title'] = '子公众号列表 - 编辑主公众号'; $accounts = uni_accounts($uniacid); $types = account_types(); template('account/list'); }
function account_fetch($acid) { $acid = intval($acid); $types = account_types(); $accountindex = pdo_fetch("SELECT type,isconnect FROM " . tablename('account') . " WHERE acid = :id", array(':id' => $acid)); if (empty($accountindex)) { return array(); } $type = ''; foreach ($types as $t) { if ($t['sn'] == $accountindex['type']) { $type = $t; break; } } $account = pdo_fetch("SELECT * FROM " . tablename($type['table']) . " WHERE acid = '{$acid}'"); $account['type'] = $t['sn']; $account['isconnect'] = intval($accountindex['isconnect']); return $account; }