httplibAbilityServiceGateway.go
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package service_gateway
import (
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/constant"
"strings"
"time"
)
type HttplibAbilityServiceGateway struct {
httplibBaseServiceGateway
}
func (serviceGateway *HttplibAbilityServiceGateway) CommitQuestionQuotes(uid int64, taskId int64, serials []int64) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "task/commitQuestionQuotes"}, "/")
request := serviceGateway.createRequest(url, "post")
options := make(map[string]interface{})
options["uid"] = uid
options["taskId"] = taskId
options["serials"] = serials
request.JSONBody(options)
response := make(map[string]interface{})
request.ToJSON(&response)
data, err := serviceGateway.responseHandle(response)
return data, err
}
func (serviceGateway *HttplibAbilityServiceGateway) CommitQuestionSolution(qid int64, uid int64, solveUid int64, content string, scoreSolve float64, imgs []string, partners []map[string]interface{}) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "task/commitQuestionSolution"}, "/")
request := serviceGateway.createRequest(url, "post")
options := make(map[string]interface{})
options["qid"] = qid
options["uid"] = uid
options["solveUid"] = solveUid
options["content"] = content
options["scoreSolve"] = scoreSolve
options["imgs"] = imgs
options["partners"] = partners
request.JSONBody(options)
response := make(map[string]interface{})
request.ToJSON(&response)
data, err := serviceGateway.responseHandle(response)
return data, err
}
func NewHttplibAbilityServiceGateway() *HttplibAbilityServiceGateway {
return &HttplibAbilityServiceGateway{
httplibBaseServiceGateway: httplibBaseServiceGateway{
baseURL: constant.ABILITY_SERVICE_HOST,
connectTimeout: 100 * time.Second,
readWriteTimeout: 30 * time.Second,
},
}
}