作者 wangzhi

222

... ... @@ -9,8 +9,7 @@ use fast\Random;
use think\Config;
use app\common\model\Attachment;
use addons\qiniu\library\Auth;
use think\Db;
/**
* 公共接口
*/
... ... @@ -23,8 +22,8 @@ class Common extends Api
* 加载初始化
*
* @param string $version 版本号
* @param string $lng 经度
* @param string $lat 纬度
* @param string $lng 经度
* @param string $lat 纬度
*/
public function init()
{
... ... @@ -32,10 +31,10 @@ class Common extends Api
$lng = $this->request->request('lng');
$lat = $this->request->request('lat');
$content = [
'citydata' => Area::getCityFromLngLat($lng, $lat),
'citydata' => Area::getCityFromLngLat($lng, $lat),
'versiondata' => Version::check($version),
'uploaddata' => Config::get('upload'),
'coverdata' => Config::get("cover"),
'uploaddata' => Config::get('upload'),
'coverdata' => Config::get("cover"),
];
$this->success('', $content);
} else {
... ... @@ -115,7 +114,7 @@ class Common extends Api
$sha1 = sha1_file($filePath);
$imagewidth = $imageheight = 0;
if (in_array($suffix, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf','pdf'])) {
if (in_array($suffix, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf', 'pdf'])) {
$imgInfo = getimagesize($splInfo->getPathname());
$imagewidth = isset($imgInfo[0]) ? $imgInfo[0] : $imagewidth;
$imageheight = isset($imgInfo[1]) ? $imgInfo[1] : $imageheight;
... ... @@ -173,4 +172,21 @@ class Common extends Api
}
return;
}
//每天清空日搜索
public function delete_day_so()
{
$beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));
// Db::name('so_level_day')->where(['createtime','<',$beginToday])->delete();
Db::name('so_level_day')->where(['createtime','<',1594955100])->delete();
}
//每周清空周搜索
public function delete_month_so()
{
$beginWeek = mktime(0,0,0,date("m"),date("d")-date("w")+1,date("Y"));
Db::name('so_level_month')->where(['createtime','<',$beginWeek])->delete();
}
}
... ...