public function fetch() { $push = new \Hnust\Analyse\Push(); $this->data = $push->fetch($this->uid); }
public function push() { $type = \Hnust\input('type'); $key = \Hnust\input('key'); $id = \Hnust\input('id'); $uid = \Hnust\input('uid'); $mode = \Hnust\input('mode'); $title = \Hnust\input('title'); $content = \Hnust\input('content'); $success = \Hnust\input('success'); //初始化推送对象 $push = new \Hnust\Analyse\Push(); //添加推送 if ('add' === $type) { $data = $push->add($uid, $mode, $title, $content, $success); $push->socket($data); $this->msg = '系统提示'; $this->data = '添加推送成功'; //重置推送 } elseif ('reset' === $type) { $data = $push->reset($id); if ('0' == $data['received']) { $push->socket($data); } $this->code = Config::RETURN_NORMAL; //删除推送 } elseif ('delete' === $type) { $push->delete($id); $this->code = Config::RETURN_NORMAL; //获取推送列表 } else { $sql = "SELECT `p`.`id`, `p`.`uid`, `s`.`name`, `p`.`type`, `p`.`title`, `p`.`content`,\n `p`.`success`, `p`.`received`, `p`.`time`, `p`.`upTime` FROM `push` `p`\n LEFT JOIN `student` `s` ON `s`.`sid` = `p`.`uid`\n WHERE CONCAT_WS(',', `p`.`uid`, `s`.`name`, `p`.`title`, `p`.`content`, `p`.`success`) LIKE ?\n ORDER BY `p`.`id` DESC"; $result = Mysql::paging($sql, array("%{$key}%"), $this->page); $this->data = $result['data']; $this->info = array_merge($result['info'], array('type' => $type, 'key' => $key)); } }