APP 上線以后可能遇到的問題:
① APP 強退
② 數據加載失敗
③ APP 潛在問題
錯誤日志需要記錄的內容
數據表 error_log 字段:
id
app_id:app 類別 id
did:客戶端設備號
version_id:版本號
version_mini:小版本號
error_log:錯誤信息(由 APP 返回,客戶端開發工程師開發)
error.php 處理 app 錯誤日志
require_once('./common.php');
class ErrorLog extends Common {
public function index() {
$this->check();
$errorLog = isset($_POST['error_log']) ? $_POST['error_log'] : '';
if(!$errorLog) {
return Response::show(401, '日志為空');
}
$sql = "insert into
error_log(
`app_id`,
`did`,
`version_id`,
`version_mini`,
`error_log`,
`create_time`)
values(
".$this->params['app_id'].",
'".$this->params['did']."',
".$this->params['version_id'].",
".$this->params['version_mini'].",
'".$errorLog."',
".time()."
)";
$connect = Db::getInstance()->connect();
if(mysql_query($sql, $connect)) {
return Response::show(200, '錯誤信息插入成功');
} else {
return Response::show(400, '錯誤信息插入失敗');
}
}
}
$error = new ErrorLog();
$error->index();