作者 linmadan

重构创建任务字段认‘证

... ... @@ -68,6 +68,8 @@ spec:
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: ABILITY_SERVICE_HOST
value: "https://ability-dev.fjmaimaimai.com"
volumes:
- name: accesslogs
emptyDir: {}
\ No newline at end of file
... ...
... ... @@ -68,6 +68,8 @@ spec:
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: ABILITY_SERVICE_HOST
value: "https://ability-test.fjmaimaimai.com"
volumes:
- name: accesslogs
emptyDir: {}
\ No newline at end of file
... ...
... ... @@ -22,15 +22,15 @@ type CreateTaskCommand struct {
// 引用资源项列表
ReferenceResourceItems []*domain.ReferenceResourceItem `json:"referenceResourceItems,omitempty"`
// 客户价值列表
CustomerValue []string `json:"customerValue" valid:"Required"`
CustomerValue []string `json:"customerValue,omitempty"`
// 任务性质
TaskNature string `json:"taskNature" valid:"Required"`
TaskNature string `json:"taskNature,omitempty"`
// 奖励素币
SuMoney float64 `json:"suMoney,omitempty"`
// 验收标准
AcceptanceStandard string `json:"acceptanceStandard" valid:"Required"`
AcceptanceStandard string `json:"acceptanceStandard,omitempty"`
// 任务描述
TaskDescription string `json:"taskDescription" valid:"Required"`
TaskDescription string `json:"taskDescription,omitempty"`
// 任务图片URL列表
TaskPictureUrls []string `json:"taskPictureUrls,omitempty"`
// 是否悬赏任务
... ...
... ... @@ -5,9 +5,13 @@ import "os"
const SERVICE_NAME = "mmm-worth"
var LOG_LEVEL = "debug"
var ABILITY_SERVICE_HOST = "https://ability-test.fjmaimaimai.com"
func init() {
if os.Getenv("LOG_LEVEL") != "" {
LOG_LEVEL = os.Getenv("LOG_LEVEL")
}
if os.Getenv("ABILITY_SERVICE_HOST") != "" {
ABILITY_SERVICE_HOST = os.Getenv("ABILITY_SERVICE_HOST")
}
}
... ...
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,
},
}
}
... ...
package service_gateway
type AbilityServiceGateway interface {
CommitQuestionQuotes(uid int64, taskId int64, serials []int64) (map[string]interface{}, error)
CommitQuestionSolution(qid int64, uid int64, solveUid int64, content string, scoreSolve float64, imgs []string, partners []map[string]interface{}) (map[string]interface{}, error)
}
... ...