package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"encoding/hex"
"fmt"
"log"
"net/url"
"strconv"
"time"
//"log"
//"net/url"
//"net/url"
//"net/url"
//"encoding/base64"
//"encoding/hex"
//"net/url"
//"encoding/json"
//"log"
//"strconv"
//"time"
)
//
//import (
// "fmt"
// "strconv"
// "strings"
//)
//
//func CreateList(num int, len int) []int{
// var list []int
// if (len <= 0 || num <0) {
// return list
// }
// for i := 0; i < len; i++ {
// if i == num {
// list = append(list,1)
// } else {
// list = append(list,0)
// }
// }
// return list
//}
//
//
//func main() {
// date := "2020-09-01 21:00:00"
// year := strings.Split(date, "-")
//
// fmt.Printf("year: %v\n", year)
// time := strings.Split(year[2], " ")
//
// fmt.Printf("time: %v\n", time[0])
// hour := strings.Split(time[1], ":")
// fmt.Printf("hour: %v\n", hour[0])
// val,_ := strconv.Atoi(hour[0])
// fmt.Printf("hour==: %v\n", val)
//
//
//
// var featureList []int
// var list []int
// list = append(list, 100)
// //list := []int{1, 2, 3}
//
// featureList = append(featureList, 20)
// featureList = append(featureList, 20)
// featureList = append(featureList, 20)
// featureList = append(featureList, 20)
//
// //list = append(list, {0, 1, 2})
// //list[0] = 1
// //list[1] = 2
// //list[2] = 3
//
//
// var gist [7]int
// gist[0] = 4
// gist[1] = 5
// gist[2] = 6
//
// featureList = append(featureList, list...)
//
//
//
// iist := CreateList(1, 10)
//
// featureList = append(featureList, iist...)
// //a := []int{1, 2, 3}
// //b := []int{2, 3, 4, 5, 6}
// //a = append(a, b...)
// fmt.Println(featureList)
//
// featureL := featureList[2:]
// fmt.Println(featureL)
//}
//package main
//func main() {
//var testtype = map[int][][]int{
// 1: {},
// 2: {
// {1, 2, 3},
// {1,2, 3,4},
// {5},
// },
// 3: {
// {6}, //车票
// {7},
// {8},
// {9,10}, //功能引导
// },
//}
//for _, priLine := range testtype[2] {
// fmt.Print(priLine)
// for _, p := range priLine {
// //fmt.Print(p)
// //return
// }
//
//}
//fmt.Print(time.Now().Format("20060102"))
//var passengerID int64
//passengerID = 10102030
//spid := strconv.FormatInt(passengerID, 10)
//offset := int(time.Monday - time.Now().Weekday())
fmt.Print(time.Now().Weekday())
//offset = -2
//if offset > 0 {
// offset = -6
//}
//weekStartDate := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
//weekMonday := weekStartDate.Format("20060102")
//key := "watson_commute_feq_" + spid + "_" + weekMonday
//fmt.Print("=======", key)
//}
package main
import (
"fmt"
"encoding/json"
)
type FromType int
type EventType int
type PushType int
func main() {
//r := gin.Default()
//r.GET("/ping", func(c *gin.Context) {
//
// c.JSON(200, gin.H{
// "message": "pong",
// })
//
//})
//fmt.Printf("come on")
//r.Run() // listen and serve on 0.0.0.0:808
//
//0
const (
FromTypeDefault FromType = 1 //默认来源
FromTypePush FromType = 2 //从push侧来
FromTypeMainPageBubble FromType = 3 //从首页气泡进来
FromTypeOrderDuringBubble FromType = 4 //从行程中气泡进来
FromType65MainPageBubble FromType = 5 //从6.5新版首页进来
FromTypeWeatherIcon FromType = 6 //从端内常驻天气进来
FromTypeWaitForAnswer FromType = 7 //等待应答
EventTypeDefault EventType = 0 //默认
EventTypeExtremeWeather EventType = 1 //极端天气
EventTypeAbnormalWeather EventType = 2 //异常天气
EventTypeAbnormalTriffic EventType = 3 //路况异常
EventTypeAbnormalQueue EventType = 4 //排队异常
EventTypePeakWarning EventType = 5 //高峰预警
EventTypeTripRemind EventType = 6 //出行预警
EventTypeKuakua EventType = 7 //夸夸机器人
EventTypeTips EventType = 8 //滴滴贴士/常用工具/沟通卡片,都是一个意思
//EventTypeFestival EventType = 9 //节日临时方案
EventTypeTicket EventType = 10 //车票
EventTypeBackend EventType = 11 //后台推送
EventTypeCommuteRemind EventType = 12 //通勤引导
EventTypeEmoteCompany EventType = 13 //互动情感关怀:当前定位在公司(设置了公司地址,或推测公司地址)
EventTypeEmoteTransport EventType = 14 //互动情感关怀:当前定位在非常驻城市、大型交通枢纽
EventTypeGuideIndex EventType = 15 //功能引导,3次/1天/用户
EventTypeGuideNoCommute EventType = 16 //功能引导:没有填写完整通勤地址并且没有预测地址,1次/7天/用户
EventTypeTask EventType = 17 //任务
EventTypeCaiDanChe EventType = 18 //彩蛋车
EventTypeBusCode EventType = 19 //乘车码
EventTypeRechargeForOther EventType = 20 //代人充值
EventTypeCoupon EventType = 21 //功能引导:优惠卷导流
EventTypeCoupon65Version EventType = 22 //优惠卷导流,6.5版本新首页用,主要是文案不同
EventTypeDefault65Version EventType = 23 //6.5版本兜底
EventTypeBindCard EventType = 24 //绑卡提醒
EventTypeFuyao EventType = 25 //扶摇
EventTypeFuyao65Version EventType = 26 //扶摇6.5
EventTypeEmotionCare EventType = 27 //情感关怀配置化
EventTypeFestival EventType = 28 //新节日方案
EventTypeSuperMember EventType = 29 //超级会员
EventTypeWeatherIcon EventType = 30 //端内常驻天气icon
//EventTypeIndexPage EventType = 1 //首页气泡
//EventTypeOrderPage EventType = 2 //订单页气泡
)
var eventTypePriority = map[FromType][][]EventType{
FromTypePush: {},
FromTypeMainPageBubble: {
{EventTypeRechargeForOther},
{EventTypeAbnormalTriffic, EventTypeAbnormalQueue, EventTypeTripRemind, EventTypePeakWarning},
{EventTypeExtremeWeather},
{EventTypeAbnormalWeather},
{EventTypeFuyao},
{EventTypeCoupon},
{EventTypeFestival},
{EventTypeCommuteRemind, EventTypeGuideIndex, EventTypeGuideNoCommute}, //功能引导
{EventTypeEmoteCompany, EventTypeEmoteTransport, EventTypeEmotionCare},
{EventTypeDefault},
},
FromTypeOrderDuringBubble: {
{EventTypeTicket}, //车票
{EventTypeTask},
{EventTypeBindCard},
{EventTypeBusCode}, //乘车码
{EventTypeSuperMember}, //付费会员
{EventTypeCommuteRemind, EventTypeGuideNoCommute}, //功能引导
{EventTypeCaiDanChe},
{EventTypeKuakua, EventTypeTips},
},
FromType65MainPageBubble: {
{EventTypeFuyao65Version},
{EventTypeCoupon65Version},
{EventTypeDefault65Version}, //情感关怀
},
FromTypeWaitForAnswer: {
{EventTypeTips},
},
}
eventType, err := json.Marshal(eventTypePriority)
if err == nil {
str := string(eventType);
fmt.Print(str)
}
//fmt.Printf("hello\n")
}
//
//
//package main
//
//import "fmt"
//
//const (
// Light_Rain = "LIGHT_RAIN"
// Moderate_Rain = "MODERATE_RAIN"
// Heavy_Rain = "HEAVY_RAIN"
// Storm_Rain = "STORM_RAIN"
// Light_Snow = "LIGHT_SNOW"
// Moderate_Snow = "MODERATE_SNOW"
// Heavy_Snow = "HEAVY_SNOW"
// Storm_Snow = "STORM_SNOW"
//)
//
//
//func IsRain(weather string) bool {
// switch weather {
// case Light_Rain:
// fallthrough
// case Moderate_Rain:
// fallthrough
// case Heavy_Rain:
// fallthrough
// case Storm_Rain:
// fallthrough
// case Light_Snow:
// fallthrough
// case Moderate_Snow:
// fallthrough
// case Heavy_Snow:
// fallthrough
// case Storm_Snow:
// return true
// }
// return false
//}
//
//func GetAboWeatherName(weather string) string {
// switch weather {
// case Light_Rain:
// return "小雨"
// case Moderate_Rain:
// return "中雨"
// case Heavy_Rain:
// return "大雨"
// case Storm_Rain:
// return "暴雨"
// case Light_Snow:
// return "小雪"
// case Moderate_Snow:
// return "中雪"
// case Heavy_Snow:
// return "大雪"
// case Storm_Snow:
// return "暴雪"
// }
// return ""
//}
//
//func main() {
// weather := "LIGHT_RAIN"
// RealTime, level:= 0, 1
// flg := true
// if flg {
// RealTime = 2
// } else if level > 1 {
// RealTime = 1
// }
// if IsRain(weather) {
// fmt.Print("小雨")
// }
// if RealTime == 1 {
// fmt.Print("woxiaole")
// }
// return
//}
//package main
//
//import "fmt"
//
//func main() {
// var age int = 23
// if age <= 26 {
// fmt.Println("true")
// } else if age < 25 {
// fmt.Println("too small")
// }
//}
//package main
//
//import (
// "encoding/json"
// "fmt"
//)
//
//type AbnormalWeatherExt struct {
// A string `json:"a"`
// WeatherType string `json:"weather_type"`
//}
//
//type AbnormalWeatherExtn struct {
// A string `json:"a"`
// //WeatherType string `json:"weather_type"`
//}
//
//func main() {
// tpe := AbnormalWeatherExtn{
// A: "hello",
// }
// str, _ := json.Marshal(tpe)
// tpe1 := &AbnormalWeatherExt{}
// err := json.Unmarshal(str, tpe1)
// if err != nil {
// fmt.Printf("err = %v", err.Error())
// return
// }
// fmt.Print("no err")
// return
//}
//package main
//
//import "fmt"
//
//type student struct {
// Name string
// Age int
//}
//
//func pase_student() {
// m := make(map[string]*student)
// stus := []student{
// {
// Name: "zhou",
// Age: 24,
// }, {
// Name: "li",
// Age: 23,
// }, {
// Name: "wang",
// Age: 22,
// },
// }
// for _, stu := range stus {
// //stu := stu
// stu.Name = "1"
// m[stu.Name] = &stu
// }
//
// fmt.Printf("%v\n", stus)
// //
// //for _, stu := range m {
// // fmt.Println("name: ",stu,"age: ",stu)
// //}
//}
//
//func main() {
// pase_student()
//}
//package main
//
//import "fmt"
//
//func main() {
// picklist := make([]int, 10, 10)
// for i := 0; i < 10; i++ {
// picklist = append(picklist, i)
// }
// fmt.Print(picklist)
//}
//
/*************************对channel进行测试***********************/
//package main
//
//import (
// "fmt"
// "reflect"
// "sync"
//
// //"fmt"
// //"reflect"
// "time"
//)
//
//
//type ConcurrentMap struct {
// m sync.Map
// keyType reflect.Type
// valueType reflect.Type
//}
//
//func (cm *ConcurrentMap)test(key interface{}) {
// if reflect.TypeOf(key) == cm.keyType {
// fmt.Println("test")
// }
// fmt.Println("gan")
//}
//
//func main() {
// c := make(chan int)
//
// go func() {
// c <- 1 // send to channel
// }()
// //c <- 1
//
// time.Sleep(10)
// x := <-c // recv from channel
// var h string
// h = "1"
// fmt.Println(x)
// var a reflect.Type
// type test1 interface {
//
// }
// //type test2 interface {
// //
// //}
// var kk test1
// //kk = 1
// //var zz test2
// var z *ConcurrentMap
// var a reflect.Type
// z = &ConcurrentMap{
// keyType: a,
// }
// if reflect.TypeOf(kk) == z.
AES的加密算法
最新推荐文章于 2022-05-01 13:51:16 发布