Commit 2b5b0393 by 叶明星

去掉多余的东西

parent 421b9c96
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Log;
use Laravel\Lumen\Routing\Controller as BaseController;
class Controller extends BaseController
{
public function Export( $Errcode=0, $ErrMsg='', $dataArr=[]) {
if(!empty($dataArr) && !is_array($dataArr)) return json_encode(['errcode'=>-1,'errmsg'=>'系统错误']);
public function apiReturn($Errcode = 0, $level = 1 , $dataArr = '') {
//生成错误码
$Errcode = $this->Errcode($Errcode , $level);
//获取错误描述
$ErrMsg = config('errmsg.cn.'.$Errcode);
//上报错误
$data=['errcode'=>$Errcode, 'errmsg'=>$ErrMsg];
if(!empty($dataArr)) foreach ($dataArr as $k=>$v) $data[$k]=$v;
//非正常返回码,上报
if(($data['errcode'] < 10000 || $data['errcode'] >= 50000) && $data['errcode'] !==0 ){
try{
ErrorLog($Errcode,$ErrMsg);
}catch (\Exception $e){
Log::info($e);
}
}
if(!empty($dataArr) && is_array($dataArr)){
foreach ($dataArr as $k=>$v){
$data['data'][$k]=$v;
}
}else{
$data['data'] = $dataArr;
}
return json_encode($data);
}
......@@ -17,8 +40,8 @@ class Controller extends BaseController
* @param int $level 错误级别 1普通错误 5需关注错误 9致命错误,急需解决
* @return int
*/
protected function ProduceErrcode( $code='0',$level=1){
if($code=='0') return 0;
protected function Errcode( $code = 0,$level=1){
if($code === 0) return 0;
$SystemCode=config('website.SystemCode');
return errCode($code,$level,$SystemCode);
}
......
......@@ -84,7 +84,6 @@ $app->middleware([
// $app->register(App\Providers\AuthServiceProvider::class);
// $app->register(App\Providers\EventServiceProvider::class);
$app->register(Illuminate\Redis\RedisServiceProvider::class);
$app->register(Jenssegers\Mongodb\MongodbServiceProvider::class);
$app->register(Hhxsv5\LaravelS\Illuminate\LaravelSServiceProvider::class);
$app->withEloquent();
/*
......@@ -99,10 +98,11 @@ $app->withEloquent();
*/
$app->configure('website');
$app->configure('database');
$app->configure('errmsg');
LogReport::$suffix = '_'.env('LARAVELS_LISTEN_PORT', '');
LogReport::$app_name = env('ELK_NAME','');
LogReport::$log_path = realpath(__DIR__ . '/../').'/storage/logs/LogReport/';
require_once __DIR__.'/../app/Http/function.php';
$app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
......
<?php
return [
'cn'=>[
-1 => '系统错误',
0 => 'ok',
]
];
......@@ -18,9 +18,5 @@ $router->get('/', function () use ($router) {
$router->post('/synchronization', 'ServicesController@synchronization');
$router->post('/ladderprice', 'ServicesController@ladderprice');
$router->post('/uuid', 'ServicesController@uuid');
$router->post('/self/sample/class/list', 'ServicesController@SelfSampleClassList');
$router->post('/self/sample/list', 'ServicesController@SelfSampleList');
$router->post('/get_new_customer_limit', 'ServicesController@getnewCustomerLimit');
40102
\ No newline at end of file
33613
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment