do badly by (one)
To treat one poorly. I've been so absorbed in my job that I've done badly by my wife and kids.
do somehow by someone
to treat someone in a particular manner. (Do not confuse this with a passive construction. The someone is not the actor but the object.) Tom did all right by Ann when he brought her red roses. I did badly by Tom. I fired him without good reason.