def get_gacha_operator(self, limit=0, extra=None):
     return self.db.select('t_operator', where=Where({
         'limit': Where({
             'available': 1,
             'in_limit': ['in', Formula('(%d, 0)' % limit)]
         }),
         'operator_name': ['in', Formula('("%s")' % '", "'.join(extra or []))]
     }, operator='OR'))
    def get_operator_id(self, operator_no='', operator_name=''):
        res = self.db.select('t_operator', where=Where({
            'operator_no': operator_no,
            'operator_name': operator_name
        }, operator='OR'), fetchone=True)

        return res['operator_id'] if res else None
    def get_skill_id(self, skill_no, operator_id):
        res = self.db.select('t_operator_skill', where=Where({
            'skill_no': skill_no,
            'operator_id': operator_id
        }), fetchone=True)

        return res['skill_id'] if res else None
Exemple #4
0
 def get_image_id(self, image_name, image_type):
     return self.db.select('t_images',
                           where=Where({
                               'image_name': image_name,
                               'image_type': image_type
                           }),
                           fetchone=True)
Exemple #5
0
 def get_voice_id(self, voice_name, voice_type):
     return self.db.select('t_voices',
                           where=Where({
                               'voice_name': voice_name,
                               'voice_type': voice_type
                           }),
                           fetchone=True)
Exemple #6
0
 def get_config(self, name, keyword, fetchone=False):
     return self.db.select('t_config_amiya',
                           where=Where({
                               'config_name': name,
                               'config_keyword': keyword
                           }),
                           fetchone=fetchone)
 def set_break_even(self, user_id, break_even, costs):
     self.db.update(table='t_user',
                    where=Where({'user_id': user_id}),
                    data={
                        'gacha_break_even': break_even,
                        'coupon': Formula('coupon - %d' % costs)
                    })
Exemple #8
0
 def set_black_user(self, user_id):
     self.db.update(
         table='t_user',
         where=Where({'user_id': user_id}),
         data={
             'black': 1
         }
     )
Exemple #9
0
 def set_gacha_pool(self, user_id, pool_id):
     self.db.update(
         table='t_user',
         where=Where({'user_id': user_id}),
         data={
             'gacha_pool': pool_id
         }
     )
Exemple #10
0
 def get_operator_gacha_config(self, group='limit'):
     limit_operator = self.db.select(
         't_operator_gacha_config',
         where=Where({
             'operator_type':
             ['in', Formula('(0, 1)')] if group == 'limit' else ['>', '1']
         }))
     return [item['operator_name'] for item in limit_operator]
Exemple #11
0
 def set_waiting(self, user_id, name):
     self.db.update(
         table='t_user',
         where=Where({'user_id': user_id}),
         data={
             'waiting': name
         }
     )
Exemple #12
0
 def get_all_operator(self, names: list = None):
     if names:
         return self.db.select(
             't_operator',
             where=Where({
                 'operator_name':
                 ['in', Formula('("%s")' % '", "'.join(names))]
             }))
     return self.db.select('t_operator')
Exemple #13
0
 def check_message_speed_by_user(self, user_id, seconds):
     return self.db.count('t_message',
                          'msg_id',
                          where=Where({
                              'reply_user':
                              user_id,
                              'msg_time': ['>=',
                                           time.time() - seconds]
                          }))
Exemple #14
0
    def check_intellect_full_alarm(self, full_time):
        res = self.db.select('t_remind',
                             where=Where({
                                 'status': 0,
                                 'full_time': ['<=', full_time]
                             }))

        self.update_intellect_full_alarm(full_time)

        return res
Exemple #15
0
 def find_operator_voice(self, operator_name, title):
     return self.db.select(
         't_operator_voice',
         where=Where({
             'operator_id':
             self.get_operator_id(operator_name=operator_name),
             'voice_title':
             title
         }),
         fetchone=True)
    def get_material_id(self, name='', nickname=''):
        res = self.db.select('t_material',
                             where=Where(
                                 {
                                     'material_name': name,
                                     'material_nickname': nickname
                                 },
                                 operator='OR'),
                             fetchone=True)

        return res['material_id']
    def find_operator_all_detail(self, operator_id):
        where = Where({
            'operator_id': operator_id
        })
        base = self.db.select('t_operator', where=where, fetchone=True)
        detail = self.db.select('t_operator_detail', where=where, fetchone=True)
        talents = self.db.select('t_operator_talents', where=where)
        potential = self.db.select('t_operator_potential', where=where)
        building_skill = self.db.select('t_operator_building_skill', where=where)

        return base, detail, talents, potential, building_skill
 def get_user(self, user_id):
     return self.db.select('t_user',
                           where=Where({'user_id': user_id}),
                           fetchone=True)
Exemple #19
0
 def get_status(self, group):
     res = self.db.select('t_group',
                          where=Where({'group_id': group}),
                          fetchone=True)
     return res
Exemple #20
0
    def del_message(self, days: int):
        last_time = int(time.time()) - days * 86400

        self.db.delete('t_message',
                       where=Where({'msg_time': ['<=', last_time]}))
 def find_material_source(self, name):
     return self.db.select(
         't_material_source',
         where=Where({'material_id': self.get_material_id(name=name)}))
Exemple #22
0
 def get_operator_by_id(self, operator_id):
     where = Where({'operator_id': operator_id})
     return self.db.select('t_operator', where=where, fetchone=True)
Exemple #23
0
 def find_operator_skin(self, skin_name):
     where = Where({'skin_name': skin_name})
     return self.db.select('t_operator_skins', where=where, fetchone=True)
Exemple #24
0
 def update_intellect_full_alarm(self, full_time):
     self.db.update('t_remind',
                    where=Where({'full_time': ['<=', full_time]}),
                    data={'status': 1})
Exemple #25
0
 def check_intellect_by_user(self, user_id):
     return self.db.select('t_remind',
                           where=Where({'user_id': user_id}),
                           fetchone=True)