文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>邮储统版根据户名查询账号的脚本

邮储统版根据户名查询账号的脚本

时间:2008-04-18  来源:sdccf

作者:styr  出处:Unix爱好者家园unix-cd.com 

#MENU #COPYRIGHT2002  BY YangRongBo,四川省邮政信息技术局运维部.
#ALL RIGHT RESERVED.
#本版本在省局的脚本上改进而成
#提升查询检索速度,增加按机构号检索输出,支持多机构号检索

#!/bin/ksh
echomain()
{
clear
printf '
  ┌───────────────────────────────────┐
  │          四  川  省  邮  政  储  蓄  帐  户  查  询  系  统          │
  └───────────────────────────────────┘

                                              四 川 省 邮 政 信 息 技 术 局

   ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※'
}

xuanze()  #选择查询活期、定期
{
while :
do
echomain
printf '
  ┌───────────────────────────────────┐
  │                                                                      │
  │           【请选择】                                                 │
  │                                                                      │
  │                   ①    活 期 帐 户 查 询                            │
  │                                                                      │
  │                   ②    定 期 帐 户 查 询                            │
  │                                                                      │
  │                                                  按 0 键退出系统     │
  │                                                                      │
  └───────────────────────────────────┘
  
'
  echo -n "                请选择查询界面   -----------> "
  read
case "$REPLY" in
1)  echoname="【活期查询】" ; databasename="活期数据库名" ; acc_cstm="活期字段名" ; chaxun ;;    #此处屏敝了库名及字段名
2)  echoname="【定期查询】" ; databasename="定期数据库名" ; acc_cstm="定期字段名" ; chaxun ;;    #此处屏敝了库名及字段名
0)  exit 0 ;;
*)  error ;;
esac
done
}

chaxun()
{
acc= ; openinst=
while :
do
clear
printf "
    ┌───────────────────────────────────┐
    │                                                                      │
    │          $echoname                                                │
    │                                                                      │
    │                                                                      │
    │                      用户帐户名称:                                   │
    │                                                                      │
    │                                                  按 0 键返回上层     │
    └───────────────────────────────────┘
                            
"
  [ "$acc" ] && echo "                            用户帐户名称:  $acc" \
|| read acc?"                            用户帐户名称:  "  
  [ $(echo "$acc" | wc -w) -eq 1 ] || { error ; acc= ; continue ; }
  [ "$acc" = "0" ] && return
echo "\n                  用户帐户的开户局机构号:  \c"
read openinst
[ "$openinst" = "0" ] && return
[ "$openinst" ] && { [ "$(echo "$openinst" | sed 's/[0-9 ]//g')" ] && \
{ tput bel ;
printf '
             ┌───────────────────────────┐
             │信息区: 输入错误 ! 请重新输入 !                       │
             │                                                      │
             │    注: 输入开户局号机构号可以显示指定开户局的账号信息│
      │        输入的机构号必须为整数; 指定多个开户机构号时请│
             │        以空格分隔;如不输入直接回车则默认为查询所有机 │
             │        构号下的账号信息; 输入 0 则返回上层           │  
             └───────────────────────────┘' ;
stty -echo ; read ; stty echo ; continue ; }  \
|| { openinst=$(echo "$openinst" | sed 's/^[^0-9][^0-9]*//g;s/  */|/g;s/  $//') ; break ; } ; } || break
done
echo "\n\n                              正在查询,请稍候 !"
##################查询用户帐号,开户机构#####################################
# # #               屏敝掉了数据库查询导出部份  # # #
[ -r mang.txt ] || { tput bel ;
printf '

       ┌───────────────────────────┐
       │ 信息区:   查询文件不存在或不可读 !  按任意键返回 !   │
       └───────────────────────────┘' ;
stty -echo ; read ; stty echo ; return ; }
jieguo="$(egrep "$openinst" mang.txt | sort -bnk2 | \
awk 'length($1)>=18 && $0!~/select/ {printf("%s%20s%12s%18s%s\n"," │",$1,"│",$2,"    │")}')"
[ "$jieguo" ] || { tput bel ;  
printf '

       ┌───────────────────────────┐
       │       信息区:   无此用户账号 !  按任意键返回 !       │
       └───────────────────────────┘' ;
stty -echo ; read ; stty echo ; return ; }
clear
sum=$(($(echo $jieguo | sed 's/│//g' |wc -w)/2))
echo "$jieguo" | sed '$!a\
├───────────────┼───────────┤
;$a\
└───────────────┴───────────┘
' | awk -v acc="$acc" -v sum=$sum 'BEGIN{print "\n   户 名:  "acc"\t\t共搜索到  "sum" 个结果\n\n" \
" ┌───────────────┬───────────┐\n"\
" │   帐        号               │   帐 号 开 户 局     │\n" \
" ├───────────────┼───────────┤"} {print}' | pg -p "按任意键继续"          
stty -echo ; stty echo
}

error()
{
tput bel ;  
printf '       ┌───────────────────────────┐
       │         信息区:   输入错误 !  请重新输入 !           │
       └───────────────────────────┘'
stty -echo ; read ; stty echo
}

############# main ############     #主函数

trap 'echo "\033[0m" ; stty echo ; rm mang.txt mang.sql 2>/dev/null ; exit ' 0 1 2 3 9 15  

echo "\033[1m" ; echomain
printf '
  ┌───────────────────────────────────┐
  │                                                                      │
  │                                                                      │
  │                                                                      │
  │            欢 迎 使 用 四 川 邮 政 储 蓄 帐 户 查 询 系 统           │
  │                                                                      │
  │                                                                      │
  │                                                                      │
  │                                                  按 0 键退出系统     │
  │                                                                      │  
  └───────────────────────────────────┘

                                                      请按任意键继续...'
stty -echo ; read ; stty echo
[ "$REPLY" = "0" ] && exit 0 || xuanze

<IFRAME name=google_ads_frame marginWidth=0 marginHeight=0 src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3707276699544226&amp;dt=1208531183687&amp;lmt=1208531183&amp;prev_slotnames=6441826526&amp;output=html&amp;slotname=4047345889&amp;correlator=1208531182437&amp;url=http%3A%2F%2Funix-cd.com%2Funixcd12%2Farticle_2795.html&amp;ref=http%3A%2F%2Funix-cd.com%2Funixcd12%2Fspecial_view.asp%3Fspid%3D26%26nsort%3D%26page%3D6&amp;frm=0&amp;cc=150&amp;ga_vid=1272800452.1205929365&amp;ga_sid=1208525577&amp;ga_hid=737064899&amp;ga_fc=true&amp;flash=9.0.115.0&amp;u_h=768&amp;u_w=1024&amp;u_ah=738&amp;u_aw=1024&amp;u_cd=32&amp;u_tz=480&amp;u_java=true" frameBorder=0 width=300 scrolling=no height=250 allowTransparency></IFRAME>
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载