更新,此代码有效,用于在用户达到Tiecket / messages / Request限制后执行指定表的更新
public function resetChecks($u_id)
{
$u_data = $this->user_model->getData($u_id);//user id also you use a session save data for the user id
$time = 86400; // 86400 = 1 day
$now = time();//Current time
//(current time - last request)
$time_passed = ($now-$u_data->last_check_time);
if($time_passed >= $time){
return true;
}else{
//resp' falsa
return false;
}
}
public function upcheck($u_id)
{
if($this->functions->resetChecks($u_id) === true){
$data = array('u_checks' => '0', 'last_check_time' => '0');
$this->db->where('user_id', $u_id);
$this->db->update('users', $data);
return true;
}else{
return false;
}
}