Example #1
0
 public static function add($posts, $logid, $origin)
 {
     if (!$logid || !$origin) {
         return false;
     }
     Buylink::model()->deleteAll('logid=:logid AND origin=:origin', array(':logid' => $logid, ':origin' => $origin));
     if (!empty($posts['text'])) {
         foreach ($posts['text'] as $k => $v) {
             $_agent = Buylink::getAgent($posts['url'][$k]);
             $_attr = array('logid' => $logid, 'origin' => $origin, 'title' => $posts['text'][$k], 'price' => $posts['price'][$k], 'oldprice' => $posts['oldprice'][$k], 'minprice' => $posts['minprice'][$k], 'url' => $posts['url'][$k], 'status' => Scenic::STATUS_PASSED, 'agent' => $_agent);
             $model = new Buylink();
             $model->attributes = $_attr;
             $model->save();
         }
     }
     return true;
 }