mongo-js-20141126

WBOY
Lepaskan: 2016-06-07 16:12:14
asal
1099 orang telah melayarinya

#!/bin/sh# 创建一个0字节文档,如果存在,则清空。:subsidiaryCode.txttlist=`cat ./AccountGuid.txt`;for i in $tlistdoTEMP_LIST=$i;# 打印出$TEMP_LIST取到的值# printf AccountGuid:$TEMP_LIST\n;mysql -h 172.24.0.220 -uquery -pquery che001 -NB EOF

#!/bin/sh
# 创建一个0字节文档,如果存在,则清空。
:>subsidiaryCode.txt
tlist=`cat ./AccountGuid.txt`;
for i in $tlist
do
TEMP_LIST=$i;
# 打印出$TEMP_LIST取到的值
# printf "AccountGuid:$TEMP_LIST\n";


mysql -h 172.24.0.220 -uquery -pquery che001 -NB << EOF > Referal_user_Id.txt
select ReferalGuid,UserGuid from KyPayAccounts where AccountGuid=&#39;$TEMP_LIST&#39;;
EOF


#获取Referal_user_Id
Referal_user_Id=`cat ./Referal_user_Id.txt`;
#判断Referal_user_Id是否为空
if [ "$Referal_user_Id"x = x ]
then
echo "Error: failed to get AccountGuid $TEMP_LIST date , Referal_user_Id in not exist !";
#exit -1
fi
ReferalId=`echo "$Referal_user_Id"|awk &#39;{print $1}&#39;`;
userId=`echo "$Referal_user_Id"|awk &#39;{print $2}&#39;`;


mongo --quiet localhost:27020/che001 -uquery -pquery << EOF >>subsidiaryCode.txt
//mongo --quiet localhost:27020/che001 -uquery -pquery << EOF
var subsidiaryCode="";
var employee=db.employee.find({"userId" :&#39;$ReferalId&#39;},{"store" :1,"logicalDel" : 1})
while(employee.hasNext()){
var employee2=employee.next();
//print("sroteId:"+employee2.store);
if( typeof(employee2.store) != "undefined")
{
var t_store=employee2.store;
var logicalDel=employee2.logicalDel;
}else{
//print(&#39;$TEMP_LIST&#39;+","+&#39;$ReferalId&#39;+",employee.store in not exist !");
break ;
}
var store=db.store.find({"id" :t_store},{"subsidiaryInfo.subsidiaryCode" :1})
while(store.hasNext()){
var store2=store.next();
//print("subsidiaryCode:"+store2.subsidiaryInfo.subsidiaryCode);
var subsidiaryCode=store2.subsidiaryInfo.subsidiaryCode;
}
var contract=db.contract.find({"userId" :&#39;$userId&#39;})
while(contract.hasNext()){
var contract2=contract.next();
//print(contract2.data.doc_cnt_number);
var doc_cnt_number=contract2.data.doc_cnt_number
}
var user=db.user.find({"id" :&#39;$userId&#39;})
while(user.hasNext()){
var user2=user.next();
//print(user2.username);
var username=user2.username
}
var serviceAccount=db.serviceAccount.find({"userId" :&#39;$userId&#39;})
while(serviceAccount.hasNext()){
var serviceAccount2=serviceAccount.next();
//print(serviceAccount2.fullName);
var fullName=serviceAccount2.fullName
}
print(""+&#39;$TEMP_LIST&#39;+","+subsidiaryCode+",logicalDel:"+logicalDel+","+doc_cnt_number+","+username+","+fullName);
}


EOF
done
Salin selepas log masuk

 

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan