-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
3 changed files
with
40 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package userCenterServices | ||
|
||
import ( | ||
"net/url" | ||
"wejh-go/app/apiException" | ||
"wejh-go/config/api/userCenterApi" | ||
) | ||
|
||
func Login(stu_id string, pass string) error { | ||
params := url.Values{} | ||
Url, err := url.Parse(string(userCenterApi.Auth)) | ||
if err != nil { | ||
return err | ||
} | ||
Url.RawQuery = params.Encode() | ||
urlPath := Url.String() | ||
regMap := make(map[string]string) | ||
regMap["stu_id"] = stu_id | ||
regMap["password"] = pass | ||
resp, err := FetchHandleOfPost(regMap, userCenterApi.UserCenterApi(urlPath)) | ||
if err != nil { | ||
return apiException.RequestError | ||
} | ||
if resp.Code == 404 { | ||
return apiException.UserNotFind | ||
} else if resp.Code == 405 { | ||
return apiException.NoThatPasswordOrWrong | ||
} else if resp.Code == 200 { | ||
return nil | ||
}else{ | ||
return apiException.ServerError | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters