function act_getOrderTestById() { //获取传递ID参数 $id = isset($_GET['id']) ? $_GET['id'] : ""; if (empty($id)) { self::$errCode = "5001"; //action层的错误码 self::$errMsg = "id不能为空"; return false; } $list = OrderTestModel::getOrderTestById($id); if ($list) { return $list; } else { self::$errCode = OrderTestModel::$errCode; self::$errMsg = OrderTestModel::$errMsg; return false; } }
public static function getOrderTestById($id) { self::initDB(); if (empty($id)) { self::$errCode = "8002"; //设置另外一个错误码 self::$errMsg = "id不能为空"; return false; } $sql = "select * from order_testorder where id = '{$id}'"; $query = self::$dbConn->query($sql); if ($query) { $ret = self::$dbConn->fetch_array($query); return $ret; //成功, 返回列表数据 } else { self::$errCode = "8003"; self::$errMsg = "query error"; return false; //失败则设置错误码和错误信息, 返回false } }