protected function _save($data) { $db = new MsgsModel(); if ($db->add($data)) { echo "<div class='center'><br><br><img src='Public/success.jpg' /><br><br>发送成功!</div>"; } else { echo "<div class='center'><br><br><img src='Public/error.jpg' /><br><br>呃,服务器开小差了~~~稍后再试··</div>"; } }
public function viewMsg() { $map['id'] = $_GET['id']; $db = new MsgsModel(); $rs = $db->where($map)->find(); $this->assign('rs', $rs); $date['flag'] = 1; //标记为已读; if ($rs['flag'] == 0) { $db->where($map)->save($date); } $this->display("WapAdmin:viewMsg"); }
public function view() { $map['id'] = $_GET['id']; $db = new MsgsModel(); $rs = $db->where($map)->find(); if ($rs['id'] === null || $rs['id'] === false) { $this->error('你查看的短信不存在,或者已经删除!'); } $this->assign('rs', $rs); $this->display('Index:viewMsg'); $data['flag'] = 1; $db->where($map)->save($data); }
public function save() { $db = new MsgsModel(); import("ORG.Util.Input"); $data['text'] = Input::deleteHtmlTags($_POST['text']); $data['time'] = date("Y-m-d H:i:s"); $data['ip'] = $this->getIp(); // if ($db->add($data)) { echo "<div id='sendmsg' class='center'>发送成功!</div>"; //dump($data); } else { echo "<div id='sendmsg' class='center red'>呃,服务器开小差了~~~稍后再试··</div>"; } }
protected function msgCount() { $db = new MsgsModel(); $count = $db->where('flag=0')->count(); if ($count != 0) { $count = "<span class='red'>(" . $count . ")</span>"; } else { unset($count); } $this->assign('msg_count', $count); }
public function sendMsg() { $db = new MsgsModel(); $db->create(); if (!$db->add()) { $this->gError('发送短信时出现错误 ' . $db->getError(), 'index'); } else { $this->gSuccess('发送成功!', 'index'); } }