|
@@ -17,51 +17,57 @@ import (
|
|
|
|
|
|
//专门处理活动定时任务相关的业务逻辑
|
|
|
|
|
|
-//func init() {
|
|
|
-// PushVmpRobotMeeting()
|
|
|
-//}
|
|
|
-
|
|
|
type VmpRobotMeeting struct {
|
|
|
- ModeID int `json:"mode_id"`
|
|
|
- PhoneNumber string `json:"phone_number"`
|
|
|
- MeetingPassword string `json:"meeting_password"`
|
|
|
- MeetingStartTime time.Time `json:"meeting_start_time"`
|
|
|
- MeetingTitle string `json:"meeting_title"`
|
|
|
- MeetingTypeID int `json:"meeting_type_id"`
|
|
|
- ParsingMethodID int `json:"parsing_method_id"`
|
|
|
- IndustryID int `json:"industry_id"`
|
|
|
- FieldID int `json:"field_id"`
|
|
|
- Stock string `json:"stock"`
|
|
|
- Remark string `json:"remark"`
|
|
|
- ProjectID int `json:"project_id"`
|
|
|
- AuthorPhoneNumber int64 `json:"author_phone_number"`
|
|
|
- ExecutionStatusID int `json:"execution_status_id"`
|
|
|
- ParsingID int `json:"parsing_id"`
|
|
|
- SerialNumber string `json:"serial_number"`
|
|
|
- ChannelID int `json:"channel_id"`
|
|
|
- IsActive int `json:"is_active"`
|
|
|
+ ModeID int `json:"mode_id"`
|
|
|
+ PhoneNumber string `json:"phone_number"`
|
|
|
+ MeetingPassword string `json:"meeting_password"`
|
|
|
+ MeetingStartTime string `json:"meeting_start_time"`
|
|
|
+ MeetingTitle string `json:"meeting_title"`
|
|
|
+ MeetingTypeID int `json:"meeting_type_id"`
|
|
|
+ ParsingMethodID int `json:"parsing_method_id"`
|
|
|
+ IndustryID int `json:"industry_id"`
|
|
|
+ FieldID int `json:"field_id"`
|
|
|
+ Stock string `json:"stock"`
|
|
|
+ Remark string `json:"remark"`
|
|
|
+ ProjectID int `json:"project_id"`
|
|
|
+ AuthorPhoneNumber int64 `json:"author_phone_number"`
|
|
|
+ ExecutionStatusID int `json:"execution_status_id"`
|
|
|
+ ParsingID int `json:"parsing_id"`
|
|
|
+ SerialNumber string `json:"serial_number"`
|
|
|
+ ChannelID int `json:"channel_id"`
|
|
|
+ IsActive int `json:"is_active"`
|
|
|
+}
|
|
|
+
|
|
|
+type VmpRobotMeetingDataResult struct {
|
|
|
+ Code int `json:"code"`
|
|
|
+ Msg string `json:"msg"`
|
|
|
+ Data VmpRobotMeetingResult `json:"data"`
|
|
|
}
|
|
|
|
|
|
type VmpRobotMeetingResult struct {
|
|
|
- ModeID int `json:"mode_id"`
|
|
|
- PhoneNumber string `json:"phone_number"`
|
|
|
- MeetingPassword string `json:"meeting_password"`
|
|
|
- MeetingStartTime time.Time `json:"meeting_start_time"`
|
|
|
- MeetingTitle string `json:"meeting_title"`
|
|
|
- MeetingTypeID int `json:"meeting_type_id"`
|
|
|
- ParsingMethodID int `json:"parsing_method_id"`
|
|
|
- IndustryID int `json:"industry_id"`
|
|
|
- FieldID int `json:"field_id"`
|
|
|
- Stock string `json:"stock"`
|
|
|
- Remark string `json:"remark"`
|
|
|
- ProjectID int `json:"project_id"`
|
|
|
- AuthorPhoneNumber int64 `json:"author_phone_number"`
|
|
|
- ExecutionStatusID int `json:"execution_status_id"`
|
|
|
- ParsingID int `json:"parsing_id"`
|
|
|
- SerialNumber string `json:"serial_number"`
|
|
|
- ChannelID int `json:"channel_id"`
|
|
|
- IsActive int `json:"is_active"`
|
|
|
- VmpRobotMeetinId int `json:"id"`
|
|
|
+ ModeID int `json:"mode_id"`
|
|
|
+ PhoneNumber string `json:"phone_number"`
|
|
|
+ MeetingPassword string `json:"meeting_password"`
|
|
|
+ MeetingStartTime string `json:"meeting_start_time"`
|
|
|
+ MeetingTitle string `json:"meeting_title"`
|
|
|
+ MeetingTypeID int `json:"meeting_type_id"`
|
|
|
+ ParsingMethodID int `json:"parsing_method_id"`
|
|
|
+ IndustryID int `json:"industry_id"`
|
|
|
+ FieldID int `json:"field_id"`
|
|
|
+ Stock string `json:"stock"`
|
|
|
+ Remark string `json:"remark"`
|
|
|
+ ProjectID int `json:"project_id"`
|
|
|
+ AuthorPhoneNumber int64 `json:"author_phone_number"`
|
|
|
+ ExecutionStatusID int `json:"execution_status_id"`
|
|
|
+ ParsingID int `json:"parsing_id"`
|
|
|
+ SerialNumber string `json:"serial_number"`
|
|
|
+ ChannelID int `json:"channel_id"`
|
|
|
+ IsActive int `json:"is_active"`
|
|
|
+ VmpRobotMeetinId int `json:"id"`
|
|
|
+}
|
|
|
+
|
|
|
+func init() {
|
|
|
+ PushVmpRobotMeeting()
|
|
|
}
|
|
|
|
|
|
// 研选活动会前15分钟推送给上海那边的机器人
|
|
@@ -86,34 +92,17 @@ func PushVmpRobotMeeting() (err error) {
|
|
|
err = errors.New("GetCygxActivityList, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
+ fmt.Println(len(listActivity))
|
|
|
+
|
|
|
+ //return
|
|
|
if len(listActivity) == 0 {
|
|
|
return
|
|
|
}
|
|
|
for _, v := range listActivity {
|
|
|
- type VmpRobotMeeting struct {
|
|
|
- ModeID int `json:"mode_id"`
|
|
|
- PhoneNumber string `json:"phone_number"`
|
|
|
- MeetingPassword string `json:"meeting_password"`
|
|
|
- MeetingStartTime string `json:"meeting_start_time"`
|
|
|
- MeetingTitle string `json:"meeting_title"`
|
|
|
- MeetingTypeID int `json:"meeting_type_id"`
|
|
|
- ParsingMethodID int `json:"parsing_method_id"`
|
|
|
- IndustryID int `json:"industry_id"`
|
|
|
- FieldID int `json:"field_id"`
|
|
|
- Stock string `json:"stock"`
|
|
|
- Remark string `json:"remark"`
|
|
|
- ProjectID int `json:"project_id"`
|
|
|
- AuthorPhoneNumber int64 `json:"author_phone_number"`
|
|
|
- ExecutionStatusID int `json:"execution_status_id"`
|
|
|
- ParsingID int `json:"parsing_id"`
|
|
|
- SerialNumber string `json:"serial_number"`
|
|
|
- ChannelID int `json:"channel_id"`
|
|
|
- IsActive int `json:"is_active"`
|
|
|
- }
|
|
|
item := new(VmpRobotMeeting)
|
|
|
item.ModeID = 2
|
|
|
- item.PhoneNumber = v.MainlandTell
|
|
|
- item.MeetingPassword = v.ParticipationCode
|
|
|
+ item.PhoneNumber = utils.GetArabicNumbers(v.MainlandTell)
|
|
|
+ item.MeetingPassword = utils.GetArabicNumbers(v.ParticipationCode) + "#" // 业务需求,必须带有一个#
|
|
|
item.MeetingStartTime = v.ActivityTime
|
|
|
item.MeetingTitle = v.ActivityName
|
|
|
item.MeetingTypeID = 1
|
|
@@ -129,43 +118,65 @@ func PushVmpRobotMeeting() (err error) {
|
|
|
item.SerialNumber = ""
|
|
|
item.ChannelID = -1
|
|
|
item.IsActive = 1
|
|
|
- jsonBody, err := json.Marshal(item)
|
|
|
- if err != nil {
|
|
|
+ jsonBody, e := json.Marshal(item)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("json.Marshal, Err: " + e.Error())
|
|
|
fmt.Println("json.Marshal Err:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
+ fmt.Println(item)
|
|
|
+ //return
|
|
|
tr := &http.Transport{
|
|
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
|
|
}
|
|
|
client := &http.Client{Transport: tr}
|
|
|
- req, err := http.NewRequest("POST", postUrl, strings.NewReader(string(jsonBody)))
|
|
|
- if err != nil {
|
|
|
- fmt.Println("err:" + err.Error())
|
|
|
+ req, e := http.NewRequest("POST", postUrl, strings.NewReader(string(jsonBody)))
|
|
|
+ if e != nil {
|
|
|
+ err = e
|
|
|
return
|
|
|
}
|
|
|
req.Header.Set("Content-Type", "application/json")
|
|
|
req.Header.Set("Authorization", authorization)
|
|
|
- resp, err := client.Do(req)
|
|
|
- if err != nil {
|
|
|
+ resp, e := client.Do(req)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("client.Do Err: " + e.Error())
|
|
|
fmt.Println("client.Do Err:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
fmt.Println("resp")
|
|
|
fmt.Println(resp)
|
|
|
defer resp.Body.Close()
|
|
|
- body, err := ioutil.ReadAll(resp.Body)
|
|
|
- if err != nil {
|
|
|
+ body, e := ioutil.ReadAll(resp.Body)
|
|
|
+ if e != nil {
|
|
|
fmt.Println("err:" + err.Error())
|
|
|
+ err = e
|
|
|
return
|
|
|
}
|
|
|
fmt.Println("body:", string(body))
|
|
|
- result := new(VmpRobotMeetingResult)
|
|
|
- err = json.Unmarshal(body, &result)
|
|
|
-
|
|
|
- vmpRobotMeetinId := result.VmpRobotMeetinId
|
|
|
+ result := new(VmpRobotMeetingDataResult)
|
|
|
+ e = json.Unmarshal(body, &result)
|
|
|
+ if e != nil {
|
|
|
+ fmt.Println(" json.Unmarshal Err:" + err.Error())
|
|
|
+ err = errors.New("json.Unmarshal Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ vmpRobotMeetinId := result.Data.VmpRobotMeetinId
|
|
|
fmt.Println("vmpRobotMeetinId", vmpRobotMeetinId)
|
|
|
fmt.Println(result)
|
|
|
fmt.Println(v.ActivityId)
|
|
|
+ e = models.UpdateActivityVmpRobotMeetingId(vmpRobotMeetinId, v.ActivityId)
|
|
|
+ if e != nil {
|
|
|
+ fmt.Println("UpdateActivityVmpRobotMeetingId Err:" + err.Error())
|
|
|
+ err = errors.New("UpdateActivityVmpRobotMeetingId Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ itemlog := new(models.CygxShanghaiCompanyLog)
|
|
|
+ itemlog.CreateTime = time.Now()
|
|
|
+ itemlog.Url = postUrl
|
|
|
+ itemlog.Body = string(jsonBody)
|
|
|
+ itemlog.Result = string(body)
|
|
|
+ go models.AddCygxShanghaiCompanyLog(itemlog)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return
|