Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

接口文档 #2

Open
hbzju opened this issue Aug 18, 2016 · 0 comments
Open

接口文档 #2

hbzju opened this issue Aug 18, 2016 · 0 comments

Comments

@hbzju
Copy link
Contributor

hbzju commented Aug 18, 2016

接口说明:
1.返回的数据是json格式的字符串,请使用JavaScript的eval函数或PHP的json_decode(注意数组和stdClass的区别)函数解码。
2.返回码(code)说明:
0-请求成功,具体查看其它参数;
411-没有给参数;
410-没有找到相应的item;
详细错误信息查看errMsg.
3.接口前缀地址:"http://114.215.144.43/ina.php?"
后续可能会进行服务器的更改,建议存成一个字符串,统一修改
4.每个接口都需要一个target参数用来指定请求哪个接口,具体见接口说明。
5.服务器地址:114.215.144.43 ssh登录,要把web放上去的话,密码找我要好了。

具体接口:

1.首页轮播图

请求方式:GET

参数:
picName | String
target  | String

正确返回码示例:
{"code":0,"picUrl":"http:\/\/qiniu.6dbox.cn\/20168151"}

示例请求:http://114.215.144.43/ina.php?target=carousel&picName=ComeAndIn

2.成员

请求方式:GET

参数:
mid | String (学号)
target | String

正确返回码示例:
{
    "mid":"3140100000",
    "memberName":"INA",
    "grade":"3",
    "major":"CS",
    "description":"hello world",
    "info":"It's a really nice organization!",
    "department":"1",
    "position":"3",
    "sex":"0",
    "protraitUrl":"https:\/\/encrypted-tbn3.gstatic.com\/images?q=tbn:ANd9GcSGd6zxl1sbfC2iX_AK0eu5cYvc8jqDTXC6DVuwi1fmLO8f1-cX7Q",
    "code":0
}

示例请求:http://114.215.144.43/ina.php?target=member&mid=3140100000

3.项目展示(pid方式)

请求方式:GET

参数:
pid | String
target | String

正确返回码示例:
{
    "pid":"e28c6183e05b95bc1bf625fd76885608",
    "projectName":"INA WebSite",
    "description":"wow",
    "picUrl":"https:\/\/encrypted-tbn1.gstatic.com\/images?q=tbn:ANd9GcQ7tXiAQuC2DtDuUXPjn6V05z-gXGMZ_mf03mzCIpCkhxMPHKCB",
    "ownerId":"3140100000",
    "type":"1",
    "code":0
}

示例请求:http://114.215.144.43/ina.php?target=getProjectById&pid=e28c6183e05b95bc1bf625fd76885608

3.项目展示(projectName方式)

请求方式:GET

参数:
projectName | String
target | String

正确返回码示例:
{
    "pid":"e28c6183e05b95bc1bf625fd76885608",
    "projectName":"INA WebSite",
    "description":"wow",
    "picUrl":"https:\/\/encrypted-tbn1.gstatic.com\/images?q=tbn:ANd9GcQ7tXiAQuC2DtDuUXPjn6V05z-gXGMZ_mf03mzCIpCkhxMPHKCB",
    "ownerId":"3140100000",
    "type":"1",
    "code":0
}

示例请求:http://114.215.144.43/ina.php?target=projectByName&projectName=INA%20WebSite (注意编码)

3.项目展示(获取所有的项目)

请求方式:GET

参数:
target | String

正确返回码示例:
{
            "proList":[{
              "pid":"e28c6183e05b95bc1bf625fd76885608",
              "projectName":"INA WebSite",
              "description":"wow",
              "picUrl":"https:\/\/encrypted-tbn1.gstatic.com\/images?                q=tbn:ANd9GcQ7tXiAQuC2DtDuUXPjn6V05z-gXGMZ_mf03mzCIpCkhxMPHKCB",
              "ownerId":"3140100000",
              "type":"1",

               }]
            "code":0
}

示例请求:http://114.215.144.43/ina.php?target=project(注意编码)

附所有SQL语句及其说明:

create table carousel
(
    picUrl varchar(300) not null,
    picName char(30),
    primary key(picName)
);
insert into carousel values('http://qiniu.6dbox.cn/20168151','ComeAndIn');

create table member
(
    mid char(10),
    memberName char(15) not null,
    description char(100),
    info text,
    department int not null,
    protraitUrl varchar(300),
    primary key(mid)
);
--mid:学号
--grade:大一到博士生一直往上累加即可,从1开始
--major:尽量使用简称
--description:一句话描述,不要超过50字
--info:更多的文字
--department:0-主席团,1-技术,2-产品/运营,3-设计,后续可扩展
--position:0-会长,1-部长,2-副部长,3-成员
--sex:0:男,1:女
insert into member values('3140100000','INA','3','CS','hello world','It\'s a really nice organization!','1','3','0','https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSGd6zxl1sbfC2iX_AK0eu5cYvc8jqDTXC6DVuwi1fmLO8f1-cX7Q');

create table project
(
    pid char(32),
    projectName char(50),
    description text,
    picUrl varchar(300),
    ownerId char(10),
    type int,
    primary key(pid),
    CONSTRAINT `fk_p` FOREIGN KEY (ownerId) REFERENCES member(mid)
);
-- pid:当前时间md5
-- type:0-App,1-Website,2-others
insert into project values(md5(current_timestamp()),'INA WebSite','wow','https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQ7tXiAQuC2DtDuUXPjn6V05z-gXGMZ_mf03mzCIpCkhxMPHKCB','3140100000','1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant