Files
OMS/app/ome/lib/retrial.php
2026-01-04 17:22:44 +08:00

41 lines
1.7 KiB
PHP

<?php
/**
* Copyright 2026 ShopeX (https://www.shopex.cn)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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)."')");
}
}
}