Core.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Audit\Lib;
  3. use Dever;
  4. class Core
  5. {
  6. public function audit($id, $name, $data)
  7. {
  8. $audit = Dever::param('audit', $data);
  9. $info = Dever::db('audit/data')->one($id);
  10. $table = Dever::config('base')->type_table[$info['type']];
  11. $source = Dever::db($table)->one($info['data_id']);
  12. if ($source && $source['audit'] != $audit) {
  13. Dever::config('base')->after = false;
  14. Dever::db($table)->update(array('where_id' => $info['data_id'], 'audit' => $audit));
  15. }
  16. }
  17. public function status($id, $name, $data)
  18. {
  19. $status = Dever::param('status', $data);
  20. $info = Dever::db('audit/data')->one($id);
  21. $table = Dever::config('base')->type_table[$info['type']];
  22. $source = Dever::db($table)->one($info['data_id']);
  23. if ($source && $source['status'] != $status) {
  24. Dever::config('base')->after = false;
  25. Dever::db($table)->update(array('where_id' => $info['data_id'], 'status' => $status));
  26. }
  27. }
  28. }