Proving Sigma Protocol on a Schnorr Protocol Variant
This Sigma protocol is basically a variant of the Schnorr knowledge of exponent protocol but with respect to two different generators. Therefore, also the proof is really similar to the classic one:


Completeness


This is kind of straightforward: $$g_1^{z_1}g_2^{z_2}=g_1^{r_1+ew_1}g_2^{r_2+ew_2}=g_1^{r_1}g_2^{r_2}g_1^{ew_1}g_2^{ew_2}=g_1^{r_1}g_2^{r_2}(g_1^{w_1}g_2^{w_2})^e =ah^e \mod q $$


Special soundness


Let's assume we have two accepting transcripts $(a,e,(z_1,z_2))$ and $(a,e^{'},(z^{'}_1,z^{'}_2))$. A knowledge extractor could extract the witness in the following way. We have that: 

$$g_1^{z_1}g_2^{z_2} = ah^e$$ and $$g_1^{z_1^{'}}g_2^{z_2^{'}} = ah^{e^{'}}$$
Let's divide the two equations and we will get: $g_1^{z_1-z_1^{'}}g_2^{z_2-z_2^{'}} = h^{e-e^{'}}$, which yields: $$g_1^{\frac{z_1-z_1^{'}}{e-e^{'}}}g_2^{\frac{z_2-z_2^{'}}{e-e^{'}}} = h=g_1^{w_1}g_2^{w_2}$$. 
Therefore the extractor has that $w_1=\frac{z_1-z_1^{'}}{e-e^{'}} \mod q$ and $w_2=\frac{z_2-z_2^{'}}{e-e^{'}} \mod q$ .


Honest-Verifier zero-knowledge (HVZK)


Let's build the simulator given a random $(z_1,z_2)$ and $e$. The first message message $a$ can be obtained by $a=h^{-e}g_1^{z_1}g_2^{z_2} \mod q$.
Clearly, $(a,e,(z_1,z_2))$ have the same distribution as in a real run. Namely, random values
satisfying $g_1^{z_1}g_2^{z_2} = ah^e$.