Ejemplo n.º 1
0
    def connect(self, value):
        select = 'SELECT purchase_inf.`商品编号`,user_inf.`收货地址`,purchase_inf.`评价`,purchase_inf.`时间` ' \
                 'FROM purchase_inf,user_inf ' \
                 'WHERE purchase_inf.`用户账号`=user_inf.`用户账号` and user_inf.`用户账号`=\''+value+'\'' \
                 'GROUP BY purchase_inf.`时间` order by purchase_inf.`时间` desc '
        my = PyMySQL(select)
        self.list = [('', '', '', ''), ('', '', '', ''), ('', '', '', ''),
                     ('', '', '', ''), ('', '', '', ''), ('', '', '', '')]
        self.list = my.select_data2(self.list)

        self.total = 0
        select1 = 'SELECT COUNT(*) FROM purchase_inf WHERE purchase_inf.`用户账号`=\'' + value + '\''
        my1 = PyMySQL(select1)
        self.total = my1.select_data(self.total)

        self.str1 = ""
        select2 = 'SELECT `收货地址` FROM user_inf WHERE user_inf.`用户账号`=\'' + value + '\''
        my2 = PyMySQL(select2)
        self.str1 = my2.select_data(self.str1)

        if len(self.list) >= 1:
            self.m_button11.SetLabel('购买商品编号:' + self.list[0][0] + "购买时间:" +
                                     str(self.list[0][3]))
            if len(self.list) >= 2:
                self.m_button12.SetLabel('购买商品编号:' + self.list[1][0] +
                                         "购买时间:" + str(self.list[1][3]))
                if len(self.list) >= 3:
                    self.m_button13.SetLabel('购买商品编号:' + self.list[2][0] +
                                             "购买时间:" + str(self.list[2][3]))
                    if len(self.list) >= 4:
                        self.m_button14.SetLabel('购买商品编号:' + self.list[3][0] +
                                                 "购买时间:" +
                                                 str(self.list[3][3]))
                        if len(self.list) >= 5:
                            self.m_button15.SetLabel('购买商品编号:' +
                                                     self.list[4][0] +
                                                     "购买时间:" +
                                                     str(self.list[4][3]))
                            if len(self.list) >= 6:
                                self.m_button16.SetLabel('购买商品编号:' +
                                                         self.list[5][0] +
                                                         "购买时间:" +
                                                         str(self.list[5][3]))
        self.m_button1.SetLabel('收货地址:' + self.str1)
        #print(self.list[0][1])
        self.m_button3.SetLabel('购买统计:' + str(self.total))
Ejemplo n.º 2
0
 def initdb(self):
     select = 'SELECT item_inf.`商品编号`,shop_info.`店铺编号` FROM shop_info,item_inf ' \
              'WHERE shop_info.`店铺编号`=item_inf.`所属店铺` ' \
              'AND shop_info.`所属用户`=\''+userone.username+'\''
     my = PyMySQL(select)
     self.list = my.select_data2(self.list)
     print(self.list)
     select = 'SELECT shop_info.`店铺编号` FROM shop_info ' \
              'WHERE  shop_info.`所属用户`=\'' + userone.username + '\''
     my = PyMySQL(select)
     self.str = ""
     self.str = my.select_data(self.str)
Ejemplo n.º 3
0
    def Onclick(self, event):
        self.value = str(self.GetValue())

        update1 = 'UPDATE purchase_inf SET `评价`=\'' + self.value + '\' WHERE `商品编号`=\'' + self.value1 + '\''
        my = PyMySQL(update1)
        my.update_data()
        str_1 = []
        select = 'SELECT `评价` FROM item_inf WHERE `商品编号`=\'' + self.value1 + '\''
        my2 = PyMySQL(select)
        str_1 = my2.select_data(str_1)
        if str_1 == "0":
            update2='' \
                    'UPDATE item_inf SET `评价`=\''+self.value+'\' WHERE `商品编号`=\''+ self.value1 +'\''
        else:
            update2 ='UPDATE item_inf SET `评价`=CAST(((CAST(`评价` AS FLOAT)+' + self.value + ')/2.0)AS CHAR)' \
                                                                                        'WHERE `商品编号`=\'' + \
                  self.value1+ '\''
        #print(update2)
        my = PyMySQL(update2)
        my.update_data()
        self.Close(True)