You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package test
import ( "encoding/json" "fmt" "github.com/kirinlabs/HttpRequest" "io/ioutil" )
const RootHost = "http://127.0.0.1:20181" const ActivityId = 19 const UserId = 19
type ApiConfig struct { Host string `json:"host"` ActivityId int64 `json:"activity_id"` // 互动id
UserId int64 `json:"user_id"` //用户id
UserToken string `json:"user_token"` // token
CustomerId string `json:"customer_id"` CustomerToken string `json:"customer_token"` CustomerName string `json:"customer_name"` CustomerPwd string `json:"customer_pwd"` EntryAccount string `json:"entry_account"` EntryPwd string `json:"entry_pwd"` EntryToken string `json:"entry_token"` }
// get 方法
func Api(token string) *HttpRequest.Request { return HttpRequest.NewRequest().Debug(true).SetHeaders(map[string]string{ "token": token, }) }
func ApiUrl(path string) string { return fmt.Sprintf("%s/%s", RootHost, path) }
func GetConfig() *ApiConfig { bs, err := ioutil.ReadFile("api.json") if err != nil { panic(err) } config := new(ApiConfig) err = json.Unmarshal(bs, config) if err != nil { panic(err) } return config }
|