def get_comment_list(self, limit, offset, user_id):
     offset = get_offset_by_page(offset, limit)
     result_dict = {
         'limit': limit,
         'offset': offset,
         'count': 0,
         'content': [],
         'total': 0
     }
     with MysqlTools().session_scope() as session:
         # account_service = AccountService()
         q = session.query(MineCommentsModel). \
             filter(MineCommentsModel.status == 1). \
             order_by(MineCommentsModel.created_at.desc())
         record_count = q.count()
         result_dict['total'] = record_count
         result_dict['count'] = get_page_by_offset(record_count, limit)
         query_result = q.all()
         if query_result is not None:
             for i in query_result:
                 # user_info = account_service.get_inner_user_account_info(session, i.user_id)
                 is_praise = self.get_is_praise(user_id, i.praise_users)
                 result_dict['content'].append({
                     'user_name': i.user_name,
                     'submit_content': i.submit_content,
                     'submit_image': i.submit_image,
                     'submit_thumbnail': i.submit_thumbnail,
                     'praise_number': i.praise_number,
                     'is_praise': is_praise,
                     'status': i.status
                 })
         return result_dict
示例#2
0
 def gather_address_list(self, sub_public_address, coin_id, update_at_start, update_at_end, status, offset, limit):
     """
     归集地址列表
     :param sub_public_address: 地址
     :param coin_id: 币种(必填)
     :param update_at_start: 最近一次变动时间start
     :param update_at_end: 最近一次变动时间end
     :param status: 启用状态:0-停用, 1-启用
     :param offset: 当前页数
     :param limit: 每页条数
     :return:
     """
     filters = {}
     if sub_public_address:
         filters["sub_public_address"] = sub_public_address
     filters["coin_id"] = coin_id
     if not update_at_start:
         update_at_start = "0000-00-00"
     else:
         update_at_start = update_at_start
     if not update_at_end:
         update_at_end = "2999-12-31"
     else:
         update_at_end = update_at_end
     if status:
         filters["status"] = status
     with MysqlTools().session_scope() as session:
         if coin_id == _ZERO_S:
             model = WalletBtcGatherModel
         elif coin_id == _SIXTY_S:
             model = WalletEthGatherModel
         elif coin_id == _COIN_ID_EOS:
             model = WalletEosGatherModel
         g = session.query(model).filter_by(**filters).filter(
             model.update_at >= update_at_start,
             model.update_at <= update_at_end)
         count = g.count()
         if int(offset) == 0:
             gather_list = g
         else:
             gather_list = g.limit(
                 limit).offset(get_offset_by_page(offset, limit))
         result_list = []
         for g in gather_list:
             map = {}
             map["sub_public_address"] = str(g.sub_public_address)
             map["coin_id"] = str(coin_id)
             map["amount"] = decimal_to_str(g.amount)
             map["amount_change"] = decimal_to_str(g.amount_change)
             map["status"] = str(g.status)
             map["update_at"] = str(g.update_at)
             result_list.append(map)
         result_map = {}
         result_map["count"] = str(count)
         result_map["list"] = result_list
         return result_map
示例#3
0
 def gather_record(self, public_address, coin_id, operate_at_start, operate_at_end, offset, limit):
     """
     归集操作记录
     :param public_address: 归集地址
     :param coin_id: 币种
     :param operate_at_start: 操作时间start
     :param operate_at_end: 操作时间end
     :param offset: 当前页数
     :param limit: 每页条数
     :return:
     """
     filters = {}
     if public_address:
         filters["public_address"] = public_address
     if coin_id:
         filters["coin_id"] = coin_id
     if not operate_at_start:
         operate_at_start = "0000-00-00"
     else:
         operate_at_start = operate_at_start
     if not operate_at_end:
         operate_at_end = "2999-12-31"
     else:
         operate_at_end = operate_at_end
     with MysqlTools().session_scope() as session:
         g = session.query(ForeignGatherRecordModel).filter_by(**filters).filter(
             ForeignGatherRecordModel.created_at >= operate_at_start,
             ForeignGatherRecordModel.created_at <= operate_at_end)
         count = g.count()
         gather_list = g.order_by(desc(ForeignGatherRecordModel._id)).limit(
             limit).offset(get_offset_by_page(offset, limit))
         result_list = []
         for g in gather_list:
             map = {}
             map["record_id"] = str(g.record_id)  # ID
             map["created_at"] = str(g.created_at)  # 操作时间
             map["coin_id"] = str(g.coin_id)  # 币种
             map["amount"] = decimal_to_str(g.purpose_amount)  # 数量
             map["fee"] = decimal_to_str(g.actual_fee)  # 归集手续费
             withdraw_list = session.query(ForeignWithdrawOrderRecordModel).filter(
                 ForeignWithdrawOrderRecordModel.relate_flow_no == g.record_id)
             map["number"] = str(withdraw_list.count())  # 操作账号数量
             map["public_address"] = str(g.public_address)  # 归集地址
             result_list.append(map)
         result_map = {}
         result_map["count"] = str(count)
         result_map["list"] = result_list
         return result_map
示例#4
0
 def get_banner_list(self, limit, offset, title='', site='', online_time_start='',
                     online_time_end='', status='', create_time_start='',
                     create_time_end=''):
     offset = get_offset_by_page(offset, limit)
     result_dict = {
         'limit': limit,
         'offset': offset,
         'count': 0,
         'content': [],
         'total': 0
     }
     with MysqlTools().session_scope() as session:
         q = session.query(BannerManageModel). \
             order_by(BannerManageModel.created_at.desc())
         if title != '':
             q = q.filter(BannerManageModel.title == title)
         if site != '':
             q = q.filter(BannerManageModel.site == site)
         if status != '':
             q = q.filter(BannerManageModel.status == status)
         if create_time_start != '':
             q = q.filter(BannerManageModel.created_at >= create_time_start)
         if create_time_end != '':
             q = q.filter(BannerManageModel.created_at <= create_time_end)
         if online_time_start != '':
             q = q.filter(BannerManageModel.auto_online >= online_time_start)
         if online_time_end != '':
             q = q.filter(BannerManageModel.auto_online <= online_time_end)
         record_count = q.count()
         result_dict['total'] = record_count
         result_dict['count'] = get_page_by_offset(record_count, limit)
         query_result = q.all()
         if query_result is not None:
             for i in query_result:
                 result_dict['content'].append({
                     'id': i._id,
                     "title": i.title,
                     'site': i.site,
                     'status': i.status,
                     'image': i.image,
                     'thumbnail': i.thumbnail,
                     'created_at': str(i.created_at),
                     'auto_online': str(i.auto_online),
                     'remark': i.remark
                 })
         return result_dict
示例#5
0
    def dice_records(self, limit, offset, user_id='', start_id=None):
        offset = get_offset_by_page(offset, limit)
        result_dict = {
            'limit': limit,
            'offset': offset,
            'count': 0,
            'content': []
        }
        account_service = AccountService()
        with MysqlTools().session_scope() as session:
            q = session.query(DiceParticipateInModel). \
                order_by(DiceParticipateInModel.created_at.desc())
            if user_id != '':
                q = q.filter(DiceParticipateInModel.user_id == user_id)
            record_count = q.count()
            result_dict['count'] = get_page_by_offset(record_count, limit)
            if start_id is not None:
                start_id = str(start_id)
                q = q.filter(DiceParticipateInModel._id < start_id)
            participate_list = q.limit(limit).offset(offset).all()
            for i in participate_list:
                user_info = account_service.get_inner_user_account_info(
                    session, i.user_id)
                user_name = user_info['nick_name']
                result = {
                    'id':
                    i._id,
                    'user_name':
                    user_name,
                    'dice_result':
                    i.dice_result,
                    'dice_time':
                    timestamp_to_str(int(float(i.dice_timestamp)),
                                     format_style="%Y-%m-%d %H:%M:%S"),
                    'reward_token':
                    self.get_coin_name(i.reward_token),
                    'reward_quantity':
                    decimal_to_str(i.reward_quantity, 6)
                }
                if i.reward_token == int(_COIN_ID_USDT):
                    result['reward_quantity'] = decimal_to_str(
                        i.reward_quantity, 4)
                result_dict['content'].append(result)

        return result_dict
示例#6
0
 def comment_manage_list(self, limit, offset, user_name='', key_word='', release_time_start='',
                         release_time_end='', status='', picture=''):
     offset = get_offset_by_page(offset, limit)
     result_dict = {
         'limit': limit,
         'offset': offset,
         'count': 0,
         'content': [],
         'total': 0
     }
     with MysqlTools().session_scope() as session:
         # account_service = AccountService()
         q = session.query(MineCommentsModel). \
             order_by(MineCommentsModel.created_at.desc())
         if user_name != '':
             q = q.filter(MineCommentsModel.user_name == user_name)
         if key_word != '':
             q = q.filter(MineCommentsModel.submit_content.like('%' + key_word + '%'))
         if status != '':
             q = q.filter(MineCommentsModel.status == status)
         if release_time_start != '':
             q = q.filter(MineCommentsModel.created_at >= release_time_start)
         if release_time_end != '':
             q = q.filter(MineCommentsModel.created_at <= release_time_end)
         if picture == '1':
             q = q.filter(MineCommentsModel.submit_image != '')
         if picture == '0':
             q = q.filter(MineCommentsModel.submit_image == '')
         record_count = q.count()
         result_dict['total'] = record_count
         result_dict['count'] = get_page_by_offset(record_count, limit)
         query_result = q.all()
         if query_result is not None:
             for i in query_result:
                 # user_info = account_service.get_inner_user_account_info(session, i.user_id)
                 result_dict['content'].append({
                     "user_name": i.user_name,
                     'submit_content': i.submit_content,
                     'submit_image': i.submit_image,
                     'submit_thumbnail': i.submit_thumbnail,
                     'praise_number': i.praise_number,
                     'status': i.status
                 })
         return result_dict
示例#7
0
    def search_robot_config(self, dic):
        limit = int(dic.get('limit', 10))
        offset = get_offset_by_page(dic.get('offset', 1), limit)
        start_id = dic.get("start_id", None)

        total = 0
        count = 0
        with MysqlTools().session_scope() as session:
            game_config = session.query(RobotGameConfigRecordModel).filter(
                RobotGameConfigRecordModel._id == dic['id']).first()
            q = session.query(RobotConfigRecordModel).filter(
                RobotConfigRecordModel.time_stamp == game_config.time_stamp)

            total = q.count()
            count = get_page_by_offset(total, limit)

            if start_id is not None:
                q = q.filter(RobotConfigRecordModel._id < str(start_id))
            query_result = q.order_by(RobotConfigRecordModel._id.asc()).limit(
                limit).offset(offset).all()

            content = []
            if len(query_result) > 0:
                for i in query_result:
                    content.append({
                        'user_id': str(i.user_id),
                        'nick_name': i.nick_name,
                        'bet_number': str(i.bet_number),
                        'pay_token': str(i.pay_token),
                        'bet_plan_time': str(i.bet_plan_time),
                        'bet_status': str(i.bet_status),
                    })

            return {
                'limit': dic.get('limit', 10),
                'offset': dic.get('offset', 1),
                'count': count,
                'total:': total,
                'content': content
            }
示例#8
0
 def gather_address_record(self, sub_public_address, relevant_address, transfer_at_start, transfer_at_end,
                           operation_type, offset,
                           limit):
     """
     归集地址流水
     :param sub_public_address: 地址(必填)
     :param relevant_address: 相关地址
     :param transfer_at_start: 操作时间start
     :param transfer_at_end: 操作时间end
     :param operation_type: 操作类型:1-收款, 2-出款[提现类型: 0-用户提现, 1-用户中奖, 2-归集, 3-归集转归集]
     :param offset: 当前页数
     :param limit: 每页条数
     :return:
     """
     if not transfer_at_start:
         transfer_at_start = "0000-00-00"
     else:
         transfer_at_start = transfer_at_start
     if not transfer_at_end:
         transfer_at_end = "2999-12-31"
     else:
         transfer_at_end = transfer_at_end
     with MysqlTools().session_scope() as session:
         coin_id = _ZERO_S
         gather = session.query(WalletBtcGatherModel).filter(
             WalletBtcGatherModel.sub_public_address == sub_public_address).first()
         if gather is None:
             coin_id = _SIXTY_S
         f = session.query(ForeignWithdrawOrderRecordModel, UserAccountModel).filter(
             ForeignWithdrawOrderRecordModel.transfer_at >= transfer_at_start,
             ForeignWithdrawOrderRecordModel.transfer_at <= transfer_at_end)
         if relevant_address:
             f = f.filter(or_(
                 ForeignWithdrawOrderRecordModel.from_address == relevant_address,
                 ForeignWithdrawOrderRecordModel.withdraw_address == relevant_address))
         if not operation_type:  # 全部
             fw = f.outerjoin(
                 UserAccountModel,
                 ForeignWithdrawOrderRecordModel.account_id == UserAccountModel.account_id)
         elif operation_type == _ONE_S:  # 收款
             fw = f.filter(
                 ForeignWithdrawOrderRecordModel.withdraw_type == _TWO_S).outerjoin(
                 UserAccountModel,
                 ForeignWithdrawOrderRecordModel.account_id == UserAccountModel.account_id)
         elif operation_type == _TWO_S:  # 出款
             fw = f.filter(
                 ForeignWithdrawOrderRecordModel.withdraw_type == _ZERO_S).outerjoin(
                 UserAccountModel,
                 ForeignWithdrawOrderRecordModel.account_id == UserAccountModel.account_id)
         count = fw.count()
         record_list = fw.order_by(desc(ForeignWithdrawOrderRecordModel.transfer_at)).limit(
             limit).offset(get_offset_by_page(offset, limit))
         result_list = []
         for r in record_list:
             map = {}
             map["order_no"] = str(r.ForeignWithdrawOrderRecordModel.order_no)
             map["user_name"] = ""
             try:
                 map["user_name"] = str(r.UserAccountModel.user_name)
             except:
                 pass
             map["transfer_at"] = str(r.ForeignWithdrawOrderRecordModel.transfer_at)
             map["withdraw_amount"] = decimal_to_str(r.ForeignWithdrawOrderRecordModel.withdraw_amount)
             map["withdraw_fee"] = decimal_to_str(r.ForeignWithdrawOrderRecordModel.withdraw_fee)
             map["operation_type"] = ""
             map["relevant_address"] = ""
             withdraw_type = str(r.ForeignWithdrawOrderRecordModel.withdraw_type)
             from_address = str(r.ForeignWithdrawOrderRecordModel.from_address)
             withdraw_address = str(r.ForeignWithdrawOrderRecordModel.withdraw_address)
             if withdraw_type == _ZERO_S:  # 提现
                 map["operation_type"] = "2"  # 出款
                 map["relevant_address"] = withdraw_address
             elif withdraw_type == _TWO_S:  # 归集
                 map["operation_type"] = "1"  # 收款
                 map["relevant_address"] = from_address
             map["operation_user"] = str(r.ForeignWithdrawOrderRecordModel.operation_user)
             result_list.append(map)
         result_map = {}
         result_map["count"] = str(count)
         result_map["list"] = result_list
         return result_map
示例#9
0
    def gather_record_all(self, user_name, from_address, operate_at_start, operate_at_end, withdraw_address, coin_id,
                          confirm_at_start, confirm_at_end, withdraw_status, offset, limit):
        """
        归集操作记录详情
        :param user_name: 用户名
        :param from_address: 用户钱包地址
        :param operate_at_start: 操作时间start
        :param operate_at_end: 操作时间end
        :param withdraw_address: 归集地址
        :param coin_id: 币种
        :param confirm_at_start: 结束时间start
        :param confirm_at_end: 结束时间end
        :param withdraw_status: 状态: 1-归集中, 2-成功, 3-失败
        :param offset: 当前页数
        :param limit: 每页条数
        :return:
        """
        u_filters = {}
        if user_name:
            u_filters["user_name"] = user_name

        f_filters = {}
        f_filters["withdraw_type"] = _TWO_S
        if from_address:
            f_filters["from_address"] = from_address
        if withdraw_address:
            f_filters["withdraw_address"] = withdraw_address
        if coin_id:
            f_filters["coin_id"] = coin_id
        if withdraw_status:
            f_filters["withdraw_status"] = withdraw_status
        if not operate_at_start:
            operate_at_start = "0000-00-00"
        else:
            operate_at_start = operate_at_start
        if not operate_at_end:
            operate_at_end = "2999-12-31"
        else:
            operate_at_end = operate_at_end
        if not confirm_at_start:
            confirm_at_start = "0000-00-00"
        else:
            confirm_at_start = confirm_at_start
        if not confirm_at_end:
            confirm_at_end = "2999-12-31"
        else:
            confirm_at_end = confirm_at_end
        with MysqlTools().session_scope() as session:
            g = session.query(ForeignWithdrawOrderRecordModel, UserAccountModel).filter_by(
                **f_filters).filter(
                ForeignWithdrawOrderRecordModel.created_at >= operate_at_start,
                ForeignWithdrawOrderRecordModel.created_at <= operate_at_end,
                ForeignWithdrawOrderRecordModel.confirm_at >= confirm_at_start,
                ForeignWithdrawOrderRecordModel.confirm_at <= confirm_at_end).outerjoin(
                UserAccountModel,
                ForeignWithdrawOrderRecordModel.account_id == UserAccountModel.account_id).filter_by(**u_filters)
            count = g.count()
            gather_list = g.order_by(desc(ForeignWithdrawOrderRecordModel._id)).limit(
                limit).offset(get_offset_by_page(offset, limit))
            result_map = {}
            list = []
            for g in gather_list:
                map = {}
                map["user_name"] = ""
                try:
                    map["user_name"] = str(g.UserAccountModel.user_name)  # 用户名
                except:
                    pass
                map["order_no"] = str(g.ForeignWithdrawOrderRecordModel.order_no)
                map["from_address"] = str(g.ForeignWithdrawOrderRecordModel.from_address)  # 用户钱包地址
                map["created_at"] = str(g.ForeignWithdrawOrderRecordModel.created_at)  # 操作时间
                map["coin_id"] = str(g.ForeignWithdrawOrderRecordModel.coin_id)  # 归集币种
                map["withdraw_amount"] = decimal_to_str(g.ForeignWithdrawOrderRecordModel.withdraw_amount)  # 数量
                map["withdraw_fee"] = decimal_to_str(g.ForeignWithdrawOrderRecordModel.withdraw_fee)  # 手续费
                map["confirm_at"] = str(g.ForeignWithdrawOrderRecordModel.confirm_at)  # 结束时间
                map["withdraw_address"] = str(g.ForeignWithdrawOrderRecordModel.withdraw_address)  # 归集地址
                map["withdraw_status"] = str(g.ForeignWithdrawOrderRecordModel.withdraw_status)
                list.append(map)
            result_map["count"] = count
            result_map["list"] = list
            return result_map
示例#10
0
    def gather_record_details(self, record_id, user_name, from_address, operate_at_start, operate_at_end,
                              withdraw_status,
                              confirm_at_start, confirm_at_end, offset, limit):
        """
        归集操作记录详情
        :param record_id: record_id
        :param user_name: 用户名
        :param from_address: 用户钱包地址
        :param operate_at_start: 操作时间start
        :param operate_at_end: 操作时间end
        :param withdraw_status: 状态: 1-归集中, 2-成功, 3-失败
        :param confirm_at_start: 结束时间start
        :param confirm_at_end: 结束时间end
        :param offset: 当前页数
        :param limit: 每页条数
        :return:
        """
        u_filters = {}
        if user_name:
            u_filters["user_name"] = user_name

        f_filters = {}
        f_filters["relate_flow_no"] = record_id
        if from_address:
            f_filters["from_address"] = from_address
        if withdraw_status:
            f_filters["withdraw_status"] = withdraw_status
        if not operate_at_start:
            operate_at_start = "0000-00-00"
        else:
            operate_at_start = operate_at_start
        if not operate_at_end:
            operate_at_end = "2999-12-31"
        else:
            operate_at_end = operate_at_end
        if not confirm_at_start:
            confirm_at_start = "0000-00-00"
        else:
            confirm_at_start = confirm_at_start
        if not confirm_at_end:
            confirm_at_end = "2999-12-31"
        else:
            confirm_at_end = confirm_at_end
        with MysqlTools().session_scope() as session:
            gather_model = session.query(ForeignGatherRecordModel).filter(
                ForeignGatherRecordModel.record_id == record_id).first()
            result_map = {}
            info = {}
            info["coin_id"] = str(gather_model.coin_id)
            info["amount"] = decimal_to_str(gather_model.actual_amount)
            info["fee"] = decimal_to_str(gather_model.actual_fee)
            withdraw_list = session.query(ForeignWithdrawOrderRecordModel).filter(
                ForeignWithdrawOrderRecordModel.relate_flow_no == record_id)
            info["number"] = str(withdraw_list.count())  # 操作账号数量
            info["created_at"] = str(gather_model.created_at)
            info["public_address"] = str(gather_model.public_address)
            result_map["info"] = info
            g = session.query(ForeignWithdrawOrderRecordModel, UserAccountModel).filter_by(
                **f_filters).filter(
                ForeignWithdrawOrderRecordModel.created_at >= operate_at_start,
                ForeignWithdrawOrderRecordModel.created_at <= operate_at_end,
                ForeignWithdrawOrderRecordModel.confirm_at >= confirm_at_start,
                ForeignWithdrawOrderRecordModel.confirm_at <= confirm_at_end).outerjoin(
                UserAccountModel,
                ForeignWithdrawOrderRecordModel.account_id == UserAccountModel.account_id).filter_by(**u_filters)
            count = g.count()
            gather_list = g.limit(
                limit).offset(get_offset_by_page(offset, limit))
            list = []
            for g in gather_list:
                map = {}
                map["user_name"] = ""
                try:
                    map["user_name"] = str(g.UserAccountModel.user_name)  # 用户名
                except:
                    pass
                map["from_address"] = str(g.ForeignWithdrawOrderRecordModel.from_address)  # 用户钱包地址
                map["created_at"] = str(g.ForeignWithdrawOrderRecordModel.created_at)  # 操作时间
                map["coin_id"] = str(g.ForeignWithdrawOrderRecordModel.coin_id)  # 币种
                map["withdraw_amount"] = decimal_to_str(g.ForeignWithdrawOrderRecordModel.withdraw_amount)  # 数量
                map["withdraw_fee"] = decimal_to_str(g.ForeignWithdrawOrderRecordModel.withdraw_fee)  # 手续费
                map["confirm_at"] = str(g.ForeignWithdrawOrderRecordModel.confirm_at)  # 结束时间
                map["withdraw_address"] = str(g.ForeignWithdrawOrderRecordModel.withdraw_address)  # 归集地址
                map["withdraw_status"] = str(g.ForeignWithdrawOrderRecordModel.withdraw_status)  # 状态
                list.append(map)
            result_map["count"] = count
            result_map["list"] = list
            return result_map
示例#11
0
    def game_instance_info_list(self, limit, offset, status='', start_id=None):
        offset = get_offset_by_page(offset, limit)
        result_dict = {
            'limit': limit,
            'offset': offset,
            'count': 0,
            'content': []
        }
        account_service = AccountService()
        with MysqlTools().session_scope() as session:
            if status != '':
                q = session.query(GameDigitalInstanceModel). \
                    order_by(GameDigitalInstanceModel.status.asc(),
                             GameDigitalInstanceModel.created_at.desc(),
                             GameDigitalInstanceModel._id != 0)
                q = q.filter(GameDigitalInstanceModel.status == status)
            else:
                q = session.query(GameDigitalInstanceModel). \
                    order_by(GameDigitalInstanceModel.created_at.desc(),
                             GameDigitalInstanceModel._id != 0)
            record_count = q.count()
            result_dict['count'] = get_page_by_offset(record_count, limit)
            if start_id is not None:
                start_id = str(start_id)
                q = q.filter(GameDigitalInstanceModel._id < start_id)
            query_result = q.limit(limit).offset(offset).all()
            winner = ''
            bet_serial = ''
            bet_number = 0
            # --------------- 即时开 --------------- #
            if status == '':
                ins_instance = session.query(InstantGameInstanceModel). \
                    order_by(InstantGameInstanceModel.created_at.desc()).first()
                if ins_instance is not None:
                    result_dict['content'].append({
                        'id':
                        ins_instance._id,
                        'created_at':
                        str(ins_instance.created_at),
                        'game_serial':
                        ins_instance.game_serial,
                        'game_title':
                        ins_instance.game_title,
                        'progress':
                        0,
                        'remain':
                        0,
                        'bet_token':
                        self.get_coin_name(ins_instance.bet_token),
                        'bet_number':
                        0,
                        'reward_token':
                        self.get_coin_name(ins_instance.reward_token),
                        'reward_quantity':
                        ins_instance.reward_quantity,
                        'support_token':
                        ins_instance.support_token,
                        'status':
                        -1,
                        'lottery_time':
                        str(ins_instance.lottery_time),
                        'winners':
                        '',
                        'bet_serial':
                        '',
                        'game_describe':
                        ins_instance.game_describe,
                        'participation':
                        ins_instance.participation,
                        'merge_id':
                        -1,
                        'merge_list': []
                    })
            # --------------- 即时开end --------------- #
            for i in query_result:
                merge_id = -1
                merges = []
                merge_list = session.query(MergeParticipateInModel). \
                    filter(MergeParticipateInModel.game_instance_id == i._id). \
                    order_by(MergeParticipateInModel.created_at.desc()).limit(3).offset(0).all()
                if len(merge_list) > 0:
                    merge_id = 1
                    for merge in merge_list:
                        initiate_user = account_service.get_inner_user_account_info(
                            session, merge.initiate_user_id)
                        merges.append({
                            'merge_id':
                            merge._id,
                            'name':
                            initiate_user['nick_name'],
                            'portrait':
                            initiate_user['profile_picture']
                        })
                if i.status == 2:
                    winning_record = session.query(WinningRecordModel). \
                        filter(WinningRecordModel.game_instance_id == i._id).first()
                    if winning_record is not None:
                        if winning_record.user_type == 0:
                            account_service = AccountService()
                            user_info = account_service.get_inner_user_account_info(
                                session, winning_record.user_id)
                            winner = user_info['nick_name']
                        elif winning_record.user_type == 1:
                            robot = session.query(RobotAccountModel).filter(
                                RobotAccountModel.user_id ==
                                winning_record.user_id).first()
                            winner = robot.nick_name
                        else:
                            winner = 'X@17Yau8'
                        bet_serial = winning_record.bet_serial
                        merge_id = winning_record.merge_id
                        bet_number = winning_record.bet_number
                progress = 0
                progress = (i.bet_number / i.need) * 100
                if 0 < progress < 1:
                    progress = 1
                if progress > 1:
                    progress = int(progress)

                result_dict['content'].append({
                    'id':
                    i._id,
                    'created_at':
                    str(i.created_at),
                    'game_serial':
                    i.game_serial,
                    'game_title':
                    i.game_title,
                    'progress':
                    progress,
                    'remain':
                    int(i.need - i.bet_number),
                    'bet_token':
                    self.get_coin_name(i.bet_token),
                    'bet_number':
                    bet_number,
                    'reward_token':
                    self.get_coin_name(i.reward_token),
                    'reward_quantity':
                    i.reward_quantity,
                    'support_token':
                    i.support_token,
                    'status':
                    i.status,
                    'lottery_time':
                    str(i.lottery_time),
                    'winners':
                    winner,
                    'bet_serial':
                    bet_serial,
                    'game_describe':
                    i.game_describe,
                    'participation':
                    i.participation,
                    'merge_id':
                    merge_id,
                    'merge_list':
                    merges
                })
        return result_dict
示例#12
0
    def indiana_record(self, limit, offset, user_id, start_id=None):
        offset = get_offset_by_page(offset, limit)
        result_dict = {
            'limit': limit,
            'offset': offset,
            'count': 0,
            'content': []
        }
        with MysqlTools().session_scope() as session:
            q = session.query(ParticipateInModel._id,
                              ParticipateInModel.game_instance_id, ParticipateInModel.game_serial,
                              ParticipateInModel.bet_token,
                              (ParticipateInModel.bet_unit * ParticipateInModel.bet_number).label(
                                  'total_bet'),
                              ParticipateInModel.merge_id, ParticipateInModel.created_at,
                              ParticipateInModel.pay_token, ParticipateInModel.pay_number). \
                filter(ParticipateInModel.user_id == user_id). \
                order_by(ParticipateInModel.created_at.desc())
            record_count = q.count()
            result_dict['count'] = get_page_by_offset(record_count, limit)
            if start_id is not None:
                start_id = str(start_id)
                q = q.filter(ParticipateInModel._id < start_id)
            participate_list = q.limit(limit).offset(offset).all()
            for i in participate_list:
                instance_info = session.query(GameDigitalInstanceModel.need, GameDigitalInstanceModel.status,
                                              GameDigitalInstanceModel.bet_token,
                                              GameDigitalInstanceModel.participation). \
                    filter(GameDigitalInstanceModel._id == i.game_instance_id).first()
                if instance_info is None:
                    continue
                total = instance_info.participation
                lower = session.query((func.count(ParticipateInModel._id)).label('lower_users')). \
                    filter(ParticipateInModel.game_instance_id == i.game_instance_id,
                           ParticipateInModel.bet_unit * ParticipateInModel.bet_number < int(i.total_bet)). \
                    first()
                hc = hcf(int(i.total_bet), int(instance_info.need))
                probability = str(int(int(i.total_bet) / hc)) + '/' + str(
                    int(int(instance_info.need) / hc))
                if lower is None:
                    lower = total
                else:
                    lower = lower.lower_users
                if int(i.pay_token) == int(_COIN_ID_EXP):
                    pay_number = int(i.pay_number)
                else:
                    pay_number = decimal_to_str(i.pay_number, 8)
                result_dict['content'].append({
                    'instance_id':
                    i.game_instance_id,
                    'participate_id':
                    i._id,
                    'game_serial':
                    i.game_serial,
                    'bet_token':
                    self.get_coin_name(i.bet_token),
                    'total_bet':
                    int(i.total_bet),
                    'need':
                    instance_info.need,
                    'status':
                    instance_info.status,
                    'need_token':
                    self.get_coin_name(instance_info.bet_token),
                    'probability':
                    probability,
                    'ranking':
                    math.ceil((lower / total) * 100),
                    'merge_id':
                    i.merge_id,
                    'part_in_time':
                    str(i.created_at),
                    "pay_token":
                    self.get_coin_name(i.pay_token),
                    "pay_number":
                    pay_number
                })

        return result_dict
示例#13
0
    def sub_address_list(self, user_name, sub_public_address, conditions, coin_id, offset, limit):
        """
        子账户地址列表
        :param user_name: 用户名
        :param sub_public_address: 钱包地址
        :param conditions: 归集条件(大于等于xx个单位)
        :param coin_id: 币种(必填)
        :param offset: 当前页数
        :param limit: 每页条数
        :return:
        """
        f_filters = {}
        u_filters = {}
        if user_name:
            u_filters["user_name"] = user_name
        if sub_public_address:
            f_filters["sub_public_address"] = sub_public_address
        if not conditions:
            conditions = 0
        with MysqlTools().session_scope() as session:
            model = None
            if coin_id == _ZERO_S:
                model = WalletBtcModel
            elif coin_id == _SIXTY_S:
                model = WalletEthModel
            w = session.query(model, UserAccountModel).filter(
                model.amount >= conditions, model.account_id != "").filter_by(**f_filters).outerjoin(
                UserAccountModel,
                model.account_id == UserAccountModel.account_id).filter_by(**u_filters)
            count = w.count()
            # 计算可归集总额
            total_amount = 0
            for o in w:
                amount = 0
                if coin_id == _ZERO_S:
                    amount = o.WalletBtcModel.amount
                elif coin_id == _SIXTY_S:
                    amount = o.WalletEthModel.amount
                total_amount = total_amount + amount

            wallet_list = w.limit(
                limit).offset(get_offset_by_page(offset, limit))
            result_list = []
            for w in wallet_list:
                map = {}
                map["user_name"] = ""
                try:
                    map["user_name"] = str(w.UserAccountModel.user_name)
                except:
                    pass
                map["coin_id"] = coin_id
                amount = 0
                if coin_id == _ZERO_S:
                    map["sub_public_address"] = str(w.WalletBtcModel.sub_public_address)
                    amount = w.WalletBtcModel.amount
                    map["amount"] = decimal_to_str(amount)
                    map["amount_frozen"] = decimal_to_str(w.WalletBtcModel.amount_frozen)
                elif coin_id == _SIXTY_S:
                    map["sub_public_address"] = str(w.WalletEthModel.sub_public_address)
                    amount = w.WalletEthModel.amount
                    map["amount"] = decimal_to_str(amount)
                    map["amount_frozen"] = decimal_to_str(w.WalletEthModel.amount_frozen)
                result_list.append(map)
            result_map = {}
            result_map["count"] = str(count)
            result_map["total_amount"] = decimal_to_str(total_amount)
            result_map["list"] = result_list
            return result_map
    def newest_online_record(game_serial, page_num, page_limit, start_id,
                             record_type, timezone):
        # response structure
        response_dict = {
            'limit': page_limit,
            'offset': page_num,
            'count': 0,
            'content': []
        }
        page_offset = get_offset_by_page(page_num, page_limit)
        page_limit = str(page_limit)

        # query info
        with MysqlTools().session_scope() as session:
            query = session.query(
                BlockChainInfoModel._id, BlockChainInfoModel.instance_id,
                BlockChainInfoModel.record_type,
                BlockChainInfoModel.participate_id,
                BlockChainInfoModel.on_chain_info,
                BlockChainInfoModel.on_chain_at).filter(
                    BlockChainInfoModel.on_chain_status == 1,
                    BlockChainInfoModel.deleted == False).order_by(
                        BlockChainInfoModel.on_chain_at.desc())

            # 计算不分页的总页数
            record_count = query.count()
            response_dict['count'] = get_page_by_offset(
                record_count, page_limit)

            if game_serial is not None:
                query = query.filter(
                    BlockChainInfoModel.game_serial == game_serial)

            if record_type is not None:
                query = query.filter(
                    BlockChainInfoModel.record_type == record_type)

            if start_id is not None:
                start_id = str(start_id)
                query = query.filter(BlockChainInfoModel._id < start_id)

            query = query.limit(page_limit).offset(page_offset)

            record_list = query.all()

            for one_record in record_list:
                on_chain_info = json.loads(one_record.on_chain_info)
                response_dict['content'].append({
                    'id':
                    one_record._id,
                    'instance_id':
                    one_record.instance_id,
                    "record_type":
                    RECORD_TYPE_DICT[one_record.record_type],
                    "nick_name":
                    on_chain_info.get("nick_name", ""),
                    "bet_number":
                    on_chain_info.get("bet_number", ""),
                    "participate_id":
                    one_record.participate_id,
                    "on_chain_at":
                    time_transform_from_zone(
                        one_record.on_chain_at.strftime("%Y-%m-%d %H:%M:%S"),
                        timezone)
                })

            return response_dict
示例#15
0
    def search_model(self, dic):
        count = 0
        total = 0
        number_games = []
        object_games = []

        if dic is None:
            dic = {}

        limit = int(dic.get('limit', 10))
        offset = get_offset_by_page(dic.get('offset', 1), limit)
        start_id = dic.get("start_id", None)

        with MysqlTools().session_scope() as session:
            q = session.query(GameDigitalTemplateModel)
            if dic.get('id', '') != '':
                q = q.filter(GameDigitalTemplateModel._id == dic['id'])
            if dic.get('game_title', '') != '':
                q = q.filter(
                    GameDigitalTemplateModel.game_title == dic['game_title'])
            if dic.get('reward_quantity', '') != '':
                q = q.filter(GameDigitalTemplateModel.reward_quantity == int(
                    dic['reward_quantity']))

            if dic.get('release_time_start', '') != '':
                q = q.filter(GameDigitalTemplateModel.created_at >=
                             dic['release_time_start'])
            if dic.get('release_time_end', '') != '':
                q = q.filter(GameDigitalTemplateModel.created_at <=
                             dic['release_time_end'])

            if dic.get('template_status', '') != '':
                q = q.filter(GameDigitalTemplateModel.template_status == int(
                    dic['template_status']))
            if dic.get('auto_release', '') != '':
                q = q.filter(GameDigitalTemplateModel.auto_release == int(
                    dic['auto_release']))

            total = q.count()
            count = get_page_by_offset(total, limit)

            if start_id is not None:
                q = q.filter(GameDigitalTemplateModel._id < str(start_id))

            query_result = q.order_by(
                GameDigitalTemplateModel._id.desc()).limit(limit).offset(
                    offset).all()

            # if len(query_result) == 0:
            #     return self.return_error(50001)
            if len(query_result) >= 0:
                for i in query_result:
                    number_games.append({
                        'id':
                        str(i._id),
                        'game_title':
                        i.game_title,
                        'reward_token':
                        i.reward_token,
                        'bet_token':
                        i.bet_token,
                        'bet_unit':
                        i.bet_unit,
                        'reward_quantity':
                        i.reward_quantity,
                        'need_ceiling':
                        i.need_ceiling,
                        'need_floor':
                        i.need_floor,
                        'exceeded_ratio':
                        i.exceeded_ratio,
                        'experience':
                        i.experience,
                        'merge_threshold':
                        i.merge_threshold,
                        'handling_fee':
                        str(i.handling_fee),
                        'support_token':
                        i.support_token,
                        'template_status':
                        i.template_status,
                        'auto_release':
                        i.auto_release,
                        'game_describe':
                        i.game_describe,
                        # 'phase_prefix': i.phase_prefix,
                        # 'phase_date': i.phase_date,
                        'phase_serial':
                        i.phase_prefix + i.phase_date + i.phase_serial,
                        'agreement':
                        i.agreement,
                        'agreement_name':
                        i.agreement_name,
                        'created_at':
                        str(i.created_at),
                        'update_at':
                        str(i.update_at)
                    })
                # print("number_games:", number_games)

        if dic.get("model_type") == "1":
            return {
                'limit': dic.get('limit', 10),
                'offset': dic.get('offset', 1),
                'count': count,
                'total': total,
                'number_games': number_games
            }

        if dic.get("model_type") == "2":
            return {
                'limit': dic.get('limit', 10),
                'offset': dic.get('offset', 1),
                'count': count,
                'total': total,
                'object_games': object_games
            }

        return {
            "data": {
                "number_games": number_games,
                "object_games": object_games
            }
        }
示例#16
0
    def indiana_record_new(self, limit, offset, user_id, start_id=None):
        offset = get_offset_by_page(offset, limit)
        result_dict = {
            'limit': limit,
            'offset': offset,
            'count': 0,
            'content': []
        }
        with MysqlTools().session_scope() as session:
            q = session.query(ParticipateInModel._id,
                              ParticipateInModel.game_instance_id, ParticipateInModel.game_serial,
                              ParticipateInModel.bet_token,
                              ParticipateInModel.award_numbers,
                              ParticipateInModel.win_number,
                              (ParticipateInModel.bet_unit * ParticipateInModel.bet_number).label(
                                  'total_bet'),
                              ParticipateInModel.merge_id, ParticipateInModel.created_at,
                              ParticipateInModel.pay_token, ParticipateInModel.pay_number). \
                filter(ParticipateInModel.user_id == user_id). \
                order_by(ParticipateInModel.created_at.desc())
            record_count = q.count()
            result_dict['count'] = get_page_by_offset(record_count, limit)
            if start_id is not None:
                start_id = str(start_id)
                q = q.filter(ParticipateInModel._id < start_id)
            participate_list = q.limit(limit).offset(offset).all()
            for i in participate_list:
                award_numbers_list = i.award_numbers
                if i.game_instance_id == 0:
                    instance_info = session.query(InstantGameInstanceModel.need, InstantGameInstanceModel.status,
                                                  InstantGameInstanceModel.bet_token,
                                                  InstantGameInstanceModel.participation). \
                        filter(InstantGameInstanceModel.game_serial == i.game_serial).first()
                    if instance_info is None:
                        continue
                    if i.win_number in award_numbers_list:
                        is_win = True
                    else:
                        is_win = False
                else:
                    instance_info = session.query(GameDigitalInstanceModel.need, GameDigitalInstanceModel.status,
                                                  GameDigitalInstanceModel._id,
                                                  GameDigitalInstanceModel.bet_token,
                                                  GameDigitalInstanceModel.participation). \
                        filter(GameDigitalInstanceModel._id == i.game_instance_id).first()
                    if instance_info is None:
                        continue
                    if instance_info.status == 2:
                        winning_record = session.query(WinningRecordModel). \
                            filter(WinningRecordModel.game_instance_id == instance_info._id).first()
                        if winning_record.bet_serial in award_numbers_list:
                            is_win = True
                        else:
                            is_win = False
                    else:
                        is_win = False
                if int(i.pay_token) == int(_COIN_ID_EXP):
                    pay_number = int(i.pay_number)
                else:
                    pay_number = decimal_to_str(i.pay_number, 8)
                result_dict['content'].append({
                    'is_win':
                    is_win,
                    'instance_id':
                    i.game_instance_id,
                    'participate_id':
                    i._id,
                    'game_serial':
                    i.game_serial,
                    'bet_token':
                    self.get_coin_name(i.bet_token),
                    'total_bet':
                    int(i.total_bet),
                    # 'need': instance_info.need,
                    'status':
                    instance_info.status,
                    'need_token':
                    self.get_coin_name(instance_info.bet_token),
                    # 'probability': probability,
                    # 'ranking': math.ceil((lower / total) * 100),
                    'merge_id':
                    i.merge_id,
                    'part_in_time':
                    str(i.created_at),
                    "pay_token":
                    self.get_coin_name(i.pay_token),
                    "pay_number":
                    pay_number
                })

        return result_dict
示例#17
0
 def get_instant_part_in_list(self,
                              limit,
                              offset,
                              game_serial='',
                              bet_time_start='',
                              bet_time_end='',
                              result='',
                              user_name='',
                              start_id=None):
     offset = get_offset_by_page(offset, limit)
     result_dict = {
         'limit': limit,
         'offset': offset,
         'count': 0,
         'content': [],
         'total': 0
     }
     with MysqlTools().session_scope() as session:
         account_service = AccountService()
         q = session.query(ParticipateInModel)
         if user_name != '':
             q = q.filter(ParticipateInModel.nick_name == user_name)
         if game_serial != '':
             q = q.filter(ParticipateInModel.game_serial == game_serial)
         if bet_time_start != '':
             q = q.filter(ParticipateInModel.created_at >= bet_time_start)
         if bet_time_end != '':
             q = q.filter(ParticipateInModel.created_at <= bet_time_end)
         if result != '':
             q = q.filter(ParticipateInModel.result == result)
         game_instance_id = 0
         q = q.filter(
             ParticipateInModel.game_instance_id == game_instance_id)
         record_count = q.count()
         result_dict['total'] = record_count
         result_dict['count'] = get_page_by_offset(record_count, limit)
         if start_id is not None:
             start_id = str(start_id)
             q = q.filter(ParticipateInModel._id < start_id)
         q = q.order_by(ParticipateInModel.created_at.desc())
         participate_in_list = q.limit(limit).offset(offset).all()
         for participate in participate_in_list:
             # user_type 0:真实用户  1:机器人
             if participate.user_type == 0:
                 user_info = account_service.get_inner_user_account_info(
                     session, participate.user_id)
                 user_name = user_info['nick_name']
             else:
                 user_name = participate.nick_name
             is_win = False
             if participate.win_number in participate.award_numbers:
                 is_win = True
             result_dict['content'].append({
                 "id":
                 participate._id,
                 "user":
                 user_name,
                 "bet_time":
                 str(participate.created_at),
                 "channel":
                 participate.channel,
                 "bet_token":
                 self.get_coin_name(participate.bet_token),
                 "bet_unit":
                 participate.bet_unit,
                 "bet_number":
                 decimal_to_str(participate.bet_number, 8),
                 "pay_token":
                 self.get_coin_name(participate.pay_token),
                 "pay_number":
                 decimal_to_str(participate.pay_number, 8),
                 'game_serial':
                 participate.game_serial,
                 "is_win":
                 is_win
             })
     return result_dict
示例#18
0
    def search_game_robot_config(self, dic):
        if dic is None:
            dic = {}

        limit = int(dic.get('limit', 10))
        offset = get_offset_by_page(dic.get('offset', 1), limit)
        start_id = dic.get("start_id", None)

        total = 0
        count = 0
        with MysqlTools().session_scope() as session:
            q = session.query(RobotGameConfigRecordModel)
            if dic.get('id', '') != '':
                q = q.filter(RobotGameConfigRecordModel._id == dic['id'])
            if dic.get('game_serial', '') != '':
                q = q.filter(RobotGameConfigRecordModel.game_serial ==
                             dic['game_serial'])
            if dic.get('plan_start_time_first', '') != '':
                q = q.filter(RobotGameConfigRecordModel.start_of_plan_time >=
                             dic['start_of_plan_time'])
            if dic.get('plan_start_time_finish', '') != '':
                q = q.filter(RobotGameConfigRecordModel.start_of_plan_time <=
                             dic['start_of_plan_time'])

            if dic.get('plan_end_time_first', '') != '':
                q = q.filter(RobotGameConfigRecordModel.end_of_plan_time >=
                             dic['plan_end_time_first'])
            if dic.get('plan_end_time_finish', '') != '':
                q = q.filter(RobotGameConfigRecordModel.end_of_plan_time <=
                             dic['plan_end_time_first'])

            if dic.get('status', '') != '':
                q = q.filter(
                    RobotGameConfigRecordModel.status == int(dic['status']))

            if dic.get('real_end_time_first', '') != '':
                q = q.filter(RobotGameConfigRecordModel.end_of_real_time ==
                             dic['real_end_time_first'])
            if dic.get('real_end_time_finish', '') != '':
                q = q.filter(RobotGameConfigRecordModel.end_of_real_time ==
                             dic['real_end_time_finish'])

            if dic.get('robot_bet_type', '') != '':
                q = q.filter(RobotGameConfigRecordModel.robot_bet_type == int(
                    dic['robot_bet_type']))

            total = q.count()
            count = get_page_by_offset(total, limit)

            if start_id is not None:
                q = q.filter(RobotGameConfigRecordModel._id < str(start_id))

            query_result = q.order_by(
                RobotGameConfigRecordModel._id.desc()).limit(limit).offset(
                    offset).all()

            if len(query_result) <= 0:
                return self.return_error(50001)

            content = []
            for i in query_result:
                robots = session.query(RobotConfigRecordModel).filter(
                    RobotConfigRecordModel.time_stamp == i.time_stamp)
                count = robots.count()
                finish_count = robots.filter(
                    RobotConfigRecordModel.bet_status == 1).count()

                yet_bet_number = 0
                if count != 0:
                    for robot in robots:
                        yet_bet_number = yet_bet_number + robot.bet_number

                end_of_real_time = ''
                if ("1970-01-01 00:00:00" != str(i.end_of_real_time)
                        and "0000-00-00 00:00:00" != str(i.end_of_real_time)):
                    end_of_real_time = str(i.end_of_real_time)

                completion = "0"
                if count != 0:
                    completion = str(finish_count / count * 100) + "%"

                content.append({
                    'id': str(i._id),
                    'game_serial': i.game_serial,
                    'robot_number': str(i.robot_number),
                    'yet_bet_number': str(yet_bet_number),
                    'total_bet_number': str(i.total_bet_number),
                    'created_at': str(i.created_at),
                    'start_of_plan_time': str(i.start_of_plan_time),
                    'end_of_plan_time': str(i.end_of_plan_time),
                    'end_of_real_time': end_of_real_time,
                    'completion': completion,
                    'status': str(i.status),
                    'robot_bet_type': str(i.robot_bet_type),
                    'created_user_id': str(i.created_user_id)
                })

            return {
                'limit': dic.get('limit', 10),
                'offset': dic.get('offset', 1),
                'count': count,
                'total': total,
                'content': content
            }
 def instant_game_list(self,
                       limit,
                       offset,
                       game_serial='',
                       release_time_start='',
                       release_time_end='',
                       full_load_time_start='',
                       full_load_time_end='',
                       lottery_time_start='',
                       lottery_time_end='',
                       start_id=None):
     offset = get_offset_by_page(offset, limit)
     result_dict = {
         'limit': limit,
         'offset': offset,
         'count': 0,
         'content': [],
         'total': 0
     }
     with MysqlTools().session_scope() as session:
         q = session.query(InstantGameInstanceModel)
         if game_serial != '':
             q = q.filter(
                 InstantGameInstanceModel.game_serial == game_serial)
         if release_time_start != '':
             q = q.filter(
                 InstantGameInstanceModel.created_at >= release_time_start)
         if release_time_end != '':
             q = q.filter(
                 InstantGameInstanceModel.created_at <= release_time_end)
         if full_load_time_start != '':
             q = q.filter(InstantGameInstanceModel.full_load_time >=
                          full_load_time_start)
         if full_load_time_end != '':
             q = q.filter(InstantGameInstanceModel.full_load_time <=
                          full_load_time_end)
         if lottery_time_start != '':
             q = q.filter(
                 InstantGameInstanceModel.lottery_time >= lottery_time_start
             )
         if lottery_time_end != '':
             q = q.filter(
                 InstantGameInstanceModel.lottery_time <= lottery_time_end)
         record_count = q.count()
         result_dict['total'] = record_count
         result_dict['count'] = get_page_by_offset(record_count, limit)
         if start_id is not None:
             start_id = str(start_id)
             q = q.filter(InstantGameInstanceModel._id < start_id)
         q = q.order_by(InstantGameInstanceModel.created_at.desc())
         query_result = q.limit(limit).offset(offset).all()
         if query_result is not None:
             for i in query_result:
                 total_bet_number = session.query(
                     func.sum(ParticipateInModel.bet_number * ParticipateInModel.bet_unit)). \
                     filter(ParticipateInModel.game_serial == i.game_serial,
                            ParticipateInModel.pay_token != int(_COIN_ID_EXP)).first()
                 total_bet = 0
                 if total_bet_number[0] is not None:
                     total_bet = int(total_bet_number[0])
                 result_dict['content'].append({
                     'id':
                     i._id,
                     'game_serial':
                     i.game_serial,  # 期号
                     'game_title':
                     i.game_title,
                     'bet_unit':
                     i.bet_unit,
                     'bet_token':
                     self.get_coin_name(i.bet_token),
                     'reward_quantity':
                     i.reward_quantity,  # 奖励数量
                     'reward_token':
                     self.get_coin_name(i.reward_token),  # 奖励币种
                     'release_time':
                     str(i.created_at),  # 上线时间
                     'status':
                     i.status,
                     'need':
                     i.need,  # 本期份额
                     'full_load_time':
                     str(i.full_load_time),  # 超募完成时间
                     'lottery_time':
                     str(i.lottery_time),  # 下线时间
                     'release_type':
                     i.release_type,
                     'participation':
                     i.participation,
                     'total_bet':
                     total_bet
                 })
         return result_dict