exists($redis_key)) { $redis_key_type = $redis->type($redis_key); if($redis_key_type == \Redis::REDIS_STRING){ return []; }else{ $data = $redis->hGetAll($redis_key); } } else { $rst = $this->getGuideManageModel()->get(['channel_id' => $channel_id, 'state' => '1']); if ($rst) { $data = $rst->toarray(); $redis->hMSet($redis_key, $data); $redis->expire($redis_key, 24 * 60 * 60); }else{ $redis->set($redis_key, '0'); $redis->expire($redis_key, 24 * 60 * 60); } } return $data; } /** * App引导入口, 访问UV 打点 * @param $channel_id * @param $user_id * @param int $guide_idx * 1 => '文章头部引导位浏览量' * 2 => '文章底部引导位浏览量', * 3 => 'CODE码页面引导位浏览量' * 4 => '充值成功引导位浏览量', */ public function appGuideViewDot($channel_id, $user_id, $guide_idx = 1) { $guideArr = $this->getAppGuideInfo($channel_id); if (count($guideArr) && (Ua::getOs() != "iOS")) { //发送打点数据 $dotData = new DotObject(); //打点信息初始化 $dotData->channel_id = $channel_id; $dotData->user_id = $user_id; $dotData->event_time = time(); $dotData->action_type = MqConstants::ROUTING_KEY_APP_GUIDE_UV; $dotData->guide_idx = $guide_idx; $dotData->guide_op_type = MqConstants::APP_GUIDE_OP_TYPE_VIEW; MqService::instance()->sendMessage($dotData); } } /** * App引导入口,点击UV 打点 * @param $channel_id * @param $user_id * @param int $guide_idx * 1 => '文章头部引导位浏览量' * 2 => '文章底部引导位浏览量', * 3 => 'CODE码页面引导位浏览量' * 4 => '充值成功引导位浏览量', */ public function appGuideClickDot($channel_id, $user_id, $guide_idx = 1) { $guideArr = $this->getAppGuideInfo($channel_id); if (count($guideArr) && (Ua::getOs() != "iOS")) { //发送打点数据 $dotData = new DotObject(); //打点信息初始化 $dotData->channel_id = $channel_id; $dotData->user_id = $user_id; $dotData->event_time = time(); $dotData->action_type = MqConstants::ROUTING_KEY_APP_GUIDE_UV; $dotData->guide_idx = $guide_idx; $dotData->guide_op_type = MqConstants::APP_GUIDE_OP_TYPE_CLICK; MqService::instance()->sendMessage($dotData); } } /** * 是否展示后台的菜单 * @param $admin_id * @return bool */ public function isShowAdminMenu($admin_id) { $show = false; //$row = $this->getGuideManageModel()->where('channel_id', 'EQ', $admin_id)->find(); $row = $this->getAppGuideInfo($admin_id); if ($row) { $show = true; return $show; } //是否是代理 $agentRow = model("AdminExtend")->where('admin_id', 'EQ', $admin_id)->find(); if ($agentRow) { /*$where = [ 'channel_id' => ['eq', $agentRow['create_by']], ]; $res = $this->getGuideManageModel()->where($where)->find(); */ $res = $this->getAppGuideInfo($agentRow['create_by']); if ($res) { $show = true; return $show; } } //是否是VIP $slaveRows = model("VipAdminBind")->where("admin_id_master", 'EQ', $admin_id)->select(); if ($slaveRows) { $ids = array_column($slaveRows, 'admin_id_slave'); $where = [ 'channel_id' => ['in', $ids], ]; $res = $this->getGuideManageModel()->where($where)->find(); if ($res) { $show = true; return $show; } } return $show; } }