iPhone 7 won't charge consistently from MacBookAir 2015
I'm not sure when it started, but at some point both USB ports in my
  MacBook won't charge my iPhone 7, it just keeps going from charging to
  not charging really rapidly


Given that you've tried different cables, you've ruled out the possibility of the cable failing.  However, there are a few more things to try to isolate the problem


Reset the SMC (this manages the power in your MacBook)
Try a different computer with the same cable and iPhone.  If the problem goes away, you've narrowed it to your MacBook.  If not, the problem is with your device.
Try a different device with your MacBook.  Same concept as the previous point; if the symptoms remain, it's probably your MacBook.


Now, given that it's happening on both ports, it's entirely possible that there is an issue with the power rail that supplies the 5V to the USB port, the USB controller itself (unlikely unless your keyboard, Bluetooth, camera also stopped working) or any of the related components.  If this is the case, you will need to take it in for repair.

This YouTube video from Louis Rossman on repairing the USB port is a good resource for what the problem might actually be (I've started the video at the point where he discusses the 5V power).