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
@@ -45,6 +45,8 @@ func (s *Storage) Reset() {
|
||||
s.setBoltDB(storage.IosErrorKey, 0)
|
||||
s.setBoltDB(storage.AndroidSuccessKey, 0)
|
||||
s.setBoltDB(storage.AndroidErrorKey, 0)
|
||||
s.setBoltDB(storage.HuaweiSuccessKey, 0)
|
||||
s.setBoltDB(storage.HuaweiErrorKey, 0)
|
||||
}
|
||||
|
||||
func (s *Storage) setBoltDB(key string, count int64) {
|
||||
@@ -91,6 +93,18 @@ func (s *Storage) AddAndroidError(count int64) {
|
||||
s.setBoltDB(storage.AndroidErrorKey, total)
|
||||
}
|
||||
|
||||
// AddHuaweiSuccess record counts of success Huawei push notification.
|
||||
func (s *Storage) AddHuaweiSuccess(count int64) {
|
||||
total := s.GetHuaweiSuccess() + count
|
||||
s.setBoltDB(storage.HuaweiSuccessKey, total)
|
||||
}
|
||||
|
||||
// AddHuaweiError record counts of error Huawei push notification.
|
||||
func (s *Storage) AddHuaweiError(count int64) {
|
||||
total := s.GetHuaweiError() + count
|
||||
s.setBoltDB(storage.HuaweiErrorKey, total)
|
||||
}
|
||||
|
||||
// GetTotalCount show counts of all notification.
|
||||
func (s *Storage) GetTotalCount() int64 {
|
||||
var count int64
|
||||
@@ -130,3 +144,19 @@ func (s *Storage) GetAndroidError() int64 {
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
// GetHuaweiSuccess show success counts of Huawei notification.
|
||||
func (s *Storage) GetHuaweiSuccess() int64 {
|
||||
var count int64
|
||||
s.getBoltDB(storage.HuaweiSuccessKey, &count)
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
// GetHuaweiError show error counts of Huawei notification.
|
||||
func (s *Storage) GetHuaweiError() int64 {
|
||||
var count int64
|
||||
s.getBoltDB(storage.HuaweiErrorKey, &count)
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user