/** * 查询天津时时彩 中三 组3形态 设定的号码 最后一次出现的位置 * @param $newest; 天津时时彩最新的数据位置; * @param $number; 设定的报警号码值; * @param $qishu; 设定的报警期数; * @return string|void */ private function tj_after_three_three_show($newest, $number, $qishu) { //设定号码 中三 组3 最新出现的位置 $result = Tjssc::find()->andWhere(['after_three_type' => 2])->andFilterWhere(['or', "three={$number}", "four={$number}", "five={$number}"])->orderBy('time DESC')->one(); //数据中 暂无 此号码在 出现过 - 数据库刚创建的情况才会出现 if (!$result) { echo '天津时时彩 后三 组3,当前数据库中暂没有出现过 ' . $number . ' 的号码' . "\r\n"; return false; } //计算有多少期没有开过 设定号码的奖了 $interval = Tjssc::find()->andWhere(['>', 'qishu', $result->qishu])->andWhere(['<=', 'qishu', $newest->qishu])->count(); //间隔期数 大于 或 等于 报警期数就报警 if ($interval >= $qishu) { echo '警告: 天津时时彩 - 后三 组3 - 预定号码:' . $number . ' 已经有' . $interval . ' 期未开奖了' . "\r\n"; //报警操作 return '警告: 天津时时彩 - 后三 组3 - 预定号码:' . $number . ' 已经有' . $interval . ' 期未开奖了' . "<br>"; } else { echo '天津时时彩 - 中三 后3 - 预定号码:' . $number . ' 已经有' . $interval . '期未开奖了' . "\r\n"; } return false; }
/** * 获取分组数据 */ private function getdate($type) { //查询选择时间的前2天数据 $name = $this->getUnit(\Yii::$app->request->post('cp_unit')); $val = \Yii::$app->request->post('cp_unit_val'); if ($type == 1) { //重庆时时彩 //查询选择号码 最新出现的位置 $newest = Cqssc::find()->where([$name => $val])->orderBy('time DESC')->limit(1)->select('time')->one(); if (!$newest) { //还没有出现过此号码 return false; } $end_time = $newest->time; $start_time = $end_time - 86400 * 2; // 比此号码出现的时间 - 2天的时间 $cqssc = Cqssc::find()->andWhere(['>=', 'time', $start_time])->andWhere(['<', 'time', $end_time])->orderBy('time ASC')->all(); $newCqssc = []; $number = 0; foreach ($cqssc as $key => $m) { if ($m->{$name} == $val) { $newCqssc[] = $m; $number = 1; } else { if ($number > 0 && $number < 2) { $newCqssc[] = $m; $number += 1; } if ($number == 2) { $number = 0; } } } /* $cqssc = Codeold::find()->andWhere(['>=','time',$start_time])->andWhere(['<','time',$end_time])->orderBy('time ASC')->all(); $newCqssc = []; $number = 0; foreach ($cqssc as $key=>$m){ //将开奖号中间的空格去掉 $code = str_replace(" ", '', $m->code); if($code[\Yii::$app->request->post('cp_unit') -1 ] == $val){ $newCqssc [] = $m; $number = 1; }else{ if($number>0 && $number<2){ $newCqssc [] = $m; $number += 1; } if($number == 2){ $number = 0; } } } */ return $newCqssc; } if ($type == 2) { //天津时时彩 //查询选择号码 最新出现的位置 $newest = Tjssc::find()->where([$name => $val])->orderBy('time DESC')->limit(1)->select('time')->one(); if (!$newest) { //还没有出现过此号码 return false; } $end_time = $newest->time; $start_time = $end_time - 86400 * 2; // 比此号码出现的时间 - 2天的时间 $tjssc = Tjssc::find()->andWhere(['>=', 'time', $start_time])->andWhere(['<=', 'time', $end_time])->orderBy('time ASC')->all(); $newTjssc = []; $number = 0; foreach ($tjssc as $key => $m) { if ($m->{$name} == $val) { $newTjssc[] = $m; $number = 1; } else { if ($number > 0 && $number < 2) { $newTjssc[] = $m; $number += 1; } if ($number == 2) { $number = 0; } } } return $newTjssc; } if ($type == 3) { //新疆时时彩 //查询选择号码 最新出现的位置 $newest = Tjssc::find()->where([$name => $val])->orderBy('time DESC')->limit(1)->select('time')->one(); if (!$newest) { //还没有出现过此号码 return false; } $end_time = $newest->time; $start_time = $end_time - 86400 * 2; // 比此号码出现的时间 - 2天的时间 $xjssc = Xjssc::find()->andWhere(['>=', 'time', $start_time])->andWhere(['<', 'time', $end_time])->orderBy('time ASC')->all(); $newXjssc = []; $number = 0; foreach ($xjssc as $key => $m) { if ($m->{$name} == $val) { $newXjssc[] = $m; $number = 1; } else { if ($number > 0 && $number < 2) { $newXjssc[] = $m; $number += 1; } if ($number == 2) { $number = 0; } } } return $newXjssc; } }