<?php
defined('IN_WEB') or die( 'Include Error!');
/**
 *   分享奖励统计
 */

class ModelReward {

    /**
     *   每日分享次数统计
     * @param $shareType #分享类型 $type #selfType分享 otherType点击分享
     * @return int
     * Created by: hss
     */
    public function todayShareStatistics($shareType,$config,$type = 'selfType'){
        if (empty($shareType) || empty($config)) {
            return -1;
        }
        $type = ($type != 'selfType')?'otherType':'selfType';
        if($config[$type] == 1){
            $rewardType = "money";
        }else if($config[$type] == 2){
            $rewardType = 'spins';
        }
        oo::commonOprRedis('Statistics')->hIncrBy(okeys::todayShareStatistics($shareType,$type),$rewardType,($type != 'selfType')?$config['otherReward']:$config['selfReward']);
        oo::commonOprRedis('Statistics')->hIncrBy(okeys::todayShareStatistics($shareType,$type),'successNumber',1);
    }

}
