class OperationHistorys(Resource): @marshal_with(make_marshal_fields({ 'id': fields.Integer, 'uid': fields.Integer, 'auditime': fields.Integer, 'info': fields.String, 'makeUser': fields.String, 'orderId': fields.String, 'contents': fields.String, 'ip': fields.String, 'amount': fields.Integer, 'username': fields.String, 'makeUserName': fields.String })) def get(self): historys = RequestParser() historys.add_argument('username', type=str) historys.add_argument('auditimeUpper', type=int) historys.add_argument('auditimeLower', type=int) historys.add_argument('infoIn', type=str) historys.add_argument('infoOut', type=str) historys.add_argument('makeUserName', type=str) m_args = historys.parse_args(strict=True) criterion = set() if m_args['username']: criterion.add(OperationHistory.username == m_args['username']) if m_args['auditimeUpper']: criterion.add(OperationHistory.auditime < m_args['auditimeUpper'] + SECONDS_PER_DAY) if m_args['auditimeLower']: criterion.add(OperationHistory.auditime >= m_args['auditimeLower']) if m_args['infoIn']: criterion.add(OperationHistory.info.like('%{}%'.format(m_args['infoIn']))) if m_args['infoOut']: criterion.add(~OperationHistory.info.like('%{}%'.format(m_args['infoOut']))) if m_args['makeUserName']: criterion.add(OperationHistory.makeUserName == m_args['makeUserName']) args = OperationHistory().getdata(criterion) return make_response(args)
from flask_restful.reqparse import RequestParser from app.api_0_1.common.utils import make_response, make_marshal_fields, make_response_from_pagination from app.models.config_countries import ConfigCountries from app.models.config_system import ConfigSystem from app.models.common.utils import paginate import json import re import os from app.models import db ''' 系统设置 - 国别阻挡 ''' fields = make_marshal_fields({ 'id': fields.Integer, 'name': fields.String, 'ename': fields.String, 'code': fields.String, 'state': fields.Integer }) class ConfigCountriesAPI(Resource): @marshal_with(fields) def get(self): parser = RequestParser(trim=True) parser.add_argument('name', type=str) args = parser.parse_args(strict=True) criterion = set() if args['name']: criterion.add(ConfigCountries.name == args['name']) pagination = paginate(ConfigCountries.query, criterion, 1, 300)
ecmap[eccode] = {} gtyps = i.game_types if gtyps is None or gtyps == "": continue typeList = gtyps.split(",") for type in typeList: ecmap[eccode][type] = None data["fsb"] = ecmap return make_response(data) fields_list = make_marshal_fields({ 'id': fields.Integer, 'name': fields.String, 'ss_enable': fields.Integer, 'pc_enable': fields.Integer, 'count': fields.Integer, }) fields = make_marshal_fields({ 'id': fields.Integer, 'name': fields.String, 'fsb': fields.String, 'pc_enable': fields.Integer, 'ss_enable': fields.Integer, 'count': fields.Integer, 'agent_count': fields.Integer, 'ss_zdlqxe': fields.Float, 'ss_zglqxe': fields.Float, 'ss_jh': fields.Float,
''' 公司入款 ''' fields = make_marshal_fields({ 'id': fields.Integer, 'uid': fields.Integer, 'name': fields.String, 'bank_online_id': fields.Integer, 'enable': fields.Integer, 'username': fields.String, 'gradeList': fields.String, 'code': fields.String, 'secret_key': fields.String, 'tb': fields.String, 'amount': fields.Float, 'accumulatedAmount': fields.Float, 'min_amount': fields.Float, 'max_amount': fields.Float, 'validTime': fields.Integer, 'remark': fields.String, 'RecommendAmount': fields.String, 'RecommendRemark': fields.String, 'pay_type': fields.Integer, # 'bank':fields.Nested({ # 'id': fields.Integer, # 'name':fields.String, # 'home':fields.String, # }) }) class SysadminOnlineAPI(Resource):
class WebsiteSettings(Resource): @marshal_with( make_marshal_fields({ 'id': fields.Integer, 'name': fields.String, 'website': fields.String, 'defAgentId': fields.Integer, 'defAgentName': fields.String, 'memberServiceId': fields.Integer, 'regExamine': fields.Integer, 'remark': fields.String, 'memberServiceName': fields.String, })) def get(self, id=None): parser = RequestParser(trim=True) parser.add_argument('page', type=int, default=DEFAULT_PAGE) parser.add_argument('pageSize', type=int, default=DEFAULT_PAGE_SIZE) args = parser.parse_args(strict=True) criterion = set() if id: criterion.add(WebsiteSetting.id == id) pagination = paginate(WebsiteSetting.query, criterion, args['page'], args['pageSize']) result = [] for item in pagination.items: if item.memberServiceId: memberService = ConfigMemberService.query.filter( ConfigMemberService.id == item.memberServiceId).first() result.append({ 'id': item.id, 'name': item.name, 'website': item.website, 'defAgentId': item.defAgentId, 'defAgentName': item.defAgentName, 'memberServiceId': item.memberServiceId, 'regExamine': item.regExamine, 'remark': item.remark, 'memberServiceName': memberService.name, }) return make_response(result, page=pagination.page, pages=pagination.pages, total=pagination.total) # def post(self): # parser = RequestParser(trim=True) # parser.add_argument('name', type=str) # parser.add_argument('website', type=str) # parser.add_argument('defAgentId', type=int) # parser.add_argument('defAgentName', type=str) # parser.add_argument('memberServiceId', type=int) # parser.add_argument('regExamine', type=str) # parser.add_argument('remark', type=str) # args = parser.parse_args(strict=True) # # try: # websitesetting = WebsiteSetting(**args) # db.session.add(websitesetting) # db.session.commit() # except: # db.session.rollback() # db.session.remove() # abort(500) # return make_response([]), 201 def put(self, id): parser = RequestParser(trim=True) parser.add_argument('defAgentName', type=str) parser.add_argument('memberServiceId', type=int) parser.add_argument('regExamine', type=str) parser.add_argument('remark', type=str) args = parser.parse_args(strict=True) agents = Member.query.filter( Member.username == args['defAgentName']).first() if not agents or agents.type == 0: return make_response(error_message='预设代理帐号不存在') try: websitesetting = WebsiteSetting.query.get(id) websitesetting.defAgentId = agents.id websitesetting.defAgentName = args['defAgentName'] websitesetting.memberServiceId = args['memberServiceId'] websitesetting.regExamine = args['regExamine'] websitesetting.remark = args['remark'] db.session.add(websitesetting) db.session.commit() except: db.session.rollback() db.session.remove() abort(500) return make_response([])
from ..parsers.systemConfig import configWebsite from app.models.config_website import ConfigWebsite, WebsiteSetting from app.models.config_member_service import ConfigMemberService from app.models.member import Member from flask_restful.reqparse import RequestParser from ..common import * from app.models.common.utils import * ''' 系统设置 - 站台系统值设置 ''' fields1 = make_marshal_fields({ 'id': fields.Integer, 'webName': fields.String, 'agentName': fields.String, 'loginVerified': fields.Integer, 'regVerified': fields.Integer, 'regQAVerified': fields.Integer, 'errorCount': fields.Integer, 'puzzleVerifiedLogin': fields.Integer, 'puzzleVerifiedReg': fields.Integer, 'landingAreaVerification': fields.Integer, }) class ConfigWebsiteAPI(Resource): @marshal_with(fields1) def get(self, id=None): criterion = set() if id: criterion.add(ConfigWebsite.id == id) m_rom = ConfigWebsite() pagination = m_rom.getData(criterion)
from flask_restful import Resource, marshal_with, fields from flask_restful.reqparse import RequestParser from app.api_0_1.common.utils import make_marshal_fields, make_response, make_response_from_pagination # from .. import api from ..parsers.systemConfig import configIplist_parsers_post, configIplist_parsers_put from app.models.config_iplist import ConfigIplist from pickle import NONE import json import time from flask.json import jsonify from app.redis.redisConnectionManager import IPRedisManager fields = make_marshal_fields({ 'id': fields.Integer, 'ip': fields.String, 'state': fields.Integer, 'uid': fields.Integer, 'strTime': fields.String }) class ConfigIplistAPI(Resource): # 查询 @marshal_with(fields) def get(self, id=None): m_args = configIplist_parsers_put.parse_args(strict=True) criterion = set() if id: criterion.add(ConfigIplist.id == id) m_result = ConfigIplist().getDate(criterion, m_args['page'], m_args['pageSize'])
# import json # from datetime import datetime fields = make_marshal_fields({ 'id': fields.Integer, 'level': fields.String, 'levelName': fields.String, 'min_rk': fields.Float, 'max_rk': fields.Float, 'min_tk': fields.Float, 'max_tk': fields.Float, 'sx_Free': fields.Float, 'mcfy': fields.Integer, 'tksc': fields.Integer, 'ms': fields.Integer, 'js': fields.Integer, 'dkzfsxf': fields.String, 'gsrkyh': fields.String, 'xszfyh': fields.String, 'zcscj': fields.String, 'kscz': fields.String, 'ckjhb': fields.String, 'xz_Free': fields.Float, 'remark': fields.String, 'danger': fields.Integer, 'zfbmqckzt': fields.Integer, 'isBanned': fields.Integer, # 'memberCount': fields.Integer, }) class MemberlevelAPI(Resource):
from flask_restful import Resource, marshal_with, fields from flask_restful.reqparse import RequestParser from app.api_0_1.common.utils import make_response,make_marshal_fields from .. import api from ..parsers.systemConfig import configMemberService_parsers from app.models.config_member_service import ConfigMemberService import json ''' 系统设置 - 佣金 ''' fields = make_marshal_fields({ 'id': fields.Integer, 'name': fields.String, 'member_reg': fields.String, 'agent_reg': fields.String, 'remark': fields.String, 'pmd': fields.String }) ''' 会员端设定 ''' class ConfigMemberServiceAPI(Resource): @marshal_with(fields) def get(self, id=None): m_args = configMemberService_parsers.parse_args(strict=True) criterion = set() if id: criterion.add(ConfigMemberService.id == id)
class DataAdminAPI(Resource): ''' 查询现在已经有的预设信息 ''' @marshal_with( make_marshal_fields({ 'id': fields.Integer, 'type': fields.Integer, 'time': fields.Integer, 'actionNo': fields.String, 'data': fields.String, 'uid': fields.Integer, 'username': fields.String, 'actionTime': fields.String, })) def get(self): m_args = dataAdmin_get_parser.parse_args(strict=True) criterion = set() if m_args['sActionTime']: criterion.add(BlastDataAdmin.time >= m_args['sActionTime']) if m_args['eActionTime']: criterion.add(BlastDataAdmin.time <= m_args['eActionTime']) if m_args['username']: criterion.add(BlastDataAdmin.username == m_args['username']) if m_args['actionNo']: criterion.add(BlastDataAdmin.actionNo == m_args['actionNo']) if m_args['type']: criterion.add(BlastDataAdmin.type == m_args['type']) m_orm = BlastDataAdmin() pagination = m_orm.getBlastDataAdmin(criterion, m_args['page'], m_args['pageSize']) return make_response_from_pagination(pagination) ''' 更新一个系统开奖信息 ''' #@marshal_with(systemConfig_fields.basic_fields) def put(self, id): kwargs = data_admin_post_parser.parse_args(strict=True) m_result = BlastDataAdmin().update(id, kwargs) return m_result ''' 添加一个系统开奖信息 ''' @marshal_with({ 'data': fields.List( fields.Nested({ 'id': fields.Integer, 'type': fields.Integer, 'time': fields.Integer, 'actionNo': fields.String, 'data': fields.String, 'uid': fields.Integer, 'username': fields.String, })), 'success': fields.Boolean(default=True), 'pages': fields.Integer(default=1), 'page': fields.Integer(default=1), 'pageSize': fields.Integer(default=1), }) def post(self, id): kwargs = data_admin_post_parser.parse_args(strict=True) kwargs['type'] = id m_result = BlastDataAdmin().insert(kwargs) return {'data': [m_result]} #@marshal_with(systemConfig_fields.basic_fields) def delete(self, id): m_res = BlastDataAdmin().delete(id) return {'success': m_res}, 201