|
@@ -24,6 +24,14 @@ require_once(BASE_ROOT_PATH . '/helper/activity_helper.php');
|
|
require_once(BASE_ROOT_PATH . '/helper/room_helper.php');
|
|
require_once(BASE_ROOT_PATH . '/helper/room_helper.php');
|
|
require_once(BASE_ROOT_PATH . '/admin/control/person_bonus.php');
|
|
require_once(BASE_ROOT_PATH . '/admin/control/person_bonus.php');
|
|
|
|
|
|
|
|
+
|
|
|
|
+require_once(BASE_ROOT_PATH . '/helper/algorithm.php');
|
|
|
|
+require_once(BASE_ROOT_PATH . '/helper/login_helper.php');
|
|
|
|
+require_once(BASE_ROOT_PATH . '/helper/sms_helper.php');
|
|
|
|
+require_once(BASE_ROOT_PATH . '/helper/model_helper.php');
|
|
|
|
+require_once(BASE_ROOT_PATH . '/helper/third_author/wxauthor.php');
|
|
|
|
+require_once(BASE_ROOT_PATH . '/helper/user_session/storage.php');
|
|
|
|
+
|
|
use room\proto_type;
|
|
use room\proto_type;
|
|
class member_bonusControl extends mbMemberControl
|
|
class member_bonusControl extends mbMemberControl
|
|
{
|
|
{
|
|
@@ -1224,6 +1232,30 @@ class member_bonusControl extends mbMemberControl
|
|
public function free_giftsOp()
|
|
public function free_giftsOp()
|
|
{
|
|
{
|
|
return self::outsuccess(null,"bonus/free_gifts");
|
|
return self::outsuccess(null,"bonus/free_gifts");
|
|
|
|
+
|
|
|
|
+ $user = intval($_GET['curuser']);
|
|
|
|
+ if(session_helper::need_wechat_author())
|
|
|
|
+ {
|
|
|
|
+ $author = new thrid_author\wxauthor();
|
|
|
|
+ $url = author_url::inviter_url($user);
|
|
|
|
+ $url = $author->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_free_gifts($user,$type_sn)],"bonus/free_gifts",'wap');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ return self::outerr(errcode::ErrParamter);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -1271,4 +1303,290 @@ class member_bonusControl extends mbMemberControl
|
|
|
|
|
|
return $type_infos;
|
|
return $type_infos;
|
|
}
|
|
}
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+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_free_gifts
|
|
|
|
+{
|
|
|
|
+ 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 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()
|
|
|
|
+ {
|
|
|
|
+ $this->show_relay();
|
|
|
|
+// if(!empty($this->mTypesn)) {
|
|
|
|
+// $this->show_bonus();
|
|
|
|
+// }
|
|
|
|
+ $rewared = $this->show_rewared();
|
|
|
|
+ $rewarding = $this->show_rewarding();
|
|
|
|
+ if($rewared == false && $rewarding == false) {
|
|
|
|
+ $this->show_noinvitee();
|
|
|
|
+ }
|
|
|
|
+ $this->show_prompt();
|
|
|
|
+ }
|
|
|
|
+ private function show_noinvitee()
|
|
|
|
+ {
|
|
|
|
+ echo "<div class=\"bonus_list\">";
|
|
|
|
+ echo "<span class=\"invite_null\">TA尚未邀请好友</span>";
|
|
|
|
+ echo "</div>";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function show_relay()
|
|
|
|
+ {
|
|
|
|
+ $minfo = $this->mUserInfo;
|
|
|
|
+ $inviter_id = $minfo->inviter_id();
|
|
|
|
+
|
|
|
|
+ $str = "
|
|
|
|
+ <div class=\"profit_box\">
|
|
|
|
+ <div class=\"left_profit\">
|
|
|
|
+ <img class=\"profit_avatar\" src=\"{$minfo->avatar()}\" alt=\"\">
|
|
|
|
+ <p class=\"f14 col333 lineH1\">{$minfo->nickname()}</p>
|
|
|
|
+ ";
|
|
|
|
+
|
|
|
|
+ if($inviter_id > 0) {
|
|
|
|
+ $str .= "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $str .= "
|
|
|
|
+ </div>
|
|
|
|
+ <div class=\"right_profit\">
|
|
|
|
+ <p class=\"profit_money mb9\">{$minfo->reward_amount()}<span class=\"profit_unit\">元</span></p>
|
|
|
|
+ <p class=\"f14 col666 lineH1\">邀请好友累计获得收益</p>
|
|
|
|
+ </div>
|
|
|
|
+ </div>";
|
|
|
|
+ echo $str;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// private function show_bonus()
|
|
|
|
+// {
|
|
|
|
+// echo "<div class=\"open_bonus_link\">
|
|
|
|
+// <div class=\"bonus\">
|
|
|
|
+// <div class=\"bonus_top\"></div>
|
|
|
|
+// <div class=\"bonus_center\"></div>
|
|
|
|
+// <div class=\"bonus_bg\">
|
|
|
|
+// <span id=\"coin\" class=\"open_bonus_btn gold_coin\"></span>
|
|
|
|
+// </div>
|
|
|
|
+// </div>
|
|
|
|
+// </div>";
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ private function show_rewared()
|
|
|
|
+ {
|
|
|
|
+ if(empty($this->mMineInfo) && empty($this->mRewardedInvites)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!empty($this->mMineInfo) && $this->mMineInfo->rewared_inviter()) {
|
|
|
|
+ $count = count($this->mRewardedInvites) + 1;
|
|
|
|
+ } else {
|
|
|
|
+ $count = count($this->mRewardedInvites);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ echo "<div class=\"bonus_list\">";
|
|
|
|
+ echo "<div class=\"prompt_label\">
|
|
|
|
+ <span class=\"title\">已带来收益的好友<span class=\"invite_num\">({$count})</span></span>
|
|
|
|
+ </div>";
|
|
|
|
+
|
|
|
|
+ if(!empty($this->mMineInfo) && $this->mMineInfo->rewared_inviter()) {
|
|
|
|
+ $this->show_invitee($this->mMineInfo);
|
|
|
|
+ }
|
|
|
|
+ foreach ($this->mRewardedInvites as $minfo) {
|
|
|
|
+ $this->show_invitee($minfo);
|
|
|
|
+ }
|
|
|
|
+ echo "</div>";
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function show_rewarding()
|
|
|
|
+ {
|
|
|
|
+ if(empty($this->mMineInfo) && empty($this->mRewardingInvites)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!empty($this->mMineInfo) && $this->mMineInfo->rewared_inviter() == false) {
|
|
|
|
+ $count = count($this->mRewardingInvites) + 1;
|
|
|
|
+ } else {
|
|
|
|
+ $count = count($this->mRewardingInvites);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ echo "<div class=\"bonus_list\">";
|
|
|
|
+ echo "<div class=\"prompt_label\">
|
|
|
|
+ <span class=\"title\">尚未带来收益的好友<span class=\"invite_num\">({$count})</span></span>
|
|
|
|
+ </div>";
|
|
|
|
+
|
|
|
|
+ if(!empty($this->mMineInfo) && $this->mMineInfo->rewared_inviter() == false) {
|
|
|
|
+ $this->show_invitee($this->mMineInfo);
|
|
|
|
+ }
|
|
|
|
+ foreach ($this->mRewardingInvites as $minfo) {
|
|
|
|
+ $this->show_invitee($minfo);
|
|
|
|
+ }
|
|
|
|
+ echo "</div>";
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function show_prompt()
|
|
|
|
+ {
|
|
|
|
+ $str = "<div class=\"prompt\">
|
|
|
|
+ <div class=\"prompt_label\">
|
|
|
|
+ <span class=\"title\">提示</span>
|
|
|
|
+ </div>
|
|
|
|
+ <div class=\"prompt_list\">
|
|
|
|
+ <p>1.由于近期发现恶意刷红包用户,为保障体验,在邀请好友之后,需要好友微信授权、注册、下载APP登录后才发邀请奖励。</p>
|
|
|
|
+ <p>2.邀请前5名新用户可得10元100%红包,邀请好友数量>5后可得10元40%红包,雨露均沾红包为40%红包,为了您的长期收益,我们建议您邀请真实的朋友。</p>
|
|
|
|
+ <p>3.您可以点击\"召唤TA\",邀请好友回来。(同一用户每天只能召唤一次)</p>
|
|
|
|
+ <p>4.熊猫有权解散违规邀请的用户,收回已发红包并关闭相关订单。(具体细节查看规则)</p>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class=\"briefing_address\"></div>";
|
|
|
|
+ echo $str;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function show_invitee($minfo)
|
|
|
|
+ {
|
|
|
|
+ if(empty($minfo)) return;
|
|
|
|
+ $user = $minfo->member_id();
|
|
|
|
+ $called = $this->mCaller->called($user);
|
|
|
|
+
|
|
|
|
+ $url = BASE_SITE_URL . "/mobile/index.php?act=invite_friend&op=index&client_type=wap&curuser={$user}";
|
|
|
|
+ $str = "<div class=\"item\">
|
|
|
|
+ <a href=\"{$url}\">
|
|
|
|
+ <div class=\"user_img\">
|
|
|
|
+ <img src=\"{$minfo->avatar()}\">
|
|
|
|
+ </div>
|
|
|
|
+ <div class=\"user_name text-overflow\">
|
|
|
|
+ <p class=\"text-overflow\"> {$minfo->nickname()}</p>
|
|
|
|
+ <p class=\"invite_msg\">邀请{$minfo->invitees()}人,收益<span class=\"price\">{$minfo->reward_amount()}</span>元</p>
|
|
|
|
+ </div>";
|
|
|
|
+ if($this->mMine == false)
|
|
|
|
+ {
|
|
|
|
+ $str .= "<div class=\"look_btn\">
|
|
|
|
+ <span class=\"arrow\"></span>
|
|
|
|
+ </div>";
|
|
|
|
+ }
|
|
|
|
+ $str .= "</a>";
|
|
|
|
+
|
|
|
|
+ if($this->mMine)
|
|
|
|
+ {
|
|
|
|
+ if($called) {
|
|
|
|
+ $str .= "<span class=\"call_btn called\" data-user=\"{$user}\">召唤TA</span>";
|
|
|
|
+ } else {
|
|
|
|
+ $str .= "<span class=\"call_btn\" data-user=\"{$user}\">召唤TA</span>";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $str .= "</div>";
|
|
|
|
+ echo $str;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function show_open()
|
|
|
|
+ {
|
|
|
|
+ if(!session_helper::isapp())
|
|
|
|
+ {
|
|
|
|
+ echo "<div class=\"fixed_bottom\">
|
|
|
|
+ <span class=\"logo\"></span>
|
|
|
|
+ <div class=\"label\">
|
|
|
|
+ <p>熊猫美妆</p>
|
|
|
|
+ <p>下载APP即可得更多奖励</p>
|
|
|
|
+ </div>
|
|
|
|
+ <a href=\"#\" class=\"download_app_btn\" id=\"download_app\">打开APP</a>
|
|
|
|
+ </div>";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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_title()
|
|
|
|
+ {
|
|
|
|
+ return $this->mShareInfo['title'];
|
|
|
|
+ }
|
|
|
|
+ public function share_image()
|
|
|
|
+ {
|
|
|
|
+ return $this->mShareInfo['img'];;
|
|
|
|
+ }
|
|
|
|
+ public function share_subtitle()
|
|
|
|
+ {
|
|
|
|
+ return $this->mShareInfo['sub_title'];;
|
|
|
|
+ }
|
|
}
|
|
}
|