package com.tencent.mm.plugin.card.model;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.e.e;
import com.tencent.mm.sdk.e.j;
import com.tencent.mm.sdk.platformtools.ab;

public final class l extends j<k> {
    public static final String[] fnj = new String[]{j.a(k.ccO, "CardQrCodeDataInfo")};
    public e bSd;

    static {
        AppMethodBeat.i(87848);
        AppMethodBeat.o(87848);
    }

    public l(e eVar) {
        super(eVar, k.ccO, "CardQrCodeDataInfo", k.diI);
        this.bSd = eVar;
    }

    /* JADX WARNING: Removed duplicated region for block: B:12:0x0047 A:{REMOVE} */
    public final java.util.List<com.tencent.mm.plugin.card.model.k> Gw(java.lang.String r9) {
        /*
        r8 = this;
        r3 = 1;
        r4 = 0;
        r7 = 87843; // 0x15723 float:1.23094E-40 double:4.34E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r7);
        r0 = "select * from CardQrCodeDataInfo where card_id =? AND status=0";
        r1 = new java.util.ArrayList;
        r1.<init>();
        r2 = r8.bSd;
        r3 = new java.lang.String[r3];
        r3[r4] = r9;
        r2 = r2.rawQuery(r0, r3);
    L_0x001a:
        if (r2 == 0) goto L_0x004b;
    L_0x001c:
        r0 = r2.moveToNext();	 Catch:{ Exception -> 0x002e }
        if (r0 == 0) goto L_0x004b;
    L_0x0022:
        r0 = new com.tencent.mm.plugin.card.model.k;	 Catch:{ Exception -> 0x002e }
        r0.<init>();	 Catch:{ Exception -> 0x002e }
        r0.d(r2);	 Catch:{ Exception -> 0x002e }
        r1.add(r0);	 Catch:{ Exception -> 0x002e }
        goto L_0x001a;
    L_0x002e:
        r0 = move-exception;
        r3 = "MicroMsg.CardQrCodeDataInfoStorage";
        r4 = "getCardQrcodeByCardId error!";
        r5 = 1;
        r5 = new java.lang.Object[r5];	 Catch:{ all -> 0x0051 }
        r6 = 0;
        r0 = r0.getMessage();	 Catch:{ all -> 0x0051 }
        r5[r6] = r0;	 Catch:{ all -> 0x0051 }
        com.tencent.mm.sdk.platformtools.ab.e(r3, r4, r5);	 Catch:{ all -> 0x0051 }
        if (r2 == 0) goto L_0x0047;
    L_0x0044:
        r2.close();
    L_0x0047:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r7);
        return r1;
    L_0x004b:
        if (r2 == 0) goto L_0x0047;
    L_0x004d:
        r2.close();
        goto L_0x0047;
    L_0x0051:
        r0 = move-exception;
        if (r2 == 0) goto L_0x0057;
    L_0x0054:
        r2.close();
    L_0x0057:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r7);
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.card.model.l.Gw(java.lang.String):java.util.List");
    }

    /* JADX WARNING: Removed duplicated region for block: B:9:0x0040  */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x006f  */
    public final com.tencent.mm.plugin.card.model.k Gx(java.lang.String r9) {
        /*
        r8 = this;
        r7 = 87844; // 0x15724 float:1.23096E-40 double:4.34007E-319;
        r3 = 1;
        r4 = 0;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r7);
        r0 = "select * from CardQrCodeDataInfo where card_id =? AND status=0  limit 1";
        r2 = 0;
        r1 = r8.bSd;
        r3 = new java.lang.String[r3];
        r3[r4] = r9;
        r3 = r1.rawQuery(r0, r3);
        if (r3 == 0) goto L_0x0047;
    L_0x0018:
        r0 = r3.getCount();	 Catch:{ Exception -> 0x0058 }
        if (r0 <= 0) goto L_0x0047;
    L_0x001e:
        r0 = 0;
        r3.moveToPosition(r0);	 Catch:{ Exception -> 0x0058 }
        r0 = new com.tencent.mm.plugin.card.model.k;	 Catch:{ Exception -> 0x0058 }
        r0.<init>();	 Catch:{ Exception -> 0x0058 }
        r0.d(r3);	 Catch:{ Exception -> 0x007d }
        r1 = "MicroMsg.CardQrCodeDataInfoStorage";
        r2 = "getOneCardQrcodeByCardId  success! card_id = %s, code_id = %s ";
        r4 = 2;
        r4 = new java.lang.Object[r4];	 Catch:{ Exception -> 0x007d }
        r5 = 0;
        r4[r5] = r9;	 Catch:{ Exception -> 0x007d }
        r5 = 1;
        r6 = r0.field_code_id;	 Catch:{ Exception -> 0x007d }
        r4[r5] = r6;	 Catch:{ Exception -> 0x007d }
        com.tencent.mm.sdk.platformtools.ab.i(r1, r2, r4);	 Catch:{ Exception -> 0x007d }
    L_0x003e:
        if (r3 == 0) goto L_0x0043;
    L_0x0040:
        r3.close();
    L_0x0043:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r7);
        return r0;
    L_0x0047:
        r0 = "MicroMsg.CardQrCodeDataInfoStorage";
        r1 = "getOneCardQrcodeByCardId  is empty! card_id = %s";
        r4 = 1;
        r4 = new java.lang.Object[r4];	 Catch:{ Exception -> 0x0058 }
        r5 = 0;
        r4[r5] = r9;	 Catch:{ Exception -> 0x0058 }
        com.tencent.mm.sdk.platformtools.ab.e(r0, r1, r4);	 Catch:{ Exception -> 0x0058 }
        r0 = r2;
        goto L_0x003e;
    L_0x0058:
        r1 = move-exception;
        r0 = r2;
    L_0x005a:
        r2 = "MicroMsg.CardQrCodeDataInfoStorage";
        r4 = "getOneCardQrcodeByCardId error!";
        r5 = 1;
        r5 = new java.lang.Object[r5];	 Catch:{ all -> 0x0073 }
        r6 = 0;
        r1 = r1.getMessage();	 Catch:{ all -> 0x0073 }
        r5[r6] = r1;	 Catch:{ all -> 0x0073 }
        com.tencent.mm.sdk.platformtools.ab.e(r2, r4, r5);	 Catch:{ all -> 0x0073 }
        if (r3 == 0) goto L_0x0043;
    L_0x006f:
        r3.close();
        goto L_0x0043;
    L_0x0073:
        r0 = move-exception;
        if (r3 == 0) goto L_0x0079;
    L_0x0076:
        r3.close();
    L_0x0079:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r7);
        throw r0;
    L_0x007d:
        r1 = move-exception;
        goto L_0x005a;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.card.model.l.Gx(java.lang.String):com.tencent.mm.plugin.card.model.k");
    }

    /* JADX WARNING: Removed duplicated region for block: B:9:0x0040  */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x006f  */
    public final com.tencent.mm.plugin.card.model.k Gy(java.lang.String r9) {
        /*
        r8 = this;
        r7 = 87845; // 0x15725 float:1.23097E-40 double:4.3401E-319;
        r2 = 1;
        r3 = 0;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r7);
        r0 = "select * from CardQrCodeDataInfo where card_id =? AND status=1  limit 1";
        r1 = r8.bSd;
        r2 = new java.lang.String[r2];
        r2[r3] = r9;
        r3 = r1.rawQuery(r0, r2);
        r2 = 0;
        if (r3 == 0) goto L_0x0047;
    L_0x0018:
        r0 = r3.getCount();	 Catch:{ Exception -> 0x0058 }
        if (r0 <= 0) goto L_0x0047;
    L_0x001e:
        r0 = 0;
        r3.moveToPosition(r0);	 Catch:{ Exception -> 0x0058 }
        r0 = new com.tencent.mm.plugin.card.model.k;	 Catch:{ Exception -> 0x0058 }
        r0.<init>();	 Catch:{ Exception -> 0x0058 }
        r0.d(r3);	 Catch:{ Exception -> 0x007d }
        r1 = "MicroMsg.CardQrCodeDataInfoStorage";
        r2 = "getCardQrcodeShowingByCardId  success! card_id = %s, code_id = %s ";
        r4 = 2;
        r4 = new java.lang.Object[r4];	 Catch:{ Exception -> 0x007d }
        r5 = 0;
        r4[r5] = r9;	 Catch:{ Exception -> 0x007d }
        r5 = 1;
        r6 = r0.field_code_id;	 Catch:{ Exception -> 0x007d }
        r4[r5] = r6;	 Catch:{ Exception -> 0x007d }
        com.tencent.mm.sdk.platformtools.ab.i(r1, r2, r4);	 Catch:{ Exception -> 0x007d }
    L_0x003e:
        if (r3 == 0) goto L_0x0043;
    L_0x0040:
        r3.close();
    L_0x0043:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r7);
        return r0;
    L_0x0047:
        r0 = "MicroMsg.CardQrCodeDataInfoStorage";
        r1 = "getCardQrcodeShowingByCardId  is empty! card_id = %s";
        r4 = 1;
        r4 = new java.lang.Object[r4];	 Catch:{ Exception -> 0x0058 }
        r5 = 0;
        r4[r5] = r9;	 Catch:{ Exception -> 0x0058 }
        com.tencent.mm.sdk.platformtools.ab.e(r0, r1, r4);	 Catch:{ Exception -> 0x0058 }
        r0 = r2;
        goto L_0x003e;
    L_0x0058:
        r1 = move-exception;
        r0 = r2;
    L_0x005a:
        r2 = "MicroMsg.CardQrCodeDataInfoStorage";
        r4 = "getCardQrcodeShowingByCardId error!";
        r5 = 1;
        r5 = new java.lang.Object[r5];	 Catch:{ all -> 0x0073 }
        r6 = 0;
        r1 = r1.getMessage();	 Catch:{ all -> 0x0073 }
        r5[r6] = r1;	 Catch:{ all -> 0x0073 }
        com.tencent.mm.sdk.platformtools.ab.e(r2, r4, r5);	 Catch:{ all -> 0x0073 }
        if (r3 == 0) goto L_0x0043;
    L_0x006f:
        r3.close();
        goto L_0x0043;
    L_0x0073:
        r0 = move-exception;
        if (r3 == 0) goto L_0x0079;
    L_0x0076:
        r3.close();
    L_0x0079:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r7);
        throw r0;
    L_0x007d:
        r1 = move-exception;
        goto L_0x005a;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.card.model.l.Gy(java.lang.String):com.tencent.mm.plugin.card.model.k");
    }

    public final boolean dm(String str, String str2) {
        AppMethodBeat.i(87846);
        k kVar = new k();
        kVar.field_card_id = str;
        kVar.field_code_id = str2;
        boolean a = a(kVar, new String[]{"card_id", "code_id"});
        if (a) {
            ab.i("MicroMsg.CardQrCodeDataInfoStorage", "delete qrCodeData  success! card_id = %s, code_id = %s", new Object[]{kVar.field_card_id, kVar.field_code_id});
        } else {
            ab.e("MicroMsg.CardQrCodeDataInfoStorage", "delete qrCodeData  failure! card_id = %s, code_id = %s", new Object[]{kVar.field_card_id, kVar.field_code_id});
        }
        AppMethodBeat.o(87846);
        return a;
    }

    public final boolean pI(String str) {
        AppMethodBeat.i(87847);
        k kVar = new k();
        kVar.field_card_id = str;
        boolean a = a(kVar, new String[]{"card_id"});
        if (a) {
            ab.i("MicroMsg.CardQrCodeDataInfoStorage", "delete qrCodeData by cardId  success! card_id = %s", new Object[]{str});
        } else {
            ab.e("MicroMsg.CardQrCodeDataInfoStorage", "delete qrCodeData by cardId  failure! card_id = %s", new Object[]{str});
        }
        AppMethodBeat.o(87847);
        return a;
    }
}
