ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 推荐奖 公共函数 ~~~ 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'); } ~~~