Commit f647573c authored by 桂秋月's avatar 桂秋月

new file

parent c88aef15
/search/tempFile/* /search/tempFile/*
/feature/tempFile/*
/recommend/tempFile/*
/tools/changeLXQpassword.py /tools/changeLXQpassword.py
\ No newline at end of file
...@@ -44,17 +44,34 @@ dapan_redis_config={ ...@@ -44,17 +44,34 @@ dapan_redis_config={
'REDIS_PASSWD': '1234', 'REDIS_PASSWD': '1234',
} }
from rediscluster import RedisCluster from rediscluster import RedisCluster
import redis
def redis_conn(key): def get_simple_redis_instance(namespace):
#reids_universal="reids://{name}:{pwd}@{host}:{port}"
from databaseConn.mysqlOperation import mysqlInfo
redis_info=mysqlInfo(namespace,dbtype='redis')
#print(redis_info)
pool = redis.ConnectionPool(host=redis_info.get('host'), port=redis_info.get('port'),decode_responses=True)
redis_instance = redis.Redis(connection_pool=pool)
return redis_instance
def redis_conn(key=None,namespace=None):
'''
如果不是从集群的redis配置拿到host等信息,则使用非集群reids创建实例
:param key:
:param namespace:
:return:
'''
REDIS_CONFIG_temp=REDIS_CONFIG.get(key) REDIS_CONFIG_temp=REDIS_CONFIG.get(key)
if not REDIS_CONFIG_temp:
return get_simple_redis_instance(key)
return RedisCluster(startup_nodes=REDIS_CONFIG_temp.get('REDIS_NODES'), return RedisCluster(startup_nodes=REDIS_CONFIG_temp.get('REDIS_NODES'),
max_connections=REDIS_CONFIG_temp.get('REDIS_MAX_CONNECTIONS'), max_connections=REDIS_CONFIG_temp.get('REDIS_MAX_CONNECTIONS'),
password=REDIS_CONFIG_temp.get('REDIS_PASSWD'), decode_responses=True) password=REDIS_CONFIG_temp.get('REDIS_PASSWD'), decode_responses=True)
def getRedisValue(redis_key,key,conntype=None,oper='select'): def getRedisValue(redis_key=None,key=None,conntype=None,oper='select'):
''' '''
:param key: :param key:
:param conntype: 区分不同的redis连接 :param conntype: 区分不同的redis连接,暂时没用
:param oper:如果是delete,则做删除操作。目前只支持delete,select :param oper:如果是delete,则做删除操作。目前只支持delete,select
:return:select->获取所有匹配到key的值 :return:select->获取所有匹配到key的值
''' '''
...@@ -105,10 +122,15 @@ if __name__ == '__main__': ...@@ -105,10 +122,15 @@ if __name__ == '__main__':
redis_key="product_similarity:2304543819777" redis_key="product_similarity:2304543819777"
redis_key="product_correlation:253755595169288" redis_key="product_correlation:253755595169288"
sku_list="163979637300224,163979645691904,163979628911616" sku_list="163979637300224,163979645691904,163979628911616"
redis_db=redis_conn('89') #redis_db=redis_conn('89')
#redis_db.lpush(redis_key,*sku_list.split(',')) #redis_db.lpush(redis_key,*sku_list.split(','))
redis_key="appstart:1d0cdee1-85af-4e5b-856e-4a2e453befb6-2"
print(getRedisValue('89',redis_key,oper='delete1')) redis_key="price-tracker:stock:9"
redis_key="nearline_recommend:real-time:user_feature:*"
#redis_key="nearline_recommend:offline:feed_sort_sku_cid3_feature3"
#print(getRedisValue('yxm',redis_key,oper='delete1'))
#print(getRedisValue(redis_key='89',key=redis_key))
print(getRedisValue('89',key=redis_key))
......
...@@ -3,6 +3,7 @@ from tools import * ...@@ -3,6 +3,7 @@ from tools import *
from tools.publicFun import * from tools.publicFun import *
from tools.httprequest import * from tools.httprequest import *
from tools.listOperation import * from tools.listOperation import *
from tools.mulThread import *
from feature.custom_enum import custom_enum_info from feature.custom_enum import custom_enum_info
from databaseConn.mysqlOperation import * from databaseConn.mysqlOperation import *
#from databaseConn.redisOperation import * #from databaseConn.redisOperation import *
......
...@@ -133,6 +133,51 @@ def main(codes): ...@@ -133,6 +133,51 @@ def main(codes):
except: except:
traceback.print_exc(3) traceback.print_exc(3)
def data_to_write(uuids,kwargs):
result=[]
for uuid in uuids:
print("执行的uuid,",uuid)
#print("data_to_write:",kwargs)
result1=devResult(uuid,codes=kwargs.get('codes'),codetype=kwargs.get('codetype'))
result.append(result1)
#print("result--",result)
return result
def exec_to_write(uuids,kwargs):
result=[]
for uuid in uuids:
print("执行的uuid,",uuid)
result2=simple_exec(uuid,codes)
result.append(result2)
return result
def main_final(codes,threadnum=3):
codetype='pre'
final_result=[]
my_threads=[]
filename=os.path.join(feature_report,'uuids.xlsx')
uuids_df=readFile(filename)
uuids=uuids_df['uuid'].to_list()[:10]
#divnum=int(len(uuids)/threadnum)
divlists=split_by_num(uuids,threadnum)
print(divlists)
#print("divlists:",divlists)
temp={
"codes":codes,
"codetype":'pre'
}
for i in range(threadnum):
mythreads=MyThread(exec_to_write,divlists[i],**temp)
my_threads.append(mythreads)
mythreads.start()
for i in my_threads:
i.join()
for i in my_threads:
final_result+=i.get_result()
return final_result
def compare(codes): def compare(codes):
dev_df=readFile("dev.xlsx") dev_df=readFile("dev.xlsx")
...@@ -147,14 +192,10 @@ def compare(codes): ...@@ -147,14 +192,10 @@ def compare(codes):
if __name__ == '__main__': if __name__ == '__main__':
codes=['vcc_fixed_amount','vcc_temporary_amount','vcc_sum_amount','vcc_used_amount','cash_used_amount','vcc_credit_usage'] codes=['vcc_fixed_amount','vcc_temporary_amount','vcc_sum_amount','vcc_used_amount','cash_used_amount','vcc_credit_usage']
#compare(codes) #compare(codes)
codes=['vcc_used_amount'] codes=['vcc_used_amount','vcc_temporary_amount']
t=simple_exec('9d287da7-c5e8-4319-bd8f-b81abb8b294d',codes) #t=simple_exec('9d287da7-c5e8-4319-bd8f-b81abb8b294d',codes)
print(t) #print(t)
#print(main(codes)) print('over==',main_final(codes))
\ No newline at end of file \ No newline at end of file
...@@ -9,6 +9,7 @@ def devResult(uuid,codes,codetype='pre'): ...@@ -9,6 +9,7 @@ def devResult(uuid,codes,codetype='pre'):
'rc_auth_secret': '9d9}bc24!e1z1x3`(x~4r29d$+45n3)\'zb696b$85e>_]p2&4f{,a3~8b3e_ldt^' 'rc_auth_secret': '9d9}bc24!e1z1x3`(x~4r29d$+45n3)\'zb696b$85e>_]p2&4f{,a3~8b3e_ldt^'
} }
temp={'uuid':uuid} temp={'uuid':uuid}
#print("uuidssssss",uuid)
temp_codes=','.join(codes) temp_codes=','.join(codes)
body={ body={
"codes":temp_codes "codes":temp_codes
...@@ -21,12 +22,16 @@ def devResult(uuid,codes,codetype='pre'): ...@@ -21,12 +22,16 @@ def devResult(uuid,codes,codetype='pre'):
body['tradeNo']=0 body['tradeNo']=0
body['userUuid']=uuid body['userUuid']=uuid
t=requests.post(url,data=body,headers=headers) t=requests.post(url,data=body,headers=headers)
#print('开发结果===',t.text,uuid) #print('开发结果===',t.text)
#print(curlify.to_curl(t.request)) #print(curlify.to_curl(t.request))
try:
for code in codes: for code in codes:
#print(code) #print(code)
temp[code+'_dev']=jsonpath.jsonpath(t.json(),'$..{}.value'.format(code))[0] temp[code+'_dev']=jsonpath.jsonpath(t.json(),'$..{}.value'.format(code))[0]
return temp return temp
except:
traceback.print_exc(3)
pass
def getuuids(): def getuuids():
......
from recommend import *
\ No newline at end of file
...@@ -153,3 +153,11 @@ select item_ids from offline_recommend.kdsp_personalize_recall_etrec ...@@ -153,3 +153,11 @@ select item_ids from offline_recommend.kdsp_personalize_recall_etrec
kdsp_personalize_recall_swing_sql=""" kdsp_personalize_recall_swing_sql="""
select item_ids from offline_recommend.kdsp_personalize_recall_swing select item_ids from offline_recommend.kdsp_personalize_recall_swing
""" """
########################################feed流重排策略#################################################################
online_feature_redis="""
nearline_recommend:real-time:user_feature:{uid_or_gid}
"""
offline_feature_redis="""
nearline_recommend:offline:feed_sort_sku_cid3_feature3
"""
\ No newline at end of file
...@@ -22,7 +22,7 @@ def readFile(filename,sheetname=0): ...@@ -22,7 +22,7 @@ def readFile(filename,sheetname=0):
''' '''
houzhui=filename.split('.')[-1] houzhui=filename.split('.')[-1]
if houzhui=='csv': if houzhui=='csv':
df=pd.read_csv(filename, index_col=0,sheetname=sheetname) df=pd.read_csv(filename, index_col=0)
else: else:
df=pd.read_excel(filename,sheet_name=sheetname) df=pd.read_excel(filename,sheet_name=sheetname)
return df return df
......
from tools import *
addr_level_4="""
select a.addr_id as id_1,a.addr_name as name_1 ,
b.addr_id as id_2 ,b.addr_name as name_2 ,
c.addr_id as id_3,c.addr_name as name_3,
d.addr_id as id_4 ,d.addr_name as name_4
from
(select * from kdsp.t_area_address where addr_level=1) a
join (select * from kdsp.t_area_address where addr_level=2) b on a.addr_id=b.parent_addr_id
join (select * from kdsp.t_area_address where addr_level=3) c on b.addr_id=c.parent_addr_id
left join (select * from kdsp.t_area_address where addr_level=4) d on c.addr_id=d.parent_addr_id
order by RAND() limit 500
"""
addr_level_3="""
select a.addr_id as id_1,a.addr_name as name_1 ,
b.addr_id as id_2 ,b.addr_name as name_2 ,
c.addr_id as id_3,c.addr_name as name_3
from
(select * from kdsp.t_area_address where addr_level=1) a
join (select * from kdsp.t_area_address where addr_level=2) b on a.addr_id=b.parent_addr_id
join (select * from kdsp.t_area_address where addr_level=3) c on b.addr_id=c.parent_addr_id
order by RAND() limit 100
"""
user_addr_sql="""
INSERT INTO `kdsp`.`t_user_receiver_addr` ( `user_id`, `uuid`, `province_id`, `province_name`, `city_id`, `city_name`, `county_id`, `county_name`, `town_id`, `town_name`, `detail`, `receiver_name`, `receiver_mobile`, `zip_code`, `addr_default`, `tenant_id`, `enable`, `created_at`, `updated_at`)
VALUES ( '{user_id}', '{uuid}', '{province_id}', '{province_name}', '{city_id}', '{city_name}', '{county_id}',
'{county_name}', '{town_id}', '{town_name}', '{detail}', '{receiver_name}',
'{receiver_mobile}', NULL, 1, 560761, 1, now(), now())
"""
user_uuid_sql="""
select id ,uuid,phone_no from xyqb_user.user order by rand() limit 500
"""
def gen_data():
from tools.publicFun import gen_title
user_uuid_df=execmysl('yxm',user_uuid_sql)
addr_df=execmysl('yxm',addr_level_4)
df=user_uuid_df.join(addr_df)
temp_sql=[]
df=df.astype(str)
for i in df.itertuples():
detail=gen_title('address').split('县')[-1].split('市')[-1].split('省')[-1]
detail= detail if len(detail)>10 else detail+'测试测试'
receiver_name=gen_title('name')
user_addr_tempsql=user_addr_sql.format(
user_id=i.__getattribute__('id'),
uuid=i.__getattribute__('uuid'),
province_id=i.__getattribute__('id_1'),
province_name=i.__getattribute__('name_1'),
city_id=i.__getattribute__('id_2'),
city_name=i.__getattribute__('name_2'),
county_id=i.__getattribute__('id_3'),
county_name=i.__getattribute__('name_3'),
town_id=i.__getattribute__('id_4'),
town_name=i.__getattribute__('name_4'),
detail=detail,
receiver_name=receiver_name,
receiver_mobile=i.__getattribute__('phone_no')
)
temp_sql.append(user_addr_tempsql)
print(';'.join(temp_sql))
try:
execmysl('yxm',';'.join(temp_sql))
except:
print("insert succ")
if __name__ == '__main__':
gen_data()
import copy import copy
import math
from databaseConn import * from databaseConn import *
def listCross(a,b): def listCross(a,b):
...@@ -93,6 +94,26 @@ def split_by_length(init_list, children_list_len): ...@@ -93,6 +94,26 @@ def split_by_length(init_list, children_list_len):
end_list.append(init_list[-count:]) if count != 0 else end_list end_list.append(init_list[-count:]) if count != 0 else end_list
return end_list return end_list
def split_by_num(init_list, num):
'''
按照num拆分给定数组
:param init_list:
:param num:
:return:
'''
temp=[]
flag=0
split_by=math.ceil(len(init_list)/num)
#print(split_by)
for i in range(num):
temp.append(init_list[flag:flag+split_by])
flag+=split_by
#print(flag,i)
return [i for i in temp if i]
def countlist(a,num=0): def countlist(a,num=0):
from collections import Counter from collections import Counter
''' '''
...@@ -117,9 +138,9 @@ def bingji(a,b): ...@@ -117,9 +138,9 @@ def bingji(a,b):
if __name__ == '__main__': if __name__ == '__main__':
a=[2,2,4,3,5,6,7,8] a=[1,2,4,3,5,6,7,8,9,10]
b=[10,2,4,3,9] b=[10,2,4]
print(split_by_length(a,5)) print(split_by_num(b,3))
#print(int(11/2)) #print(int(11/2))
#a=[[1,2],[2,3]] #a=[[1,2],[2,3]]
......
...@@ -3,19 +3,30 @@ from tools.listOperation import * ...@@ -3,19 +3,30 @@ from tools.listOperation import *
class MyThread(threading.Thread): class MyThread(threading.Thread):
def __init__(self,func,divlist): def __init__(self,func,divlist,**kwargs):
super(MyThread,self).__init__() super(MyThread,self).__init__()
self.func=func self.func=func
self.divlist=divlist self.divlist=divlist
self.result=None
self.kv=kwargs
def run(self): def run(self):
#time.sleep(1) #time.sleep(1)
#print(threading.currentThread().name) #print(threading.currentThread().name)
self.func(self.divlist) #print('请求参数:',self.kv,self.divlist,self.func)
if self.kv:
t=self.func(self.divlist,self.kv)
else:
t=self.func(self.divlist)
#print('结果:',t)
self.result=t
#print('over') #print('over')
def func(divlist): def get_result(self):
for i in divlist: #print(self.name,'-->multhread:',self.result)
print(i) return self.result
def main(thnum): def main(thnum):
num=list(range(100)) num=list(range(100))
......
from tools import * from tools import *
import hashlib import hashlib
import faker
def gen_title(ftype):
'''
faker.name(),faker.email(),faker.phone_number(),faker.address(),faker.company()
:param ftype:
:return:
'''
t=faker.Faker(locale='zh_CN')
if ftype in('address','name'):
return eval('t.{}()'.format(ftype))
if ftype=='phone':
return t.phone_number()
return t.name()
def md5jiami(mess): def md5jiami(mess):
t=hashlib.md5(mess) t=hashlib.md5(mess)
......
import pandas as pd
import requests import requests
from tools import *
codes=['baihang_tile_info#homeInfoFirstTime', 'baihang_tile_info#homeInfoLastTime', 'baihang_tile_info#homeInfoNum', 'baihang_tile_info#homeInfoNumDrop', 'baihang_tile_info#workInfoFirstTime', 'baihang_tile_info#workInfoLastTime', 'baihang_tile_info#workInfoNum', 'baihang_tile_info#workInfoNumDrop', 'baihang_tile_info#firstQueryTime', 'baihang_tile_info#lastQueryTime', 'baihang_tile_info#queryNumHis', 'baihang_tile_info#queryNumHisApply', 'baihang_tile_info#queryCategoryHisApply', 'baihang_tile_info#queryHistoryReason1And90dNum', 'baihang_tile_info#queryHistoryReason1And365dNum', 'baihang_tile_info#queryHistory90dAnd365dRatio', 'baihang_tile_info#queryHistory30dNum', 'baihang_tile_info#diffQueryReason1Days', 'baihang_tile_info#diffFirstQueryDays', 'baihang_tile_info#newLoan90dNum', 'baihang_tile_info#newLoan360dNum', 'baihang_tile_info#newLoan90dAnd360dRatio', 'baihang_tile_info#revolvingLoanNoValidAccountRatio', 'baihang_tile_info#revolvingLoanNoValidAccountNum', 'baihang_tile_info#allSummaryLoanNums', 'baihang_tile_info#newLoanAmount180d', 'baihang_tile_info#newLoanAmount360d', 'baihang_tile_info#newLoanAmount180dAnd360dRatio', 'baihang_tile_info#newLoanTenant180dAnd360dRatio', 'third_data_source#baihang_homeInfo', 'third_data_source#baihang_nonRevolvingLoan_D180_applyTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D180_averageLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D180_loanAmount', 'third_data_source#baihang_nonRevolvingLoan_D180_loanCount', 'third_data_source#baihang_nonRevolvingLoan_D180_loanTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D180_maxLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D180_overdueLoanCount', 'third_data_source#baihang_nonRevolvingLoan_D30_applyTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D30_averageLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D30_loanAmount', 'third_data_source#baihang_nonRevolvingLoan_D30_loanCount', 'third_data_source#baihang_nonRevolvingLoan_D30_loanTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D30_maxLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D30_overdueLoanCount', 'third_data_source#baihang_nonRevolvingLoan_D360_applyTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D360_averageLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D360_loanAmount', 'third_data_source#baihang_nonRevolvingLoan_D360_loanCount', 'third_data_source#baihang_nonRevolvingLoan_D360_loanTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D360_maxLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D360_overdueLoanCount', 'third_data_source#baihang_nonRevolvingLoan_D90_applyTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D90_averageLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D90_loanAmount', 'third_data_source#baihang_nonRevolvingLoan_D90_loanCount', 'third_data_source#baihang_nonRevolvingLoan_D90_loanTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D90_maxLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D90_overdueLoanCount', 'third_data_source#baihang_nonRevolvingLoan_summary_loanCount', 'third_data_source#baihang_nonRevolvingLoan_summary_maxOverdueStatus', 'third_data_source#baihang_nonRevolvingLoan_summary_openLoanCount', 'third_data_source#baihang_nonRevolvingLoan_summary_overdueCount', 'third_data_source#baihang_nonRevolvingLoan_summary_remainingAmount', 'third_data_source#baihang_nonRevolvingLoan_summary_remainingMaxOverdueStatus', 'third_data_source#baihang_nonRevolvingLoan_summary_remainingOverdueAmount', 'third_data_source#baihang_nonRevolvingLoan_summary_remainingOverdueLoanCount', 'third_data_source#baihang_personalProfile_mobileCount', 'third_data_source#baihang_queryHistory', 'third_data_source#baihang_reportHeader_queryResult', 'third_data_source#baihang_revolvingLoan_D180_accountCount', 'third_data_source#baihang_revolvingLoan_D180_applyTenantCount', 'third_data_source#baihang_revolvingLoan_D180_creditLimitSum', 'third_data_source#baihang_revolvingLoan_D180_lendingAmount', 'third_data_source#baihang_revolvingLoan_D180_overdueAccountCount', 'third_data_source#baihang_revolvingLoan_D30_accountCount', 'third_data_source#baihang_revolvingLoan_D30_applyTenantCount', 'third_data_source#baihang_revolvingLoan_D30_creditLimitSum', 'third_data_source#baihang_revolvingLoan_D30_lendingAmount', 'third_data_source#baihang_revolvingLoan_D30_overdueAccountCount', 'third_data_source#baihang_revolvingLoan_D360_accountCount', 'third_data_source#baihang_revolvingLoan_D360_applyTenantCount', 'third_data_source#baihang_revolvingLoan_D360_creditLimitSum', 'third_data_source#baihang_revolvingLoan_D360_lendingAmount', 'third_data_source#baihang_revolvingLoan_D360_overdueAccountCount', 'third_data_source#baihang_revolvingLoan_D90_accountCount', 'third_data_source#baihang_revolvingLoan_D90_applyTenantCount', 'third_data_source#baihang_revolvingLoan_D90_creditLimitSum', 'third_data_source#baihang_revolvingLoan_D90_lendingAmount', 'third_data_source#baihang_revolvingLoan_D90_overdueAccountCount', 'third_data_source#baihang_revolvingLoan_summary_accountCount', 'third_data_source#baihang_revolvingLoan_summary_creditLimitSum', 'third_data_source#baihang_revolvingLoan_summary_maxCreditLimitPerTenant', 'third_data_source#baihang_revolvingLoan_summary_maxOverdueStatus', 'third_data_source#baihang_revolvingLoan_summary_overdueCount', 'third_data_source#baihang_revolvingLoan_summary_remainingAmount', 'third_data_source#baihang_revolvingLoan_summary_remainingMaxOverdueStatus', 'third_data_source#baihang_revolvingLoan_summary_remainingOverdueAccountCount', 'third_data_source#baihang_revolvingLoan_summary_remainingOverdueAmount', 'third_data_source#baihang_revolvingLoan_summary_validAccountCount', 'third_data_source#baihang_workInfo', 'third_data_source#baihang_revolvingLoan_D360_lendingAmount_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D360_accountCount_div_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D30_overdueAccountCount_add_nonRevo_div_90', 'third_data_source#baihang_revolvingLoan_D90_overdueAccountCount_add_nonRevo_div_360', 'third_data_source#baihang_revolvingLoan_D360_lendingAmount_sub_nonRevo', 'third_data_source#baihang_revolvingLoan_D90_accountCount_div_add_nonRevo', 'third_data_source#baihang_revolvingLoan_summary_overdueCount_div_summary_accountCount', 'third_data_source#baihang_nonRevolvingLoan_D30_overdueLoanCount_div_360', 'third_data_source#baihang_revolvingLoan_D90_accountCount_add_nonRevo_div_360', 'third_data_source#baihang_revolvingLoan_D90_accountCount_sub_nonRevo', 'third_data_source#baihang_revolvingLoan_D180_overdueAccountCount_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D180_accountCount_div_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D360_accountCount_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D30_lendingAmount_add_nonRevo_div_360', 'third_data_source#baihang_revolvingLoan_D30_lendingAmount_div_360'] codes=['baihang_tile_info#homeInfoFirstTime', 'baihang_tile_info#homeInfoLastTime', 'baihang_tile_info#homeInfoNum', 'baihang_tile_info#homeInfoNumDrop', 'baihang_tile_info#workInfoFirstTime', 'baihang_tile_info#workInfoLastTime', 'baihang_tile_info#workInfoNum', 'baihang_tile_info#workInfoNumDrop', 'baihang_tile_info#firstQueryTime', 'baihang_tile_info#lastQueryTime', 'baihang_tile_info#queryNumHis', 'baihang_tile_info#queryNumHisApply', 'baihang_tile_info#queryCategoryHisApply', 'baihang_tile_info#queryHistoryReason1And90dNum', 'baihang_tile_info#queryHistoryReason1And365dNum', 'baihang_tile_info#queryHistory90dAnd365dRatio', 'baihang_tile_info#queryHistory30dNum', 'baihang_tile_info#diffQueryReason1Days', 'baihang_tile_info#diffFirstQueryDays', 'baihang_tile_info#newLoan90dNum', 'baihang_tile_info#newLoan360dNum', 'baihang_tile_info#newLoan90dAnd360dRatio', 'baihang_tile_info#revolvingLoanNoValidAccountRatio', 'baihang_tile_info#revolvingLoanNoValidAccountNum', 'baihang_tile_info#allSummaryLoanNums', 'baihang_tile_info#newLoanAmount180d', 'baihang_tile_info#newLoanAmount360d', 'baihang_tile_info#newLoanAmount180dAnd360dRatio', 'baihang_tile_info#newLoanTenant180dAnd360dRatio', 'third_data_source#baihang_homeInfo', 'third_data_source#baihang_nonRevolvingLoan_D180_applyTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D180_averageLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D180_loanAmount', 'third_data_source#baihang_nonRevolvingLoan_D180_loanCount', 'third_data_source#baihang_nonRevolvingLoan_D180_loanTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D180_maxLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D180_overdueLoanCount', 'third_data_source#baihang_nonRevolvingLoan_D30_applyTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D30_averageLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D30_loanAmount', 'third_data_source#baihang_nonRevolvingLoan_D30_loanCount', 'third_data_source#baihang_nonRevolvingLoan_D30_loanTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D30_maxLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D30_overdueLoanCount', 'third_data_source#baihang_nonRevolvingLoan_D360_applyTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D360_averageLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D360_loanAmount', 'third_data_source#baihang_nonRevolvingLoan_D360_loanCount', 'third_data_source#baihang_nonRevolvingLoan_D360_loanTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D360_maxLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D360_overdueLoanCount', 'third_data_source#baihang_nonRevolvingLoan_D90_applyTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D90_averageLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D90_loanAmount', 'third_data_source#baihang_nonRevolvingLoan_D90_loanCount', 'third_data_source#baihang_nonRevolvingLoan_D90_loanTenantCount', 'third_data_source#baihang_nonRevolvingLoan_D90_maxLoanAmount', 'third_data_source#baihang_nonRevolvingLoan_D90_overdueLoanCount', 'third_data_source#baihang_nonRevolvingLoan_summary_loanCount', 'third_data_source#baihang_nonRevolvingLoan_summary_maxOverdueStatus', 'third_data_source#baihang_nonRevolvingLoan_summary_openLoanCount', 'third_data_source#baihang_nonRevolvingLoan_summary_overdueCount', 'third_data_source#baihang_nonRevolvingLoan_summary_remainingAmount', 'third_data_source#baihang_nonRevolvingLoan_summary_remainingMaxOverdueStatus', 'third_data_source#baihang_nonRevolvingLoan_summary_remainingOverdueAmount', 'third_data_source#baihang_nonRevolvingLoan_summary_remainingOverdueLoanCount', 'third_data_source#baihang_personalProfile_mobileCount', 'third_data_source#baihang_queryHistory', 'third_data_source#baihang_reportHeader_queryResult', 'third_data_source#baihang_revolvingLoan_D180_accountCount', 'third_data_source#baihang_revolvingLoan_D180_applyTenantCount', 'third_data_source#baihang_revolvingLoan_D180_creditLimitSum', 'third_data_source#baihang_revolvingLoan_D180_lendingAmount', 'third_data_source#baihang_revolvingLoan_D180_overdueAccountCount', 'third_data_source#baihang_revolvingLoan_D30_accountCount', 'third_data_source#baihang_revolvingLoan_D30_applyTenantCount', 'third_data_source#baihang_revolvingLoan_D30_creditLimitSum', 'third_data_source#baihang_revolvingLoan_D30_lendingAmount', 'third_data_source#baihang_revolvingLoan_D30_overdueAccountCount', 'third_data_source#baihang_revolvingLoan_D360_accountCount', 'third_data_source#baihang_revolvingLoan_D360_applyTenantCount', 'third_data_source#baihang_revolvingLoan_D360_creditLimitSum', 'third_data_source#baihang_revolvingLoan_D360_lendingAmount', 'third_data_source#baihang_revolvingLoan_D360_overdueAccountCount', 'third_data_source#baihang_revolvingLoan_D90_accountCount', 'third_data_source#baihang_revolvingLoan_D90_applyTenantCount', 'third_data_source#baihang_revolvingLoan_D90_creditLimitSum', 'third_data_source#baihang_revolvingLoan_D90_lendingAmount', 'third_data_source#baihang_revolvingLoan_D90_overdueAccountCount', 'third_data_source#baihang_revolvingLoan_summary_accountCount', 'third_data_source#baihang_revolvingLoan_summary_creditLimitSum', 'third_data_source#baihang_revolvingLoan_summary_maxCreditLimitPerTenant', 'third_data_source#baihang_revolvingLoan_summary_maxOverdueStatus', 'third_data_source#baihang_revolvingLoan_summary_overdueCount', 'third_data_source#baihang_revolvingLoan_summary_remainingAmount', 'third_data_source#baihang_revolvingLoan_summary_remainingMaxOverdueStatus', 'third_data_source#baihang_revolvingLoan_summary_remainingOverdueAccountCount', 'third_data_source#baihang_revolvingLoan_summary_remainingOverdueAmount', 'third_data_source#baihang_revolvingLoan_summary_validAccountCount', 'third_data_source#baihang_workInfo', 'third_data_source#baihang_revolvingLoan_D360_lendingAmount_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D360_accountCount_div_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D30_overdueAccountCount_add_nonRevo_div_90', 'third_data_source#baihang_revolvingLoan_D90_overdueAccountCount_add_nonRevo_div_360', 'third_data_source#baihang_revolvingLoan_D360_lendingAmount_sub_nonRevo', 'third_data_source#baihang_revolvingLoan_D90_accountCount_div_add_nonRevo', 'third_data_source#baihang_revolvingLoan_summary_overdueCount_div_summary_accountCount', 'third_data_source#baihang_nonRevolvingLoan_D30_overdueLoanCount_div_360', 'third_data_source#baihang_revolvingLoan_D90_accountCount_add_nonRevo_div_360', 'third_data_source#baihang_revolvingLoan_D90_accountCount_sub_nonRevo', 'third_data_source#baihang_revolvingLoan_D180_overdueAccountCount_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D180_accountCount_div_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D360_accountCount_add_nonRevo', 'third_data_source#baihang_revolvingLoan_D30_lendingAmount_add_nonRevo_div_360', 'third_data_source#baihang_revolvingLoan_D30_lendingAmount_div_360']
base_url="https://finance-feature-calc.tjzimu.com" base_url="https://finance-feature-calc.tjzimu.com"
url="/calc/features" url="/calc/features"
...@@ -17,15 +18,85 @@ body={ ...@@ -17,15 +18,85 @@ body={
"business_type":0 "business_type":0
} }
map_header={
"x-user-terminal": "MINI-APP",
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1 wechatdevtools/1.06.2206090 MicroMessenger/8.0.5 Language/zh_CN webview/",
"content-type": "application/json",
"Sec-Fetch-Site": "cross-site",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "https://servicewechat.com/wxdb83e21133f33067/devtools/page-frame.html"
}
def get_token(numlist):
temps=[]
for i in numlist:
url="https://xfg.mumcooking.com//weidaoyun/shop/member/getkey.jhtml?w=eAxzXoqV"
temp=requests.get(url,headers=map_header)
token=jsonpath.jsonpath(temp.json(),'$..token')
temps.append(token[0] if token else 0)
return temps
def get_code_data(tokenlist):
temps=[]
for i in tokenlist:
url="https://xfg.mumcooking.com/weidaoyun/shop/member/getMemberTimeCardList.jhtml?pageSize=5&pageNumber=1&w=eAxzXoqV&token=${token}".format(token=i)
temp=requests.get(url,headers=map_header)
code=jsonpath.jsonpath(temp.json(),'$..code')
url="https://xfg.mumcooking.com/weidaoyun/shop/writeoff/getUUID.jhtml?w=eAxzXoqV&token=${token}".format(token=i)
temp1=requests.get(url,headers=map_header)
data1=jsonpath.jsonpath(temp.json(),'$..data')
temp_code={}
if code :
temp_code["code"]=code[0]
if data1:
temp_code['data']=data1[0]
temps.append(temp_code)
return temps
def httpre(code): def httpre(code):
#code=','.join(codes[:]) #code=','.join(codes[:])
body['codes']=code body['codes']=code
#print(body) #print(body)
t=requests.post(base_url+url,headers=headers,data=body) t=requests.post(base_url+url,headers=headers,data=body)
return t.json() return t.json()
def main(threadnum=3):
from tools.mulThread import MyThread
from tools.listOperation import split_by_num
from tools.fileOperation import readFile,readRenameColums
listsss=[i for i in range(10)]
listsss_df=readFile("/Users/dm/Downloads/量化派/下载的文件/file_172a5f4d4baf858bf49e1ecb7c713238.csv")
listsss=listsss_df['token'].to_list()
divlists=split_by_num(listsss,threadnum,)
mylist=[]
final_result=[]
for i in range(threadnum):
t=MyThread(get_token,divlists[i])
mylist.append(t)
t.start()
for i in mylist:
i.join()
for i in mylist:
final_result+=i.get_result()
return final_result
if __name__ == '__main__': if __name__ == '__main__':
for i in codes: t=main(3)
print("跑的特征:",i) print(t)
print(httpre(i)) # from tools.fileOperation import readFile
# token_len=readFile('/Users/dm/Downloads/apache-jmeter-4.0/bin/phoneno.csv')
# tttemp=[]
#
# for i in range(10000):
# temp=get_token()
# tttemp.append(tttemp)
# print("i",i,temp)
# df=pd.DataFrame(tttemp)
# df.to_csv('/Users/dm/Downloads/apache-jmeter-4.0/bin/token.csv',index=0,encoding = 'utf-8')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment