Browse Source

中奖接口

lizhen_gitee 3 months ago
parent
commit
01c752866a
1 changed files with 39 additions and 1 deletions
  1. 39 1
      application/api/controller/Index.php

+ 39 - 1
application/api/controller/Index.php

@@ -9,9 +9,47 @@ use think\Db;
  */
 class Index extends Api
 {
-    protected $noNeedLogin = ['index'];
+    protected $noNeedLogin = [];
     protected $noNeedRight = ['*'];
 
+    //结束后的首页
+    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(){
+
+    }
 
 }