#!/bin/bash
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE-$0}")";pwd)
exec 1>>$CUR_DIR"/log/spIdToSpUid.log"
exec 2>>$CUR_DIR"/log/spIdToSpUid.log.wf"
. ~/.bashrc
fileName=$1
dateStr=`date +'%Y%m%d'`
current=`date "+%Y-%m-%d %H:%M:%S"`
timeStamp=`date -d "$current" +%s`
#将current转换为时间戳,精确到毫秒
#currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000))
dataFile=$CUR_DIR/"/var/data-"${fileName}""
while read line
do
spId=`echo -e $line |awk '{print $1}' `
if [ "$spId" = "" ]
then
continue
fi
sql="select F_sp_user_id from db_vip_bfb.t_sp_user_info where F_sp_id='${spId}'"
dataInfo=`echo -e ${sql} |cifdb -t -A`
echo $dataInfo
spUid=`echo -e $dataInfo |awk -F '|' '{print $4}' `
if [ "$spUid" = "" ]
then
spUid=0
fi
`echo -e "${spUid}" >> $dataFile`
done < "./var/${fileName}"
# alias cifdb='mysql -h -P -u -p --default-character-set=latin1'
#!/bin/bash
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE-$0}")";pwd)
exec 1>>$CUR_DIR"/log/goodsname.log"
exec 2>>$CUR_DIR"/log/goodsname.log.wf"
. ~/.bashrc
readfile=$1
currentdate=`date +'%Y%m%d'`
outfile=$CUR_DIR/var/${currentdate}"_goodsname.csv"
while read line
do
uid=`echo -e $line |awk '{print $1}' `
if [ "$uid" = "" ]
then
continue
fi
db_no=${uid:0-3:2}
tb_no=${uid:0-1}
sql="select F_goods_name from bfb_db_${db_no}.t_trans_query_${db_no}_${tb_no} where F_seller_user_id='${uid}' and F_seller_sub_account_type=1 and F_create_time>='2019-06-01' and F_create_time<='2019-06-30' group by F_goods_name"
echo $sql
info=`async -e "${sql}"`
goodsname=${info:13}
`echo -e "${goodsname}" >> $outfile`
done < "./var/${readfile}"