wangtengyu
2018-12-03 0350944842085cb543c992b1a4c61d063be3c09a
加入接口异常处理
1 files modified
25 ■■■■■ changed files
api/userApi.php 25 ●●●●● patch | view | raw | blame | history
api/userApi.php
@@ -16,16 +16,21 @@
    switch ($retData["rspCode"]){
        case "e00000":
            $userApi = new UserApi();
            switch (getUrl($_SERVER['REQUEST_URI']))
            {
                case "getUserList":
                    $retData["rspData"] = $userApi->getUserList($retData["repData"]);
                    break;
                case "getUserOrderList":
                    $retData["rspData"] = $userApi->getUserOrderList($retData["repData"]);
                    break;
                default: http_response_code(404);
            }
            try {
                switch (getUrl($_SERVER['REQUEST_URI']))
                {
                    case "getUserList":
                        $retData["rspData"] = $userApi->getUserList($retData["repData"]);
                        break;
                    case "getUserOrderList":
                        $retData["rspData"] = $userApi->getUserOrderList($retData["repData"]);
                        break;
                    default: http_response_code(404);
                }
            } catch (Exception $e){
                $retData["rspCode"] = "e99999";
                $retData["rspData"] = $e->getMessage();
            }
            break;
        case "e00001":
            $retData["rspMsg"]="接入平台不存在";