public function updateBindRelation($account, $userId) { $account = mysql_real_escape_string($account); $userId = array_map('intval', $userId); /* *执行逻辑 先删除旧的 然后再批量插入新的 */ $delSql = "delete from msg_userAccountBind where account='{$account}'"; $delQuey = $this->dbConn->query($delSql); if (FALSE === $delQuey) { self::$errMsg = '更新失败!'; return FALSE; } foreach ($userId as $id) { $insertSql = "insert into msg_userAccountBind (account, userID) values ('{$account}', '{$id}')"; $this->dbConn->query($insertSql); } }