In the context of national efforts to promote country-wide distributed photovoltaics (DPVs), the installation of distributed energy storage systems (DESSs) can solve the current problems of DPV consumption, peak shaving, and valley filling, as well as operation optimization faced by medium-voltage distribution networks (DN). In this paper, firstly, a price elasticity matrix based on the peak and valley tariff mechanism is introduced to establish a master–slave game framework for DN-DESSs under the DPV multi-point access environment. Secondly, the main model optimizes the pricing strategy of peak and valley tariffs with the objective of the lowest annual operating cost of the DN, and the slave model establishes a two-layer optimization model of DESSs with the objective of the maximum investment return of the DESSs and the lowest daily operating costs and call the CPLEX solver and particle swarm optimization algorithm for solving. Finally, the IEEE33 node system is used as a prototype for simulation verification. The results show that the proposed model can not only effectively reduce the operating cost of the distribution network but also play a role in improving the energy storage revenue and DPV consumption capacity, which has a certain degree of rationality and practicality.