opr11plus玻璃外套权限

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)LINUX&赋予普通用户管理员权限
LINUX下赋予普通用户管理员权限:
查找/etc/passwd文件
vi/etc/passwd
找到需要更改权限的用户名,如test:x:500:500::/home/haohao:/bin/bash
将500 更改为0
test:x:0:0::/home/haohao:/bin/bash
用户管理操作示例
root 超级用户,超级管理员,权限无限大 &
500以下的 帐号 系统软件运行 没有登录的权限 &
500及以上的 普通用户 &
hongyi:x:501:501::/home/hongyi:/bin/bash
hongyi:用户名 &
x:密码占位符,没有可以不使用密码登录,有的话必须使用密码登录 &
501:用户编号 &
501:用户所属组组编号 &
::注释信息,可有可无,可随便写,比如用户
/home/hongyi:家 &
/bin/bash:用户登录系统默认使用什么shell &
shd:!!:15908:::::: &
!!:用户被锁住,两把锁 &
!:一把锁 &
15908:修改这次密码距离隔多少天 &
zhink:$6$YJ.smIrY$psvbOkK9YqpsSABEWJLXVIiExUummHIL03NlMmEp1K8gGysgUU3nu1Bk8HzbA.yVJutBtyqlaJSJG.9AJC4.s/:99:7:::
0:密码最少使用多少天才可以修改 &
99999:密码最多可以使用多少天必须修改,否则过期 &
7:密码过期时提前多少天给你提示 &
[root@larrywen soft]# man shadow &
[root@larrywen soft]# man 5 shadow &
[root@serv01 test]usermod --help &
--修改用户的编号 &
[root@serv01 test]# usermod -u 666 zhink
[root@serv01 test]# id zhink &
uid=666(zhink) gid=500(hink) groups=500(hink)
--更改用户zhink为think &
[root@serv01 test]# usermod -l think zhink
[root@serv01 test]# id zhink &
id: zhink: No such user &
[root@serv01 test]# tail -n2 /etc/passwd
hongyi:x:501:501::/home/hongyi:/bin/bash
think:x:666:500::/home/zhink:/bin/bash
--添加编号为666组名为linux的组 &
[root@serv01 test]# groupadd -g 666 linux
[root@serv01 test]# tail -n1 /etc/group
linux:x:666: &
--修改think的组名为linux &
[root@serv01 test]# usermod -g linux think
[root@serv01 test]# tail -n1 /etc/passwd
think:x:666:666::/home/zhink:/bin/bash
[root@serv01 test]# id think &
uid=666(think) gid=666(linux) groups=666(linux)
--更改用户think的注释为this is linux admin &
[root@serv01 test]# usermod -c "this is linux admin" think
[root@serv01 test]# tail -n2 /etc/passwd
hongyi:x:501:501::/home/hongyi:/bin/bash
think:x:666:666:this is linux admin:/home/zhink:/bin/bash
[root@serv01 test]# mkdir /rhome &
[root@serv01 test]# ls -ld /rhome/ &
drwxr-xr-x. 2 root root 4096 Jul 24 23:58 /rhome/
--给用户搬家,失败 &
[root@serv01 test]# usermod -m /rhome/think think
usermod: no changes &
[root@serv01 test]# tail -n2 /etc/passwd
hongyi:x:501:501::/home/hongyi:/bin/bash
think:x:666:666:this is linux admin:/home/zhink:/bin/bash
[root@serv01 test]# ls /rhome &
[root@serv01 test]# ls /home &
hongyi &test &zhink
--给用户think搬家 &
[root@serv01 test]# usermod -m -d /rhome/think think
[root@serv01 test]# tail -n2 /etc/passwd
hongyi:x:501:501::/home/hongyi:/bin/bash
think:x:666:666:this is linux admin:/rhome/think:/bin/bash
[root@serv01 test]# ls /rhome &
[root@serv01 test]# ls /home &
hongyi &test &
#测试禁止登录 &
[root@serv01 test]# usermod -s /sbin/nologin think
[root@larrywen Desktop]# ssh think@192.168.1.11
think@192.168.1.11's password:
Last login: Thu Jul 25 00:03:44 2013 from 192.168.1.1
This account is currently not available.
Connection to 192.168.1.11 closed. &
[root@serv01 test]# usermod -s /bin/bash think
[root@larrywen Desktop]# ssh think@192.168.1.11
think@192.168.1.11's password:
Last login: Thu Jul 25 00:03:58 2013 from 192.168.1.1
[think@serv01 ~]$ &&
[root@serv01 test]usermod -p &
[root@serv01 test]# grub-md5-crypt
Password: &&
Retype password: &&
$1$9gmEH1$TxmCSmV4.uJTjCNVlqnBn. &
#修改用户think的密码 &
[root@serv01 test]# usermod -p
'$1$9gmEH1$TxmCSmV4.uJTjCNVlqnBn.' think &
[root@serv01 test]# passwd think &
#修改think的密码,需要root用户 &
[root@serv01 test]# passwd think &
#用户think的密码失效的最小日期为3 &
[root@serv01 test]# passwd -n 3 think &
#用户think的密码失效的最小日期为0 &
[root@serv01 test]# passwd -n 0 think &
#用户失效的日期,此处设置为3天以后 &
[root@serv01 test]# passwd -i 3 think &
#修改用户think,过期 &
[root@serv01 test]# usermod -e "" think
#用户think的密码失效的警告日期为3,3天后用户think在登录时将受到警告
[root@serv01 test]# passwd -w 3 think &
[root@serv01 test]# date &
Thu Jul 25 00:25:44 CST 2013 &
[root@serv01 test]# date -s " 16:26:44"
Thu Jul 25 16:26:44 CST 2013 &
[root@serv01 test]# date &
Thu Jul 25 16:26:45 CST 2013 &
[root@serv01 test]# tail -n2 /etc/shadow
think:$6$B0kGPvNc$xsRV5MLUUhbc1duBQNzKs8qX0FrrchETVv1Z0J5vzWF97wxGhYqgfFYpcCNOsldY2/KNAl7sNswovvsGawl1:99:7:::
[root@serv01 test]# passwd think &
Changing password for user think. &
New password: &&
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple &
Retype new password:
passwd: all authentication tokens updated successfully.
[root@serv01 test]# tail -n2 /etc/shadow
think:$6$xuDtWPxr$9S2ZcJ0mn4CWXnUZqSZCxcgQz263gNH4dPoKrigwdgd9tuRQ07TkvvOvuDxlupnxjXIDjziIfWPs4txJJ3L2h1:99:7:::
#15911:不需要自己修改 &
[root@serv01 test]# passwd --help &
[root@serv01 test]# passwd -n 3 think &
Adjusting aging data for user think. &
passwd: Success &
[root@serv01 test]# tail -n2 /etc/shadow
think:$6$xuDtWPxr$9S2ZcJ0mn4CWXnUZqSZCxcgQz263gNH4dPoKrigwdgd9tuRQ07TkvvOvuDxlupnxjXIDjziIfWPs4txJJ3L2h1:99:7:::
[root@larrywen Desktop]# ssh think@192.168.1.11
think@192.168.1.11's password:
Last login: Thu Jul 25 00:04:23 2013 from 192.168.1.1
[think@serv01 ~]$ passwd &
Changing password for user think. &
Changing password for think. &
(current) UNIX password:
You must wait longer to change your password
passwd: Authentication token manipulation error
[root@serv01 test]# passwd -n 0 think &
Adjusting aging data for user think. &
passwd: Success &
[think@serv01 ~]$ passwd &
Changing password for user think. &
Changing password for think. &
(current) UNIX password:
New password: &&
BAD PASSWORD: it is too simplistic/systematic
New password: &&
Retype new password:
passwd: all authentication tokens updated successfully.
[root@serv01 test]# date &
Thu Jul 25 16:33:27 CST 2013 &
[root@serv01 test]# date -s ""
Tue Jul 30 00:00:00 CST 2013 &
[root@serv01 test]# date -s ""
[root@larrywen Desktop]# ssh think@192.168.1.11
think@192.168.1.11's password:
Warning: your password will expire in 0 days
Last login: Thu Jul 25 16:29:24 2013 from 192.168.1.1
[root@serv01 test]# date -s ""
Sun Sep &1 00:00:00 CST 2013
[root@larrywen Desktop]# ssh think@192.168.1.11
think@192.168.1.11's password:
You are required to change your password immediately (password
Last login: Tue Aug 20 00:00:28 2013 from 192.168.1.1
WARNING: Your password has expired. &
You must change your password now and login again!
Changing password for user think. &
Changing password for think. &
(current) UNIX password:
[root@serv01 test]# passwd -i 3 think &
Adjusting aging data for user think. &
passwd: Success &
[root@serv01 test]# tail -n1 /etc/shadow
think:$6$7yd/Qbel$uAzY/GJKpo7J9aPOy62axAYvWK.tQCRN9WQj4KVpsQM0D1ILeaA2JqiTa/BXvSsMipC5GLtKtkiyYLVNFe6dy1::7:3::
[root@serv01 test]# usermod -f 10 think
[root@serv01 test]# tail -n1 /etc/shadow
think:$6$7yd/Qbel$uAzY/GJKpo7J9aPOy62axAYvWK.tQCRN9WQj4KVpsQM0D1ILeaA2JqiTa/BXvSsMipC5GLtKtkiyYLVNFe6dy1::7:10::
#修改过期时间 &
[root@serv01 test]# usermod -e "" think
[root@serv01 test]# tail -n1 /etc/shadow
think:$6$7yd/Qbel$uAzY/GJKpo7J9aPOy62axAYvWK.tQCRN9WQj4KVpsQM0D1ILeaA2JqiTa/BXvSsMipC5GLtKtkiyYLVNFe6dy1::7:10:15958:
[root@serv01 test]# date &
Sun Sep &1 00:03:45 CST 2013
[root@serv01 test]# date -s ""
Fri Sep 20 00:00:00 CST 2013 &
[root@larrywen Desktop]# ssh think@192.168.1.11
think@192.168.1.11's password:
Your please contact your system
administrator &
Connection closed by 192.168.1.11 &
[root@serv01 test]# passwd --help &
Usage: passwd [OPTION...] &
& -k, --keep-tokens &
& & keep non-expired
authentication tokens &
& -d, --delete &
& &delete the password for the
named account (root &
& -l, --lock &
& & &lock the
named account (root only) &
& -u, --unlock &
& &unlock the named account (root
& -f, --force &
& & force operation
& -x, --maximum=DAYS &
& &maximum password lifetime
(root only) &
& -n, --minimum=DAYS &
& &minimum password lifetime
(root only) &
& -w, --warning=DAYS &
& &number of days warning users
receives before &
password expiration (root only) &
& -i, --inactive=DAYS &
& number of days after password expiration when an
account becomes disabled (root only) &
& -S, --status &
& &report password status on the
named account (root &
& --stdin &
& read new tokens from stdin (root only)
Help options: &
& -?, --help &
& & &Show this
help message &
& --usage &
& Display brief usage message
[root@serv01 test]# tail -n1 /etc/group
linux:x:666: &
[root@serv01 test]# groupadd --help &
#添加oracle用户到编号为668的组 &
[root@serv01 test]# groupadd -g 667 oracle
[root@serv01 test]# tail -n2 /etc/group
linux:x:666: &
oracle:x:667: &
#创建用户时给用户添加组,可以使用组名或者组的编号 &
[root@serv01 test]# useradd -g oracle oracle01
[root@serv01 test]# useradd -g 667 oracle01
[root@serv01 test]# useradd -g oracle oracle01
[root@serv01 test]# id oracle01 &
uid=667(oracle01) gid=667(oracle) groups=667(oracle)
#添加用户时加入到多个组 &
[root@serv01 test]# useradd -g oracle -G linux oracle01
[root@serv01 test]# usermod --help &
#添加用户oracle01到linux组 &
[root@serv01 test]# usermod -G linux oracle01
[root@serv01 test]# id oracle01 &
uid=667(oracle01) gid=667(oracle)
groups=667(oracle),666(linux) &
[root@serv01 test]# tail -n2 /etc/group
linux:x:666:oracle01 &
oracle:x:667: &
[root@serv01 test]# groupadd dba &
[root@serv01 test]# tail -n2 /etc/group
oracle:x:667: &
dba:x:668: &
#修改用户的主组 &
[root@serv01 test]# usermod -g dba oracle01
[root@serv01 test]# id oracle01 &
uid=667(oracle01) gid=668(dba) groups=668(dba),666(linux)
[root@serv01 test]# tail -n2 /etc/passwd
oracle01:x:667:668::/home/oracle01:/bin/bash
test:x:668:667::/home/test:/bin/bash &
[root@serv01 test]# id oracle01 &
uid=667(oracle01) gid=668(dba) groups=668(dba),666(linux)
#修改用户的副组,覆盖以前的 &
[root@serv01 test]# usermod -G oracle oracle01
[root@serv01 test]# id oracle01 &
uid=667(oracle01) gid=668(dba) groups=668(dba),667(oracle)
#添加用户到多个组 &
[root@serv01 test]# usermod -G oracle,linux oracle01
[root@serv01 test]# id oracle01 &
uid=667(oracle01) gid=668(dba)
groups=668(dba),666(linux),667(oracle) &
[root@serv01 test]# usermod -G oracle oracle01
[root@serv01 test]# id oracle01 &
uid=667(oracle01) gid=668(dba) groups=668(dba),667(oracle)
#添加到多个组,不会覆盖以前的副组 &
[root@serv01 test]# usermod -a -G linux oracle01
[root@serv01 test]# id oracle01 &
uid=667(oracle01) gid=668(dba)
groups=668(dba),666(linux),667(oracle) &
#从oracle组里删除指定用户 &
[root@serv01 /]# gpasswd -d oracle01 oracle
Removing user oracle01 from group oracle
[root@serv01 /]# id oracle01 &
uid=667(oracle01) gid=666(linux) groups=666(linux)
[root@serv01 /]# tail -n2 /etc/passwd &
think:x:666:666:this is linux admin:/rhome/think:/bin/bash
oracle01:x:667:666::/home/oracle01:/bin/bash
#删除用户,不加参数不删除主目录 &
[root@serv01 /]# userdel hongyi &
[root@serv01 /]# ls /home &
hongyi &learning &oracle01
#删除用户,并删除主目录 &
[root@serv01 /]# userdel -r oracle01 &
[root@serv01 /]# ls /home/ &
hongyi/ & learning/
[root@serv01 /]# tail -n3 /etc/passwd &
avahi:x:70:70:Avahi mDNS/DNS-SD
Stack:/var/run/avahi-daemon:/sbin/nologin &
sshd:x:74:74:Privilege-separated
SSH:/var/empty/sshd:/sbin/nologin &
think:x:666:666:this is linux admin:/rhome/think:/bin/bash
[root@serv01 /]# tail -n3 /etc/passwd &
avahi:x:70:70:Avahi mDNS/DNS-SD
Stack:/var/run/avahi-daemon:/sbin/nologin &
sshd:x:74:74:Privilege-separated
SSH:/var/empty/sshd:/sbin/nologin &
think:x:666:666:this is linux admin:/rhome/think:/bin/bash
[root@serv01 /]# tail -n5 /etc/gruop &
tail: cannot open `/etc/gruop' for reading: No such file or
directory &
[root@serv01 /]# tail -n5 /etc/group &
sshd:x:74: &
hink:x:500: &
linux:x:666: &
oracle:x:667: &
dba:x:668: &
[root@serv01 /]# userdel hongyi &
userdel: user 'hongyi' does not exist &
[root@serv01 /]# rm -rf /home/hongyi &
#删除组linux &
[root@serv01 /]# groupdel linux &
groupdel: cannot remove the primary group of user 'think'
[root@serv01 /]# userdel -r think &
[root@serv01 /]# groupdel dba &
[root@serv01 /]# groupdel linux &
[root@serv01 /]# groupdel oracle &
#集群:指定编号,不重复 &
#不一样的机器ID保持一样 用户名保持一样 &
[root@serv01 /]# groupadd oracle &
[root@serv01 /]# groupadd linux &
[root@serv01 /]# groupadd dba &
[root@serv01 /]# tail -n3 /etc/group &
oracle:x:501: &
linux:x:502: &
dba:x:503: &
#一个用户属于多个组,添加到多个组 &
[root@serv01 /]# useradd -g oracle -G linux,dba zhink
[root@serv01 /]# id zhink &
uid=500(zhink) gid=501(oracle)
groups=501(oracle),502(linux),503(dba) &
[root@serv01 /]# groupadd admin &
[root@serv01 /]# groupadd oper &
[root@serv01 /]# usermod -a -G admin,oper zhink
[root@serv01 /]# id zhink &
uid=500(zhink) gid=501(oracle) &
groups=501(oracle),502(linux),503(dba),504(admin),505(oper)
[root@serv01 /]# tail -n1 /etc/group &
oper:x:505: &
#修改组的名字 &
[root@serv01 /]# groupmod -n opr oper &
[root@serv01 /]# tail -n1 /etc/group &
opr:x:505: &
#修改组的编号 &
[root@serv01 /]# tail -n1 /etc/group &
opr:x:505: &
[root@serv01 /]# groupmod -g 666 opr &
[root@serv01 /]# tail -n1 /etc/group &
opr:x:666: &
#一个组里添加多个成员 &
[root@serv01 /]# useradd -G admin hongyi
Creating mailbox file: File exists &
[root@serv01 /]# id hongyi &
uid=501(hongyi) gid=667(hongyi) groups=667(hongyi),504(admin)
[root@serv01 /]# useradd up01 &
[root@serv01 /]# useradd up02 &
[root@serv01 /]# useradd up03 &
[root@serv01 /]# tail -n10 /etc/group &
hink:x:500: &
oracle:x:501: &
linux:x:502:zhink &
dba:x:503:zhink &
admin:x:504:zhink,hongyi &
opr:x:666: &
hongyi:x:667: &
up01:x:668: &
up02:x:669: &
up03:x:670: &
#追加up01到admin组 &
[root@serv01 /]# gpasswd -a up01 admin
Adding user up01 to group admin &
[root@serv01 /]# tail -n10 /etc/group &
hink:x:500: &
oracle:x:501: &
linux:x:502:zhink &
dba:x:503:zhink &
admin:x:504:zhink,hongyi,up01 &
opr:x:666: &
hongyi:x:667: &
up01:x:668: &
up02:x:669: &
up03:x:670: &
#添加多个用户到一个组里,会覆盖以前的 &
[root@serv01 /]# gpasswd -M up01,up02,up03 admin
[root@serv01 /]# tail -n10 /etc/group &
hink:x:500: &
oracle:x:501: &
linux:x:502:zhink &
dba:x:503:zhink &
admin:x:504:up01,up02,up03 &
opr:x:666: &
hongyi:x:667: &
up01:x:668: &
up02:x:669: &
up03:x:670: &
rm -rf * &
#手动删除用户:逆向思维创建用户 &
#修改组的密码 &
[root@serv01 /]# tail -n1 /etc/gshadow
linux:!::zhink &
[root@serv01 /]# gpasswd linux &
Changing the password for group linux &
New Password: &&
Re-enter new password:
[root@serv01 /]# tail -n1 /etc/gshadow
linux:$6$Qkm/5/Xju/N/U$cmxuQ0KEcDJzISIhlhEaAkKi/fQSxeqicB3U/mGLk1o02kyCSQMvdu4FI3.UAmiS/kQzjrnBs7Kbg7DriXaCJ1::zhink
useradd zhink &
passwd zhink &
#以zhink用户登录 &
[root@larrywen Desktop]# ssh zhink@192.168.1.11
zhink@192.168.1.11's password:
#修改zhink用户到linux组 &
[zhink@serv01 ~]$ newgrp linux &
Password: &&
Invalid password. &
#RHEL5支持添加到其他组需要密码,6不支持 &
#修改用户up01到linux组,成为该组的管理员 &
[root@serv01 /]# gpasswd -A up01 linux
[root@serv01 /]# tail -n1 /etc/gshadow
linux:$6$Qkm/5/Xju/N/U$cmxuQ0KEcDJzISIhlhEaAkKi/fQSxeqicB3U/mGLk1o02kyCSQMvdu4FI3.UAmiS/kQzjrnBs7Kbg7DriXaCJ1:up01:
[root@serv01 /]# passwd up01 &
#以up01用户登录,然后把zhink添加到linux组 &
[root@larrywen Desktop]# ssh up01@192.168.1.11
up01@192.168.1.11's password:
[up01@serv01 ~]$ gpasswd -a zhink linux
Adding user zhink to group linux &
[up01@serv01 ~]$ id zhink &
uid=500(zhink) gid=501(oracle)
groups=501(oracle),502(linux),503(dba) &
[root@serv01 /]# tail -n1 /etc/gshadow
linux:$6$Qkm/5/Xju/N/U$cmxuQ0KEcDJzISIhlhEaAkKi/fQSxeqicB3U/mGLk1o02kyCSQMvdu4FI3.UAmiS/kQzjrnBs7Kbg7DriXaCJ1:up01:zhink
#修改up02的密码 &
[root@serv01 /]# passwd up02 &
[root@larrywen Desktop]# ssh up02@192.168.1.11
#以up02登录,然后将zhink添加到linux组,发现失败 &
up02@192.168.1.11's password:
[up02@serv01 ~]$ id zhink &
uid=500(zhink) gid=501(oracle)
groups=501(oracle),502(linux),503(dba) &
[up02@serv01 ~]$ gpasswd -a zhink linux
gpasswd: Permission denied. &
#添加用户时的定义 &
[root@serv01 /]# vim /etc/default/useradd
[root@serv01 etc]# ls -l /var/mail /var/spool/mail/ -id
417 lrwxrwxrwx. 1 root root & 10 Jul 23 00:54
/var/mail -& spool/mail &
424 drwxrwxr-x. 2 root mail 4096 Sep 20 17:37 /var/spool/mail/
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。/ bignebulahome
项目语言:JAVA
权限:read-only(如需更高权限请先加入项目)
bignebulahome/
package com.tmount.
import java.io.BufferedR
import java.io.IOE
import java.io.InputS
import java.io.InputStreamR
import java.io.InterruptedIOE
import java.io.OutputS
import java.io.PrintW
import java.io.UnsupportedEncodingE
import java.net.ConnectE
import java.net.URL;
import java.net.URLC
import java.net.UnknownHostE
import java.util.ArrayL
import java.util.L
import java.util.M
import java.util.S
import javax.net.ssl.SSLE
import org.apache.http.C
import org.apache.http.HttpEntityEnclosingR
import org.apache.http.HttpH
import org.apache.http.HttpR
import org.apache.http.HttpR
import org.apache.http.HttpS
import org.apache.http.NameValueP
import org.apache.http.client.HttpRequestRetryH
import org.apache.http.client.entity.UrlEncodedFormE
import org.apache.http.client.methods.HttpP
import org.apache.http.conn.params.ConnRoutePN
import org.apache.http.impl.client.DefaultHttpC
import org.apache.http.message.BasicNameValueP
import org.apache.http.params.CoreConnectionPN
import org.apache.http.protocol.ExecutionC
import org.apache.http.protocol.HttpC
import org.apache.http.util.EntityU
import com.fasterxml.jackson.core.JsonProcessingE
import com.fasterxml.jackson.databind.JsonN
import com.fasterxml.jackson.databind.ObjectM
public class ConnUtil {
* 向指定URL发送GET方法的请求
* @param url
发送请求的URL
* @param param
请求参数,请求参数应该是name1=value1&name2=value2的形式。
* @return URL所代表远程资源的响应
public static String sendGet(String url, String param) {
String result = &&;
BufferedReader in =
String urlName = url + &?& +
URL realUrl = new URL(urlName);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty(&accept&, &*/*&);
conn.setRequestProperty(&connection&, &Keep-Alive&);
conn.setRequestProperty(&user-agent&,
&Mozilla/4.0 ( MSIE 6.0; Windows NT 5.1; SV1)&);
// 设置超时时间
conn.setConnectTimeout(10000);
conn.setReadTimeout(10000);
// 建立实际的连接
conn.connect();
// 获取所有响应头字段
Map&String, List&String&& map = conn.getHeaderFields();
// 遍历所有的响应头字段
for (String key : map.keySet()) {
System.out.println(key + &---&& + map.get(key));
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
while ((line = in.readLine()) != null) {
result += &\n& +
} catch (Exception e) {
e.printStackTrace();
// 使用finally块来关闭输入流
if (in != null) {
in.close();
} catch (IOException ex) {
ex.printStackTrace();
* 向指定URL发送POST方法的请求
* @param url
发送请求的URL
* @param param
请求参数,请求参数应该是name1=value1&name2=value2的形式。
* @return URL所代表远程资源的响应
public static String sendPostString(String url, String param) {
String result = &&;
BufferedReader in =
PrintWriter out =
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty(&accept&, &*/*&);
conn.setRequestProperty(&connection&, &Keep-Alive&);
// conn.setRequestProperty(&Content-Type&,
// &application/octet-stream&);
// 设置超时时间
conn.setConnectTimeout(10000);
conn.setReadTimeout(10000);
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
// String requestParam =
// &{\&head\&:{\&company_id\&:1234,\&platform\&:11,\&width\&:640,\&height\&:480,\&term_id\&:\&abcdefgsdfs\&,\&command_id\&:1000,\&timestamp\&:123456},\&body\&:&
// + param + &}&;
String requestParam = &{\&head\&:{\&appid\&:101,\&platform\&:11,\&width\&:640,\&height\&:480,\&term_id\&:\&abcdefgsdfs\&,\&command_id\&:1000,\&timestamp\&:123456,\&user_id\&:1000},\&body\&:&
+ param + &}&;
out.print(requestParam);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
String resutlUtf8 = &&;
in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
while ((line = in.readLine()) != null) {
resutlUtf8 += &\n& +
result = new String(resutlUtf8.getBytes(), &UTF-8&);
} catch (Exception e) {
e.printStackTrace();
// 使用finally块来关闭输出流、输入流
if (out != null) {
out.close();
if (in != null) {
in.close();
} catch (IOException ex) {
ex.printStackTrace();
* 向指定URL发送POST方法的请求
* @param url
发送请求的URL
* @param param
请求参数,请求参数应该是name1=value1&name2=value2的形式。
* @return URL所代表远程资源的响应
public static String sendPostZip(String url, String param) {
String result = &&;
OutputStream os =
InputStream is =
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty(&accept&, &*/*&);
conn.setRequestProperty(&connection&, &Keep-Alive&);
conn.setRequestProperty(&Content-Type&,
&application/octet-charset=UTF-8&);
// 设置超时时间
conn.setConnectTimeout(10000);
conn.setReadTimeout(10000);
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
os = conn.getOutputStream();
String sign = MD5.getMD5(param + &1qazxsw2&);
// 发送请求参数
//String requestParam = &{\&head\&:{\&company_id\&:1234,\&platform\&:11,\&width\&:640,\&height\&:480,\&term_id\&:\&abcdefgsdfs\&,\&command_id\&:1000,\&timestamp\&:123456},\&body\&:& + param + &}&;
String requestParam = &{\&head\&:{\&appid\&:101,\&platform\&:11,\&width\&:640,\&height\&:480,\&term_id\&:\&abcdefgsdfs\&,\&command_id\&:1000,\&timestamp\&:123456,\&user_id\&:1000,\&tt\&:\&测试中文\&,\&ver\&:\&1.0\&,\&sign_m\&:\&md5\&,\&app_key\&:\&sshop\&,\&sign\&:\&&+sign+&\&},\&body\&:& + param + &}&;
byte[] in = ZipUtil.compress(requestParam.toString().getBytes(
&UTF-8&));
os.write(in);
// flush输出流的缓冲
os.flush();
// 定义BufferedReader输入流来读取URL的响应
int outLen = conn.getContentLength();
is = conn.getInputStream();
byte[] utf8Str = ZipUtil.decompress(is, outLen);
result = new String(utf8Str, &UTF-8&);
} catch (Exception e) {
e.printStackTrace();
// 使用finally块来关闭输出流、输入流
if (os != null) {
os.close();
if (is != null) {
is.close();
} catch (IOException ex) {
ex.printStackTrace();
validRequestParam(result);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
public static String sendPostZip(String serverUrl, String method,
String param)
System.out.println(&发送报文=&+param);
String result = &&;
OutputStream os =
InputStream is =
StringBuffer url = new StringBuffer();
url.append(serverUrl);
url.append(method);
URL realUrl = new URL(url.toString());
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty(&accept&, &*/*&);
conn.setRequestProperty(&connection&, &Keep-Alive&);
conn.setRequestProperty(&Content-Type&,
&application/octet-charset=UTF-8&);
conn.setConnectTimeout(10000);
conn.setReadTimeout(10000);
conn.setDoOutput(true);
conn.setDoInput(true);
os = conn.getOutputStream();
StringBuilder sb = new StringBuilder();
String sign = MD5.getMD5(param.substring(param.indexOf(&\&body\&:{&)+7,param.length()-1) + &1qazxsw2&);
sb.append(param.substring(0, param.indexOf(&\&user_id\&&)));
sb.append(&\&ver\&:\&1.0\&,\&sign_m\&:\&md5\&,\&app_key\&:\&sshop\&,\&sign\&:\&&+sign+&\&,&);
sb.append(param.substring(param.indexOf(&\&user_id\&&)));
System.out.println(&MD5 sign===&+sb.toString());
byte[] in = ZipUtil.compress(sb.toString().getBytes(&UTF-8&));
os.write(in);
os.flush();
int outLen = conn.getContentLength();
is = conn.getInputStream();
byte[] utf8Str = ZipUtil.decompress(is, outLen);
result = new String(utf8Str, &UTF-8&);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (os != null) {
os.close();
if (is != null) {
is.close();
} catch (IOException ex) {
ex.printStackTrace();
System.out.println(&返回报文=&+result);
validRequestParam(result);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
public static String getHtmlAsString(String url) {
String result = &&;
OutputStream os =
InputStream is =
URL realUrl = new URL(url.toString());
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty(&accept&, &*/*&);
conn.setRequestProperty(&connection&, &Keep-Alive&);
conn.setRequestProperty(&Content-Type&,
&application/octet-charset=UTF-8&);
conn.setConnectTimeout(10000);
conn.setReadTimeout(10000);
conn.setDoOutput(true);
conn.setDoInput(true);
os = conn.getOutputStream();
os.flush();
int outLen = conn.getContentLength();
is = conn.getInputStream();
byte[] bufOut = new byte[outLen];
int offset = 0, readed = 0;
while ((readed = is.read(bufOut, offset, outLen - offset)) != -1) {
result = new String(bufOut, &GBK&);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (os != null) {
os.close();
if (is != null) {
is.close();
} catch (IOException ex) {
ex.printStackTrace();
public static String sendPost(String url, String param){
// String jsonStr = sendPostString(url, param);
String jsonStr = sendPostZip(url, param);
System.out.println(&传出参数=& + param);
ObjectMapper mapper = new ObjectMapper();
// System.out.println(&oldjsonStr& +jsonStr);
mapper.readTree(jsonStr);
} catch (JsonProcessingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
validRequestParam(jsonStr);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
validRequestParam(jsonStr);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(&======== url in connutil & + url);
if (url.indexOf(&user.login.opr&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:0,\&error_msg\&:\&\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&IMSI\&:\&8900\&,\&IMEI\&:\&910\&,\&CORP_NAME\&:\&道里区小学中心校\&}}&;
// return &{\&result\&:1}&;
} else if (url.indexOf(&user.register.opr&) != -1) {
//return &{\&IMSI\&:\&8900\&,\&IMEI\&:\&910\&}&;
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:110,\&error_msg\&:\&注册失败\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&result\&:1}}&;
} else if (url.indexOf(&device.info.get&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:0,\&error_msg\&:\&\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&IMSI\&:\&8900\&,\&IMEI\&:\&910\&,\&DEVICE_TYPE\&:\&TD09\&,\&PRODUCTER_CODE\&:\&0001\&,\&LAC\&:\&789-2013\&,\&SIGNAL_LEVEL\&:10,\&STATUS\&:\&开机\&,\&STATUS_INFON\&:\&撤防\&}}&;
} else if (url.indexOf(&sensor.alarminfo.get&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:0,\&error_msg\&:\&\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&ALARM_LIST\&:[{\&SENSOR_NAME\&:\&客厅窗户\&,\&OP_TIME\&:\& 14:14:02\&,\&REPORT_TIME\&:\& 11:00:00\&,\&ALARM_DESC\&:\&报警升级\&},{\&SENSOR_NAME\&:\&烟感告警\&,\&OP_TIME\&:\& 15:33:10\&,\&REPORT_TIME\&:\& 17:48:00\&,\&ALARM_DESC\&:\&\&},{\&SENSOR_NAME\&:\&烟感告警\&,\&OP_TIME\&:\& 15:34:05\&,\&REPORT_TIME\&:\& 17:48:00\&,\&ALARM_DESC\&:\&\&},{\&SENSOR_NAME\&:\&烟感告警\&,\&OP_TIME\&:\& 15:34:36\&,\&REPORT_TIME\&:\& 17:48:00\&,\&ALARM_DESC\&:\&\&},{\&SENSOR_NAME\&:\&烟感告警\&,\&OP_TIME\&:\& 15:35:59\&,\&REPORT_TIME\&:\& 17:48:00\&,\&ALARM_DESC\&:\&\&},{\&SENSOR_NAME\&:\&烟感告警\&,\&OP_TIME\&:\& 10:26:25\&,\&REPORT_TIME\&:\& 17:48:00\&,\&ALARM_DESC\&:\&\&}]}}&;
} else if (url.indexOf(&device.alarminfo.get&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:0,\&error_msg\&:\&\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&DEVICEALARM_LIST\&:[{\&DEVICE_NAME\&:\&门磁1\&,\&TERMINAL_DESC\&:\&低电\&,\&OP_TIME\&:\& 11:10:58\&,\&REMAIN_VAL\&:\&1\&},{\&DEVICE_NAME\&:\&门磁1\&,\&TERMINAL_DESC\&:\&低电\&,\&OP_TIME\&:\& 11:24:17\&,\&REMAIN_VAL\&:\&1\&},{\&DEVICE_NAME\&:\&门磁1\&,\&TERMINAL_DESC\&:\&低电\&,\&OP_TIME\&:\& 17:32:21\&,\&REMAIN_VAL\&:\&1\&}]}}&;
}else if (url.indexOf(&device.opr.rcv&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:110,\&error_msg\&:\&撤防失败\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&RESULT\&:0}}&;
}else if (url.indexOf(&sensor.info.get&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:0,\&error_msg\&:\&\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&SENSOR_LIST\&:[{\&SENSOR_NAME\&:\&门磁1\&,\&SENSOR_TYPE\&:\&门磁\&,\&SENSOR_STATUS\&:\&在线\&},{\&SENSOR_NAME\&:\&门磁2\&,\&SENSOR_TYPE\&:\&门磁\&,\&SENSOR_STATUS\&:\&在线\&},{\&SENSOR_NAME\&:\&门磁2\&,\&SENSOR_TYPE\&:\&门磁\&,\&SENSOR_STATUS\&:\&在线\&}]}}&;
}else if (url.indexOf(&user.phonenumber.get&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:0,\&error_msg\&:\&\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&PHONE_LIST\&:[{\&PHONE_NO\&:\&\&,\&PHONE_STATUS\&:\&未回复短信确认\&},{\&PHONE_NO\&:\&\&,\&PHONE_STATUS\&:\&未回复短信确认\&},{\&PHONE_NO\&:\&\&,\&PHONE_STATUS\&:\&未回复短信确认\&},{\&PHONE_NO\&:\&\&,\&PHONE_STATUS\&:\&未回复短信确认\&},{\&PHONE_NO\&:\&\&,\&PHONE_STATUS\&:\&未回复短信确认\&}]}}&;
}else if (url.indexOf(&user.phonenumber.opr&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:101,\&error_msg\&:\&操作失败\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&result\&:0}}&;
}else if (url.indexOf(&applc.info.get&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:0,\&error_msg\&:\&操作成功\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&APPLC_LIST\&:[{\&APPLC_NAME\&:\&神马\&,\&APPLC_TYPE\&:\&类型\&,\&APPLC_STATUS\&:\&状态啊\&},{\&APPLC_NAME\&:\&神马2\&,\&APPLC_TYPE\&:\&类型2\&,\&APPLC_STATUS\&:\&状态啊2\&}]}}&;
}else if (url.indexOf(&switch.info.get&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:0,\&error_msg\&:\&操作成功\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&SWITCH_LIST\&:[{\&SWITCH_NAME\&:\&神马\&,\&SWITCH_STATUS\&:\&状态啊\&},{\&SWITCH_NAME\&:\&神马2\&,\&SWITCH_STATUS\&:\&状态啊2\&}]}}&;
}else if (url.indexOf(&corp.device.get&) != -1) {
return &{\&head\&:{\&command_id\&:1000,\&timestamp\&:123456,\&error_code\&:0,\&error_msg\&:\&操作成功\&,\&ver\&:\&1.0\&,\&sign_m\&:\&1.0\&,\&app_key\&:\&sshop\&,\&sign\&:\&ba759bf5f59c2c982cdae\&},\&body\&:{\&RESULT_COUNT\&:\&51\&,\&DEVICE_LIST\&:[{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&},{\&IMEI\&:\&123321\&,\&PHONE_NO\&:\&\&,\&OP_TIME\&:\&\&}]}}&;
return jsonS
public static void ttUtf8() {
String ch = &上地店&;
System.getProperties().list(System.out);
String utf81 = new String(ch.getBytes(&UTF-8&), &ISO-8859-1&);
String utf82 = new String(ch.getBytes(&ISO-8859-1&), &GBK&);
System.out.println(&ssss& + utf81);
System.out.println(&ssss3& + utf82);
String chinese = new String(utf81.getBytes(&ISO-8859-1&), &UTF-8&);
System.out.println(&ssss2& + chinese);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
public static String doPost(String url, Map params, String charset,
boolean pretty) {
StringBuffer returnStr = new StringBuffer();
// 构造HttpClient的实例
DefaultHttpClient client = new DefaultHttpClient();
HttpRequestRetryHandler myRetryHandler = new HttpRequestRetryHandler() {
public boolean retryRequest(IOException exception,
int executionCount, HttpContext context) {
if (executionCount &= 5) {
// Do not retry if over max retry count
if (exception instanceof InterruptedIOException) {
// Timeout
if (exception instanceof UnknownHostException) {
// Unknown host
if (exception instanceof ConnectException) {
// Connection refused
if (exception instanceof SSLException) {
// SSL handshake exception
HttpRequest request = (HttpRequest) context
.getAttribute(ExecutionContext.HTTP_REQUEST);
boolean idempotent = !(request instanceof HttpEntityEnclosingRequest);
if (idempotent) {
// Retry if the request is considered idempotent
client.setHttpRequestRetryHandler(myRetryHandler);
HttpHost proxy = new HttpHost(&10.109.222.57&, 8003);
client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
// 创建Post法的实例
HttpPost method = new HttpPost(url);
method.getParams().setParameter(
CoreConnectionPNames.CONNECTION_TIMEOUT, 5000);
method.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 5000);
method.setHeader(&Content-type&,
&application/x-www-form- charset=UTF-8&);
method.setHeader(&User-Agent&,
&Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/ Firefox/14.0.1&);
method.setHeader(&Host&, &www.dami88.com&);
// 设置Http Post数据
if (params != null) {
// 填入各个表单域的值
List&NameValuePair& data = new ArrayList&NameValuePair&();
Set sets = params.keySet();
Object[] arr = sets.toArray();
int mxsets = sets.size();
for (int i = 0; i & i++) {
String key = (String) arr[i];
String val = (String) params.get(key);
data.add(new BasicNameValuePair(key, val));
// 将表单的值放入postMethod中
method.setEntity(new UrlEncodedFormEntity(data, Consts.UTF_8));
// 执行postMethod
HttpResponse response = client.execute(method);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
returnStr.append(EntityUtils.toString(response.getEntity()));
} catch (IOException e) {
System.out.println(&IO错误原因:& + e.getMessage());
} finally {
method.abort();
client.getConnectionManager().shutdown();
return returnStr.toString();
private static void validRequestParam(String gbkStr) throws Exception {
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonN
jsonNode = mapper.readTree(gbkStr);
int bodyIndex
= gbkStr.indexOf(&\&body\&:{&);
if (bodyIndex == -1) {
throw new Exception();
String bodyStr = gbkStr.substring(bodyIndex + 7,gbkStr.length() -1); //只验证body里两个大括号中的内容,包括大括号。
String signValid = MD5.getMD5(bodyStr + &1qazxsw2&);
JsonNode headNode = jsonNode.get(&head&);
int errorCode = headNode.get(&error_code&).asInt();
if (errorCode == 0) {
String sign = headNode.get(&sign&).textValue();
if (!sign.equals(signValid)) {
throw new Exception();
} catch (JsonProcessingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
public static void main(String[] args) throws Exception {
// 获得图片:
// http://localhost:8080/sshop/res?resid=110&width=40&pic_size_type=4x3
// //1. 获取公司信息getCompanyInfo
// System.out.println(&获取公司信息=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/company.get&,
// &{\&company_id\&:0,\&update_time\&:\& 03:04:05\&}&));
// //2. 获取公司的商品分类列表getShopItemsType
System.out.println(&获取公司的商品分类列表=& +
ConnUtil.sendPost(&http://10.110.2.121:9001/sshop/shop.itemstype.get&,
&{\&shop_id\&:100,\&data_type\&:40}&));
// //3.1 获取单公司某个商品分类下商品列表信息 ——全部获取 getItemFromType
System.out.println(&单公司某个商品分类下商品列表信息(全部获取)=&
ConnUtil.sendPost(&http://10.110.2.121:9001/sshop/shop.itemstype.items.get&,
&{\&shop_id\&:100,\&sitems_type\&:107}&));
System.out.println(&单公司某个商品分类下商品列表信息(全部获取)=&
ConnUtil.sendPost(&http://10.110.2.121:9001/sshop/advertise.get&,
&{\&shopId\&:0,\&showId\&:1000}&));
// //3.2 获取单公司某个商品分类下商品列表信息 ——分页 getItemFromType
// System.out.println(&单公司某个商品分类下商品列表信息(分页)=&
// ConnUtil.sendPost(&http://localhost:8080/sshop/shop.itemstype.items.get&,
// &{\&shop_id\&:106,\&sitems_type\&:107,\&orders_time\&:345,\&fetch_rows\&:2}&));
// //4 获取单个商品的明细信息getItemsInfo
// System.out.println(&获取单个商品的明细信息=&
// + ConnUtil.sendPost(&http://localhost:8080/sshop/shop.items.get&,
// &{\&items_id\&:12}&));
// //5 获取用户余额信息getUserAccount
// System.out.println(&获取用户余额信息=&
// + ConnUtil.sendPost(&http://localhost:8080/sshop/user.account.get&,
// &{\&user_id\&:1000}&));
// //6.1 得到商品下级商品列表(全部)。getSubItemFromItem
// System.out.println(&得到商品下级商品列表(全部)=&
// ConnUtil.sendPost(&http://localhost:8080/sshop/shop.items.subitems.get&,
// &{\&items_id\&:12}&));
// //6.2 得到商品下级商品列表(部分)。getSubItemFromItem
// System.out.println(&得到商品下级商品列表(部分)=&
// ConnUtil.sendPost(&http://localhost:8080/sshop/shop.items.subitems.get&,
// &{\&items_id\&:12,\&orders_time\&:0,\&fetch_rows\&:2}&));
// //7 发送订单。sendUserOrder
// System.out.println(&订单ID=&
// + ConnUtil.sendPost(&http://localhost:8080/sshop/user.order.add&,
// &{\&shop_id\&:106,\&contact_name\&:\&张三\&,\&contact_phone\&:\&1390000tmountx\&, \&fee_date\&:\& 02:03:04\&,\&mark\&:\&测试\&,\&item_list\&:[{\&items_id\&:11,\&items_type\&:11,\&acount\&:22,\&price\&:44}]}&));
// //8 获取用户订单列表信息getUserOrder
// System.out.println(&获取用户订单列表信息=&
// + ConnUtil.sendPost(&http://localhost:8080/sshop/user.order.get&,
// &{\&state\&:10}&));
// //8 获取用户订单列表信息
// System.out.println(&获取用户订单列表信息=&
// + ConnUtil.sendPost(&http://localhost:8080/sshop/user.orders.get&,
// &{\&user_id\&:1000,\&state\&:10,\&order_end\&:\&N\&}&));
// //9 获取用户订购商品详情。getUserOrderDetail
// System.out.println(&获取用户订购商品详情=&
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.order.detail.get&,
// &{\&order_no\&:25}&));
// //10 取消订单。removeUserOrder
// System.out.println(&订单ID=&
// + ConnUtil.sendPost(&http://localhost:8080/sshop/user.order.delete&,
// &{\&order_no\&:25,\&mark\&:\&取消\&}&));
// //11 获取酒店的楼层信息getShopFloor
// System.out.println(&获取酒店的楼层信息=&
// + ConnUtil.sendPost(&http://localhost:8080/sshop/shop.floor.get&,
// &{\&shop_id\&:106}&));
// //12 获取房间类商品明细getRoomInfo
// System.out.println(&获取房间类商品明细=&
// ConnUtil.sendPost(&http://localhost:8080/sshop/shop.items.room.get&,
// &{\&items_id\&:12}&));
// //13 获取某商品的图片介绍列表getItemPics
// System.out.println(&获取某商品的图片介绍列表=&
// ConnUtil.sendPost(&http://localhost:8080/sshop/shop.items.pics.get&,
// &{\&items_id\&:14}&));
// //14 新用户注册。newUser
// System.out.println(&新用户注册=&
// + ConnUtil.sendPost(&http://localhost:8080/sshop/user.add&,
// &{\&user_account\&:\&admin11\&, \&password\&:\&123456\&}&));
// //15 用户登录。userLogin
// System.out.println(&用户登录=&
// + ConnUtil.sendPost(&http://localhost:8080/sshop/user.login&,
// &{\&user_account\&:\&admin11\&, \&password\&:\&123456\&}&));
// //16 用户密码变更
// System.out.println(&用户密码变更=&
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.password.change&,
// &{\&user_id\&:1000, \&new_password\&:\&123456\&, \&old_password\&:\&123456\&}&));
// //16. 平台目录信息(product. catalog.get)
// System.out.println(&平台目录信息=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/product.catalog.get&,
// &{\&company_id\&:100}&));
// //17. 获取取平台目录下商品列表信息(product.catalog.items.get)
// System.out.println(&获取取平台目录下商品列表信息=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/product.catalog.items.get&,
// &{\&items_type\&:109, \&start_rows\&:0, \&fetch_rows\&:20}&));
// //18. 获取商店活动列表getShopActvity
// System.out.println(&获取商店活动列表=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/shop.activity.get&,
// &{\&shop_id\&:106,\&begin_time\&:\& 00:00:00\&}&));
// //19. 获取商店活动下的商品列表AcActionItemsInfo
// System.out.println(&获取商店活动下的商品列表=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/shop.activity.items.get&,
// &{\&actions_id\&:100}&));
// //20. 获取系统热词。
// System.out.println(&获取系统热词=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/sys.hotwords.get&,
// &{}&));
// //21. 获取系统搜索词。
// System.out.println(&获取系统搜索词=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/sys.searchwords.get&,
// &{}&));
// //22.商城商品检索
// //System.out.println(&resutl=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/shop.platitems.get&,
// &{\&serchStr\&:106,\&keyword\&:\&one\&}&));
// //23.商品详细信息获取
System.out.println(&resutl=& +
ConnUtil.sendPost(&http://www.taodami.com.cn:8080/sshop/shop.itemsdetail.get&, &{\&serchStr\&:106,\&itemsId\&:\&44\&}&));
// //24.商店详细信息获取
// // System.out.println(&resutl=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/shop.get&,
// &{\&serchStr\&:106,\&shopId\&:\&1\&}&));
// //25.评论信息获取
// //System.out.println(&resutl=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.comment.get&,&{\&shopId\&:1}&));
// //26.统计当月指定商品,各个买家的购买情况。
// System.out.println(&统计当月指定商品,各个买家的购买情况。=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/product.month.consumer.stat&,&{\&items_id\&:12,\&fetch_rows\&:3,\&start_rows\&:0}&));
// //27.得到用户对商品的评论情况,按照时间倒序排列。
// System.out.println(&得到用户对商品的评论情况,按照时间倒序排列=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/product.user.comment.get&,&{\&items_id\&:12,\&fetch_rows\&:3,\&start_rows\&:0}&));
// //28.获取用户购物车中的信息。
// System.out.println(&获取用户购物车中的信息=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.cart.get&,&{\&user_id\&:11}&));
// //29.用户收藏商品添加。
// System.out.println(&用户收藏商品添加=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.favourite.items.add&,&{\&user_id\&:11,\&shop_id\&:106,\&items_id\&:12,\&user_tag_id\&:11,\&discount\&:11}&));
// //29.用户收藏商品查询。
// System.out.println(&用户收藏商品查询=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.favourite.items.get&,&{\&user_id\&:11,\&shop_id\&:106,\&items_id\&:12}&));
// //29.用户收藏商品删除。
// System.out.println(&用户收藏商品查询=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.favourite.items.delete&,&{\&user_id\&:11,\&shop_id\&:106,\&items_id\&:12}&));
// //29.1.用户收藏商店添加。
// System.out.println(&用户收藏商店添加=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.favourite.shop.add&,&{\&user_id\&:22,\&shop_id\&:11,\&user_tag_id\&:11}&));
// //30.用户加入购物车
// System.out.println(&用户加入购物车=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.cart.add&,&{\&item_list\&:[{\&user_id\&:11,\&shop_id\&:11,\&items_id\&:11,\&acount\&:11,\&discount\&:11},{\&user_id\&:22,\&shop_id\&:22,\&items_id\&:22,\&acount\&:22,\&discount\&:22}]}&));
// //31.用户移除购物车中商品
// System.out.println(&用户移除购物车中商品=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.cart.delete&,&{\&user_id\&:22,\&shop_id\&:22,\&items_id\&:22,\&acount\&:99}&));
// //32.用户地址增加
// System.out.println(&用户地址增加=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.address.add&,&{\&user_id\&:22,\&orders\&:2,\&post_addr\&:\&1\&,\&province_code\&:11,\&city_code\&:11,\&address\&:\&22\&,\&post_code\&:\&22\&,\&content_phone\&:\&22\&,\&mobile\&:\&22\&,\&user_name\&:\&22\&,\&arrival_time\&:22}&));
// //33.获取用户地址数据列表
// System.out.println(&获取用户地址数据列表=& +
// ConnUtil.sendPost(&http://localhost:8080/sshop/user.address.get&,&{\&user_id\&:22,\&update_time\&:\& 00:00:00\&}&));
// System.out.println(&test=& +
// ConnUtil.sendPostZip(&http://10.109.222.76:8080/sshop/&,&product.month.consumer.stat&,
// &{\&head\&:{\&appid\&:1,\&platform\&:1,\&screenX\&:1024,\&screenY\&:769,\&term_id\&:\&1\&,\&command_id\&:1,\&timestamp\&:9,\&user_id\&:1},\&body\&:{\&fetch_rows\&:40,\&items_id\&:60,\&start_rows\&:0}}&));
// System.out.println(&test=& +
// ConnUtil.getHtmlAsString(&http://10.109.222.76:8080/mshop/data/.html&));
System.out.println(&resutl=& +
ConnUtil.sendPost(&http://10.109.222.79:8080/service_platform/user.login.opr&,
&{\&USERNO\&:\&8900\&,\&OPERATOR\&:0,\&PASSWORD\&:\&\&}&));
(C)&&2013&&Alibaba&&Inc.&&All&&rights&&resvered.
Powered by

我要回帖

更多关于 opr11怎么截屏 的文章

 

随机推荐