Example #1
0
 def create(self):
     form = HallCreateForm(self.body_data())
     if not form.is_valid():
         return self.json(ResultCode.CODE_40003.value, None,
                          ResultMsg.MSG_40003.value)
     Hall.create(form.data)
     return self.json(ResultCode.CODE_20000.value, None,
                      ResultMsg.MSG_20000.value)
Example #2
0
def find_by_id(hall_id):
    """
    根据ID查询
    :param hall_id:
    :return:
    """
    return Hall.hall_info(hall_id=hall_id)
Example #3
0
def next_hall_stage(hall_id):
    """
    大厅阶段切换
    :param hall_id:
    :return:
    """
    return Hall.next_hall_stage(hall_id)
Example #4
0
def get_hall_bet_second(hall_id):
    """
    获取大厅倒计时
    :param hall_id:
    :return:
    """
    return Hall.get_bet_second(hall_id)
Example #5
0
def update_lottery_time(hall_id, value):
    """
    更新开奖时间
    :param hall_id: 大厅ID
    :param value: 新的开奖时间
    :return: Boolean
    """
    return Hall.update_lottery_time(hall_id, value)
Example #6
0
 def edit(self):
     form = HallEditForm(self.body_data())
     if not form.is_valid():
         return self.json(ResultCode.CODE_40003.value, None,
                          ResultMsg.MSG_40003.value)
     data = Hall.edit(form.data)
     return self.json(ResultCode.CODE_20000.value, data,
                      ResultMsg.MSG_20000.value)
Example #7
0
 def switch(self):
     form = SwitchForm(self.get_arguments())
     if not form.is_valid():
         return self.json(ResultCode.CODE_40003.value, None,
                          ResultMsg.MSG_40003.value)
     ok, hall = Hall.switch(form.data['obj_id'])
     if not ok:
         return self.json(ResultCode.CODE_60009.value, None,
                          ResultMsg.MSG_60009.value)
     if hall.active:
         start_stage.delay(hall.id, hall.tag)
         return self.json(ResultCode.CODE_20000.value, None,
                          ResultMsg.MSG_20000.value)
     return self.json(ResultCode.CODE_20000.value, None,
                      ResultMsg.MSG_20000.value)
def hall_info(hall_id=None, hall_tag=None):
    """
    获取大厅详情
    :param hall_tag:
    :param hall_id:
    :return:
    """
    ok, obj = Hall.hall_info(hall_id=hall_id, hall_tag=hall_tag)
    if not ok:
        return False, None
    hall = model_to_dict(obj)
    hall['sequence'] = get_hall_new_sequence(obj.id, obj.tag)[-4:]
    result = get_result(get_hall_previous_sequence(obj.id, obj.tag))
    hall[
        'previous_result'] = [] if result == '' or result is None else literal_eval(
            result)
    hall['bet_option'] = hall_bet_option(obj.id)
    hall['chip_option'] = hall_chip_option(obj.id)
    return True, hall
Example #9
0
 def hall_options(self):
     data = Hall.hall_options()
     return self.json(ResultCode.CODE_20000.value, data,
                      ResultMsg.MSG_20000.value)