/** * @author song * 登录+踢屁股页面 * @param int $sid * * */ public function actionGamestar() { $sid = Yii::$app->request->get('sid'); $sid = intval($sid); if (empty($sid)) { return $this->redirect(['baiying/index']); } $user = PublicLibrary::is_login(); if (!$user) { $backurl = Yii::$app->params['idaiyan'] . "/baiying/gamestar?sid=" . $sid; $backurl = Publiclibrary::encode_callback($backurl); return $this->redirect(['baiying/auth', 'backurl' => $backurl]); } else { $uid = isset($user['uid']) ? $user['uid'] : ''; $openid = isset($user['openid']) ? $user['openid'] : ''; $headimgurl = isset($user['headimgurl']) ? $user['headimgurl'] : ''; $nickname = isset($user['nickname']) ? $user['nickname'] : ''; } // file_put_contents('/tmp/test.log',"\n\n :".$headimgurl,FILE_APPEND); // file_put_contents('/tmp/test.log',"\n\n :".$nickname,FILE_APPEND); $mshare = new BaiyingShare(); $shareone = $mshare->getSharebyid($sid); //判断活动状态 $rel_id = $shareone['rel_id']; $mactpro = new ActivityProduct(); $productattr = $mactpro->getDetailBypk($rel_id); if ($productattr['status'] != ActivityProduct::STATUS_VERIFY_THROUGH) { echo "<script>alert('活动已结束!'),window.location.href='/baiying/userproduct';</script>"; exit; } if ($shareone) { //分享人来到游戏页面 进入 用户中心叶 if ($shareone['openid'] == $openid && !empty($openid)) { return $this->redirect(['baiying/userproduct']); } $mutpl = new UserThirdPartyLogin(); $thirdone = $mutpl->getByOpenId($openid); if ($thirdone) { $member_model = new Member(); $userone = $member_model->getByUid($thirdone['user_id']); } $msupport = new BaiyingSupport(); $supportweixin = $msupport->isSupportweixin($openid, $sid); $supportres = $msupport->isSupportreg($uid, $sid); $supportone = !empty($supportweixin) ? $supportweixin : $supportres; if ($supportone) { $supportid = $supportone['id']; if (!empty($supportone['sup_avatar']) && substr($supportone['sup_avatar'], 0, 4) == 'http') { $supportone['sup_avatar'] = $supportone['sup_avatar']; } else { $supportone['sup_avatar'] = Yii::$app->params['idaiyan'] . '/' . $supportone['sup_avatar'] . '.jpg'; } } else { $content['shareid'] = $sid; $content['openid'] = $openid; $content['sup_avatar'] = $headimgurl; $content['sup_nicename'] = $nickname; $content['mobile'] = isset($userone['mobile']) ? $userone['mobile'] : ''; $supportid = $msupport->store($content); $supportone = $content; } if (substr($shareone['share_avatar'], 0, 4) == 'http') { $shareone['share_avatar'] = $shareone['share_avatar']; } else { $shareone['share_avatar'] = Yii::$app->params['idaiyan'] . '/' . $shareone['share_avatar'] . '.jpg'; } $mutpl = new UserThirdPartyLogin(); $thirdone = $mutpl->getByOpenId($openid); if ($thirdone) { $member_model = new Member(); $userone = $member_model->getByUid($thirdone['user_id']); } if (isset($userone)) { $ismember = 1; } // file_put_contents('/tmp/test.log',"\n\n :".$supportone['sup_avatar'],FILE_APPEND); // file_put_contents('/tmp/test.log',"\n\n :".$content['sup_avatar'],FILE_APPEND); $this->layout = false; return $this->render('gamelogin', ['shareone' => $shareone, 'supportone' => $supportone, 'supportid' => $supportid, 'sid' => $sid, 'uid' => $uid, 'userone' => isset($ismember) ? $ismember : 0]); } return $this->redirect(['baiying/index']); }