zoukankan      html  css  js  c++  java
  • PHP开发APP接口(十)

    错误日志接口

    主要是为了解决面临的错误问题:
    1.APP强退、
    2.数据加载失败
    3.APP潜在问题

    CREAT TABLE `err_log`(
        id int(16),
        app_id int(16),
        did int(16),
        version_id int(16),
        version_mini smallint(4),
        err_log text
    )ENGINE = InnoDB CHARSET = utf8;

    把错误信息获取直接插如数据库

    vim error.php
    <?php
    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`,
                `creat_time`) values
            ('.
                $this->params['app_id'].',"'.
                $this->params['did'].'",'.
                $this->params['version_id'].','.
                $this->params['version_mini'].',"'.
                $errorLog.'",'.time().
                ')';
            $connect = Ndb::getInstance()->connect();
            $result = mysql_query($sql,$connect);

            if($result) {
                return Response::show(200,'错误信息插入成功');
            }else{
                return Response::show(400,'错误信息插入失败');
            }

        }
    }

  • 相关阅读:
    排序算法之--堆排序
    排序算法之--插入排序
    排序算法之--直接选择排序
    排序算法之--快速排序(及优化测试亿级100_000_000用时)
    分布式计算--(分布式+多进程+多线程+多协程)
    HDU
    2019牛客多校第四场D-triples I 贪心
    Interview_C++_day8
    Interview_C++_day7
    Interview_C++_day6
  • 原文地址:https://www.cnblogs.com/eis13/p/5555906.html
Copyright © 2011-2022 走看看