Exemple #1
0
import requests
from flask import current_app, Response
from flask_limiter.util import get_remote_address
from flask_restplus import Resource, reqparse, Namespace, fields
import base64
from haozhuan.resources.user import user_api
from utils import constants, parser
from utils.captcha.captcha import captcha
from utils.send_sms import SendSMS
from utils.limiter import limiter as lmt
from utils.http_status import HttpStatus

generate = Namespace('sms_code', description='获取手机短信验证码 请求方式:json')
generate_code = Namespace('verification', description='生成验证码图片 请求方式:关键字')
user_api.add_namespace(generate)
user_api.add_namespace(generate_code)

sms_code_model = user_api.model(
    'sms_code', {
        'mobile': fields.String(required=True, description='手机号码'),
        'uuid': fields.String(required=True, description='在图片验证码哪里生成的uuid'),
        'v_code': fields.String(required=True, description='用户输入的验证码'),
        '返回信息': fields.String(description='验证码获取的状态'),
    })

image_code_model = user_api.model(
    'verification', {
        'uuid': fields.Integer(required=True,
                               description='要生成一个uuid给我作为图片验证码唯一识别'),
        '返回信息': fields.String(description='验证码图片/jpeg'),
from flask_restplus import Resource, reqparse, Namespace, fields
from flask import current_app, g
from haozhuan.resources.user import user_api
from haozhuan.resources.user.tasks import TasksDetailsView
from utils.http_status import HttpStatus
from utils.decorators import verify_required, login_required, withdrawal, bind_aliplay
from utils.mysql_cli import MysqlWrite
from utils.constants import ET_TASK_ORDERS, TASKS_TABLE
from utils.limiter import limiter as lmt
from utils import constants
from flask_limiter.util import get_remote_address

# 用户领取任务
user_draw_tasks = Namespace('user_draw_task',
                            description='获取用户所有任务列表 请求方式:关键字')
user_api.add_namespace(user_draw_tasks)

draw_tasks_model = user_api.model(
    'draw_tasks_model', {
        'task_id': fields.String(required=True, description='携带任务id'),
        '返回信息': fields.String(description='添加任务的状态回调'),
        '提示': fields.String(description='此接口必须携带token'),
    })


@user_draw_tasks.route('')
class UserDrawTaskView(Resource):
    method_decorators = [
        verify_required, login_required
        # , withdrawal
    ]
Exemple #3
0
import time
from flask_restplus import Resource, reqparse, fields, Namespace
from flask import current_app
from cache.user import UserCache
from cache.user_center import UserCentreCache
from haozhuan.resources.user import user_api
from utils.alicloud_authentication import ali_authentication
from utils.http_status import HttpStatus
from utils.constants import ET_MEMBER_EXTEND,MEMBERS_TABLE, ET_MEMBER_EXTEND, ET_MEMBER_EARNINGS
from utils.mysql_cli import MysqlWrite,MysqlSearch
from common.cache.user_extend import UserExtendCache
from utils.parser import id_car, name_str
from utils.card import checkIdcard, verifid_card_1

auth = Namespace('authentication', description='实名认证 请求方式:表单')
user_api.add_namespace(auth)

authentication_model = user_api.model('authentication', {
        'idNo': fields.Integer(required=True, description='身份证'),
        'name': fields.Integer(required=True, description='姓名'),
        '返回内容': fields.String(description='当前接口返回验证回调'),
})

@auth.route('')
class User_AuthenticationView(Resource):
    @auth.expect(authentication_model)
    def post(self):
        """用户实名认证"""
        parser = reqparse.RequestParser()
        parser.add_argument('mobile', type=int, required=True, location='json')
        parser.add_argument('idNo', type=str, required=True, location='json')
from utils.mysql_cli import MysqlWrite, MysqlSearch
from utils.decorators import verify_required, login_required
from utils.constants import ET_TASK_ORDERS, TASKS_TABLE
from utils.http_status import HttpStatus
from flask import g, current_app
from pyzbar import pyzbar
import datetime
import os
import requests
import argparse
import cv2
import numpy as np
import urllib.request as urllib

add_tasks = Namespace('user_add_task', description='用户提交任务 请求方式:json')
user_api.add_namespace(add_tasks)

tasks_add = user_api.model(
    'tasks_add', {
        'task_id': fields.String(required=True, description='要提交任务的id'),
        'json_data': fields.Integer(required=True,
                                    description='用户任务凭证---->json数据'),
        '返回信息': fields.String(description='任务提交回调'),
        '提示': fields.String(description='此接口必须携带token'),
    })


@add_tasks.route('')
class UserAddTaskView(Resource):
    method_decorators = [verify_required, login_required]
Exemple #5
0
from flask_restplus import Resource, reqparse, Namespace, fields

from utils import constants
from haozhuan.resources.user import user_api
from utils.decorators import verify_required, login_required
from utils.http_status import HttpStatus
from utils.constants import ET_DRP_CONFIG, ET_MEMBER_WITHDRAWAL, MEMBERS_TABLE, ET_MEMBER_EARNINGS, ET_MEMBER_RELATIONS
from utils.mysql_cli import MysqlSearch, MysqlWrite
from flask import g, current_app
from datetime import datetime
from utils.limiter import limiter as lmt

# 用户提现页面
user_carry = Namespace('user_carry_money',
                       description='获取用户提现页面 请求方式:带token请求即可')
user_api.add_namespace(user_carry)
user_carry_model = user_api.model(
    'user_carry_model', {
        '返回信息': fields.String(description='提现页面数据'),
        '提示': fields.String(description='此接口必须携带token'),
    })

# 用户提交提现

user_carry_post = Namespace('user_carry_money', description='提交提现 请求方式:json')
user_api.add_namespace(user_carry_post)
user_carry_post_model = user_api.model(
    'user_carry_post_model', {
        'amount': fields.Integer(description='提现的金额'),
        '请求类型': fields.String(description='json'),
        '返回信息': fields.String(description='返回成功或者失败回调'),
Exemple #6
0
import json
from flask_restplus import Resource, Namespace, fields, reqparse
from cache.tasks import TasksCache
from cache.tasks_detail import TasksDetail
from cache.user_tasks import UserTasks
from haozhuan.resources.user import user_api
from utils.decorators import login_required, verify_required
from flask import current_app, g
from utils.http_status import HttpStatus
from utils.constants import ET_TASK_ORDERS, ET_GLOBAL_CONFIG
from utils.mysql_cli import MysqlWrite, MysqlSearch

# 任务列表
tasks = Namespace('tasks', description='获取所有任务列表 请求方式:json')
user_api.add_namespace(tasks)

#任务详情
tasks_detail = Namespace('tasks_detail', description='获取任务详情 请求方式:关键字')
user_api.add_namespace(tasks_detail)

# 用户任务列表
user_tasks = Namespace('user_tasks', description='获取用户所有任务列表 请求方式:关键字')
user_api.add_namespace(user_tasks)

#任务列表
tasks_model = user_api.model(
    'tasks_model', {
        'option':
        fields.String(required=True, description='high/general---->高级任务/简单任务'),
        'page_index':
        fields.Integer(required=True, description='分页页数'),
Exemple #7
0
import re

from flask_restplus import Resource, reqparse, Namespace, fields
from haozhuan.resources.user import user_api
from utils.decorators import login_required, verify_required
from utils.mysql_cli import MysqlWrite
from utils.constants import MEMBERS_TABLE
from utils.http_status import HttpStatus
from flask import g, current_app

bind = Namespace('bind_aliplay', description='绑定支付宝 请求方式:json')
user_api.add_namespace(bind)

bind_model = user_api.model(
    'bind_aliplay', {
        'account': fields.Integer(required=True, description='支付宝账号'),
        'name': fields.Integer(required=True, description='姓名'),
        '提示': fields.String(description='此接口必须携带token'),
    })


@bind.route('')
class Bind_aliplayView(Resource):
    method_decorators = [verify_required, login_required]

    @bind.expect(bind_model)
    def post(self):
        """绑定支付宝"""
        parser = reqparse.RequestParser()
        parser.add_argument('account',
                            type=str,
Exemple #8
0
from flask_restplus import Resource, Namespace, fields
from flask import current_app
from haozhuan.resources.user import user_api
from utils.http_status import HttpStatus
from cache.user_center import UserCentreCache
from utils.decorators import verify_required, login_required

# 用户个人中心
user_center = Namespace('user_center',
                        description='获取用户所有任务列表 请求方式:直接带token请求')
user_api.add_namespace(user_center)

user_center_model = user_api.model(
    'user_center_model', {
        '返回信息': fields.String(description='首页信息data'),
        '提示': fields.String(description='此接口必须携带token'),
    })


@user_center.route('')
class UserCenterView(Resource):
    method_decorators = [login_required]

    @user_center.expect(user_center_model)
    def get(self):
        """用户个人中心"""
        res = UserCentreCache().get()
        if res:
            return {'data': res}, HttpStatus.OK.value
        else:
            return {'error': '暂无记录'}, HttpStatus.OK.value
Exemple #9
0
from flask import current_app, g
from flask_restplus import Resource, reqparse, Namespace, fields
from datetime import datetime, timedelta
from cache.user import UserCache
from cache.relation_tree import MemberRelationTreeCache
from haozhuan.resources.user import user_api
from utils.hashids_iiuv import hashids_iivu_encode
from utils.jwt_util import generate_jwt
from utils.constants import MEMBERS_TABLE
from utils.mysql_cli import MysqlSearch, MysqlWrite
from utils.snowflake.id_worker import IdWorker
from utils.http_status import HttpStatus
from utils.short_link import get_short_link

login = Namespace('login', description='手机登录 请求方式:json')
user_api.add_namespace(login)

register_model = user_api.model(
    'Register', {
        'mobile': fields.Integer(required=True, description='手机号码'),
        'code': fields.Integer(required=True, description='手机验证码'),
        'iiuv': fields.String(description='是否通过二维码过来注册,是就要携带,不是可以为空'),
        '返回内容': fields.String(description='当前接口返回一个token'),
    })


@login.route('')
class LoginView(Resource):
    def _generate_tokens(self,
                         user_id,
                         setreal,
from flask_restplus import Resource, reqparse, Namespace, fields
from cache.user_apprentice_cache import UserApprenticeCache
from cache.user_apprenticedetail_cache import UserApprenticeDetailCache
from haozhuan.resources.user import user_api
from utils.decorators import verify_required, login_required
from utils.http_status import HttpStatus

user_apprentice_page = Namespace('user_apprentice',description='用户收徒页信息 请求方式:直接携带token过来请求就行')
user_api.add_namespace(user_apprentice_page)
user_apprentice_detail = Namespace('user_apprentice_detail',description='用户收徒收益明细 请求方式:关键字')
user_api.add_namespace(user_apprentice_detail)

user_apprentice_page_model = user_api.model('user_apprentice_page', {
        '提示': fields.String(description='此接口必须携带token'),
        '返回信息': fields.String(description='收徒页面内容'),
})

user_apprentice_detail_model = user_api.model('user_apprentice_model', {
        'page_index': fields.Integer(description='页数'),
        'page_size': fields.Integer(description='内容总数'),
        '提示': fields.String(description='此接口必须携带token'),
        '返回信息': fields.String(description='收徒详情[列表]'),
})


@user_apprentice_page.route('')
class UserApprenticeView(Resource):
    method_decorators = [
        login_required
    ]
    @user_apprentice_page.expect(user_apprentice_page_model)
Exemple #11
0
from flask_restplus import Resource, fields, Namespace
from cache.user_earnings import UserEarningsCache
from haozhuan.resources.user import user_api
from utils.decorators import verify_required, login_required
from utils.http_status import HttpStatus

# 用户个人收益
user_earnings = Namespace('user_earnings',
                          description='获取用户个人收益列表 请求方式:直接携带token请求')
user_api.add_namespace(user_earnings)

user_earnings_model = user_api.model(
    'user_earnings_model', {
        '返回信息': fields.String(description='收益流水[列表]'),
        '提示': fields.String(description='此接口必须携带token'),
    })


@user_earnings.route('')
class UserEarningsView(Resource):
    method_decorators = [login_required]

    @user_earnings.expect(user_earnings_model)
    def get(self):
        """用户个人收益获取"""
        res = UserEarningsCache().get()
        if res:
            return {'data': res[0:4]}, HttpStatus.OK.value
        else:
            return {'error' '次用户没有流水记录'}, HttpStatus.OK.value