private function event_20151015($xml) { if (!$this->bind_check($xml)) { return; } $text = trim('' . $xml->Content); if ($text != '爱奇艺' && $text != '乐视') { return; } $uid = $this->user_profile->id; $inviter = $this->user_profile->inviter; $mobile = $this->user_profile->mobile; $from = $xml->FromUserName; $to = $xml->ToUserName; $info_id = EdaixiCoupon::INFO_EVENT_20151015_IQIYI_LETV; $iqiyi_inviters = array(Channel::CHANNEL_ID_IQIYI, Channel::CHANNEL_ID_RONG_360); if (in_array($inviter, $iqiyi_inviters) && $text != '爱奇艺') { $content = '抱歉,您还未获得会员激活码,可在活动页查看获取方法。'; $this->wx_reply->imm_reply_text($to, $from, $content); return; } if ($inviter == Channel::CHANNEL_ID_LETV && $text != '乐视') { $content = '抱歉,您还未获得会员激活码,可在活动页查看获取方法。'; $this->wx_reply->imm_reply_text($to, $from, $content); return; } $ret_code = EventUtil::check_event_20151015($uid); // 不符合条件 if ($ret_code == EventUtil::EVENT_20151015_RET_CODE_NONE) { $content = '抱歉,您还未获得会员激活码,可在活动页查看获取方法。'; $this->wx_reply->imm_reply_text($to, $from, $content); return; } $do_lqjh = false; $do_lrjh = false; if ($ret_code == EventUtil::EVENT_20151015_RET_CODE_LQJH) { $do_lqjh = true; } elseif ($ret_code == EventUtil::EVENT_20151015_RET_CODE_LRJH) { $do_lrjh = true; } elseif ($ret_code == EventUtil::EVENT_20151015_RET_CODE_BOTH) { $do_lqjh = true; $do_lrjh = true; } // 领取1月会员 if ($do_lqjh) { EventUtil::do_event_20151015_job($this->user_profile, EventUtil::EVENT_20151015_RET_CODE_LQJH); } // 领取3月会员 if ($do_lrjh) { EventUtil::do_event_20151015_job($this->user_profile, EventUtil::EVENT_20151015_RET_CODE_LRJH); } // 为了简化逻辑 根据邀请人和type去取 if (in_array($inviter, $iqiyi_inviters)) { $str = "恭喜您获得爱奇艺VIP会员,激活码如下:\n"; $str2 = '登录爱奇艺VIP会员购买页面,选择“激活码支付”即可激活,过期失效请尽快使用。'; $prize_id = EdaixiCoupon::TYPE_EVENT_20151015_IQIYI_1; $prize_id2 = EdaixiCoupon::TYPE_EVENT_20151015_IQIYI_3; } else { $str = "恭喜您获得乐视网VIP会员,激活码如下:\n"; $str2 = '在电脑登录乐视网首页,进入“会员VIP”-“兑换码”,输入即可激活,过期失效请尽快使用。'; $prize_id = EdaixiCoupon::TYPE_EVENT_20151015_LETV_1; $prize_id2 = EdaixiCoupon::TYPE_EVENT_20151015_LETV_3; } // 取一次 // 是否领取过1月会员 $m = EdaixiCoupon::check_have_taken($uid, $info_id, $prize_id); // 是否领取过3月会员 $m2 = EdaixiCoupon::check_have_taken($uid, $info_id, $prize_id2); // 未领取到 if (!$m && !$m2) { $content = "会员激活码被抢光啦,小懒正加急准备下一波~请2小时候后重试或咨询客服:400-807-8000"; $this->wx_reply->imm_reply_text($to, $from, $content); return; } // 至少领取了一个 $text_m = $m ? "1个月会员:{$m->code}" : '1个月会员:暂未获得'; $text_m2 = $m2 ? "3个月会员:{$m2->code}" : '3个月会员:暂未获得'; $content = $str . $text_m . "\n" . $text_m2 . "\n" . $str2; $this->wx_reply->imm_reply_text($to, $from, $content); return; }