protected function doJob($arg) { $criteria = new CDbCriteria(); $criteria->addCondition('DATE_SUB(NOW(),INTERVAL ' . DATE_DELETE_ORDER . ' DAY) >= t.created_date '); $models = PrecOrder::model()->findAll($criteria); if (count($models) > 0) { foreach ($models as $item) { PrecOrder::model()->deleteByPk($item->id); } } else { return; } }
public static function getNameBuyer($id_order) { $order = PrecOrder::model()->findByPk($id_order); if (count($order) > 0) { $name = json_decode($order->data_buyer); return $name->name; } }