From 4c80cd7365316a09ebebb28a904ee70608e5d898 Mon Sep 17 00:00:00 2001
From: zhaojs <349234519@qq.com>
Date: 星期二, 11 七月 2023 15:16:30 +0800
Subject: [PATCH] no message

---
 application/api/logic/ActivityInfo.php  |   52 ++++++++++++++++++++++++++
 public/html/compareprice.html           |   31 ++++++++++++++-
 application/api/controller/User.php     |    4 ++
 application/api/controller/Activity.php |   16 ++++++++
 4 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/application/api/controller/Activity.php b/application/api/controller/Activity.php
index 284d866..317737e 100644
--- a/application/api/controller/Activity.php
+++ b/application/api/controller/Activity.php
@@ -7,6 +7,8 @@
 use app\common\model\FqbCate;
 use app\api\logic\taoke\device\Jd as LogicJd;
 
+use app\api\logic\ActivityInfo as ActInfo;
+
 header("Access-Control-Allow-Origin:*");
 class Activity extends Api
 {
@@ -173,4 +175,18 @@
         $this->success('鑾峰彇鎴愬姛',$list);
     }
 
+    /**
+     * 鍙傚姞娲诲姩
+     */
+    public function attendAct()
+    {
+        $actid=request()->param('actid');
+        if(empty($actid)) $this->error('鍙傛暟閿欒');
+        $actInfo=new ActInfo();
+        $user = $this->auth->getUser();
+        $res=$actInfo->attendAct($actid,$user->id);
+
+        $res?$this->success('鎴愬姛',$res):  $this->error('娲诲姩寮傚父');;
+    }
+
 }
\ No newline at end of file
diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index 9e3e1bb..412d90e 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -19,6 +19,7 @@
 use app\api\logic\SettlementRecord as LogicSettlementRecord;
 use app\api\logic\UserMoneyLog as LogicUserMoneyLog;
 use think\log;
+use app\api\logic\ActivityInfo as InfoActivityInfo;
 
 /**
  * 浼氬憳鎺ュ彛
@@ -724,6 +725,9 @@
             $this->error('缁戝畾澶辫触');
         } 
         $ModelUser->commit();
+        //鏇存柊鎷涘嫙娲诲姩淇℃伅
+        $activityInfo=new InfoActivityInfo();
+        $activityInfo->updateRecruitCount($user['id']);
         $this->success('缁戝畾鎴愬姛',[]);    
     }
 
diff --git a/application/api/logic/ActivityInfo.php b/application/api/logic/ActivityInfo.php
new file mode 100644
index 0000000..a1b2c4e
--- /dev/null
+++ b/application/api/logic/ActivityInfo.php
@@ -0,0 +1,52 @@
+<?php
+namespace app\api\logic;
+
+use app\common\logic\Basic as BasicLogic;
+use think\Db;
+class ActivityInfo extends BasicLogic
+{
+    /**
+     * 鍙傚姞娲诲姩
+     * 
+     */
+    public function attendAct($actid,$userid)
+    {
+        //鏌ヨ娲诲姩鏄惁瀛樺湪
+        $res=Db::query('SELECT * FROM t_activity_manage WHERE id=?',[$actid]);
+        if(empty($res)){
+           return false;
+        }
+        if($res[0]['act_status']==0||time()>strtotime($res[0]['end_time'])||time()<strtotime($res[0]['start_time']))
+        {
+            return false;
+        }
+        //鎻掑叆娲诲姩琛�
+        $recruitid=$actid.'u'.$userid;
+        $inser=Db::execute('insert ignore into t_recruit_act (id,user_id,act_id,create_time) values(?,?,?,?)',[$recruitid,$userid,$actid,time()]);
+        return true;
+    }
+
+    /**
+     * 鏇存柊鑾峰彇宸查個璇蜂汉鏁�
+     */
+    public function updateRecruitCount($userid)
+    {
+        //鏌ヨ杩涜涓殑鎷涘嫙娲诲姩
+        $nowTime=time();
+        $actList=Db::query('select id from t_activity_manage where act_status=1 and start_time<=? and end_time>=? limit 1',[$nowTime,$nowTime]);
+        if(empty($actList))
+        {//娌℃湁杩涜涓殑娲诲姩锛屼笉鐢ㄥ鐞�
+            return true;
+        }
+         //鏌ヨ鏄惁鍙傚姞浜嗘嫑鍕熸椿鍔�
+         $recruitid=$actList[0]['id'].'u'.$userid;
+         $actReinfo=Db::query('select id from t_recruit_act where id=? and settlement_status=0',[$recruitid]);
+         if(empty($actReinfo))
+         {//娌℃湁鍙傚姞娲诲姩锛屼笉鐢ㄥ鐞�
+             return true;
+         }
+        //澧炲姞count
+        $countres=Db::execute('update t_recruit_act set recruit_count=recruit_count+1 where id=?',[$recruitid]);
+        return $countres==1;
+    }
+}
\ No newline at end of file
diff --git a/public/html/compareprice.html b/public/html/compareprice.html
index 86fba4b..ec18e23 100644
--- a/public/html/compareprice.html
+++ b/public/html/compareprice.html
@@ -40,6 +40,12 @@
             margin-bottom: 1.1rem;
             padding-top:1.4rem;
         }
+        .mid-content-list
+        {
+            width: 100%;
+            background: #fff;
+            border-radius: .5rem;
+        }
         .content-tip
         {
             width: 88%;
@@ -73,6 +79,21 @@
         {
             width: 30%;
         }
+        .cont-title
+        {
+            margin: 0 0 0.5rem 0.5rem;
+            font-weight: 600;
+        }
+        .mid-content-none
+        {
+            width: 100%;
+            width: 100%;
+            text-align: center;
+            margin: 0 auto;
+            line-height: 6.2rem;
+            color: #a69b9b;
+    font-size: 14px;
+        }
     </style>
 </head>
 
@@ -97,8 +118,14 @@
                         </div>
                     </div>
                 </div>
-                <div class="mid-content-con">
-
+                <div class="cont-title">
+                    鏌ヨ鎺掕
+                </div>
+                <div class="mid-content-list">
+                    
+                    <div class="mid-content-none">
+                        鏆傛棤鏁版嵁~
+                    </div>
                 </div>
             </div>
         </div>

--
Gitblit v1.9.3