//将分成1写入写入数据库 $res7 = $sqlhelper->execute_dql("select user_money,user_name from ydcom_users where user_id={$b1}"); $row7 = mysql_fetch_array($res7); $user_name = $row7[1]; $user_money = $row7[0] + $f1; //分成,跟新其余额 $sqlhelper->execute_dql("update ydcom_users set user_money={$user_money} where user_id={$b1}"); //write_affiliate_log($oid, $up_uid, $row['user_name'], $setmoney, $setpoint, $separate_by); write_affiliate_log($oid, $b1, $user_name, $f1, 0, 0); $time = time(); $sqlhelper->execute_dql("insert into ydcom_account_log(user_id,user_money,frozen_money,rank_points,pay_points,change_time,change_desc,change_type) values({$b1},{$f1},0,0,0,{$time},'分佣金',2)"); //values($b1,$f1,0,0,0,,"分佣金",2) //insert into ydcom_account_log(user_id,user_money,frozen_money,rank_points,pay_points,change_time,change_desc,change_type) } //查询模式一最高享受的层数 $highlayer = $sqlhelper->getmodel1_highlayer(); if ($highlayer < $i) { break; } $b1 = $sqlhelper->execute_dql1("select parent_id from ydcom_users where user_id={$b1}"); //b1为上家 } //模式二分成 $b2 = $sqlhelper->execute_dql1("select parent_id from ydcom_users where user_id={$user_id}"); //b2就是上家id //$a2为买家id $a2 = $user_id; for (; $b2 > 0;) { $d1 = $sqlhelper->getuser_fenxiaorank($a2); $d2 = $sqlhelper->getuser_fenxiaorank($b2); //a2为当前,b2为上家,d1为当前分销等级,d2为上家等级