error('活动不存在'); } $is_range = 0; if ($this->isLogin) { UserService::instance()->setUserCache($this->userid); $user_id = UserService::instance()->getUserInfo()->id; $admin_id = UserService::instance()->getAdminId()->data; $channel_id = UserService::instance()->getUserInfo()->channel_id; } else { //拉取系统默认设置 $user_id = $this->userid; $admin_id = $channel_id = Config::get('site.fake_channel_id'); } if ($this->request->has('isrange') || $this->request->has('isRange')) { $is_range = 1; } if ($this->request->has('visitor')) { Cookie::set('visitor', $this->request->get('visitor')); } /** * 获取渠道商/代理商资料 */ $adminExtend = AdminService::instance()->getAdminExtendModel()->where(['admin_id' => $admin_id])->find(); if (!$adminExtend) { $this->error('管理员信息获取失败'); } $activityInfo = model('Activity')->where('id', $aid)->find(); $isGiveAct = $activityInfo['type'] == ActivityConstants::ACTIVITY_TYPE_GIVE; $res = model('resource')->join('activity a', 'a.id=resource.activity_id')->where('a.id', $aid) ->field('a.starttime,a.endtime,a.status as astatus,a.name as aname,resource.*')->order('resource.weigh', 'desc')->find(); if(!$res){ $this->error('活动不存在'); } if ($res['goods_id'] > 0) { $goodsInfo = model('Goods')->where('id', $res['goods_id'])->find(); if ($goodsInfo) { $res['money'] = $goodsInfo['money']; } } $recent_url = getCurrentDomain($channel_id, '/index/user/recent'); $this->assign('recent_url', $recent_url); if ($res['activity_id'] == 100) { if (UserService::instance()->getUserInfo()->is_pay == UserConstants::USER_IS_PAY_YES) { $is_range = 1; } } if($res['endtime'] < $this->time||empty($res['astatus'])){ $this->assign('isend',1); } if($res['starttime'] > $this->time && !empty($res['astatus'])){ $this->assign('needWait',1); $lastTime = $this->lastTime($res['starttime']); $this->assign('lastTime',$lastTime); } $arr = []; array_push($arr,"\r\n"); array_push($arr,"\r"); array_push($arr,"\n"); $pay_url = ''; $res['warning'] = str_replace($arr,"
",$res['warning']); $to_url = ClientAppService::instance()->parseAppUrl('book', []); $payment_method = empty($admin_info['payment_method']) ? '0' : '1'; $this->assign('res', $res); $this->assign('isGiveAct', $isGiveAct); $this->assign('payment_method', $payment_method); $this->assign('aid', $res['activity_id']); $this->assign('payUrl', $pay_url); $this->assign('toUrl', $to_url); $this->assign('goods_id', $res['goods_id']); $this->assign('isRange', $is_range); return $this->fetch(); } }