<?php
defined('IN_WEB') or die('Include Error!');
/**
 * Created by Vim
 * User: Ricahrd
 * Date: 2021/3/05
 * Time: 10:45
 */
class SysMailMsg
{

    /**
     * 获取系统邮件
     * @param array $param
     * @return string
     */
    public function getSysMailMsg($param) {
        $uid = oo::functions()->uint($param['uid']);
        $sid = oo::functions()->uint($param['sid']);
        if(empty($uid)){
            return oo::response(-1);
        }
        $ret = oo::commonOprModel('message')->getSysMailMsgByUid($uid, $sid);
        return oo::response(1, $ret, "", true);
    }
    
    /**
     * 领取邮件奖励
     * @param array $param
     * @return string
     */
    public function getSysmMailReward($param){
        $uid = oo::functions()->uint($param['uid']);
        $id  = oo::functions()->uint($param['id']);
        if(empty($uid) || empty($id)){
            return oo::response(-1);
        }
        return oo::commonOprModel('message')->getUserMailMsgReward($uid, $id);
    }

    /**
     * 读取邮件消息
     * @param array $param
     * @return string
     */
    public function readSysMailMsg($param) {
        $uid = oo::functions()->uint($param['uid']);
        $id  = oo::functions()->uint($param['id']);
        if(empty($uid) || empty($id)){
            return oo::response(-1);
        }
        $ret = oo::commonOprModel('message')->readMailMsg($uid, $id);
        return oo::response(1);
    }

}
