Skip to content

Commit 12769b6

Browse files
李海燕李海燕
authored andcommitted
update log lib
1 parent 26532b5 commit 12769b6

3 files changed

Lines changed: 60 additions & 31 deletions

File tree

getui.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import (
1616
"encoding/json"
1717
"errors"
1818
"fmt"
19+
"github.com/zituocn/logx"
1920
"strings"
2021
"time"
2122

2223
"github.com/zituocn/getui-push/models"
2324

2425
"github.com/zituocn/gow/lib/goredis"
25-
"github.com/zituocn/gow/lib/logy"
2626
)
2727

2828
var (
@@ -108,7 +108,7 @@ func (g *PushClient) GetToken() (token string, err error) {
108108
rdb := goredis.GetRDB()
109109
token, err = rdb.Get(ctx, g.Key).Result()
110110
if err != nil {
111-
logy.Errorf("%s 在redis中获取token失败 :%s", NAME, err.Error())
111+
logx.Errorf("%s 在redis中获取token失败 :%s", NAME, err.Error())
112112
}
113113
if token == "" {
114114
token, err = getToken(g.AppId, g.AppKey, g.MasterSecret)
@@ -118,7 +118,7 @@ func (g *PushClient) GetToken() (token string, err error) {
118118
}
119119
_, err = rdb.SetEX(ctx, g.Key, token, time.Duration(expTime)).Result()
120120
if err != nil {
121-
logy.Errorf("%s 在redis中存储token失败 :%s", NAME, err.Error())
121+
logx.Errorf("%s 在redis中存储token失败 :%s", NAME, err.Error())
122122
}
123123
}
124124
return
@@ -608,7 +608,7 @@ func (g *PushClient) PushListByCid(msgType int, cid []string, payload *models.Cu
608608
respList, err := pushListByCid(g.AppId, token, pushListParam)
609609

610610
if err != nil {
611-
logy.Errorf("%s 按cid群推失败: %s", NAME, err.Error())
611+
logx.Errorf("%s 按cid群推失败: %s", NAME, err.Error())
612612
}
613613
data = append(data, respList)
614614
time.Sleep(time.Microsecond * 500) //休眠500ms
@@ -883,7 +883,7 @@ func getPushMessageAndChannel(msgType int, scheduleTime int, payload *models.Cus
883883
// "notifyType": -1,
884884
// }
885885
//
886-
// logy.Errorf("小米新的channel")
886+
// logx.Errorf("小米新的channel")
887887
//
888888
// //vivo
889889
// android.Ups.Options.Vv.Classification = 0
@@ -936,7 +936,7 @@ func getPushMessageAndChannel(msgType int, scheduleTime int, payload *models.Cus
936936
"/extra.channel_id": ximiChannelId,
937937
"notifyType": -1,
938938
}
939-
//logy.Errorf("【小米推送】channelID:%v", ximiChannelId)
939+
//logx.Errorf("【小米推送】channelID:%v", ximiChannelId)
940940

941941
//华为
942942
huaweiChannelId, huaweiCategory, importance := MessageType(msgType).GetHuaweiInfo()
@@ -947,14 +947,14 @@ func getPushMessageAndChannel(msgType int, scheduleTime int, payload *models.Cus
947947
"/message/android/notification/visibility": "PUBLIC", //最新接口已没有此参数
948948
"/message/android/notification/importance": importance,
949949
}
950-
//logy.Errorf("【华为】channelId:%v, category:%v, importance:%v", huaweiChannelId, huaweiCategory, importance)
950+
//logx.Errorf("【华为】channelId:%v, category:%v, importance:%v", huaweiChannelId, huaweiCategory, importance)
951951

952952
//荣耀
953953
honorImportance := MessageType(msgType).GetHonorImportance()
954954
android.Ups.Options.Ho = map[string]interface{}{
955955
"/android/notification/importance": honorImportance,
956956
}
957-
//logy.Errorf("【荣耀】importance:%v", honorImportance)
957+
//logx.Errorf("【荣耀】importance:%v", honorImportance)
958958

959959
//vivo
960960
vvClassification := MessageType(msgType).GetViVoClassification()
@@ -964,14 +964,14 @@ func getPushMessageAndChannel(msgType int, scheduleTime int, payload *models.Cus
964964
"/notifyType": 4,
965965
"/category": vvCategory,
966966
}
967-
//logy.Errorf("【vivo】classification:%v, category:%v", vvClassification, vvCategory)
967+
//logx.Errorf("【vivo】classification:%v, category:%v", vvClassification, vvCategory)
968968

969969
// oppo
970970
oppoChannelId := MessageType(msgType).GetOPPOChannelId()
971971
android.Ups.Options.Op = map[string]interface{}{
972972
"/channel_id": oppoChannelId,
973973
}
974-
//logy.Errorf("【oppo】channelId:%v", oppoChannelId)
974+
//logx.Errorf("【oppo】channelId:%v", oppoChannelId)
975975
}
976976
pushChannel = &models.PushChannel{
977977
Android: android,

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ go 1.16
44

55
require (
66
github.com/tidwall/gjson v1.14.3
7-
github.com/zituocn/gow v1.2.1
7+
github.com/zituocn/gow v1.3.0
8+
github.com/zituocn/logx v0.0.2
89
)

0 commit comments

Comments
 (0)