From c5855f5eb22d2dd1d30d32d1d4f06a566b532a98 Mon Sep 17 00:00:00 2001
From: zhaojs <349234519@qq.com>
Date: 星期二, 22 八月 2023 14:14:48 +0800
Subject: [PATCH] Revert "no message"

---
 application/api/controller/Activity.php |  164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 163 insertions(+), 1 deletions(-)

diff --git a/application/api/controller/Activity.php b/application/api/controller/Activity.php
index 284d866..94ae472 100644
--- a/application/api/controller/Activity.php
+++ b/application/api/controller/Activity.php
@@ -6,11 +6,14 @@
 use app\api\logic\taoke\device\Haodanku;
 use app\common\model\FqbCate;
 use app\api\logic\taoke\device\Jd as LogicJd;
+use app\api\logic\Banner as LogicBanner;
+
+use app\api\logic\ActivityInfo as ActInfo;
 
 header("Access-Control-Allow-Origin:*");
 class Activity extends Api
 {
-    protected $noNeedLogin = ['fqb_plat_cate'];
+    protected $noNeedLogin = ['UpWxImg','recordItemClick','fqb_plat_cate','run_countRecruitAct','test'];
     protected $noNeedRight = '*';
     /**
      * 鑾峰彇鐤姠姒�
@@ -173,4 +176,163 @@
         $this->success('鑾峰彇鎴愬姛',$list);
     }
 
+
+    /**
+     * 鑾峰彇娲诲姩淇℃伅
+     * 
+     */
+    public function getActInfo()
+    {
+        $actid=request()->param('actid');
+        if(empty($actid)) $this->error('鍙傛暟閿欒');
+        $actInfo=new ActInfo();
+        $user = $this->auth->getUser();
+        $res=$actInfo->getActInfo($actid,$user->id);
+        
+        $this->success('鑾峰彇鎴愬姛',$res);
+    }
+
+    /**
+     * 鍙傚姞娲诲姩
+     */
+    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('娲诲姩寮傚父');;
+    }
+
+    /**
+     * 鑾峰彇娲诲姩宸查個璇蜂汉鏁�
+     * 
+     */
+    public function getActRecruitCount()
+    {
+        $actid=request()->param('actid');
+        if(empty($actid)) $this->error('鍙傛暟閿欒');
+        $actInfo=new ActInfo();
+        $user = $this->auth->getUser();
+        $res=$actInfo->getActRecruitCount($actid,$user->id);
+        $this->success('鑾峰彇鎴愬姛',$res);
+    }
+
+    /**
+     * 鑾峰彇鎺掑悕
+     */
+    public function getRankingList()
+    {
+        $actid=request()->param('actid');
+        if(empty($actid)) $this->error('鍙傛暟閿欒');
+        $actInfo=new ActInfo();
+        $user = $this->auth->getUser();
+        $res=$actInfo->getRankingList($actid,$user->id);
+        $this->success('鑾峰彇鎴愬姛',$res);
+    }
+
+    public function test()
+    {
+        $actInfo=new ActInfo();
+        $res=$actInfo->updateRecruitCount(2);
+    }
+
+    /**
+     * 鎷涘嫙娲诲姩璁$畻
+     */
+    public function run_countRecruitAct()
+    {
+        $actInfo=new ActInfo();
+        $res=$actInfo->run_countRecruitAct();
+        $this->success('鎵ц瀹屾垚',$res);
+    }
+    /**
+     * 鑾峰彇閭�璇风爜
+     */
+    public function getInviteUrl()
+    {
+        $user = $this->auth->getUser();
+        $this->success('鑾峰彇鎴愬姛',$user->invitation_code);
+    }
+
+
+    /**
+     * 鑾峰彇鑷畾涔夊脊绐�
+     * 
+     */
+    public function getCustomizePopup()
+    {
+        $LogicBanner = new LogicBanner();
+        $list = $LogicBanner->getList('20,21');
+        if(!$list||$list['customizePop']==null||count($list['customizePop'])==0)
+        {
+            $this->success('鑾峰彇鎴愬姛',[]);
+        }
+        $user = $this->auth->getUser();
+        $actInfo=new ActInfo();
+        foreach ($list['customizePop'] as $vaule) {
+            $paraJson=json_decode($vaule->note);
+            $isPop=false;
+            switch($paraJson->poptype)
+            {
+                case 'freebuy'://0鍏冭喘寮圭獥
+                    $isPop=$actInfo->popupcus_freebuy($user);
+                    break;
+                default:
+                    break;
+            }
+            if($isPop)
+            {
+                $this->success('鑾峰彇鎴愬姛',['haspop'=>true,'info'=>$vaule]);
+                break;
+            }
+        }
+        $this->success('鑾峰彇鎴愬姛',['haspop'=>false]);
+    }
+
+    /**
+     * 
+     * 璁板綍鍟嗗搧鐐瑰嚮
+     */
+
+    public function recordItemClick()
+    {
+        $goodsid=request()->param('goodsid');
+        $plat=request()->param('plat');
+        $title=request()->param('title');
+        $act_price=request()->param('act_price');
+        $actInfo=new ActInfo();
+        $actInfo->recordItemClick($goodsid,$plat,$title,$act_price);
+        $this->success('鎴愬姛',['success'=>true]);
+    }
+
+    public function UpWxImg()
+    {
+        $token=request()->param('token');
+        $picPath=request()->param('picPath');
+        //涓婁紶姘镐箙绱犳潗
+        $url="https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=".$token."&type=image";
+        //2銆佸悓姝ュ埌寰俊鏈嶅姟鍣�
+        if(class_exists('\CURLFile')){  //7.0
+            $data = ['media' => new \CURLFile($picPath)];
+        }else{  //5.6浠ュ強5.6浠ヤ笅
+            $data = array('media' => '@'.$picPath);
+        }
+ 
+        $ch  = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER , true);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST , false);
+        curl_setopt($ch, CURLOPT_POST, 1);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+        $res  = curl_exec($ch);
+        curl_close($ch);
+        $wxrs_id_card=json_decode($res,true);
+        $id_card =$wxrs_id_card['media_id'];  //寰楀埌media_id
+    }
+
+    
 }
\ No newline at end of file

--
Gitblit v1.9.3