action_log.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. class action_log extends DooModel {
  4. public $aid;
  5. public $updatetime;
  6. public $time;
  7. public $action;
  8. public $sid;
  9. public $class;
  10. public $cid;
  11. public $status;
  12. public $districtid;
  13. public $city;
  14. public $province;
  15. public $nature;
  16. public $company;
  17. public $_table = 'CLD_action_log';
  18. public $_primarykey = 'aid';
  19. public $_fields = array('aid', 'updatetime','time', 'action','sid','class','cid','status','districtid','city','province','nature','company');
  20. public $iconGenerate="iconGenerate";
  21. public $iconReceive="iconReceive";
  22. public $iconBorrow="iconBorrow";
  23. public $iconSell="iconSell";
  24. public $iconUpdate="iconUpdate";
  25. public $iconReplace="iconReplace";
  26. public $iconRecycle="iconRecycle";
  27. public $iconLock="iconLock";
  28. public $iconContacts="iconContacts";
  29. /**
  30. * 拷贝日志表到存储
  31. */
  32. function copyActionLogToBakTable($tableNmae=''){
  33. if (empty($tableNmae))
  34. return '';
  35. $sql = "SELECT table_name FROM information_schema.TABLES WHERE table_name ='".$tableNmae."'" ;
  36. $query = Doo::db ()->query ( $sql );
  37. $result = $query->fetch ();
  38. if (!empty($result))
  39. return '';
  40. $sql = "create table ".$tableNmae." as (select * from ".$this->_table.")" ;
  41. $query = Doo::db ()->query ( $sql );
  42. }
  43. function delActionLogByAid($aid=''){
  44. if (empty($aid))
  45. return '';
  46. $sql ="DELETE FROM " . $this->_table . " WHERE `aid`>".$aid;
  47. $query = Doo::db ()->query ( $sql );
  48. }
  49. function getClientByCid($cid){
  50. $sql = "select * from " . $this->_table . " as a left join CLD_staff as b on (a.sid=b.sid) where a.cid= '".$cid."' " ;
  51. $query = Doo::db ()->query ( $sql );
  52. $result = $query->fetch ();
  53. return $result;
  54. }
  55. function getClientByStaff($condition,$limit){
  56. $sql = "select * from " . $this->_table . " as a left join CLD_client as b on (a.cid=b.cid) where 1 ".$condition." ".$limit ;
  57. $query = Doo::db ()->query ( $sql );
  58. $result = $query->fetchAll ();
  59. return $result;
  60. }
  61. public function getProject(){
  62. return $this->find ( array ('asc' => 'pid', 'asArray' => TRUE ) );
  63. }
  64. public function getProjectByIdList($projectid){
  65. return $this->find ( array ('where' => "pid= '".$projectid."'", 'asArray' => TRUE ) );
  66. }
  67. }
  68. ?>