|
|
@@ -30,7 +30,6 @@ class Index extends Api
|
|
|
public function vocs()
|
|
|
{
|
|
|
$req=$this->request->param();
|
|
|
- Log::record($req);
|
|
|
|
|
|
$time = date('Y/m/d H:i:s');
|
|
|
$rows = $req;
|
|
|
@@ -55,9 +54,10 @@ class Index extends Api
|
|
|
//单个日志文件的大小限制,超过后会自动记录到第二个文件
|
|
|
'file_size' =>2097152,
|
|
|
//日志的时间格式,默认是` c `
|
|
|
- 'time_format' =>'c'
|
|
|
+ 'time_format' =>'c',
|
|
|
+ 'level' => ['log'],
|
|
|
]);
|
|
|
- Log::record($req);
|
|
|
+ Log::record(['失败'=>'样品编号为'.$res['data_txt_name'].'数据插入失败','原因'=>'该文件编号不以ABCD开头']);
|
|
|
return $this->success('数据文件不以A、B、C、D开头,已记录日志',$req,0);
|
|
|
}
|
|
|
foreach($rows as $k=>$v){
|
|
|
@@ -343,11 +343,12 @@ class Index extends Api
|
|
|
|
|
|
//提交事务
|
|
|
db()->commit();
|
|
|
+ Log::record(['成功'=>'样品编号为'.$res['data_txt_name'].'数据插入成功']);
|
|
|
return json_encode(['code'=>'0','msg'=>'成功','time'=>$time,'data'=>[$res,$row]]);
|
|
|
} catch (\Exception $e){
|
|
|
//失败回滚
|
|
|
db()->rollback();
|
|
|
- Log::record($e->getMessage());
|
|
|
+ Log::record(['失败'=>'样品编号为'.$res['data_txt_name'].'数据插入失败','原因'=>$e->getMessage()]);
|
|
|
return $e->getMessage();
|
|
|
}
|
|
|
|
|
|
@@ -548,12 +549,12 @@ class Index extends Api
|
|
|
|
|
|
//提交事务
|
|
|
db()->commit();
|
|
|
-
|
|
|
+ Log::record(['成功'=>'样品编号为'.$res['data_txt_name'].'数据插入成功']);
|
|
|
return json_encode(['code'=>'0','msg'=>'成功','time'=>$time,'data'=>[$res,$row]]);
|
|
|
} catch (\Exception $e){
|
|
|
//失败回滚
|
|
|
db()->rollback();
|
|
|
- Log::record($e->getMessage());
|
|
|
+ Log::record(['失败'=>'样品编号为'.$res['data_txt_name'].'数据插入失败','原因'=>$e->getMessage()]);
|
|
|
return $e->getMessage();
|
|
|
}
|
|
|
|
|
|
@@ -567,7 +568,6 @@ class Index extends Api
|
|
|
public function updateVocs()
|
|
|
{
|
|
|
$req=$this->request->param();
|
|
|
- Log::record($req);
|
|
|
|
|
|
$time = date('Y/m/d H:i:s');
|
|
|
$rows = $req;
|
|
|
@@ -863,14 +863,13 @@ class Index extends Api
|
|
|
|
|
|
//提交事务
|
|
|
db()->commit();
|
|
|
+ Log::record(['成功'=>'样品编号为'.$res['data_txt_name'].'数据插入成功']);
|
|
|
return json_encode(['code'=>'0','msg'=>'修改成功','time'=>$time,'data'=>[$res,$row]]);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
} catch (\Exception $e){
|
|
|
//失败回滚
|
|
|
db()->rollback();
|
|
|
- Log::record($e->getMessage());
|
|
|
+ Log::record(['失败'=>'样品编号为'.$res['data_txt_name'].'数据插入失败','原因'=>$e->getMessage()]);
|
|
|
return $e->getMessage();
|
|
|
}
|
|
|
}else{
|
|
|
@@ -1072,12 +1071,13 @@ class Index extends Api
|
|
|
|
|
|
//提交事务
|
|
|
db()->commit();
|
|
|
+ Log::record(['成功'=>'样品编号为'.$res['data_txt_name'].'数据插入成功']);
|
|
|
return json_encode(['code'=>'0','msg'=>'修改成功','time'=>$time,'data'=>[$res,$row]]);
|
|
|
}
|
|
|
} catch (\Exception $e){
|
|
|
//失败回滚
|
|
|
db()->rollback();
|
|
|
- Log::record($e->getMessage());
|
|
|
+ Log::record(['失败'=>'样品编号为'.$res['data_txt_name'].'数据插入失败','原因'=>$e->getMessage()]);
|
|
|
return $e->getMessage();
|
|
|
}
|
|
|
}else{
|