$account['appsecret'] = getstr($_POST['appsecret']); check_role($id); include_once S_ROOT . './source/class_weixin.php'; $ro = new WX_Remote_Opera(); $token = "true"; //= $ro->test_login($account['username'], $account['password']); if ($token != '') { $ro->init($account['username'], $account['password']); $info = $ro->get_account_info(); $setarr = array('ghid' => $info['ghid'], 'headimg' => $_SC['img_url'] . '/weixin_headimg/' . $info['fakeid'] . '.png', 'qrcode' => $_SC['img_url'] . '/weixin_qrcode/' . $info['fakeid'] . '.png', 'weixin_name' => $info['nickname'], 'username' => $account['username'], 'password' => $account['password'], 'fakeid' => $info['fakeid'], 'state' => 1, 'appid' => $account['appid'], 'appsecret' => $account['appsecret']); updatetable(tname('open_member_weixin'), array('state' => 0, 'password' => ''), array('username' => $account['username'], 'state' => 1)); updatetable(tname('open_member_weixin'), $setarr, array('op_uid' => $_SGLOBAL['uid'], 'id' => $id)); updatetable(tname('weixin_member'), array('state' => 1), array('op_wxid' => $id)); //备份自定义菜单 if (getstr($_POST['appid'])) { $arr = $ro->get_menu(getstr($_POST['appid']), getstr($_POST['appsecret'])); if (!$arr['errcode']) { $_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']);
<?php include_once './common.php'; $ac = $_REQUEST["ac"]; switch ($ac) { case "get": $id = intval($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; check_role($id); include_once S_ROOT . './source/class_weixin.php'; $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); $ro = new WX_Remote_Opera(); $arr = $ro->get_menu($appid, $appsecret); if (!$arr['errcode']) { $_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'])); } } } //print_r($arr); echo 0; } else { echo 1; } break; case "add": $parent_id = intval($_GET['parent_id']) ? intval($_GET['parent_id']) : 0;