表构造
/连续签到的实现办法/
public function signList(){
/先查到是否有这个用户/
$m_id = $_GET['m_id'];
$sign = D('Sign')->where(array(\"大众m_id\公众=>$m_id))->limit(0)->find();
/如果有就进行判断韶光差,然后处理签到次数/
if($sign){
/昨天的韶光戳韶光范围/
$t = time();
$last_start_time = mktime(0,0,0,date(\"大众m\"大众,$t),date(\公众d\公众,$t)-1,date(\公众Y\"大众,$t));
$last_end_time = mktime(23,59,59,date(\公众m\"大众,$t),date(\"大众d\公众,$t)-1,date(\公众Y\"大众,$t));
/本日的韶光戳韶光范围/
// $now_start_time = mktime(0,0,0,date(\公众m\"大众,$t),date(\"大众d\"大众,$t),date(\公众Y\"大众,$t));
// $now_end_time = mktime(23,59,59,date(\"大众m\公众,$t),date(\公众d\公众,$t),date(\"大众Y\公众,$t));
/判断末了一次签到韶光是否在昨天的韶光范围内/
if($last_start_time<$sign['time']&&$sign['time']<$last_end_time){
$da['time'] = time();
$da['count'] = $sign['count']+1;
/这里还可以加一些判断连续签到几天然后加积分等等的操作/
D('Sign')->where(array(\"大众m_id\"大众=>$m_id))->save($da);
}else{
/返回已经签到的操作/
$da['time'] = time();
$da['count'] = 0;
D('Sign')->where(array(\公众m_id\"大众=>$m_id))->save($da);
}
}else{
$data['m_id'] = $m_id;
$data['time'] = time();
$data['sign'] = 1;
$res = D(\公众Sign\"大众)->add($data);
if($res){
/成功就返回,或者处理一些程序,比如加积分/
}
} }