1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace Main\Lib;
- use Dever;
- class Core
- {
- protected $uid = -1;
- protected $use = array();
- protected $data = array();
- public function __construct()
- {
- $this->uid = Dever::load('passport/user')->check(false);
- $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('操作失败');
- }
- }
- }
|