$_SGLOBAL['db']->query('delete from ' . tname('open_member_weixin_custommenu') . ' where wxid=' . $id); foreach ($arr['menu']['button'] as $k => $v) { $parent_id = inserttable(tname('open_member_weixin_custommenu'), array('wxid' => $id, 'sort_order' => $k, 'btn_type' => $v['type'] == 'view' ? 2 : 1, 'btn_name' => $v['name'] ? $v['name'] : '', 'keyword' => $v['key'] ? $v['key'] : '', 'url' => $v['url'] ? $v['url'] : '', 'addtime' => $_SGLOBAL['timestamp']), 1); if ($v['sub_button']) { foreach ($arr['menu']['button'][$k]['sub_button'] as $key => $value) { inserttable(tname('open_member_weixin_custommenu'), array('wxid' => $id, 'parent_id' => $parent_id, 'sort_order' => $key, 'btn_type' => $value['type'] == 'view' ? 2 : 1, 'btn_name' => $value['name'] ? $value['name'] : '', 'keyword' => $value['key'] ? $value['key'] : '', 'url' => $value['url'] ? $value['url'] : '', 'addtime' => $_SGLOBAL['timestamp'])); } } } } } $ro->getheadimg($info['fakeid']); $ro->getqrcode($info['fakeid']); $ro->quick_set_api($_SC['api_token'], $_SC['api_url']); if (!$arr['errcode']) { $ro->create_menu(getstr($_POST['appid']), getstr($_POST['appsecret']), urldecode(json_encode($arr['menu']))); } } else { showmessage('公众号用户名或密码错误,绑定失败'); } gourl('wx_account.php'); exit; break; case "pushedit": $query = $_SGLOBAL['db']->query('select * from ' . tname('open_member_pushweixin') . ' where op_uid=' . $_SGLOBAL['uid']); if ($account = $_SGLOBAL['db']->fetch_array($query)) { $smarty->assign('account', $account); } $smarty->display('wx_account_pushedit.dwt'); break; case "pusheditprofile":
if ($value['btn_type'] == 1) { $data['button'][$k]['sub_button'][$key]['type'] = 'click'; $data['button'][$k]['sub_button'][$key]['key'] = urlencode($value['keyword']); } if ($value['btn_type'] == 2) { $data['button'][$k]['sub_button'][$key]['type'] = 'view'; $data['button'][$k]['sub_button'][$key]['url'] = urlencode($value['url']); } } } //print_r(urldecode(json_encode($data))); $appid = $_SGLOBAL['db']->getone('select appid from ' . tname('open_member_weixin') . ' where id=' . $id); $appsecret = $_SGLOBAL['db']->getone('select appsecret from ' . tname('open_member_weixin') . ' where id=' . $id); include_once S_ROOT . './source/class_weixin.php'; $ro = new WX_Remote_Opera(); $return = $ro->create_menu($appid, $appsecret, urldecode(json_encode($data))); echo json_encode($return); //print_r($return); break; default: $id = intval($_GET['id']) ? intval($_GET['id']) : 0; check_role($id); $smarty->assign('id', $id); $total = getcount(tname('open_member_weixin_custommenu'), array('wxid' => $id)); $smarty->assign('total', $total); $list = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin_custommenu') . ' where parent_id=0 and wxid=' . $id . ' order by sort_order'); foreach ($list as $k => $v) { if ($v['btn_type'] == 1) { $list[$k]['btn_type_show'] = '关键词'; } if ($v['btn_type'] == 2) {