$sql = "select * from ybuser where run='1' "; $re0 = $mysqli->query($sql); if ($re0) { if ($re0->num_rows >= 1) { $h = date("H"); while ($row2 = $re0->fetch_array()) { if ($row2['runtime1'] <= $h && $row2['runtime2'] >= $h || $row2['runtime1'] == $row2['runtime2'] && $row2['runtime1'] == 0) { //在运行时间内的 if ($row2['state'] == 1 && $row2['dayin'] == 1) { //上次正常运行的,且开启动态功能 if (date("Y-m-d") != date("Y-m-d", $row2['lastdayintime'] == '' ? time() : $row2['lastdayintime'])) { //今天未签到 $json = $YIBAN->getLogin($row2['ybuser']); if (is_array($json) && $json['code'] == 200 && array_key_exists('isLogin', $json['data']) && $json['data']['isLogin'] == 1) { //检测登录状态成功 $re = $YIBAN->DayIn($row2['ybuser']); if (is_array($re) && array_key_exists('code', $re) && $re['code'] == 202) { //已经签到 $m = "lastdayintime='" . time() . "',state='1'"; $sql = "UPDATE `ybuser` SET {$m} where id='{$row2['id']}'"; $re2 = $mysqli->query($sql); echo __LINE__ . '.'; } elseif (is_array($re) && array_key_exists('code', $re) && $re['code'] == 200 && array_key_exists('subCode', $re['data']) && $re['data']['subCode'] == 1) { //此时我们执行了签到操作 $m = "lastdayintime='" . time() . "',state='1'"; $sql = "UPDATE `ybuser` SET {$m} where id='{$row2['id']}'"; $re2 = $mysqli->query($sql); echo __LINE__ . '.'; } else { //签到失败 echo __LINE__ . '.';