当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::responseWithSuccess方法代码示例

本文整理汇总了PHP中Response::responseWithSuccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::responseWithSuccess方法的具体用法?PHP Response::responseWithSuccess怎么用?PHP Response::responseWithSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Response的用法示例。


在下文中一共展示了Response::responseWithSuccess方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

<?php

$app['controllers']['tag/getall'] = function ($app, $request) {
    $idProject = !empty($request['id_project']) ? (int) $request['id_project'] : null;
    if (!is_null($idProject)) {
        $tags = $app['bugmanager']->getAllTagsFromProject($idProject);
        Response::responseWithSuccess(['tags' => $tags]);
    } else {
        Response::responseWithError($app['i18n']['errors']['empty_id_project']);
    }
};
开发者ID:serkin,项目名称:bugmanager,代码行数:11,代码来源:getall.php

示例2: function

<?php

$app['controllers']['tag/setstatus'] = function ($app, $request) {
    $idTag = !empty($request['id_tag']) ? $request['id_tag'] : null;
    $status = !empty($request['status']) ? $request['status'] : null;
    if (empty($status)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_tag_status'];
    } elseif (empty($idTag)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_id_tag'];
    } else {
        $result = $app['bugmanager']->setTagStatus($idTag, $status);
        $errorMsg = $app['i18n']['errors']['cannot_update_tag_status'];
    }
    if ($result) {
        Response::responseWithSuccess([], $app['i18n']['bugmanager']['tag_status_updated']);
    } else {
        Response::responseWithError($errorMsg);
    }
};
开发者ID:serkin,项目名称:bugmanager,代码行数:21,代码来源:setstatus.php

示例3: function

<?php

$app['controllers']['project/save'] = function ($app, $request) {
    parse_str($request['form'], $form);
    $idProject = !empty($form['id_project']) ? $form['id_project'] : null;
    if (empty($form['name'])) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_project_name'];
    } else {
        $result = $app['bugmanager']->saveProject($form['name'], $idProject);
        $error = $app['bugmanager']->getError();
        $errorMsg = $error[2];
    }
    if ($result) {
        Response::responseWithSuccess(['id_project' => $result], $app['i18n']['bugmanager']['project_saved']);
    } else {
        Response::responseWithError($errorMsg);
    }
};
开发者ID:serkin,项目名称:bugmanager,代码行数:19,代码来源:save.php

示例4: function

<?php

$app['controllers']['issue/getone'] = function ($app, $request) {
    $idProject = !empty($request['id_project']) ? $request['id_project'] : null;
    $idIssue = !empty($request['id_issue']) ? $request['id_issue'] : null;
    $result = true;
    $response = [];
    $response['issue_types'] = $app['config']['issue_types'];
    if (empty($idProject)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_id_project'];
    }
    $response['tags'] = !empty($idProject) ? $app['bugmanager']->getAllTagsFromProject($idProject) : [];
    $response['issue'] = !empty($idIssue) ? $app['bugmanager']->getIssue($idIssue) : [];
    if ($result) {
        Response::responseWithSuccess($response);
    } else {
        Response::responseWithError($errorMsg);
    }
};
开发者ID:serkin,项目名称:bugmanager,代码行数:20,代码来源:getone.php

示例5: function

<?php

$app['controllers']['tag/delete'] = function ($app, $request) {
    $idTag = !empty($request['id_tag']) ? $request['id_tag'] : null;
    if (empty($idTag)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_id_tag'];
    } else {
        $result = $app['bugmanager']->deleteTag($idTag);
        $error = $app['bugmanager']->getError();
        $errorMsg = $error[2];
    }
    if ($result) {
        Response::responseWithSuccess([], $app['i18n']['bugmanager']['tag_removed']);
    } else {
        Response::responseWithError($errorMsg);
    }
};
开发者ID:serkin,项目名称:bugmanager,代码行数:18,代码来源:delete.php

示例6: parse_str

    parse_str(urldecode($request['form']), $form);
    $idProject = !empty($form['id_project']) ? $form['id_project'] : null;
    $code = !empty($form['code']) ? $form['code'] : null;
    $arr = !empty($form['translation']) ? $form['translation'] : array();
    if (empty($idProject)) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['empty_id_project'];
    } elseif (empty($code) || $isCodeValid($code) === false) {
        $result = false;
        $errorMsg = $app['i18n']['errors']['not_valid_project_code'];
    } else {
        $result = $app['foler']->saveTranslation($idProject, $code, $arr);
        $errorMsg = $app['foler']->getError();
    }
    if ($result) {
        Response::responseWithSuccess(array(), $app['i18n']['foler']['translation_saved']);
    } else {
        Response::responseWithError($errorMsg);
    }
};
// Source: config/footer.php
$app['foler'] = new Foler($app['config']['db']['dsn'], $app['config']['db']['user'], $app['config']['db']['password'], $app['i18n']);
try {
    $app['foler']->connect();
} catch (Exception $exc) {
    Response::responseWithError($exc->getMessage());
}
$i18n = $app['i18n'] = $app['i18n'][$app['locale']];
if (!empty($_REQUEST['action']) && isset($app['controllers'][$_REQUEST['action']])) {
    $app['controllers'][$_REQUEST['action']]($app, $_REQUEST);
    die;
开发者ID:serkin,项目名称:foler,代码行数:31,代码来源:foler.php


注:本文中的Response::responseWithSuccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。