#!/bin/bash
ip=$1
card_no=$2
port=$3

len=`echo $card_no|awk '{print length($0)}'`
if [ $len -ne 11 ];then
	echo "请输入11位手机号!"
	exit -1
fi

mysql -h"$ip" -P"$port" -u"qa" -p"qatest" <<EOF
delete from payment_center.bank_card where card_no=$card_no;
delete from payment_center.bank_card_detail where card_no=$card_no;
delete from payment_center.card_bind_info where card_no=$card_no;
delete from payment_center.bank_card where user_id=(select id from payment_center.user where phone_no =$card_no);
delete from payment_center.bind_card_order where user_id=(select id from payment_center.user where phone_no =$card_no);
delete from payment_center.card_bind_info where user_id=(select id from payment_center.user where phone_no =$card_no);

EOF
echo "done!!!"
