isWhite('export_fans', $channel_id)) { $cacheUser = CacheConstants::getExportFansUserCache($user_id); if ($user = Redis::instance()->hGetAll($cacheUser)) { if ($user['chapter'] != -1) { $chapter = explode(',', $user['chapter']); array_push($chapter, $chapter_id); $chapter = array_unique($chapter); $count = count($chapter); $chapter = implode(',', $chapter); if ($count == 2 || $count == 7) { $result = $this->getExportFansModel()->getOne($user['id']); } if($count < 7){ Redis::instance()->hSet($cacheUser, 'chapter', $chapter); } else { Redis::instance()->hSet($cacheUser, 'chapter', '-1'); } } } } return $this->setData($result)->getReturn(); } public function checkFansPayToExport($channel_id, $user_id) { $result = false; if (Config::get('site.theme') == 'sf' && model('ChannelSpecialManage')->isWhite('export_fans', $channel_id)) { $cacheUser = CacheConstants::getExportFansUserCache($user_id); if ($user = Redis::instance()->hGetAll($cacheUser)) { $result = $this->getExportFansModel()->getOne($user['id']); if ($result['pay_status'] == ExportFansConstants::PAY_STATUS_NO) { $result = false; } } } return $this->setData($result)->getReturn(); } public function checkFansSignToExport($channel_id, $user_id) { $result = false; if (Config::get('site.theme') == 'sf' && model('ChannelSpecialManage')->isWhite('export_fans', $channel_id)) { $cacheUser = CacheConstants::getExportFansUserCache($user_id); if ($user = Redis::instance()->hGetAll($cacheUser)) { $result = $this->getExportFansModel()->getOne($user['id']); } } return $this->setData($result)->getReturn(); } /** * 是否导粉设置 * @param $channel_id * @param $user_id * @return \app\main\model\object\ReturnObject */ public function checkFansLead($channel_id, $user_id) { $result = false; if (model('ChannelSpecialManage')->isWhite('export_fans', $channel_id)) { $cacheUser = CacheConstants::getLeadUser($user_id); if ($data = Redis::instance()->hGetAll($cacheUser)) { $match = []; foreach ($data as $row) { $row = json_decode($row, true); if ($row['expire_time'] > time() && $row['start_time'] < time()) { $config = $this->getExportFansModel()->getOne($row['id']); if ($config && $config['status'] == '1') { $match[] = $config; } } } if ($match) { usort($match, function ($v1, $v2) { if ($v2['weigh'] > $v1['weigh']) { return true; } if ($v2['id'] > $v1['id']) { return true; } return false; }); $result = array_shift($match); } } } return $this->setData($result)->getReturn(); } }