コード例 #1
0
ファイル: api_routes.php プロジェクト: sujinw/passport
});
/**
 * Message Content API
 */
$app->get('/api/message/{msg_id:[0-9]+}', function ($msg_id) {
    BaseController::auth();
    BaseController::run(new MessageController(), 'getMessageAction', array($msg_id));
});
$app->post('/api/message', function () {
    BaseController::auth();
    $request = new \Phalcon\Http\Request();
    $send_uid = $request->getPost('send_uid');
    $content = $request->getPost('content');
    $msg_options = $request->getPost('msg_options') or $msg_options = '';
    $post_type = $request->getPost('post_type');
    $uid_or_gid = $request->getPost('uid_or_gid') or $uid_or_gid = $request->getPost('rec_uid') or $uid_or_gid = $request->getPost('gid');
    $post_time = $request->getPost('post_time') or $post_time = date('Y-m-d H:i:s');
    $expiry = $request->getPost('expiry') or $expiry = 30;
    $expiry_at_end = $request->getPost('expiry_at_end') or $expiry_at_end = date('Y-m-d H:i:s', time() + $expiry * 24 * 3600);
    BaseController::run(new MessageController(), 'postMessageAction', array($send_uid, $content, $msg_options, $uid_or_gid, $post_type, $post_time, $expiry, $expiry_at_end));
});
$app->put('/api/message/{msg_id:[0-9]+}', function ($msg_id) {
    BaseController::auth();
    $request = new \Phalcon\Http\Request();
    $update_data = $request->getPut();
    BaseController::run(new MessageController(), 'putMessageAction', array($msg_id, $update_data));
});
$app->delete('/api/message/{msg_id:[0-9]+}', function ($msg_id) {
    BaseController::auth();
    BaseController::run(new MessageController(), 'deleteMessageAction', array($msg_id));
});