Commit 9700c873 authored by zhz's avatar zhz

goods

parent b5709341
......@@ -67,6 +67,9 @@ class GoodsCommonModel extends \DAO\AbstractModel {
*/
public function getGoodsList($where,$field,$limit=array(),$order=array(),$attrStr=''){
$this->setDb($this->dbName);
if($attrStr) {
$field .= 'DISTINCT '.$field;
}
$str = '$data = $this->db->select($field)->from($this->_tableName)';
if($attrStr){
$str .="->join('han_goods_attribute_value','han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid')";
......@@ -86,7 +89,6 @@ class GoodsCommonModel extends \DAO\AbstractModel {
}
$str .= "->fetchAll();";
eval($str);
\Our\Log::getInstance()->write($this->db->getLastSql());
return $data;
}
/**
......@@ -100,6 +102,9 @@ class GoodsCommonModel extends \DAO\AbstractModel {
*/
public function getListWithSale($where,$field,$actIds,$limit=array(),$order=array(),$attrStr='',$online = true){
$this->setDb($this->dbName);
if($attrStr) {
$field .= 'DISTINCT '.$field;
}
$str = "select ".$field." FROM ".$this->_tableName." LEFT JOIN (SELECT MIN(discount_price) discount_price,goods_commonid,goods_id FROM han_sale_goods where sale_act_id in(".implode(',',$actIds).") GROUP BY goods_commonid) a on (han_goods_common.goods_commonid = a.goods_commonid)";
if($attrStr){
$str .= "INNER JOIN han_goods_attribute_value ON han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid ";
......@@ -125,7 +130,6 @@ class GoodsCommonModel extends \DAO\AbstractModel {
$str .=" limit {$limit[0]},{$limit[1]}";
}
$data = $this->db->query($str);
\Our\Log::getInstance()->write($this->db->getLastSql());
return $data->rows;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment