7.31 $\log _{3}(x-3)^{2}+\log _{3}|x-3|=3$.

Translate the above text into English, keeping the original text's line breaks and format, and output the translation result directly.

7.31 $\log _{3}(x-3)^{2}+\log _{3}|x-3|=3$.
7.31 Here $x \neq 3$. Writing the right-hand side of the equation as $3=3 \log _{3} 3=\log _{3} 3^{3}$, we transition to the equivalent equation $(x-3)^{2}|x-3|=3^{3}$ under the condition $x \neq 3$. Since $a^{2}=|a|^{2}$, we get $|x-3|^{3}=3^{3}$, or $|x-3|=3$, from which $x_{1}=0, x_{2}=6$.

Answer: $x_{1}=0, x_{2}=6$.