$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 ";
// public function getCouponClassGoodsWithSale($where,$field,$limit,$actIds){
// $this->setDb();
// $str = "select ".$field." FROM ".$this->_tableName." INNER JOIN han_store_coupon_goods_class on han_store_coupon_goods_class.gc_id = han_goods_common.gc_id_1 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) ";
// $str .= 'where(goods_verify = 1) AND (goods_state = 1) AND ';
// $str .= $where;
// $str .=" limit {$limit[0]},{$limit[1]}";
// $data = $this->db->query($str);
// return $data->rows;
// }
/**
* 获取优惠券对应商品列表(指定商品)
* @param $where
* @param $field
* @param $limit
* @return mixed
*/
// public function getCouponGoods($where,$field,$limit){
// public function getCouponGoodsWithSale($where,$field,$limit,$actIds){
// $this->setDb();
// $str = "select ".$field." FROM ".$this->_tableName." INNER JOIN han_store_coupon_goods on han_store_coupon_goods.goods_commonid = han_goods_common.goods_commonid 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) ";
// $str .= 'where(goods_verify = 1) AND (goods_state = 1) AND ';