From cc6247528b559cf6a9468591bb889bb58dc14199 Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期二, 01 八月 2023 16:10:55 +0800 Subject: [PATCH] no message --- application/api/logic/ActivityInfo.php | 64 ++++++++++++++++++++++++++++---- 1 files changed, 56 insertions(+), 8 deletions(-) diff --git a/application/api/logic/ActivityInfo.php b/application/api/logic/ActivityInfo.php index 2a08cdd..050b2e1 100644 --- a/application/api/logic/ActivityInfo.php +++ b/application/api/logic/ActivityInfo.php @@ -6,6 +6,8 @@ use think\Db; use app\common\model\User as ModelUser; use app\api\logic\SettlementRecord as LogicSettlementRecord; +use app\api\logic\UserBrowse as LogicUserBrowse; + class ActivityInfo extends BasicLogic { @@ -73,6 +75,8 @@ return true; } + + /** * 鏇存柊鑾峰彇宸查個璇蜂汉鏁� */ @@ -81,27 +85,35 @@ try{ //鏌ヨ杩涜涓殑鎷涘嫙娲诲姩 $nowTime= date("Y-m-d H:i:s", time()); - $actList=Db::query('select id from t_activity_manage where act_status=1 and start_time<=? and end_time>=? and act_type=0 limit 1',[$nowTime,$nowTime]); + $actList=Db::query('select id,end_time from t_activity_manage where act_status=1 and start_time<=? and end_time>=? and act_type=0 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]); + $actReinfo=Db::query('select id,create_time from t_recruit_act where id=? and user_t=0 and settlement_status=0',[$recruitid]); if(empty($actReinfo)) {//娌℃湁鍙傚姞娲诲姩锛屼笉鐢ㄥ鐞� return true; } + //鑾峰彇宸查個璇蜂汉鏁� + $actEndTime=strtotime($actList[0]['end_time']);//娲诲姩缁撴潫鏃堕棿 + $yqCount=Db::query('select count(DISTINCT(login_deviceid)) as count from t_user where invitation_id=? and status=? and invite_bind_time>=? and invite_bind_time<=?',[$userid,'normal',$actReinfo[0]['create_time'],$actEndTime]); + $count=0; + if(!empty($yqCount)) + { + $count=$yqCount[0]['count']; + } //澧炲姞count - $countres=Db::execute('update t_recruit_act set recruit_count=recruit_count+1 where id=?',[$recruitid]); + $countres=Db::execute('update t_recruit_act set recruit_count=? where id=?',[$count,$recruitid]); return $countres==1; } catch(\Exception $e) { } - } /** @@ -113,9 +125,19 @@ $count=Db::query('select recruit_count from t_recruit_act where id=?',[$recruitid]); if(empty($count)) { - return 0; + return [ + 'membercount'=>0, + 'award'=>0 + ]; } - return $count[0]['recruit_count']; + //鑾峰彇閲戦淇℃伅 + $actList=Db::query('select * from t_activity_manage where id=? and count_status=0 and act_type=0 and act_status=1',[$actid]); + $rewardRule=json_decode($actList[0]['act_json']); + $award=$this->stepAllRule($rewardRule->rule,$count[0]['recruit_count']); + return [ + 'membercount'=>$count[0]['recruit_count'], + 'award'=>$award + ]; } /** @@ -123,7 +145,7 @@ */ public function getRankingList($actid,$userid) { - $rList=Db::query(' SELECT a.id,a.nickname,a.avatar,b.recruit_count from t_recruit_act b left join t_user a on a.id =b.user_id where b.act_id=? and b.recruit_count>0 order by b.recruit_count desc limit 7',[$actid]); + $rList=Db::query('SELECT a.id,a.nickname,a.avatar,b.recruit_count from t_recruit_act b left join t_user a on a.id =b.user_id where b.act_id=? and b.recruit_count>0 order by b.recruit_count desc limit 7',[$actid]); if(empty($rList)) { return []; @@ -162,7 +184,7 @@ foreach($cusList as $cus) {//寰幆鍙備笌娲诲姩鐨勪細鍛� $tradeId=$act['id'].'u'.$cus['user_id']; - $yqCount=Db::query('select count(1) as count from t_user where invitation_id=? and invite_bind_time>=? and invite_bind_time<=?',[$cus['user_id'],$cus['create_time'],$actEndTime]); + $yqCount=Db::query('select count(DISTINCT(login_deviceid)) as count from t_user where invitation_id=? and status=? and invite_bind_time>=? and invite_bind_time<=?',[$cus['user_id'],'normal',$cus['create_time'],$actEndTime]); if(empty($yqCount)) { Db::execute('update t_recruit_act set settlement_status=?,settlement_time=?,act_count=0,act_award=0 where id=?',[1, date("Y-m-d H:i:s", time()),$tradeId]); @@ -236,4 +258,30 @@ return $maxReward; } + /** + * 鑷畾涔夊脊绐�-0鍏冭喘 + */ + public function popupcus_freebuy($userInfo) + { + $LogicUserBrowse = new LogicUserBrowse(); + $res = $LogicUserBrowse->checkIsFirstFree($userInfo->id); + if($res === false) + { + return false; + } + if(empty($res)) + { + return true; + } + return false; + } + + /*** + * 璁板綍鍟嗗搧鐐瑰嚮 + */ + public function recordItemClick($goodsid,$plat,$title,$act_price) + { + $inser=Db::execute('insert into t_wxitems (id,create_time,goodsid,plat,title,act_price) values(?,?,?,?,?,?)',[guid(),date("Y-m-d H:i:s", time()),$goodsid,$plat,$title,$act_price]); + return true; + } } \ No newline at end of file -- Gitblit v1.9.3