LogModel.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class LogModel extends Model
  5. {
  6. protected $name = 'log';
  7. /**
  8. * 删除日志
  9. */
  10. public function delLog($log_id)
  11. {
  12. try{
  13. $this->where('log_id', $log_id)->delete();
  14. writelog('日志【ID='.$log_id.'】删除成功',200,'','','true');
  15. return ['code' => 200, 'data' => '', 'msg' => '删除日志成功'];
  16. }catch( PDOException $e){
  17. writelog('日志【ID='.$log_id.'】删除失败',100,'','','true');
  18. return ['code' => 100, 'data' => '', 'msg' => '删除日志失败'];
  19. }
  20. }
  21. /**
  22. * batchDelLog 批量删除日志
  23. * @param $param
  24. * @return array
  25. */
  26. public function batchDelLog($param){
  27. try{
  28. LogModel::destroy($param);
  29. writelog('日志批量删除成功',200,'','','true');
  30. return ['code' => 200, 'data' => '', 'msg' => '批量删除成功'];
  31. }catch( PDOException $e){
  32. writelog('日志批量删除失败',100,'','','true');
  33. return ['code' => 100, 'data' => '', 'msg' => '批量删除失败'];
  34. }
  35. }
  36. }