Skip to content

Commit

Permalink
modify every py adapt for structure
Browse files Browse the repository at this point in the history
  • Loading branch information
CAOLINAN committed May 19, 2018
1 parent 668a316 commit e288c7c
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 87 deletions.
4 changes: 1 addition & 3 deletions ulordapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
# @File : __init__.py.py
# @Author: PuJi
# @Date : 2018/4/17 0017

from .user.user1 import Developer1 as Senior
from .user.user2 import Developer2 as Junior
from user import Junior,Senior
2 changes: 1 addition & 1 deletion ulordapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import os, json, logging, io, time

from ulordapi.utils import fileHelper
from .utils import fileHelper


ROOTPATH = os.path.dirname(os.path.realpath(__file__))
Expand Down
46 changes: 23 additions & 23 deletions ulordapi/daemonCLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import pprint, argparse, sys, os, textwrap, json


from ulordapi.config import config,ulordconfig
from ulordapi.db.manage import create
from ulordapi.user import user1
# from .user import user2
from ulordapi.up import udfs
from .config import config,ulordconfig
from .manage import create
from . import user

develop1 = user1.Developer1(ulordconfig.get('ulord_appkey'), ulordconfig.get('ulord_secret'))

# develop2 = user2.Developer2(ulordconfig.get('ulord_appkey'), ulordconfig.get('ulord_secret'))
senior = user.Senior(ulordconfig.get('ulord_appkey'), ulordconfig.get('ulord_secret'))

udfs = senior.udfs
# develop2 = user.Junior(ulordconfig.get('ulord_appkey'), ulordconfig.get('ulord_secret'))

try:
config_path = config.get('baseconfig').get('config_file')
Expand Down Expand Up @@ -85,46 +85,46 @@ def main():
help='just for the Senior programmer functions.'
)
parser_up_wallet_create = subparsers_up.add_parser('create', help='create wallet')
parser_up_wallet_create.set_defaults(func=develop1.ulord_createwallet)
parser_up_wallet_create.set_defaults(func=senior.ulord.ulord_createwallet)

parser_basic_publish = subparsers_up.add_parser('publish', help='publish data to the ulord')
parser_basic_publish.set_defaults(func=develop1.publish)
parser_basic_publish.set_defaults(func=senior.ulord.publish)

parser_basic_transaction = subparsers_up.add_parser('transaction', help='transaction on the ulord')
parser_basic_transaction.set_defaults(func=develop1.transaction)
parser_basic_transaction.set_defaults(func=senior.ulord.transaction)

parser_basic_paytouser = subparsers_up.add_parser('paytouser', help='activity send ulord to the user')
parser_basic_paytouser.set_defaults(func=develop1.paytouser)
parser_basic_paytouser.set_defaults(func=senior.ulord.paytouser)

parser_basic_queryblog = subparsers_up.add_parser('resourceslist', help='list all resources')
parser_basic_queryblog.set_defaults(func=develop1.queryblog)
parser_basic_queryblog.set_defaults(func=senior.ulord.queryblog)

parser_basic_querybalance = subparsers_up.add_parser('querybalance', help="query user's balance")
parser_basic_querybalance.set_defaults(func=develop1.querybalance)
parser_basic_querybalance.set_defaults(func=senior.ulord.querybalance)

parser_basic_checkisbought = subparsers_up.add_parser('checkisbought', help="check the resource if bought")
parser_basic_checkisbought.set_defaults(func=develop1.checkisbought)
parser_basic_checkisbought.set_defaults(func=senior.ulord.checkisbought)

parser_basic_queryuserpublished = subparsers_up.add_parser('queryuserpublished', help="query user's published")
parser_basic_queryuserpublished.set_defaults(func=develop1.queryuserpublished)
parser_basic_queryuserpublished.set_defaults(func=senior.ulord.queryuserpublished)

parser_basic_queryuserbought = subparsers_up.add_parser('queryuserbought', help="query user's bought")
parser_basic_queryuserbought.set_defaults(func=develop1.queryuserbought)
parser_basic_queryuserbought.set_defaults(func=senior.ulord.queryuserbought)

parser_basic_queryincomebillings = subparsers_up.add_parser('queryincomebillings', help="query user's income billings")
parser_basic_queryincomebillings.set_defaults(func=develop1.queryincomebillings)
parser_basic_queryincomebillings.set_defaults(func=senior.ulord.queryincomebillings)

parser_basic_queryoutgobillings = subparsers_up.add_parser('queryoutgobillings', help="query user's outgo billings")
parser_basic_queryoutgobillings.set_defaults(func=develop1.queryoutgobillings)
parser_basic_queryoutgobillings.set_defaults(func=senior.ulord.queryoutgobillings)

parser_basic_querybillingsdetail = subparsers_up.add_parser('querybillingsdetail', help="query the detail of user's billings")
parser_basic_querybillingsdetail.set_defaults(func=develop1.querybillingsdetail)
parser_basic_querybillingsdetail.set_defaults(func=senior.ulord.querybillingsdetail)

parser_basic_querybillings = subparsers_up.add_parser('querybillings', help="query user's billings")
parser_basic_querybillings.set_defaults(func=develop1.querybillings)
parser_basic_querybillings.set_defaults(func=senior.ulord.querybillings)

parser_basic_querypublishnum = subparsers_up.add_parser('querypublishnum', help="query the num of user's published")
parser_basic_querypublishnum.set_defaults(func=develop1.querypublishnum)
parser_basic_querypublishnum.set_defaults(func=senior.ulord.querypublishnum)

# parser_basic_addpurchases = subparsers_up.add_parser('addpurchases', help="add resources's purchases")
# parser_basic_addpurchases.set_defaults(func=develop1.addpurchases)
Expand Down Expand Up @@ -219,14 +219,14 @@ def wrapper(*args, **kwargs):
def edit_config(args):
if args and args.key:
args = args.key
return develop1.config_edit(args)
return senior.config_edit(args)


@formatResult
def show_config(args):
if args and args.key:
args = args.key
return develop1.config_show(args)
return senior.config_show(args)


if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions ulordapi/errcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def return_result(errcode=0,reason=None,result=None):
:param errcode: errcode
:type errcode: int
:param reason: reason, change it to the dict and update original reason
:type reason: str
:type reason: str/dict
:param result: result, change it to the dict and update original result
:type result: str
:type result: str/dict
:return: errcode result
"""
if errcode == 0:
Expand Down
6 changes: 3 additions & 3 deletions ulordapi/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from flask_sqlalchemy import SQLAlchemy
from passlib.apps import custom_app_context as pwd_context

from ulordapi.config import dbconfig
from ulordapi.errcode import _errcodes
from ulordapi.utils import isMail, isCellphone
from .config import dbconfig
from .errcode import _errcodes
from .utils import isMail, isCellphone

# initialization
app = Flask(__name__)
Expand Down
2 changes: 1 addition & 1 deletion ulordapi/udfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import ipfsapi

from utils import fileHelper
from .utils import fileHelper

class Udfs():
"""
Expand Down
10 changes: 2 additions & 8 deletions ulordapi/up.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import requests

import utils
from config import ulordconfig, config
from errcode import return_result
from .config import ulordconfig, config, webconfig
from .errcode import return_result


class UlordHelper(object):
Expand Down Expand Up @@ -281,12 +281,6 @@ def querypublishnum(self, author):
}
return self.post(self.ulord_published_num, data)

# def addpurchases(self, dbID):
# data = {
# 'id': dbID
# }
# return self.post(self.ulord_view, data)


ulord_helper = UlordHelper()

Expand Down
Loading

0 comments on commit e288c7c

Please sign in to comment.