#!/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后的
yesterday = str( int( time.mktime((datetime.datetime.now() - datetime.timedelta(days=overday)).timetuple()))) overd = str( int( time.mktime((datetime.datetime.now() - datetime.timedelta(days=m)).timetuple()))) if inver()[0:4] == "test": conn = connection1() else: conn = connection() cur = conn.cursor() cur.execute( "update tb_user_loan_order_repayment set late_fee=0 where user_id=" + searchuid() + " order by id desc limit 1") cur.execute("update tb_user_loan_order_repayment set plan_fee_time=" + yesterday + " where user_id=" + searchuid() + " order by id desc limit 1") cur.close() conn.commit() conn.close() for x in range(n): overday2 = x twoday = str( int( time.mktime((datetime.datetime.now() - datetime.timedelta(days=overday2)).timetuple()))) key_file = 'F:\\key\\jsqb_key' key = paramiko.RSAKey.from_private_key_file(key_file, password='******') if inver()[0:4] == "test":
int( time.mktime((datetime.datetime.now() - datetime.timedelta(days=overday)).timetuple()))) overd = str( int( time.mktime((datetime.datetime.now() - datetime.timedelta(days=m)).timetuple()))) if inver()[0:4] == "test": conn = connection1() else: conn = connection() cur = conn.cursor() cur.execute( "update tb_user_loan_order_repayment set late_fee=0 where user_id=" + searchuid() + " order by id desc limit 1") cur.execute("update tb_user_loan_order_repayment set plan_fee_time=" + overd + " where user_id=" + searchuid() + " order by id desc limit 1") cur.close() conn.commit() conn.close() overdue(inver()) for x in range(n): overday2 = x twoday = str( int( time.mktime((datetime.datetime.now() - datetime.timedelta(days=overday2)).timetuple()))) key_file = 'F:\\key\\jsqb_key' key = paramiko.RSAKey.from_private_key_file(key_file, password='******') if inver()[0:4] == "test":
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()