if ($userInfo) { $wall['wall_creatorname'] = $userInfo['user_name']; } $wall['wall_type'] = $info['wall_type']; $wall['wall_usercount'] = $info['wall_usercount']; } $wall['relationship'] = 'like'; array_push($ret, $wall); } } $walls = WaWall::FindWallIdsByCreator($id); if ($walls) { while (list($key, $value) = each($walls)) { $wall = array(); $wall['wall_id'] = $value['wall_id']; if (isset($_GET['fulldata'])) { $info = WaWall::GetWallInfo($wall['wall_id']); $wall['wall_name'] = $info['wall_name']; $wall['wall_desc'] = $info['wall_desc']; $userInfo = WaUser::GetUserInfo($info['wall_creator']); if ($userInfo) { $wall['wall_creatorname'] = $userInfo['user_name']; } $wall['wall_type'] = $info['wall_type']; $wall['wall_usercount'] = $info['wall_usercount']; } $wall['relationship'] = 'own'; array_push($ret, $wall); } } echo json_encode($ret);
$walls = false; if ($walltype) { $walls = WaWall::FindWallIdsByType($walltype, $limit); } else { $walls = WaWall::FindWallIdsByAccess(5, $limit); } if (!$walls) { returnError("这里暂时没有墙。"); return; } $ret = array(); while (list($key, $value) = each($walls)) { if (intval($key) > $limit) { break; } $info = WaWall::GetWallInfo($value['wall_id']); if (!$info) { continue; } $wall = array(); $wall['wall_id'] = $info['wall_id']; $wall['wall_name'] = $info['wall_name']; $wall['wall_desc'] = $info['wall_desc']; $userInfo = WaUser::GetUserInfo($info['wall_creator']); if ($userInfo) { $wall['wall_creatorname'] = $userInfo['user_name']; } $wall['wall_type'] = $info['wall_type']; $wall['wall_usercount'] = $info['wall_usercount']; array_push($ret, $wall); }
$appRunnning = WaApp::GetAppRunning(); if (!$appRunnning) { header('Location: ./error.html'); die(0); } else { $appName = WaApp::GetAppName(); $wall = $_GET['wall']; ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <?php $err = false; try { $info = WaWall::GetWallInfo($wall); if (!$info) { throw new Exception('找不到墙。'); } } catch (Exception $e) { $err = $e->getMessage(); } if ($err === false) { ?> <title><?php echo $info['wall_name'] . ' - ' . $appName; ?> </title> <link rel="stylesheet" href="http://lib.sinaapp.com/js/bootstrap/3.0.0/css/bootstrap.min.css" /> <link rel="stylesheet" href="/page/style.css" /> <script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/2.0.3/jquery-2.0.3.min.js"></script>
function like($wall, $user) { $found = false; try { $wallUsers = WaWall::FindUserIdsByWall($wall); } catch (Exception $e) { } if ($wallUsers) { foreach ($wallUsers as $wallUser) { if ($wallUser['user_id'] == $user) { $found = true; break; } } } $info = WaWall::GetWallInfo($wall); if (!$info) { returnError('获取墙信息失败'); } if (!$found) { try { $result = WaWall::AddUserToWall($user, $wall); } catch (Exception $e) { returnError($e->getMessage()); return; } if (!$result) { returnError('添加失败'); } $info['wall_usercount']++; $result = WaWall::SetWallInfo($wall, $info); if (!$result) { returnError('加人失败'); } } $ret = array('wall_usercount' => $info['wall_usercount']); echo json_encode($ret); }