__construct()
__construct() : void
Class constructor
公共控制器
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* 公共控制器
*/
class My_model extends CI_Model
{
public function __construct()
{
parent::__construct();
$this->load->model('Webcommon_model', 'common');
$this->load->model('Usercount_model','count');
$this->load->model('Userpoints_model','userpoints');
}
/**
* 登录验证
*/
public function islogin(){
$token = $this->input->get_post('token');
$userId = $this->input->get_post('userId');
$topicId = $this->input->get_post('topicId');
if(empty($token) || empty($userId))
{
echo $this->common->returnArray ( array ( 'list' => '' ), '请先登录', 3 );exit;
}
$this->common->getLoginStuate($userId, $token);//登录账户验证,互踢
}
/**
* 积分充值
*/
public function jifeadd($userId,$jifen=0,$msg,$typeFlag=1,$flag=2,$articleId=0){
$countuserdata = array(
'userId' => $userId,
'operandType' =>$msg,
'listId' => $articleId,
'operandNum' => $jifen,
'typeFlag' => $typeFlag,
'changeTime' => time(),
'flag'=> 2
);
$this->userpoints->insertData( $countuserdata );
$bool = $this->count->updateNum(array('jifenNum'=>'jifenNum+'.$jifen),$userId);
return $bool;
}
}