public function __construct() { action::add('columns', array($this, 'columns'), 1); action::add('list', array($this, 'load'), 1, 1); action::add('footer', array($this, 'script'), 1, 1); filter::add('refresh', array($this, 'refresh'), 1, 2); action::add('delete', array($this, 'delete'), 1, 1); }
} // preg product's cover preg_match('/data\\:image\\/jpeg;base64,(.+)/i', $html, $cover); if (!empty($cover[0])) { $product['cover'] = 1; //trim($cover[0]); // save picture @file_put_contents(PT_PATH . 'picture/' . $product['id'] . '.jpg', base64_decode($cover[1])); } } // preg product's star if (preg_match('/5つ星のうち ([0-9.]+)/i', $html, $star)) { $product['star'] = $star[1]; } $db->beginTrans(); $product = filter::apply('refresh', $product, $html); // Save $id = $product['id']; unset($product['id']); list($sql, $value) = array_values(update_array($product)); $value[':id'] = $id; $rs = $db->prepare("UPDATE `a_good` SET {$sql} WHERE `id`=:id")->execute($value); if ($rs === false) { $db->rollback(); json_return(null, 1, 'Load page\'s data fail, please retry.'); } // Commit if (!$db->commit()) { $db->rollback(); json_return(null, 9, 'Load page\'s data fail, please retry.'); }
public function __construct() { action::add('columns', array($this, 'columns'), 2); action::add('list', array($this, 'load'), 1, 2); filter::add('refresh', array($this, 'refresh'), 2, 2); }