function resourcePost($api, $tools, $param) { $param["fb_id"] = $tools->sql_injection_anti($_SESSION["fbId"]); 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; } include_once LIB_PATH . 'Table/LogLike.class.php'; $logLike = new LogLike(); $sql_param = array(); $sql_param["fb_id"] = $param["fb_id"]; $sql_param["ip"] = $param["ip"]; $sql_param["today"] = $param["today"]; $lastId = $logLike->addLikeLog($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); $output["last_id"] = $lastId; $api->setOutput('LOG記錄成功', $output); }
<?php 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);