<?php
defined('IN_WEB') or die('Include Error!');
/**
* 互动道具相关
*/
class Props
{
    /**
     * 拉取用户互动道具接口
     * @param $param
     * @return string
     * Created by: Owen
     * Created on: 2019/12/23 16:09
     */
	public function getUserProps($param) {
		$uid = oo::functions()->uint($param['uid']);
		$id = oo::functions()->uint($param['id']);
        $state = [];
        $cgBless = oo::commonOprModel('card')->getCardBlessList($uid);
        if($cgBless){
            $state['bless'] = $cgBless;
        }
		$data = [
		    'props'=>oo::commonOprModel('props')->getUserProps($uid, $id),
		    'state'=>$state,
        ];
		return oo::response(1,$data,'',true);
	}


    /**
     * 使用互动道具
     * @param $param
     * @return false|string
     * Created by: Owen
     * Created on: 2019/12/23 16:10
     */
	public function useUserProps($param) {
		$data = array('code' => -1);
		$uid = oo::functions()->uint($param['uid']);
		$id = oo::functions()->uint($param['id']);
		if ($uid == 0) {
			return json_encode($data);
		}
		$data = oo::commonOprModel('props')->useUserProps($uid, $id);
		return json_encode($data);
	}


}