uid = Dever::load('passport/user')->check(false); if ($this->uid <= 0) { $this->uid = 1; } if ($this->uid) { $this->user = Dever::load('passport/api')->info($this->uid); } else { $this->user = Dever::load('passport/user')->init(); $this->uid = $this->user['id']; } if ($this->user) { $this->user['uid'] = $this->user['id']; } } public function checkLogin() { if (!$this->uid || $this->uid <= 0) { Dever::alert('请先登录', -2); } } public function alert($state) { if ($state) { return array('msg' => 'ok'); } else { Dever::alert('操作失败'); } } # 获取记录的月份列表 public function month($table) { $data = Dever::db($table)->find(array('order' => array('id' => 'asc'))); if ($data) { $month = date('Ym', $data['cdate']); $cur = date('Ym'); if ($month == $cur) { $result[] = $month; return $result; } else { $result = array(); for ($i = $month; $i < $cur; $i++) { if ($i > 12) { } $result[] = $i; } return $result; } } } }