A time-dependent particle acceleration and emission model: understanding particle spectral evolution and blazar flares