ChoiceGoods.php 1.54 KB
<?php

header("Content-type: text/html; charset=utf-8");

class YHMApi_App_V1_ChoiceGoods extends YHMApi_App_V1_Base {
     /**
     * 获取精选的列表
     *
     * @param array $params
     * @param string $fields
     */
    public static function getChoiceGoodsList(array $params, $fields = '*') {
        $buyGoodsListResult=array();
        $offset = !empty($params ['offset']) ? (int) $params ['offset'] : '0';
        $num = !empty($params ['num']) ? (int) $params ['num'] : "15";
        $choice_list = YHMSupport_Models_Choicegoods_Client::getGoodsList($offset, $num);
        foreach ($choice_list as $k=>$val)
        {
           $goodsInfo = YHMProduct_Models_Goods_Client::getOneByProductSkc($val['product_skc']);
            $productImage = YHMProduct_Models_Goodsimages_Client::getOneImagesBySkc($val['product_skc']);
            $buyGoodsListResult[] = array(
                
                'goodsName' => $goodsInfo['goods_name'],
                'product_skc' => (int) $goodsInfo['product_skc'],
                'create_time' => (int) $goodsInfo['create_time'],
                'goodsImageUrl' =>YHMUpload_Images::view($productImage,200, 200, 1, 'yhfair-product'),// YHMUpload_Images::view($productImage, 'yhfair-product'),
                'is_deleted' => ($goodsInfo['status'] == 0 ? 'Y' : 'N'),
                'sale_price' => $goodsInfo['sale_price']
            );  
        }
         return self::result(200, '精选商品列表', array(
                    'sales_list' => $buyGoodsListResult
                   
        ));
      
    }
}