You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
3.3 KiB
102 lines
3.3 KiB
package common
|
|
|
|
import (
|
|
"hudongzhuanjia/controllers"
|
|
im_service "hudongzhuanjia/services/im"
|
|
"time"
|
|
)
|
|
|
|
type ImTestCtl struct {
|
|
controllers.BaseCtl
|
|
}
|
|
|
|
func (t *ImTestCtl) SendNotice() {
|
|
activityId := t.MustGetInt64("activity_id")
|
|
status := t.MustGetInt("status")
|
|
|
|
im_service.SendGroupCustomMessage(1, activityId, im_service.NoticeStatus(status), map[string]interface{}{
|
|
"customer_id": 16,
|
|
"shake_red_envelope_rule_id": 5,
|
|
"timestamp": time.Now().Unix(),
|
|
})
|
|
t.SUCCESS("发送成功")
|
|
}
|
|
|
|
func (t *ImTestCtl) SendRedPack() {
|
|
activityId := t.MustGetInt64("activity_id")
|
|
prompt := t.MustGet("prompt")
|
|
|
|
im_service.SendGroupCustomMessage(1, activityId, im_service.NoticeLiveRedPackStart,
|
|
map[string]interface{}{
|
|
"live_red_envelope_rule_id": 1,
|
|
"prompt": prompt,
|
|
"timestamp": time.Now().Unix(),
|
|
})
|
|
t.SUCCESS("发送成功")
|
|
}
|
|
|
|
type LotteryUser struct {
|
|
UserId int64
|
|
Username string
|
|
UserPhone string
|
|
Avatar string
|
|
PrizeName string
|
|
LadderId int64
|
|
PrizeImg string
|
|
}
|
|
|
|
func (t *ImTestCtl) SendLottery() {
|
|
activityId := t.MustGetInt64("activity_id")
|
|
ladderId := t.MustGetInt64("lottery_draw_ladder_id")
|
|
desc := t.MustGet("desc")
|
|
notice := t.MustGetInt("notice")
|
|
if notice == 264 {
|
|
winners := make([]*LotteryUser, 0)
|
|
winners = append(winners, &LotteryUser{
|
|
UserId: 1,
|
|
Username: "哗啦啦@黄梓健",
|
|
UserPhone: "18814098671",
|
|
Avatar: "http://thirdwx.qlogo.cn/mmopen/vi_32/U8krFYdib9PITkDicbaNPnJHKpUMJ8unribzyPcUKWKGyJovoKmES6UHW1Zl6bVsUUtmFjyzsUTrajAJ53icZpEcgw/132",
|
|
PrizeName: "白金王座",
|
|
LadderId: ladderId,
|
|
PrizeImg: "http://thirdwx.qlogo.cn/mmopen/vi_32/U8krFYdib9PITkDicbaNPnJHKpUMJ8unribzyPcUKWKGyJovoKmES6UHW1Zl6bVsUUtmFjyzsUTrajAJ53icZpEcgw/132",
|
|
})
|
|
winners = append(winners, &LotteryUser{
|
|
UserId: 3,
|
|
Username: "明月清风",
|
|
UserPhone: "18814098673",
|
|
Avatar: "http://thirdwx.qlogo.cn/mmopen/vi_32/ZbibUK9Ywia2TtmQCxlyQPrxqKKzed1q4IWA5EUhMEgDiaKOnDODVrAvtKGE9qpFFZYoYfdsZrm63HKMKMA7on38A/132",
|
|
PrizeName: "白银王座",
|
|
LadderId: ladderId,
|
|
PrizeImg: "http://thirdwx.qlogo.cn/mmopen/vi_32/U8krFYdib9PITkDicbaNPnJHKpUMJ8unribzyPcUKWKGyJovoKmES6UHW1Zl6bVsUUtmFjyzsUTrajAJ53icZpEcgw/132",
|
|
})
|
|
winners = append(winners, &LotteryUser{
|
|
UserId: 4,
|
|
Username: "Liujw",
|
|
UserPhone: "18814098672",
|
|
Avatar: "http://thirdwx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLCO4qnL4BtyfjDQHhYmU8MgUZK11cABc8KFY7oenQYNErtm0n2ibfFB4QkFXfT3tVNMGqibDb3Oib30Q/132",
|
|
PrizeName: "青铜王座",
|
|
LadderId: ladderId,
|
|
PrizeImg: "http://thirdwx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLCO4qnL4BtyfjDQHhYmU8MgUZK11cABc8KFY7oenQYNErtm0n2ibfFB4QkFXfT3tVNMGqibDb3Oib30Q/132",
|
|
})
|
|
im_service.SendGroupCustomMessage("admin", activityId, im_service.NoticeStatus(notice),
|
|
map[string]interface{}{
|
|
"lottery_draw_ladder_id": ladderId,
|
|
"winners": winners,
|
|
"timestamp": time.Now().Unix(),
|
|
"desc": desc,
|
|
})
|
|
|
|
} else {
|
|
num := t.MustGetInt("num")
|
|
im_service.SendGroupCustomMessage("admin", activityId, im_service.NoticeStatus(notice),
|
|
map[string]interface{}{
|
|
"lottery_draw_ladder_id": ladderId,
|
|
"timestamp": time.Now().Unix(),
|
|
"desc": desc,
|
|
"number": num,
|
|
})
|
|
}
|
|
|
|
t.SUCCESS("恭喜这B")
|
|
}
|