微调参数,支持随机notifyID

This commit is contained in:
Easy 2022-02-07 20:05:26 +08:00
parent ea29e2314b
commit e0b359f2a1
4 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,24 @@
<?php
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks
{
// define public methods as commands
public function buildMac()
{
$this->_exec("cd src && go build -o ../bin/gorush.mac");
}
public function testMac()
{
$this->_exec("bin/gorush.mac -c ../src/config/testdata/config.online.yml");
}
public function buildLinux()
{
$this->_exec("cd src && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ../bin/gorush");
}
}

Binary file not shown.

View File

@ -0,0 +1 @@
config.online.yml

View File

@ -12,6 +12,7 @@ import (
"strconv"
"strings"
"sync"
"math/rand"
)
var (
@ -80,9 +81,11 @@ func GetMINotification(req *PushNotification, pkg string) (*xmpush.Message, erro
Title: payload.PushTitle,
Description: payload.PushBody,
PassThrough: int32(passThrough),
NotifyType: 1,
NotifyType: 3,
NotifyID: rand.Int63n(1024),
RestrictedPackageName: pkg,
Extra: map[string]string{
"notify_effect": "1",
"notify_foreground": "1",
"channel_id": "high_system",
"channel_name": "服务提醒",