<?php
/**
 * 商品相关
 */
defined('IN_WEB') or die('Include Error!');
class Goods
{
    /**
     * 获取商品列表
     * @param $param
     * @return false|string
     * Created by: Owen
     * Created on: 2020/8/17 10:59
     */
    public function getGoods($param){
        $data = array('code' => -1, 'list' => []);
        $uid = oo::functions()->uint($param['uid']);//后期要根据玩家类型展示不同的商品
        if( empty($uid) ){
            return json_encode($data);
        }
        $data = oo::commonOprModel('goods')->getCrazyGodGood($uid);
        return json_encode($data,JSON_NUMERIC_CHECK);
    }
	
  	public function specialOffer($param){
        $uid = oo::functions()->uint($param['uid']);
        if( empty($uid) ){
            return oo::response(-1,[],'参数错误');
        }
        $data['goods']   = oo::commonOprModel('goods')->specialOffer($uid);
        $data['offerLv'] = oo::commonOprModel('goods')->specialOfferLv($uid);
        return oo::response(1,$data,'',true);
    }


    /**
     *	获取快捷商品
     *	根据场次获取对应的商品
     */
    public function getFastGoods($param)
    {
        $data = array('code' => -1, 'goodsList' => []);
        $blind = oo::functions()->uint($param['blind']);
        $gameId = oo::functions()->uint($param['gameId']);
        $uid = oo::functions()->uint($param['uid']);
        if (!$uid) {
            return json_encode($data);
        }
        //根据sid调用商品列表
        if(empty($blind)) {
            $blind = 0;
        }
        $data = oo::commonOprModel('goods')->getFastGoods($uid, $blind, 1);
        return json_encode($data);
    }
}