Exemple #1
0
 /**
  * 管理员登录
  */
 protected function login()
 {
     $username = $this->input->post('username', true);
     $password = $this->input->post('password', true);
     $this->_user->username = trim($username);
     $this->_user->password = $password;
     $modLogin = CModel::make('admin/loginman_model', 'loginman_model');
     $boolean = $modLogin->authenticate($this->_user);
     return $boolean === true && $modLogin->save();
 }
Exemple #2
0
 /**
  * 用户身份验证
  */
 public function _authentication()
 {
     if ($this->_user->isGuest) {
         $modelLogin = CModel::make('login_model');
         $return = $modelLogin->authLogin($this->_user);
         //申请授权并登录
         if ($return !== true) {
             CAjax::result($return);
             exit(0);
         }
     }
 }
Exemple #3
0
 static function matchOrigin($value)
 {
     static $rows = array();
     if (!$rows) {
         $modelGoods = CModel::make('goods_model');
         $rows = $modelGoods->getOrigin();
     }
     if ($rows) {
         foreach ($rows as $row) {
             if ($row['value'] == $value) {
                 return $row['name'];
             }
         }
     }
     return '';
 }
Exemple #4
0
 /**
  * 新增故事
  */
 public function append($openId, $data)
 {
     $return = false;
     $modelReg = CModel::make('register_model');
     $regRow = $modelReg->getRowByWId($openId);
     if ($regRow) {
         $content = $data['content'];
         $now = time();
         $value = array('register_id' => $regRow->id, 'wxid' => $openId, 'digest' => mb_substr($content, 32), 'create_time' => $now, 'update_time' => $now);
         $return = $this->db->insert('mhr_story', $value);
         if ($return == true) {
             $value = array('story_id' => $this->db->insert_id(), 'content' => $content, 'update_time' => $now);
             $return = $this->db->insert('mhr_story_content', $value);
         }
     }
     return $return;
 }
Exemple #5
0
 public function __construct()
 {
     parent::__construct();
     $this->_modelSys = CModel::make('admin/sysman_model', 'sysman_model');
     $this->_route = $this->input->get('r', true);
 }
Exemple #6
0
 public function __construct()
 {
     parent::__construct();
     $this->_modelOrder = CModel::make('admin/orderman_model', 'orderMan_model');
 }
Exemple #7
0
 public function __construct()
 {
     parent::__construct();
     $this->_modelRegister = CModel::make('admin/registerman_model', 'registerman_model');
 }
Exemple #8
0
 public function __construct()
 {
     parent::__construct();
     $this->_modelstory = CModel::make('admin/storyman_model', 'storyman_model');
 }
Exemple #9
0
 public function __construct()
 {
     parent::__construct();
     $this->_modelPay = CModel::make('admin/payman_model', 'payMan_model');
 }
Exemple #10
0
 /**
  * 设置管理员密码
  */
 public function setPassword($id, $password)
 {
     if (strlen($password) <= 0) {
         return false;
     }
     $id = (int) $id;
     $sql = "select id from mic_user where isdel=0 and id=?";
     $query = $this->db->query($sql, array($id));
     if (!$query->row()) {
         return false;
     }
     $model = CModel::make('login_model');
     $password = $model->hashPassword($password);
     $sql = "update mic_user set password=? where isdel=0 and id={$id}";
     $return = $this->db->query($sql, array($password));
     return $return;
 }
Exemple #11
0
 public function __construct()
 {
     parent::__construct();
     $this->_modelItem = CModel::make('admin/itemman_model', 'itemman_model');
 }