Example #1
0
 public function delete($id)
 {
     $model = new \Model\Data(array('id' => $id));
     $sql = $model->delete();
     mysqli_query($this->dbcon, $sql);
     $this->url->redirect('index.php/data');
 }
Example #2
0
        }
        $message = '排行榜获取成功';
    }
    $myScore->name = $app->_helper->emoji->toImage($myScore->name);
    if ($selfIndex < 0) {
        $selfIndex = rand(50, 10000);
    }
    $myScore->rank = $selfIndex;
    $resultList[] = $myScore;
    $resule = array('result' => '1', 'msg' => $message, 'list' => $resultList);
    echo json_encode($resule);
})->via('GET');
$app->map('/index/datacapture', function () use($app) {
    $position = $app->request()->get('position');
    $type = $app->request()->get('type');
    $dataModel = new \Model\Data();
    $dataModel->saveData($type, $position);
})->via('GET');
$app->map('/index/cron', function () use($app) {
    $lockName = APPLICATION_PATH . "/data/lock/" . date('Ymd') . '.html';
    if (time() > $app->config('p1EndTime')) {
        die('Event ended at ' . date('Y-m-d H:i:s', $app->config('p1EndTime')));
    }
    if (time() < $app->config('p1DailyRefreshTime') - 1800 || file_exists($lockName)) {
        //every 0:55 send out notification once per day
        //if(0)
        die('Not the time, planning to launch at ' . date('Y-m-d H:i:s', $app->config('p1DailyRefreshTime') - 1800));
    }
    $scoreModel = new \Model\Score();
    $bars = $scoreModel->getBars();
    $barArr = array();