123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- package services
- import (
- "crypto/tls"
- "encoding/json"
- "io/ioutil"
- "net/http"
- "strings"
- //"context"
- "errors"
- "fmt"
- "hongze/hongze_cygx/models"
- "hongze/hongze_cygx/utils"
- "time"
- )
- //专门处理活动定时任务相关的业务逻辑
- //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 bool `json:"is_active"`
- }
- // 研选活动会前15分钟推送给上海那边的机器人
- // func PushVmpRobotMeeting(cont context.Context) (err error) {
- //func PushVmpRobotMeeting() (err error) {
- // defer func() {
- // if err != nil {
- // go utils.SendAlarmMsg("15分钟会议消息提醒失败", 2)
- // fmt.Println("发送失败,Err:", err.Error())
- // }
- // }()
- // var condition string
- // var pars []interface{}
- // endDate := time.Now().Add(+time.Minute * 15).Format(utils.FormatDateTime)
- // condition = ` AND activity_time <= ? AND activity_time >= NOW() AND publish_status = 1 AND chart_permission_id = ? AND vmp_robot_meeting_id = 0 AND active_state = 1 AND mainland_tell != '' OR activity_id = 4644 `
- // pars = append(pars, endDate, utils.CHART_PERMISSION_ID_YANXUAN)
- // listActivity, e := models.GetCygxActivityList(condition, pars, 0, 100)
- // if e != nil && e.Error() != utils.ErrNoRow() {
- // err = errors.New("GetCygxActivityList, Err: " + e.Error())
- // 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.MeetingStartTime = v.ActivityTime
- // item.MeetingTitle = v.ActivityName
- // item.MeetingTypeID = 1
- // item.ParsingMethodID = 0
- // item.IndustryID = 13
- // item.FieldID = 0
- // item.Stock = ""
- // item.Remark = v.Remarks // 处理HTML格式样式
- // item.ProjectID = 1
- // item.AuthorPhoneNumber = 15000123056 // 高亦文 手机号
- // item.ExecutionStatusID = 0
- // item.ParsingID = 0
- // item.SerialNumber = ""
- // item.ChannelID = -1
- // item.IsActive = 1
- // jsonBody, err := json.Marshal(item)
- // if err != nil {
- // fmt.Println("json.Marshal Err:" + err.Error())
- // 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())
- // return
- // }
- // req.Header.Set("Content-Type", "application/json")
- // req.Header.Set("Authorization", "APPCODE "+AlAppCode)
- // resp, err := client.Do(req)
- // if err != nil {
- // 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 {
- // fmt.Println("err:" + err.Error())
- // return
- // }
- // fmt.Println("body:", string(body))
- // utils.FileLog.Info(fmt.Sprintf("aliyun card;imgUrl:%s; Body:%s", imgUrl, string(body)))
- // err = json.Unmarshal(body, &result)
- // fmt.Println(v.ActivityId)
- // }
- //
- // return
- //}
|