$v) { if ($v == $uid) { continue; } foreach ($table as $k1 => $v1) { Dever::db($v1)->updates(array('set_uid' => $uid, 'option_uid' => $v)); } # 处理一些特殊的情况 $this->other($uid, $v); # 积分相关 要把积分加上,再删掉之前的 $this->score($uid, $v, 'score/user'); $this->score($uid, $v, 'act/score'); } } private function other($uid, $drop_uid) { Dever::db('code/info')->updates(array('set_create_uid' => $uid, 'option_create_uid' => $drop_uid)); Dever::db('invite/relation')->updates(array('set_to_uid' => $uid, 'option_to_uid' => $drop_uid)); } private function score($uid, $drop_uid, $table, $col = 'score') { $db = Dever::db($table); $user_score = $db->one(array('uid' => $uid)); $user_drop_score = $db->one(array('uid' => $drop_uid)); if ($user_score && $user_drop_score) { $score = $user_score[$col] + $user_drop_score[$col]; $update['where_id'] = $user_score['id']; $update['score'] = $score; $db->update($update); $db->delete($user_drop_score['id']); } } }