Files
OMS/app/image/lib/rebuild.php
2025-12-28 23:13:25 +08:00

30 lines
972 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
class image_rebuild{
function run(&$cursor_id,$params){
//每次最多处理2个
$limit = 2;
$model = app::get('image')->model('image');
$db = kernel::database();
if($params['filter']['image_id']=='_ALL_'||$params['filter']['image_id']=='_ALL_'){
unset($params['filter']['image_id']);
}
$where = $model->_filter($params['filter']);
$where .= ' and last_modified<='.$params['queue_time'];
$rows = $db->select('select image_id from sdb_image_image where '.$where.' order by last_modified desc limit '.$limit);
foreach($rows as $r){
$model->rebuild($r['image_id'],$params['size'],$params['watermark']);
}
$r = $db->selectrow('select count(*) as c from sdb_image_image where '.$where);
return $r['c'];
}
}