where('id',1)->find(); if(!$find){ $this->error('没有进行中的投票活动'); } $find = info_domain_image($find,['image','paihang_image']); $this->success(1,$find); } //结束后的首页 public function index(){ //活动详情 $find = Db::name('vote_subject')->where('id',1)->find(); if(!$find){ $this->error('没有进行中的投票活动'); } $find = info_domain_image($find,['image','paihang_image']); //中奖信息 $zhongjiang = [ 'zhongjiang_status' => 0, 'finish_title' => config('site.finish_title'), 'finish_info' => config('site.finish_info'), 'finish_iqiyi' => config('site.finish_iqiyi'), 'user_kami' => '', 'finish_content' => config('site.finish_content'), ]; if($this->auth->isLogin()){ $exam_user_top = Db::name('exam_user_top')->where('user_id',$this->auth->id)->order('id asc')->find(); if(!empty($exam_user_top) && !empty($exam_user_top['info'])){ $zhongjiang['zhongjiang_status'] = 1; $zhongjiang['user_kami'] = $exam_user_top['info']; } } $result = [ 'subject' => $find, 'zhongjiang' => $zhongjiang, ]; $this->success(1,$result); } //领取 public function lingqu(){ $exam_user_top = Db::name('exam_user_top')->where('user_id',$this->auth->id)->order('id asc')->find(); if(!empty($exam_user_top) && !empty($exam_user_top['info'])){ if($exam_user_top['status'] == 0){ $update = [ 'status' => 1, 'gettime' => time(), ]; Db::name('exam_user_top')->where('id',$exam_user_top['id'])->update($update); } } $this->success('领取成功'); } }