Files
iotlcm/upstream-proxy/internal/logic/channelconfig/channel_update.go
T

31 lines
971 B
Go

package channelconfig
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/internal/dao"
"git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-upstream-proxy/internal/service"
"github.com/gogf/gf/v2/frame/g"
)
type sChannelUpdate struct{}
func NewChannelUpdate() *sChannelUpdate {
return &sChannelUpdate{}
}
func init() {
service.RegisterChannelUpdate(NewChannelUpdate())
}
func (s *sChannelUpdate) UpdateAccessToken(ctx context.Context, input *model.UpdateAccessTokenInput) error {
_, err := dao.TSimChannels.Ctx(ctx).Where(dao.TSimChannels.Columns().ChanKey, input.ChanKey).Update(g.Map{
dao.TSimChannels.Columns().AccessToken: input.AccessToken,
dao.TSimChannels.Columns().AccessTokenCreated: input.AccessTokenCreated,
dao.TSimChannels.Columns().AccessTokenExpire: input.AccessTokenExpire,
dao.TSimChannels.Columns().RefreshToken: input.RefreshToken,
})
return err
}