function resourcePost($api, $tools, $param) { $param["fb_id"] = $tools->sql_injection_anti($_SESSION["fbId"]); // array 如果做 sql_injection_anti 會無法解,所以不做。 $param["friend_array"] = $_POST["friend"]; if (empty($param["fb_id"])) { // log it $log_param = array(); $log_param = $param; $log_param["message"] = "資料不齊全,請重新輸入。"; // $api->setApiErrorLog($this->resource, $log_param); $api->setError($log_param["message"]); unset($param); return; } if (!empty($param['friend_array'])) { // 暫時保留,以防要走 JSON // $array_tag = json_decode($param['fb_tag'], true); $array_friend = $param['friend_array']; if (is_array($array_friend) && !empty($array_friend)) { include_once LIB_PATH . 'Table/LogInviteFriend.class.php'; $logInviteFriend = new LogInviteFriend(); $sql_param = array(); foreach ($array_friend as $value) { $sql_param["fb_id"] = $param["fb_id"]; $sql_param["ip"] = $param["ip"]; $sql_param["friend_id"] = $value; $sql_param["today"] = $param["today"]; $lastId = $logInviteFriend->addInviteFriendLog($sql_param); if (empty($lastId)) { // log it $log_param = array(); $log_param = $param; $log_param["message"] = "LOG記錄失敗。"; $api->setApiErrorLog($param["action"], $log_param); // $api->setError($log_param["message"]); // unset($param); // return; } unset($sql_param); } } } else { // 傳入空陣列, do nothing } $api->setOutput('LOG記錄完畢', $output); }
include_once LIB_PATH . 'Table/LogClick.class.php'; include_once LIB_PATH . 'Table/LogLike.class.php'; include_once LIB_PATH . 'Table/Game.class.php'; include_once LIB_PATH . 'Table/LogActStart.class.php'; include_once LIB_PATH . 'Table/LogActFinish.class.php'; include_once LIB_PATH . 'Table/LogInviteFriend.class.php'; include_once LIB_PATH . 'Table/Lottery.class.php'; include_once LIB_PATH . 'Table/User.class.php'; $logClick = new LogClick(); $result_log = $logClick->listClickLog(); if (!empty($result_log)) { $logLike = new LogLike(); $tbGame = new Game(); $logActStart = new LogActStart(); $logActFinish = new LogActFinish(); $logInviteFriend = new LogInviteFriend(); $tbLottery = new Lottery(); $tbUser = new User(); foreach ($result_log as $key => $value) { $tempRow = $value; // 按讚人數 $countLike = $logLike->countLikeLogByDate($tempRow['log_date']); $tempRow["count_like"] = $countLike; // 確認進入遊戲人數 // $countGameUser = $tbGame->countGameUserByDate($tempRow['log_date']); // $tempRow["count_game_user"] = $countGameUser; $listGameUser = $tbGame->listGameUserByDate($tempRow['log_date']); if (!empty($listGameUser) and is_array($listGameUser)) { $tempRow["count_game_user"] = count($listGameUser); // 因為此活動而進入遊戲的人數 $tempRow["count_already_join"] = 0;