123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package frontc
- import(
- "encoding/json"
- "wuyebaoxiuapi/libs"
- "fmt"
- )
- type ApiController struct {
- BBaseController
- }
- // 模拟登录
- func (this *ApiController)Login() {
- http :=libs.NewHttp()
- params := make(map[string]interface{})
- userInfo := make(map[string]interface{})
- userInfo["nickName"] = "pengjs"
- userInfo["avatarUrl"] = "1.jpg"
- userInfo["gender"] = 1
- userInfo["school"] = "xxx"
- params["is_repair_user"] = 2
- params["username"] = "admin"
- params["password"] = "123456"
- params["types"] = 2
- params["is_wechat_login"] = 0
- params["openid"] = "o6iCm1FeosWAhRS88jOXmrXCUbUI"
- params["username"] = "admin"
- params["password"] = "123456"
- jsonStr,_ := json.Marshal(userInfo)
- params["userInfo"] = string(jsonStr)
- fmt.Println("b:", string(jsonStr))
- fmt.Println("c:", params["userInfo"])
- result := http.Post("http://localhost:8081/user/login",params)
- mapJson := libs.JsonToMap(result)
- this.ajaxMsg(1,mapJson["message"],mapJson["data"])
- }
- // 修改密码
- func (this *ApiController)UpdatePassword() {
- http :=libs.NewHttp()
- params := make(map[string]interface{})
- params["old_password"] = "123456"
- params["new_password"] = "111111"
- params["confirm_password"] = "o6iCm1FeosWAhRS88jOXmrXCUbUI"
- result := http.Post("http://localhost:8081/user/UpdatePassword",params)
- mapJson := libs.JsonToMap(result)
- this.ajaxMsg(1,mapJson["message"],mapJson["data"])
- }
|