Commit 6ed8fb08 authored by 桂秋月's avatar 桂秋月

1

parent 6960865b
This diff is collapsed.
...@@ -53,7 +53,7 @@ def payRecall(skuno,num=100): ...@@ -53,7 +53,7 @@ def payRecall(skuno,num=100):
chaji=subtraction(subtraction(final_skus,temp.get('70011')),temp.get('70012')) chaji=subtraction(subtraction(final_skus,temp.get('70011')),temp.get('70012'))
temp['70013']=chaji temp['70013']=chaji
print("加购图关联表召回stop") print("加购图关联表召回stop")
return temp #return temp
print("ALS相关表召回start",'**'*50) print("ALS相关表召回start",'**'*50)
als_correlation_change_redis=als_correlation_redis.format(sku_no=skuno).strip() als_correlation_change_redis=als_correlation_redis.format(sku_no=skuno).strip()
......
...@@ -39,6 +39,24 @@ def minPriceFill(skus,num=100): ...@@ -39,6 +39,24 @@ def minPriceFill(skus,num=100):
return temp[:num] return temp[:num]
def execCondition(df,condition,needcolums,orderby=None):
'''
:param df: dataframe格式
:param condition: 字符串,筛选条件
:param needcolums: 字符串,需要从df拿到的字段
:param orderby: 默认dict格式,如果为空,则不排序。
{'ordercolums':XX,'type':XX}.ordercolums表示按照某个字段排序,type表示正排还是倒排
:return: 条件筛选后并返回数据
'''
if orderby:
col=orderby.get('ordercolums')
isasc=orderby.get('type') or 1
return df[eval(condition)].sort_values(by=[col],ascending=isasc)[needcolums].to_list()
else:
return df[eval(condition)][needcolums].to_list()
def skuinfo(sku): def skuinfo(sku):
change_sql=concatSql(skuinfo_sql,**{"sku_no":sku}) change_sql=concatSql(skuinfo_sql,**{"sku_no":sku})
sku_df=execmysl(119,change_sql) sku_df=execmysl(119,change_sql)
......
...@@ -3,6 +3,12 @@ dapan_sql=''' ...@@ -3,6 +3,12 @@ dapan_sql='''
select id,sku_no,price,cid1,cid2,cid3,brand_name,brand_id from select id,sku_no,price,cid1,cid2,cid3,brand_name,brand_id from
offline_recommend.recommend_same_product offline_recommend.recommend_same_product
''' '''
##根据cid3获取cid2,cid1等数据
cid1_3_sql="""
select distinct c_id1,c_id2,c_id3 from kdsp.t_sku_info
"""
##商品表 ##商品表
skuinfo_sql=''' skuinfo_sql='''
select id,sku_no,sku_name,price,cid1,cid2,cid3,brand_name,brand_id,source_type from select id,sku_no,sku_name,price,cid1,cid2,cid3,brand_name,brand_id,source_type from
......
...@@ -21,9 +21,12 @@ def getseed(top10_sku): ...@@ -21,9 +21,12 @@ def getseed(top10_sku):
print(sql) print(sql)
df=execmysl(119,sql) df=execmysl(119,sql)
df['cid3']=df['cid3'].astype('string') df['cid3']=df['cid3'].astype('string')
df['brand_id']=df['brand_id'].astype('string')
cid3=df.groupby(by=['cid3']).groups.__repr__()#['cid3']#.max() cid3=df.groupby(by=['cid3']).groups.__repr__()#['cid3']#.max()
brandname=df.groupby(by=['brand_name']).groups.__repr__() brandname=df.groupby(by=['brand_name']).groups.__repr__()
brandid=df.groupby(by=['brand_id']).groups.__repr__() brandid=df.groupby(by=['brand_id']).groups.__repr__()
# print('--',brandid,type(brandid))
# print('--',brandname,type(brandid))
result['cid3']=maxdict(**json.loads(cid3.replace("'",'"'))) result['cid3']=maxdict(**json.loads(cid3.replace("'",'"')))
result['brand_name']=maxdict(**json.loads(brandname.replace("'",'"'))) result['brand_name']=maxdict(**json.loads(brandname.replace("'",'"')))
result['brand_id']=maxdict(**json.loads(brandid.replace("'",'"'))) result['brand_id']=maxdict(**json.loads(brandid.replace("'",'"')))
......
...@@ -14,7 +14,7 @@ def modifyPasseord(name,namespace): ...@@ -14,7 +14,7 @@ def modifyPasseord(name,namespace):
salt_df=pd.read_sql(get_salt,con=conn_db_11) salt_df=pd.read_sql(get_salt,con=conn_db_11)
temp=salt_df.to_dict(orient='records') temp=salt_df.to_dict(orient='records')
if not temp: if not temp:
print('[name] is not exist'.format(name=name)) print('[{name}] is not exist'.format(name=name))
return 0 return 0
salt=temp[0]['salt'].encode() salt=temp[0]['salt'].encode()
#salt=b'UwKESe3cvf703Z30' #t_sys_user.salt #salt=b'UwKESe3cvf703Z30' #t_sys_user.salt
...@@ -28,4 +28,4 @@ def modifyPasseord(name,namespace): ...@@ -28,4 +28,4 @@ def modifyPasseord(name,namespace):
print("this is update") print("this is update")
if __name__ == '__main__': if __name__ == '__main__':
modifyPasseord('haiyuan.wen','qa') modifyPasseord('dong.chao','qa')
\ No newline at end of file \ No newline at end of file
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