#!/usr/bin/env python # -*- coding:utf-8 -*- import sys import MySQLdb import json import chardet from jsqbmysql import dev,test from cuserid import searchuid,inver #dev-239-zmop-feed-0teehx.dev.kdqugou.com/frontend/web/notify/test-callback?type=1&order_id=2017072116203_55971c933a2d16&code=1003 uid=searchuid() reload(sys) sys.setdefaultencoding('utf-8') if inver()[0:4]=="test": list=test("select order_uuid,user_id,operator_money from tb_user_credit_money_log where user_id="+uid+" order by id desc limit 1") hj=inver()+".test" list2=test("select name from tb_loan_person where id="+uid) else: list=dev("select order_uuid,user_id,operator_money from tb_user_credit_money_log where user_id="+uid+" order by id desc limit 1") hj=inver()+".dev" list2=dev("select name from tb_loan_person where id="+uid) y=[] for x in list: y.append(x) orderuuid=y[0][0] user_id=y[0][1] money=y[0][2] realname=(str(list2[0][0])).decode("utf-8") #打款回调 import urllib2,time #response=urllib2.urlopen("http://"+hj+".kdqugou.com/frontend/web/notify/test-callback?type=2&code=2&order_id="+orderuuid+"&money=30000")#部分还款改money后的
ssh_pkey=key, remote_bind_address=('mysql_dev', 3306)) server.start() conn = MySQLdb.connect( host='127.0.0.1', #此处必须是是127.0.0.1 port=server.local_bind_port, user='******', passwd='jsqb@ArEe4LJq', db='jsqb') cur = conn.cursor() if inver()[0:4] == "test": list = test( "select id from tb_user_loan_order_repayment where user_id=" + searchuid() + " order by id desc limit 1") #print "select id from tb_user_loan_order_repayment where user_id="+searchuid()+" order by id desc limit 1" else: list = dev( "select id from tb_user_loan_order_repayment where user_id=" + searchuid() + " order by id desc limit 1") b = list[0][0] exc = "update tb_user_loan_order_repayment set plan_repayment_time=%s, interest_time=%s where id=%s" % ( twoday, 0, b) #print exc cur.execute(exc) cur.close()
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary uid = searchuid() #后台机审,初审,复审 def stu(n): if n == "0": verify(inver()) else: pass #执行对应环境的脚本 if inver()[0:4] == "test": status = str( test("select status from tb_user_loan_order where user_id=" + uid + " order by id desc limit 1")[0][0]) stu(status) loan(inver()) #借款脚本 list = test( "select order_id,user_id,money from tb_financial_loan_record where user_id=" + uid + " order by id desc limit 1") list2 = test("select name from tb_loan_person where id=" + uid) hj = inver() + ".test" else: status = str( dev("select status from tb_user_loan_order where user_id=" + uid + " order by id desc limit 1")[0][0]) stu(status) loan(inver()) #借款脚本 list = dev( "select order_id,user_id,money from tb_financial_loan_record where user_id="
import json import chardet from jsqbmysql import dev import time from selenium import webdriver from jsqbmysql import dev, test from cuserid import searchuid, inver from selenium.webdriver.support.select import Select reload(sys) sys.setdefaultencoding('utf-8') environment = inver() driver = webdriver.Firefox() if environment[0:4] == 'test': env = environment + ".test" orderid = test("select id from tb_user_loan_order where user_id=" + searchuid() + " order by id desc limit 1")[0][0] elif environment == "stage": env = environment else: env = environment + ".dev" orderid = str( dev("select id from tb_user_loan_order where user_id=" + searchuid() + " order by id desc limit 1")[0][0]) url = "http://" + env + ".kdqugou.com/backend/web/index.php" driver.get(url) try: print driver.find_element_by_id("LoginForm_username") except: print 2
def verify(environment): driver = webdriver.Firefox() if environment[0:4] == 'test': env = environment + ".test" orderid = test("select id from tb_user_loan_order where user_id=" + searchuid() + " order by id desc limit 1")[0][0] elif environment == "stage": env = environment else: env = environment + ".dev" orderid = str( dev("select id from tb_user_loan_order where user_id=" + searchuid() + " order by id desc limit 1")[0][0]) url = "http://" + env + ".kdqugou.com/backend/web/index.php" driver.get(url) driver.find_element_by_id("LoginForm_username").send_keys("admin") driver.find_element_by_name("LoginForm[password]").send_keys("123456") driver.find_element_by_name("submit_btn").click() driver.implicitly_wait(3) driver.find_element_by_id("header_loan").click() driver.find_element_by_partial_link_text(u"待机审订单列表").click() time.sleep(1) #跳过机审 driver.switch_to.frame("main") #driver.switch_to.default_content()#切回主文档 m = driver.find_elements_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr/td[1]') list = [] for x in m: list.append(x.text) print list n = list.index(str(orderid)) driver.find_element_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr[%d]/th[10]/a[2]' % (n + 2)).click() time.sleep(1) t = driver.switch_to_alert() t.accept() driver.switch_to.default_content() #人工初审 driver.find_element_by_partial_link_text(u"人工初审").click() time.sleep(1) driver.switch_to.frame("main") m = driver.find_elements_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr/td[1]') list = [] for x in m: list.append(x.text) n = list.index(str(orderid)) driver.find_element_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr[%d]/th[12]/a[2]' % (n + 2)).click() #//*[@id="cpcontainer"]/table/tbody/tr[4]/th[12]/a[2] js = "var q=document.documentElement.scrollTop=10000" driver.execute_script(js) time.sleep(1) driver.find_element_by_id("submit_btn").click() driver.switch_to.default_content() time.sleep(1) #人工复审 driver.find_element_by_partial_link_text(u"人工复审").click() time.sleep(1) driver.switch_to.frame("main") m = driver.find_elements_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr/td[1]') list = [] for x in m: list.append(x.text) n = list.index(str(orderid)) driver.find_element_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr[%d]/th[12]/a[2]' % (n + 2)).click() time.sleep(1) js = "var q=document.documentElement.scrollTop=10000" driver.execute_script(js) time.sleep(1) driver.find_element_by_name("submit_btn").click() driver.switch_to.default_content() time.sleep(1) driver.quit()
def first_refusal(environment, status): driver = webdriver.Firefox() if environment[0:4] == 'test': env = environment + ".test" orderid = test("select id from tb_user_loan_order where user_id=" + searchuid() + " order by id desc limit 1")[0][0] elif environment == "stage": env = environment else: env = environment + ".dev" orderid = str( dev("select id from tb_user_loan_order where user_id=" + searchuid() + " order by id desc limit 1")[0][0]) url = "http://" + env + ".kdqugou.com/backend/web/index.php" driver.get(url) driver.find_element_by_id("LoginForm_username").send_keys("admin") driver.find_element_by_name("LoginForm[password]").send_keys("123456") driver.find_element_by_name("submit_btn").click() time.sleep(1) driver.find_element_by_id("header_loan").click() #跳过机审 driver.find_element_by_partial_link_text(u"待机审订单列表").click() time.sleep(1) driver.switch_to.frame("main") #driver.switch_to.default_content()#切回主文档 m = driver.find_elements_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr/td[1]') list = [] for x in m: list.append(x.text) n = list.index(orderid) driver.find_element_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr[%d]/th[10]/a[2]' % (n + 2)).click() time.sleep(1) t = driver.switch_to_alert() t.accept() driver.switch_to.default_content() #人工初审 driver.find_element_by_partial_link_text(u"人工初审").click() time.sleep(1) driver.switch_to.frame("main") m = driver.find_elements_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr/td[1]') list = [] for x in m: list.append(x.text) n = list.index(orderid) driver.find_element_by_xpath( '//*[@id="cpcontainer"]/table/tbody/tr[%d]/th[11]/a[2]' % (n + 2)).click() js = "var q=document.documentElement.scrollTop=20000" driver.execute_script(js) time.sleep(1) driver.find_elements_by_name("operation")[1].click() time.sleep(2) sel = driver.find_element_by_name("loan_action") if status == -1: Select(sel).select_by_value('-1') elif status == 1: pass elif status == 2: Select(sel).select_by_value('2') driver.find_element_by_id("review-remark").send_keys(status) driver.find_element_by_id("submit_btn").click() driver.qiut()