<?php

/**
 * 添加商品快照
 * 执行一次
 */
define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../../../')); //指向public的上一级
require APPLICATION_PATH . '/scripts/crontab/common.php';


$goodsList = \DAO\GoodsModel::getInstance()->getList(array('snapshot_id'=>0),'*');
foreach ($goodsList as $goods) {
    $snaId = \DAO\Goods\GoodsSnapshotModel::getInstance()->insert(array('content'=>serialize($goods),'type'=>1));
    \DAO\GoodsModel::getInstance()->update(array('snapshot_id'=>$snaId),array('goods_id'=>$goods['goods_id']));
}
