jwclogin

package module
v0.0.0-...-31f702d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2017 License: MIT Imports: 10 Imported by: 0

README

jwc_login

ZAFU JWC的教务处登陆接口

implement

解耦cmd_zafu的模拟登陆模块,做成了Service来向前端/移动端提供登录的服务。

how to use

详见example目录下的实现

Route Request Method Request params Response datatype Response content Others
/jwc/code GET EMPTY JSON {"href":"","cookie":"","VIEWSTATE":"","VIEWSTATEGENERATOR":""} 获取主页的一些必要信息
/jwc/login POST code,stuno,passwd, VIEWSTATE,VIEWSTATEGENERATOR,cookies(which Response to U in last step) JSON a certain name of the student 获取学生的名字

你需要做的就是

  • 发Request到/jwc/code 获取一些页面信息
  • 发起POST请求的时候带上上一步返回的信息(别忘了学生帐号和密码)即可

preview

You can test it at This Site

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginGate

type LoginGate struct {
	//GateURL
	GateURL string `json:"gateurl"`

	//DefaultGate
	DefaultGate string `json:"defaulturl"`
}

LoginGate ...

func NewGate

func NewGate(gate string, otherGate string) *LoginGate

NewGate init a gate

func (LoginGate) GetVRCode

func (gate LoginGate) GetVRCode(cookies []*http.Cookie, token string)

GetVRCode will fetch vrcode and save it ...

func (LoginGate) Getsp

func (gate LoginGate) Getsp() (map[string]string, error)

Getsp get the VIEWSTATE param ...

type Student

type Student struct {
	//Username => student name
	Username string `json:"username"`
	//Password => password name
	Password string `json:"password"`

	*LoginGate
}

Student structure ...

func NewStu

func NewStu(stuno string, password string, gate *LoginGate) *Student

NewStu load student information ..

func (*Student) Login

func (stu *Student) Login(Rurl string, c *http.Client, verifyCode string, VIEWSTATE string, VIEWSTATEGENERATOR string, tempCookies []*http.Cookie) (string, error)

Login post user info and return logined cookie(if success)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL