正在显示
6 个修改的文件
包含
71 行增加
和
4 行删除
| @@ -68,6 +68,8 @@ spec: | @@ -68,6 +68,8 @@ spec: | ||
| 68 | value: "1" | 68 | value: "1" |
| 69 | - name: ERROR_BASE_CODE_MULTIPLE | 69 | - name: ERROR_BASE_CODE_MULTIPLE |
| 70 | value: "1000" | 70 | value: "1000" |
| 71 | + - name: ABILITY_SERVICE_HOST | ||
| 72 | + value: "https://ability-dev.fjmaimaimai.com" | ||
| 71 | volumes: | 73 | volumes: |
| 72 | - name: accesslogs | 74 | - name: accesslogs |
| 73 | emptyDir: {} | 75 | emptyDir: {} |
| @@ -68,6 +68,8 @@ spec: | @@ -68,6 +68,8 @@ spec: | ||
| 68 | value: "1" | 68 | value: "1" |
| 69 | - name: ERROR_BASE_CODE_MULTIPLE | 69 | - name: ERROR_BASE_CODE_MULTIPLE |
| 70 | value: "1000" | 70 | value: "1000" |
| 71 | + - name: ABILITY_SERVICE_HOST | ||
| 72 | + value: "https://ability-test.fjmaimaimai.com" | ||
| 71 | volumes: | 73 | volumes: |
| 72 | - name: accesslogs | 74 | - name: accesslogs |
| 73 | emptyDir: {} | 75 | emptyDir: {} |
| @@ -22,15 +22,15 @@ type CreateTaskCommand struct { | @@ -22,15 +22,15 @@ type CreateTaskCommand struct { | ||
| 22 | // 引用资源项列表 | 22 | // 引用资源项列表 |
| 23 | ReferenceResourceItems []*domain.ReferenceResourceItem `json:"referenceResourceItems,omitempty"` | 23 | ReferenceResourceItems []*domain.ReferenceResourceItem `json:"referenceResourceItems,omitempty"` |
| 24 | // 客户价值列表 | 24 | // 客户价值列表 |
| 25 | - CustomerValue []string `json:"customerValue" valid:"Required"` | 25 | + CustomerValue []string `json:"customerValue,omitempty"` |
| 26 | // 任务性质 | 26 | // 任务性质 |
| 27 | - TaskNature string `json:"taskNature" valid:"Required"` | 27 | + TaskNature string `json:"taskNature,omitempty"` |
| 28 | // 奖励素币 | 28 | // 奖励素币 |
| 29 | SuMoney float64 `json:"suMoney,omitempty"` | 29 | SuMoney float64 `json:"suMoney,omitempty"` |
| 30 | // 验收标准 | 30 | // 验收标准 |
| 31 | - AcceptanceStandard string `json:"acceptanceStandard" valid:"Required"` | 31 | + AcceptanceStandard string `json:"acceptanceStandard,omitempty"` |
| 32 | // 任务描述 | 32 | // 任务描述 |
| 33 | - TaskDescription string `json:"taskDescription" valid:"Required"` | 33 | + TaskDescription string `json:"taskDescription,omitempty"` |
| 34 | // 任务图片URL列表 | 34 | // 任务图片URL列表 |
| 35 | TaskPictureUrls []string `json:"taskPictureUrls,omitempty"` | 35 | TaskPictureUrls []string `json:"taskPictureUrls,omitempty"` |
| 36 | // 是否悬赏任务 | 36 | // 是否悬赏任务 |
| @@ -5,9 +5,13 @@ import "os" | @@ -5,9 +5,13 @@ import "os" | ||
| 5 | const SERVICE_NAME = "mmm-worth" | 5 | const SERVICE_NAME = "mmm-worth" |
| 6 | 6 | ||
| 7 | var LOG_LEVEL = "debug" | 7 | var LOG_LEVEL = "debug" |
| 8 | +var ABILITY_SERVICE_HOST = "https://ability-test.fjmaimaimai.com" | ||
| 8 | 9 | ||
| 9 | func init() { | 10 | func init() { |
| 10 | if os.Getenv("LOG_LEVEL") != "" { | 11 | if os.Getenv("LOG_LEVEL") != "" { |
| 11 | LOG_LEVEL = os.Getenv("LOG_LEVEL") | 12 | LOG_LEVEL = os.Getenv("LOG_LEVEL") |
| 12 | } | 13 | } |
| 14 | + if os.Getenv("ABILITY_SERVICE_HOST") != "" { | ||
| 15 | + ABILITY_SERVICE_HOST = os.Getenv("ABILITY_SERVICE_HOST") | ||
| 16 | + } | ||
| 13 | } | 17 | } |
| 1 | +package service_gateway | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/constant" | ||
| 5 | + "strings" | ||
| 6 | + "time" | ||
| 7 | +) | ||
| 8 | + | ||
| 9 | +type HttplibAbilityServiceGateway struct { | ||
| 10 | + httplibBaseServiceGateway | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +func (serviceGateway *HttplibAbilityServiceGateway) CommitQuestionQuotes(uid int64, taskId int64, serials []int64) (map[string]interface{}, error) { | ||
| 14 | + url := strings.Join([]string{serviceGateway.baseURL, "task/commitQuestionQuotes"}, "/") | ||
| 15 | + request := serviceGateway.createRequest(url, "post") | ||
| 16 | + options := make(map[string]interface{}) | ||
| 17 | + options["uid"] = uid | ||
| 18 | + options["taskId"] = taskId | ||
| 19 | + options["serials"] = serials | ||
| 20 | + request.JSONBody(options) | ||
| 21 | + response := make(map[string]interface{}) | ||
| 22 | + request.ToJSON(&response) | ||
| 23 | + data, err := serviceGateway.responseHandle(response) | ||
| 24 | + return data, err | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +func (serviceGateway *HttplibAbilityServiceGateway) CommitQuestionSolution(qid int64, uid int64, solveUid int64, content string, scoreSolve float64, imgs []string, partners []map[string]interface{}) (map[string]interface{}, error) { | ||
| 28 | + url := strings.Join([]string{serviceGateway.baseURL, "task/commitQuestionSolution"}, "/") | ||
| 29 | + request := serviceGateway.createRequest(url, "post") | ||
| 30 | + options := make(map[string]interface{}) | ||
| 31 | + options["qid"] = qid | ||
| 32 | + options["uid"] = uid | ||
| 33 | + options["solveUid"] = solveUid | ||
| 34 | + options["content"] = content | ||
| 35 | + options["scoreSolve"] = scoreSolve | ||
| 36 | + options["imgs"] = imgs | ||
| 37 | + options["partners"] = partners | ||
| 38 | + request.JSONBody(options) | ||
| 39 | + response := make(map[string]interface{}) | ||
| 40 | + request.ToJSON(&response) | ||
| 41 | + data, err := serviceGateway.responseHandle(response) | ||
| 42 | + return data, err | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +func NewHttplibAbilityServiceGateway() *HttplibAbilityServiceGateway { | ||
| 46 | + return &HttplibAbilityServiceGateway{ | ||
| 47 | + httplibBaseServiceGateway: httplibBaseServiceGateway{ | ||
| 48 | + baseURL: constant.ABILITY_SERVICE_HOST, | ||
| 49 | + connectTimeout: 100 * time.Second, | ||
| 50 | + readWriteTimeout: 30 * time.Second, | ||
| 51 | + }, | ||
| 52 | + } | ||
| 53 | +} |
| 1 | +package service_gateway | ||
| 2 | + | ||
| 3 | +type AbilityServiceGateway interface { | ||
| 4 | + CommitQuestionQuotes(uid int64, taskId int64, serials []int64) (map[string]interface{}, error) | ||
| 5 | + CommitQuestionSolution(qid int64, uid int64, solveUid int64, content string, scoreSolve float64, imgs []string, partners []map[string]interface{}) (map[string]interface{}, error) | ||
| 6 | +} |
-
请 注册 或 登录 后发表评论