예제 #1
0
 def __init__(self, host, port, db_name, user, passwd, charset='utf8'):
     """
     function:初始化数据库并连接
     :param host: 数据库主机地址
     :param port: 端口
     :param db_name: 数据库名词
     :param user: 数据库登录用户
     :param passwd: 数据库登录密码
     :param charset: 数据库字符集
     """
     self.log = get_log("MySql")
     self.host = host
     self.port = port
     self.user = user
     self.passwd = passwd
     self.db_name = db_name
     self.charset = charset
     self.log.info("开始连接数据库%s..." % self.host)
     self.conn = connect(host=self.host,
                         port=self.port,
                         user=self.user,
                         passwd=self.passwd,
                         db=self.db_name,
                         charset=self.charset)
     self.cur = self.conn.cursor()
     self.log.info("连接数据库{}成功,库名%s!".format(self.host, self.db_name))
예제 #2
0
 def __init__(self, host, user, password, database):
     self.host = host
     self.user = user
     self.password = password
     self.database = database
     self.log = get_log("MySqlServer")
     self.log.info("开始连接数据库%s..." % self.host)
     self.conn = pymssql.connect(host=self.host,
                                 user=self.user,
                                 password=self.password,
                                 database=self.database)
     self.cur = self.conn.cursor()
     self.log.info("连接数据库{}成功,库名为{}!".format(self.host, self.database))
예제 #3
0
# -*- coding:utf-8 -*-
"""
@author:WangYong
@workNumber:xy04952
@fileName: initEnvironment.py
@creatTime: 2019/09/20
"""

from download.common.insertSql import getSoftid
from download.models import SoftId, TestCase
from Logs.log import get_log

log = get_log("initEnvironment")


# softID查重
def rechecking(soft):
    try:
        count = TestCase.objects.filter(softId=soft)
    except Exception as e:
        log.info("登录用户查询异常:", e)
        count = None
    return count


# 初始化环境
def initEnviron():
    data = getSoftid(100000)
    soft_list = []
    for d in data:
        soft_list.append(SoftId(softId=d[0]))
예제 #4
0
from django.core.paginator import PageNotAnInteger, EmptyPage
from django.shortcuts import render, redirect, HttpResponse

from download.common.customPaginator import KingPaginator
from userinfo.common.tools import *
from Logs.log import get_log
from userinfo.common.userinit import *
from .models import User
import re
import threading
import time

log = get_log("login")


# 登录页面
def login(request):
    if request.session.get("username"):
        return redirect("index")
    if request.method == "POST":
        username = request.POST.get("username")
        pwd = request.POST.get("pwd")

        try:
            count = User.objects.filter(username=username)
        except Exception as e:
            log.info("登录用户查询异常:", e)
            count = None
        if not count:
            return render(request, 'user/login.html', {"massage": "账号密码输入错误!"})
예제 #5
0
from download.common.stepmodel import RecordConsumeLog, RecordBookShopLog, RecordDowninterfaceHits, \
    RecordIncrePointFlowLog, \
    UpdateSoftDownloadHit, GetFeedbackShieledUserGroupInfo, RecordFreePointDownFeeBackLog, \
    RecordMonthlyExcellentDownFeeBackLog, \
    AssetIncreasedMonthlyExcellentDown, AsserIncreasedForNormalFeeBack, FeeBackLogForMonthly, FeeBackLogForNormal, \
    RecordSellIncomeLog, \
    RecordUserGivePoint, GetIncrePointShieledGroupInfo, GetIncrePointRuleInfo, UpdateSoftPoint, \
    RecordSoftPointIncreInfoLogAndUpdateDownNum, \
    RecordFlowLogAfterSoftPointIncre, UpdateUserDown, AddSettlementLog, UpdateDownInfoStatus, HighWXTConsumeLog, \
    HighWxtDownLoadStatisticsLog
from download.common.insertSql import getStatus, getRebate, getPoint
from download.common.sqlOprate import MySqlServer
from Logs.log import get_log
import time

log = get_log("rollBack")


# 获取执行结果
def getResult(softId, nowTime, funcPoint, softAuthor, AddTime):
    """
    :param softId: 资料softId
    :param nowTime: 获取结果执行时间
    :param funcPoint: 功能,返利、升点
    :param softAuthor: 资料作者
    :param AddTime: 正常执行时间
    :return:
    """
    times = 0
    while True:
        if getStatus(softId, AddTime) == 1:
예제 #6
0
@fileName: performCase.py
@creatTime: 2019/09/17
"""

from download.models import TestCase, CaseResult, TestSoftId
from download.common.rollback import rollBackData
from download.common.inserts import initDate, initPoint, insertDate, getbate
from download.common.getCaseAttr import getNowTime, getDownloadId
from download.common.channel.initSnapshotData import insert_snapshots_table_data
from download.common.insertSql import initSoftPoint, updateDownloadDate, initDownloadDate, getStatus, getRebate, \
    getPoint
from download.common.tools import getRandom
from Logs.log import get_log
import time

log = get_log("performCase")


# 用例执行函数
def runCase(caseIds, username, project):
    if caseIds == 'all':
        allId = TestCase.objects.filter(newCaseUser=username,
                                        project=project).values('caseId')
        ids = []
        for d in allId:
            ids.append(d["caseId"])
    else:
        ids = caseIds.split(',')
        ids.reverse()
    for caseId in ids:
        try:
예제 #7
0
@workNumber:xy04952
@fileName: UserCaseManner.py
@creatTime: 2019/09/17
"""

from dateutil.parser import parse
import time
import re
import random

from download.models import TestCase
from userinfo.models import UserSoft
from download.common.getCaseAttr import getSoftInfo, isDate, getDownloadAuthorType
from Logs.log import get_log

log = get_log("caseOperate")


def getCaseId(project):
    try:
        Id = TestCase.objects.filter(
            project=project).order_by("-createTime").values("caseId").first()
    except Exception as e:
        log.error(e)
    if Id is None:
        Id = "xkw-" + project + "_10" + "00"
    else:
        Id = "xkw-" + project + '_' + str(int(Id["caseId"].split('_')[1]) + 1)
    return Id

예제 #8
0
# coding=utf-8
import time
import uuid
import requests
from download.common.sqlOprate import MySqlServer, MySql
from Logs.log import get_log

log = get_log("TestCase")

'''
不发放奖励 用户ID:26628667,26431488,4684283

---不涨点:
1.不升点用户ID: 4684283,13794598,10006491,资料classId=668, 1419, 850, 538, 4963, 1251, 5037, 4974, 1155
2. 资料栏目为理综,文综(classId=5247, 5248 ),且上传用户为“蒋琳zok,mayanquan,zy1868,731486168,sunxinwei821,李辰辰”,不涨点
'''


# 初始化资料点数信息
def initSoftPoint(softId, authorId, AddTime, softPoint=0.00, softMoney=0.00, softCash=0.00, isSupply=0,
                  backCashRate=0, backMoneyRate=0):
    """
    function:初始化数据,将资源点数设置为测试数据一致
    :param isSupply: 高级点资料标识
    :param softCash: 第三方资料价格
    :param softMoney: 储值资料价格
    :param backMoneyRate: 储值资料返现比
    :param backCashRate:第三方资料返现比
    :param AddTime:资料上传时间
    :param authorId:资料上传者
    :param softPoint: 资源普通点数
예제 #9
0
파일: views.py 프로젝트: king152/Myproject
from django.core.paginator import PageNotAnInteger, EmptyPage
from django.shortcuts import render, redirect, HttpResponse
from download.common.customPaginator import JuncheePaginator

from UserInfo.common.userinit import initUserSoftId
from UserInfo.models import User
from Logs.log import get_log
from UserInfo.common.tools import decrypt, encrypt

import re
import threading
import time

log = get_log("UserInfo")


# 登录页面
def login(request):
    if request.session.get("username"):
        return redirect("index")
    if request.method == "POST":
        username = request.POST.get("username")
        pwd = request.POST.get("pwd")

        try:
            count = User.objects.filter(username=username)
        except Exception as e:
            log.info("登录用户查询异常:", e)
            count = None
        if not count:
            return render(request, 'user/login.html', {"massge": "账号密码输入错误!"})
예제 #10
0
# coding=utf-8
from download.common.sqlOprate import MySqlServer
from download.common.stepmodel import RecordBookShopLog, RecordConsumeLog,RecordDowninterfaceHits,\
    RecordFlowLogAfterSoftPointIncre, RecordFreePointDownFeeBackLog, RecordIncrePointFlowLog, \
    RecordMonthlyExcellentDownFeeBackLog, RecordSellIncomeLog, RecordUserGivePoint, \
    RecordSoftPointIncreInfoLogAndUpdateDownNum, UpdateDownInfoStatus, UpdateSoftDownloadHit, UpdateSoftPoint, \
    UpdateUserDown, GetFeedbackShieledUserGroupInfo, GetIncrePointRuleInfo, GetIncrePointShieledGroupInfo, \
    AddSettlementLog, AsserIncreasedForNormalFeeBack, AssetIncreasedMonthlyExcellentDown, FeeBackLogForMonthly, \
    FeeBackLogForNormal, HighWXTConsumeLog, HighWxtDownLoadStatisticsLog
from download.common.insertSql import getRebate, getPoint, getStatus
import time
from Logs.log import get_log

log = get_log("rollback")


# 获取执行结果
def getResult(softid, nowtime, funcPoint, softauthor, AddTime):
    """
    :param softid: 资料softid
    :param nowtime: 获取结果执行时间
    :param funcPoint: 功能,返利、升点
    :param softauthor: 资料作者
    :param AddTime: 正常执行时间
    :return:
    """
    times = 0
    while True:
        if getStatus(softid, AddTime) == 1:
            if funcPoint == '返利':
                print("获取时间:", nowtime)
예제 #11
0
import time
import uuid

from Logs.log import get_log
from download.common.sqlOprate import MySqlServer

log = get_log("wxtChannel")
'''
不发放奖励 用户ID:26628667,26431488,4684283

---不涨点:
1.不升点用户ID: 4684283,13794598,10006491,资料classId=668, 1419, 850, 538, 4963, 1251, 5037, 4974, 1155
2. 资料栏目为理综,文综(classId=5247, 5248 ),且上传用户为“蒋琳zok,mayanquan,zy1868,731486168,sunxinwei821,李辰辰”,不涨点
'''


# 插入快照数据
def insertWxt(SoftPoint, SoftMoney, isSupply, softCash, backMoneyRate,
              authorUserID, SoftID, DownloadUserID, AddTime, route,
              backCashRate):
    """
    function:向快照表插入数据
    :param backCashRate: 现金返现比例
    :param AddTime:资料上传时间
    :param softCash:现金
    :param backMoneyRate:储值返现比例
    :param isSupply:高级点
    :param SoftMoney:储值
    :param route: 通道类型ID
    :param SoftPoint: 下载资料点数
    :param authorUserID:资料作者