Commit f7a17a64 authored by hujun's avatar hujun

删除无效视频

parent 90466652
...@@ -37,6 +37,18 @@ class GHousesVideo extends BaseModel ...@@ -37,6 +37,18 @@ class GHousesVideo extends BaseModel
return $num; return $num;
} }
/**
* @param $data
* @param $where
* @return int|string
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function updateData($data, $where)
{
return $this->db_->where($where)->update($data);
}
public function getHouseVideoList($pageNo,$pageSize,$field,$params) public function getHouseVideoList($pageNo,$pageSize,$field,$params)
{ {
$order = "a.create_time desc"; $order = "a.create_time desc";
......
...@@ -609,6 +609,7 @@ Route::group('task', [ ...@@ -609,6 +609,7 @@ Route::group('task', [
'updateForActivityBegins' => ['task/UpdateActivityTask/updateForActivityBegins', ['method' => 'get']], 'updateForActivityBegins' => ['task/UpdateActivityTask/updateForActivityBegins', ['method' => 'get']],
'updateCouponExpired' => ['task/UpdateCouponTask/updateCouponExpired', ['method' => 'get']],//超过有效期的券改过期 'updateCouponExpired' => ['task/UpdateCouponTask/updateCouponExpired', ['method' => 'get']],//超过有效期的券改过期
'delHouseVideo' => ['task/JobTask/delHouseVideo', ['method' => 'get']],//删除无效视频
]); ]);
Route::group('broker', [ Route::group('broker', [
......
...@@ -5,6 +5,7 @@ namespace app\task\controller; ...@@ -5,6 +5,7 @@ namespace app\task\controller;
use app\index\service\ImageDepotService; use app\index\service\ImageDepotService;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesExt; use app\model\GHousesExt;
use app\model\GHousesVideo;
use app\model\GImageDepot; use app\model\GImageDepot;
use app\model\GLandlordPhone; use app\model\GLandlordPhone;
use think\Image; use think\Image;
...@@ -188,4 +189,34 @@ class JobTask ...@@ -188,4 +189,34 @@ class JobTask
unset($save_data); unset($save_data);
} }
} }
/**
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function delHouseVideo()
{
set_time_limit(0);
$m_house_video = new GHousesVideo();
$where['is_del'] = 1;
$total = $m_house_video->getTotal($where);
$pageSize = 200;
$pageTotal = ceil($total / $pageSize);
$path = ROOT_PATH.'public/resource/lib/Attachments/video/';
for ($pageNo = 1; $pageNo <= $pageTotal; $pageNo++) {
$data = $m_house_video->getList($pageNo, $pageSize, '', 'id,video_name', $where);
foreach ($data as $k=>$v) {
$del_file = $path.$v['video_name'];
@unlink($del_file);
if (!file_exists($del_file)) {
$m_house_video->updateData(['is_del'=>2], ['id'=>$v['id']]);
}
}
}
return ;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment