Bafang BBSxx PAS circuit board.
If your Bafang BBSxx motor works with the throttle, but does not operate while pedalling, it is 99% certain that the problem is a faulty PAS circuit. In this case, you may need to replace the PAS circuit.
1x PAS circuit
1x JST-SM connector