NEED_LOGIN code add
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
|||||||
/.vscode
|
/.vscode
|
||||||
/vendor
|
/vendor
|
||||||
*.log
|
*.log
|
||||||
|
.env
|
||||||
59
app/controller/Down.php
Normal file
59
app/controller/Down.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\controller;
|
||||||
|
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
class Down
|
||||||
|
{
|
||||||
|
public function times()
|
||||||
|
{
|
||||||
|
$info = Db::name("config")->where("name","shengyu")->find();
|
||||||
|
if(empty($info) || empty($info['value'])){
|
||||||
|
return show("倒计时未设置");
|
||||||
|
}
|
||||||
|
$ints = strtotime($info["value"]) - time();
|
||||||
|
return show("获取成功",SUCCESS_CODE,[
|
||||||
|
"time"=>$ints,
|
||||||
|
"timeStr"=>$this->secondsToTime($ints)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将秒进行格式化
|
||||||
|
*@param $inputSeconds 秒数
|
||||||
|
*@return array
|
||||||
|
*/
|
||||||
|
function secondsToTime($inputSeconds) {
|
||||||
|
$secondsInAMinute = 60;
|
||||||
|
$secondsInAnHour = 60 * $secondsInAMinute;
|
||||||
|
$secondsInADay = 24 * $secondsInAnHour;
|
||||||
|
|
||||||
|
// extract days
|
||||||
|
$days = floor($inputSeconds / $secondsInADay);
|
||||||
|
|
||||||
|
// extract hours
|
||||||
|
$hourSeconds = $inputSeconds % $secondsInADay;
|
||||||
|
$hours = floor($hourSeconds / $secondsInAnHour);
|
||||||
|
|
||||||
|
// extract minutes
|
||||||
|
$minuteSeconds = $hourSeconds % $secondsInAnHour;
|
||||||
|
$minutes = floor($minuteSeconds / $secondsInAMinute);
|
||||||
|
|
||||||
|
// extract the remaining seconds
|
||||||
|
$remainingSeconds = $minuteSeconds % $secondsInAMinute;
|
||||||
|
$seconds = ceil($remainingSeconds);
|
||||||
|
|
||||||
|
// return the final array
|
||||||
|
$obj = array(
|
||||||
|
'd' => (int) $days,
|
||||||
|
'h' => (int) $hours,
|
||||||
|
'm' => (int) $minutes,
|
||||||
|
's' => (int) $seconds,
|
||||||
|
);
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,6 +17,17 @@ class Search
|
|||||||
}else{
|
}else{
|
||||||
$where = "id < ".$lastIndex;
|
$where = "id < ".$lastIndex;
|
||||||
}
|
}
|
||||||
|
$types = [1,2,3,4];
|
||||||
|
if(!empty($GLOBALS['data']['data']["type"])){
|
||||||
|
$type = $GLOBALS['data']['data']["type"];
|
||||||
|
if(!in_array($type, $types)){
|
||||||
|
return show("上传的类型不正确");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == 1) $where .= " and type = 1";
|
||||||
|
if($type == 2) $where .= " and type = 2";
|
||||||
|
if($type == 3) $where .= " and disabled = 1";
|
||||||
|
}
|
||||||
|
|
||||||
$KEY = $post['keywords'];
|
$KEY = $post['keywords'];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user