enter($url); return self::outsuccess(['direct_uri' => $url],"redirect"); } if($user <= 0) { if(session_helper::logined()) { $user = session_helper::memberid(); } } $type_sn = account_helper::invite_bonus(session_helper::share_id()); if($user > 0) { return self::outsuccess(['tpl' => new tpl_invite_friend($user,$type_sn)],"invite_friend/invite",'wap'); } else { return self::outerr(errcode::ErrParamter); } } public function call_userOp() { if(!session_helper::logined()) { return self::outerr(errcode::ErrUnLogin,"召唤操作有可能会骚扰用户,只有在登录时才可以操作"); } $user = intval($_GET['user']); if($user > 0) { $mod_member = Model('member'); $minfo = $mod_member->getMemberInfo(['inviter_id' => session_helper::memberid(),'member_id' => $user]); if(!empty($minfo)) { $caller = new user_session\friend_caller(); $caller->call($user); push_helper::call_friends(session_helper::memberid(),$user); return self::outsuccess(null); } } return self::outerr(errcode::ErrParamter); } } class friend_caller extends user_session\storage { public function __construct() { parent::__construct(); } public function limit_type() { return user_session\storage::DAILY_SUPPORT;; } public function storage_tag() { return 'friend_caller'; } public function called($user) { return $this->base_supported($user); } public function call($user) { parent::base_support($user); } } class tpl_invite_friend { private $mUser; private $mRewardedInvites; private $mRewardingInvites; private $mUserInfo; private $mShareInfo; private $mTypesn; private $mMineInfo; private $mRank; private $mMine; private $mCaller; public function __construct($user,$type_sn) { $this->mUser = $user; $this->mRewardedInvites = []; $this->mRewardingInvites = []; $this->init($user); $this->mShareInfo = invite_helper::share_info(session_helper::share_id()); $this->mTypesn = $type_sn; $this->mMine = (session_helper::memberid() == $user); $this->mCaller = new user_session\friend_caller(); } private function init($user) { if($user <= 0) return false; $mod_member = Model('member'); $items = $mod_member->getMemberList(['member_id|inviter_id' => ['_multi' => true,$user,$user]],'*', 0, 'reward_amount desc'); $cur_user = session_helper::memberid(); $index = 0; foreach ($items as $item) { $user_info = new member_info($item); $uid = $user_info->member_id(); if($uid == $user) { $this->mUserInfo = $user_info; } elseif ($uid == $cur_user) { $this->mMineInfo = $user_info; $this->mRank = $index + 1; } else { if($user_info->rewared_inviter()) { $this->mRewardedInvites[] = $user_info; } else { $this->mRewardingInvites[] = $user_info; } } $index++; } } public function show() { // if(!empty($this->mTypesn)) { // $this->show_bonus(); // } $rewared = $this->show_rewared(); $rewarding = $this->show_rewarding(); $relay = $this->show_relay(); // if($rewared == false && $rewarding == false) { // $this->show_noinvitee(); // } $prompt = $this->show_prompt(); echo $relay.$rewared.$rewarding.$prompt; } private function show_noinvitee() { echo "
"; echo "TA尚未邀请好友"; echo "
"; } private function show_relay() { $minfo = $this->mUserInfo; $total_cnt = $this->reward_member_cnt + $this->rewarding_member_cnt; if($total_cnt > 0) { $str = "

已邀请 {$total_cnt} 名好友,共获得 {$minfo->reward_amount()} 元红包

"; }else{ $str = "

您尚未邀请好友

"; } return $str; } // private function show_bonus() // { // echo "
//
//
//
//
// //
//
//
"; // } private $reward_member_cnt = 0; private function show_rewared() { $html = ""; if(empty($this->mMineInfo) && empty($this->mRewardedInvites)) { return $html; } if(!empty($this->mMineInfo) && $this->mMineInfo->rewared_inviter()) { $count = count($this->mRewardedInvites) + 1; } else { $count = count($this->mRewardedInvites); } $this->reward_member_cnt = $count; $html .= "
"; if(!empty($this->mMineInfo) && $this->mMineInfo->rewared_inviter()) { $html .= $this->show_invitee($this->mMineInfo); } foreach ($this->mRewardedInvites as $minfo) { $html .= $this->show_invitee($minfo); } $html .= "
"; return $html; } private $rewarding_member_cnt = 0; private function show_rewarding() { $html = ""; if(empty($this->mMineInfo) && empty($this->mRewardingInvites)) { return $html; } if(!empty($this->mMineInfo) && $this->mMineInfo->rewared_inviter() == false) { $count = count($this->mRewardingInvites) + 1; } else { $count = count($this->mRewardingInvites); } $this->rewarding_member_cnt = $count; $html .= "
"; if(!empty($this->mMineInfo) && $this->mMineInfo->rewared_inviter() == false) { $html .= $this->show_invitee($this->mMineInfo); } foreach ($this->mRewardingInvites as $minfo) { $html .= $this->show_invitee($minfo); } $html .= "
"; return $html; } private function show_prompt() { $str = "
活动规则
1当您分享红包给新人好友,领取成功后双方均可获得相应奖励(30元个人红包)。
2成功领取:通过您发出的红包链接,新人好友通过页面注册下载APP、微信授权/登录账号后,即为成功领取。
3通过不正当手段(包括但不限于侵犯第三人合法权益,作弊,扰乱系统,实施网络工具,批量注册,用机器注册账户,用机器模拟客户端)获得奖励,熊猫美妆有权撤销奖励以及相关订单。
"; return $str; } private function show_invitee($minfo) { if(empty($minfo)) return ""; $user = $minfo->member_id(); $called = $this->mCaller->called($user); $str = "
avatar()}\">

{$minfo->nickname()}

邀请{$minfo->invitees()}人,收益{$minfo->reward_amount()}

"; if($this->mMine == false) { $str .= "
"; } if($this->mMine) { if($called) { $str .= "召唤TA"; } else { $str .= "召唤TA"; } } $str .= "
"; return $str; } public function show_open() { if(!session_helper::isapp()) { echo "

熊猫美妆

下载APP即可得更多奖励

打开APP
"; } } public function bonus_url() { return url_helper::bonus_open_url($this->mTypesn); } public function share_url() { return url_helper::bonus_open_url($this->mTypesn); } public function share_path() { return url_helper::bonus_open_path($this->mTypesn); } public function share_title() { return $this->mShareInfo['title']; } public function share_image() { return $this->mShareInfo['img'];; } public function share_subtitle() { return $this->mShareInfo['sub_title'];; } }