💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 推荐奖 公共函数 ~~~ function referral_bonus($code,$money,$level=1){ if(empty($code)||empty($money)||$level>7) return false; $userInfo = Db::name('user')->where( 'code',$code )->find(); if(empty($userInfo)) return false; if(!empty($userInfo['referrer'])){ referral_bonus($userInfo['referrer'],$money,$level+1); } $config_base = config('config_base.'); switch ($level) { case 1: $sum = round($money*$config_base['ttj_1']/100,2); break; case 2: $sum = round($money*$config_base['ttj_2']/100,2); break; case 3: $sum = round($money*$config_base['ttj_3']/100,2); break; case 4: $sum = round($money*$config_base['ttj_4']/100,2); break; case 5: $sum = round($money*$config_base['ttj_5']/100,2); break; case 6: $sum = round($money*$config_base['ttj_6']/100,2); break; case 7: $sum = round($money*$config_base['ttj_7']/100,2); break; default: $sum = 0; } $remark = '第'.$level.'代推荐奖'; change_balance($userInfo['id'],$sum,$remark,'+','tjj'); } ~~~