alert("请选择菜单组"); } } function doCancel(){ if(confirm("确定删除微信账号菜单?")){ window.location.href='<?php echo $CONTEXT_PATH; ?> /wxapi/deleteMenu.php'; } } </script> </head> <?php $menuGroup = new AccountMenuGroup(); $menuGroupList = $menuGroup->query(); ?> <body class="bg"> <?php include "../static/top.php"; ?> <div class="content"> <div class="block-nav"> <?php include "../static/nav.php"; ?> </div>
include_once '../common/include-file.php'; include_once '../wxapi/wxconsts.php'; include_once '../wxapi/WxApi.class.php'; $wxAccount = new Account(); $wxAccount = $wxAccount->getSingleAccount(); $appId = $wxAccount['appid']; $appSecret = $wxAccount['appsecret']; $gid = $_GET['gid']; $accountMenu = new AccountMenu(); $sql = ' select * from t_wxcms_account_menu where gid = ' . $gid . ' order by parentId , sort '; $querySet = $accountMenu->queryBySql($sql); $menuStr = prepareMenu($querySet); $rst = WxApi::create_menu($appId, $appSecret, $menuStr); if ($rst->errcode == 0) { $wxAccountGroup = new AccountMenuGroup(); $wxAccountGroup->updateById(array("id" => $gid, "enable" => 1)); header("Location:" . $CONTEXT_PATH . "/wxcms/success.php?type=1"); } else { header("Location:" . $CONTEXT_PATH . "/wxcms/failure.php?type=1&errcode=" . $rst->errcode); } function prepareMenu($querySet) { $menuArr = array(); $subMenuArr = array(); foreach ($querySet as $item) { if ($item['parentId'] == 0) { array_push($menuArr, $item); } else { if (empty($subMenuArr[$item['parentId']])) { $subMenuArr[$item['parentId']] = array(getMenuJson($item));
<?php include_once '../common/include-file.php'; $id = ''; if (isset($_POST['gid']) && $_POST['gid'] != '') { $id = $_POST['gid']; $menuGroup = new AccountMenuGroup(); $data = array('id' => $id, 'name' => $_POST['name']); $menuGroup->updateById($data); } else { $menuGroup = new AccountMenuGroup(); $data = array('name' => $_POST['name']); $id = $menuGroup->insert($data); } header("Location:" . $CONTEXT_PATH . "/wxcms/menuList.php?gid=" . $id);
<?php include_once '../common/include-file.php'; $id = $_GET['id']; $menuGroup = new AccountMenuGroup(); $menuGroup->delete(" id = " . $id); header("Location:" . $CONTEXT_PATH . "/wxcms/menuGroupList.php");