todoModel.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * 消息提醒的应用
  4. */
  5. class agent_todoClassModel extends agentModel
  6. {
  7. public function initModel()
  8. {
  9. $this->settable('todo');
  10. }
  11. public function gettotal()
  12. {
  13. $stotal = $this->getdbtotal($this->adminid);
  14. $titles = '';
  15. return array('stotal'=>$stotal,'titles'=> $titles);
  16. }
  17. private function getdbtotal($uid)
  18. {
  19. $optdt = $this->rock->now;
  20. $stotal = $this->rows("uid='$uid' and `status`=0 and `tododt`<='$optdt'");
  21. return $stotal;
  22. }
  23. protected function agenttotals($uid)
  24. {
  25. return array(
  26. 'wdtodo' => $this->getdbtotal($uid)
  27. );
  28. }
  29. //数据读取应用
  30. protected function agentdata($uid, $lx)
  31. {
  32. $where = '';
  33. if($lx=='wdtodo')$where='and `status`=0';
  34. if($lx=='allydu'){
  35. $this->update("`status`=1", "uid='$uid' and `status`=0");
  36. }
  37. $key = $this->rock->post('key');
  38. if(!isempt($key))$where.=" and (`title`='$key' or `mess` like '%$key%')"; //关键词搜索
  39. $arr = $this->getlimit("uid='$uid' $where", $this->page,'*', 'id desc', $this->limit);
  40. $rows = $arr['rows'];
  41. $darr = array();
  42. foreach($rows as $k=>$rs){
  43. $statustext = '已读';
  44. $statuscolor = '#aaaaaa';
  45. if($rs['status']=='0'){
  46. $statustext = '未读';
  47. $statuscolor = 'red';
  48. }
  49. $cont = $rs['mess'];
  50. $xiangurl = '';
  51. if(!isempt($rs['modenum']) && !isempt($rs['mid']) && $rs['mid']>'0'){
  52. $xiangurl = 'task.php?a=x&num='.$rs['modenum'].'&mid='.$rs['mid'].'';
  53. }
  54. $darr[] = array(
  55. //'id' => $rs['id'],
  56. 'optdt' => $rs['optdt'],
  57. 'title' => $rs['title'],
  58. 'cont' => $cont,
  59. 'xiangurl' => $xiangurl,
  60. 'ishui' => ($rs['status']=='1')?1:0,
  61. 'statustext'=>$statustext,
  62. 'statuscolor'=>$statuscolor,
  63. );
  64. }
  65. $arr['rows'] = $darr;
  66. return $arr;
  67. }
  68. }
粤ICP备19079148号