<?php
#计划任务
namespace Act\Lib;

use Dever;

class Cron
{
	# 清理一小时前的待支付数据
	public function drop_order_api()
	{
		$where['where_time'] = time() - 3600;
		Dever::db('act/order')->drop($where);
		return 'ok';
	}

	# 将七天前的数据进行迁移 废弃
	public function mv_order()
	{
		return 'error';
		$where['where_time'] = time() - (86400 * 7);
		$data = Dever::db('act/order')->getAllByDate($where);
		if ($data) {
			$db = Dever::db('act/order_bak');
			foreach ($data as $k => $v) {
				$info = $db->one(array('order_id' => $v['order_id']));
				if (!$info) {
					$id = $v['id'];
					unset($v['id']);
					$db->insert($v);
					Dever::db('act/order')->delete($id);
				}
			}
		}

		return 'ok';
	}
}
