if ($creatorInfo) { $creatorName = $creatorInfo['user_name']; ?> <div class="wall-user"> <h3>用户列表</h3> <h5>墙主:<?php echo $creatorName; ?> </h5> </div> <?php } ?> </span> <?php $users = WaWall::FindUserIdsByWall($wall); if ($users) { foreach ($users as $user) { $userInfo = WaUser::GetUserInfo($user['user_id']); if ($userInfo) { ?> <span class="wall-user list-group-item"> <h4 class="list-group-item-text"><?php echo $userInfo['user_name']; ?> </h4> </span> <?php } } }
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); }