meetingModel.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. class meetingClassModel extends Model
  3. {
  4. public $hyarra, $ytarra, $hyarrb;
  5. public function initModel()
  6. {
  7. $this->hyarra = array('正常', '会议中', '结束', '取消');
  8. $this->ytarra = array('待进行', '待进行', '进行中', '已结束');
  9. $this->hyarrb = array('green', 'blue', '#ff6600', '#888888');
  10. }
  11. /**
  12. * 判断会议室是否重复申请了
  13. */
  14. public function isapplymsg($startdt, $enddt, $hyname, $id=0, $meetType=1)
  15. {
  16. $msg = '';
  17. if ($meetType == 1) {
  18. $sql = /** @lang text */
  19. 'select id, meeting_room, start_time, end_time, title
  20. from xinhu_meeting where id <> '.$id.' and meet_state in (0, 1)
  21. union all
  22. select id, meeting_room, start_time, end_time, title
  23. from xinhu_meeting_key where meet_state in (0, 1)';
  24. } else {
  25. $sql = /** @lang text */
  26. 'select id, meeting_room, start_time, end_time, title
  27. from xinhu_meeting where meet_state in (0, 1)
  28. union all
  29. select id, meeting_room, start_time, end_time, title
  30. from xinhu_meeting_key where id <> '.$id.' and meet_state in (0, 1)';
  31. }
  32. m('log')->addlog("验证", $sql);
  33. $rows = $this->db->getall($sql);
  34. foreach($rows as $k=>$rs){
  35. if($rs['meeting_room'] != $hyname)continue;
  36. $sdt = $rs['start_time'];
  37. $edt = $rs['end_time'];
  38. m('log')->addlog("验证", json_encode($rs));
  39. if(
  40. ($sdt<=$startdt && $edt>$startdt)
  41. || ($sdt<$enddt && $edt>=$enddt)
  42. || ($sdt>$startdt && $edt<$enddt)
  43. || ($sdt==$startdt && $edt==$enddt)
  44. )$msg = '该会议室的时间段已被申请过了,主题“'.$rs['title'].'”';
  45. }
  46. return $msg;
  47. }
  48. public function firstMeetingTopicStart($meeting_id) {
  49. $topic = m('meeting_topics')->getone("mid={$meeting_id}", "id", 'sort');
  50. if (isset($topic['id'])) {
  51. m('meeting_topics')->update(['topic_state'=>'2'], 'id='.$topic['id']);
  52. }
  53. }
  54. // 会议室状态
  55. public function getstatezt($zt)
  56. {
  57. if (isset($this->hyarrb[$zt])) {
  58. $html = '<font color="'.$this->hyarrb[$zt].'">'.$this->hyarra[$zt].'</font>';
  59. return $html;
  60. } else {
  61. return null;
  62. }
  63. }
  64. }