where($where) // ->order($order) // ->field($field) // ->select(); // return $goodsSku; // } /* * 商品数量作条件查询商品列表 * @param $where 条件 * @param $field 查询字段 */ public function getSkuGoodsList($where, $field = 'k.*', $order = 'k.id asc') { $info = $this->alias('k') ->join('ls_retail_store_sale_goods as s on k.id=s.sku_id and s.attribute_state=2') ->where($where) ->field($field) ->order($order) ->select(); return $info; } /* * 商品数量作条件查询字段 * @param $where 条件 * @param $field 查询字段 */ public function getSkuGoodsFields($where, $field, $order = 'k.id asc') { $info = $this->alias('k') ->join('ls_retail_store_sale_goods as s on k.id=s.sku_id', 'LEFT') ->where($where) ->order($order) ->getField($field, true); return $info; } /** * 进销存版 find * @param $map * @param $field * @return array */ public function getSkuGoodsInfo($map, $field = 'k.*') { $info = $this->alias('k') ->join('ls_retail_store_sale_goods as s on k.id = s.sku_id') ->field($field) ->where($map) ->find(); return $info; } public function getHostSkuList($map, $fields = '*', $order = 's.id asc') { if (empty($map)) { return array(); } $time = time(); $list = $this->alias('s') ->join("ls_retail_host as h on s.id=h.sku_id AND h.type=2 AND h.starttime<={$time} AND h.endtime>={$time} AND h.state=1 AND h.status=1", 'LEFT') ->where($map) ->order($order) ->field($fields) ->select(); return $list; } /** * 商户调拨门店的规格商品库存详情 * @param $parameter * [ * merchant_goods_sku_id 商户的规格id * merchant_id 商户id * ] * @return mixed */ public function getSyncMerchantGoodsSkuInfo($parameter) { $where = array( 'k.state'=>0, 'k.sku_mgoods_id'=>$parameter['merchant_goods_sku_id'], 's.merchant_id'=>$parameter['merchant_id'], 's.status'=>array('in','0,1') ); $page = $parameter['page']?$parameter['page']:1; $limit = $parameter['limit']?$parameter['limit']:10; $list = $this->alias('k') ->join('ls_retail_store_sale_goods as s on k.id=s.sku_id and k.goods_id=s.goods_id') ->field("s.store_id,s.goods_num,s.id,s.goods_id,s.sku_id") ->where($where) ->page($page,$limit) ->select(); return $list; } /** * 商户调拨门店的规格商品库存详情 * @param $parameter * [ * merchant_goods_sku_id 商户的规格id * merchant_id 商户id * ] * @return mixed */ public function getSyncMerchantGoodsSkuCount($parameter) { $where = array( 'k.state'=>0, 'k.sku_mgoods_id'=>$parameter['merchant_goods_sku_id'], 's.merchant_id'=>$parameter['merchant_id'], 's.status'=>array('in','0,1') ); $count = $this->alias('k') ->join('ls_retail_store_sale_goods as s on k.id=s.sku_id and k.goods_id=s.goods_id') ->where($where) ->count(); return $count; } }