package com.uas.platform.b2b.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.uas.platform.b2b.model.AccessToken;
import com.uas.platform.b2b.model.UserBaseInfo;
import com.uas.platform.b2b.redis.dao.AccessTokenDao;
import com.uas.platform.b2b.service.AccessTokenService;
import com.uas.platform.b2b.support.SystemSession;

@Service("AccessTokenServiceImpl")
public class AccessTokenServiceImpl implements AccessTokenService {

	@Autowired
	private AccessTokenDao accessTokenDao;

	@Override
	public AccessToken createNew(Object bindObject, int expires_in) {
		AccessToken token = new AccessToken(SystemSession.getUser(), bindObject, expires_in);
		accessTokenDao.save(token);
		return token;
	}

	@Override
	public AccessToken findOne(String id) {
		return accessTokenDao.findOne(id);
	}

	@Override
	public void delete(String id) {
		accessTokenDao.delete(id);
	}

}
