Add Huawei Mobile Services Support to Gorush (#523)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
committed by
GitHub
parent
3db8b4f006
commit
3918fab908
@@ -56,6 +56,8 @@ func (s *Storage) Reset() {
|
||||
s.setLevelDB(storage.IosErrorKey, 0)
|
||||
s.setLevelDB(storage.AndroidSuccessKey, 0)
|
||||
s.setLevelDB(storage.AndroidErrorKey, 0)
|
||||
s.setLevelDB(storage.HuaweiSuccessKey, 0)
|
||||
s.setLevelDB(storage.HuaweiErrorKey, 0)
|
||||
}
|
||||
|
||||
// AddTotalCount record push notification count.
|
||||
@@ -88,6 +90,18 @@ func (s *Storage) AddAndroidError(count int64) {
|
||||
s.setLevelDB(storage.AndroidErrorKey, total)
|
||||
}
|
||||
|
||||
// AddHuaweiSuccess record counts of success Huawei push notification.
|
||||
func (s *Storage) AddHuaweiSuccess(count int64) {
|
||||
total := s.GetHuaweiSuccess() + count
|
||||
s.setLevelDB(storage.HuaweiSuccessKey, total)
|
||||
}
|
||||
|
||||
// AddHuaweiError record counts of error Huawei push notification.
|
||||
func (s *Storage) AddHuaweiError(count int64) {
|
||||
total := s.GetHuaweiError() + count
|
||||
s.setLevelDB(storage.HuaweiErrorKey, total)
|
||||
}
|
||||
|
||||
// GetTotalCount show counts of all notification.
|
||||
func (s *Storage) GetTotalCount() int64 {
|
||||
var count int64
|
||||
@@ -127,3 +141,19 @@ func (s *Storage) GetAndroidError() int64 {
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
// GetHuaweiSuccess show success counts of Huawei notification.
|
||||
func (s *Storage) GetHuaweiSuccess() int64 {
|
||||
var count int64
|
||||
s.getLevelDB(storage.HuaweiSuccessKey, &count)
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
// GetHuaweiError show error counts of Huawei notification.
|
||||
func (s *Storage) GetHuaweiError() int64 {
|
||||
var count int64
|
||||
s.getLevelDB(storage.HuaweiErrorKey, &count)
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user