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

30 lines
1.3 KiB
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 ome_retrial
{
/*------------------------------------------------------ */
//-- 自动清除[180天 ||90天]复审日志
/*------------------------------------------------------ */
public function clean()
{
$setting_is_monitor = app::get('ome')->getConf('ome.order.is_monitor');//是否开启价格监控
$setting_is_retrial = app::get('ome')->getConf('ome.order.is_retrial');//开启复审
$clean_time = app::get('ome')->getConf('ome.order.clean_day');//复审日志保留天数
$clean_time = intval($clean_time) ? intval($clean_time) : 90;
if($setting_is_monitor=='true' || $setting_is_retrial=='true')
{
$time = time();
$where = " WHERE obj_type='orders@ome' AND operation='order_retrial@ome' AND operate_time<'".($time - $clean_time*24*60*60)."' ";
$sql = "select log_id from sdb_ome_operation_log ".$where;
$log_id = kernel::database()->select($sql);
$log_id = array_column($log_id, 'log_id');
kernel::database()->exec("DELETE FROM ". DB_PREFIX ."ome_operation_log where log_id in ('".implode("','", $log_id)."')");
}
}
}