package com.iamberry.wechat.service.member;

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

import com.iamberry.wechat.core.entity.member.ShareInfo;
import com.iamberry.wechat.face.member.ShareInfoService;
import com.iamberry.wechat.service.member.dao.ShareInfoDao;

@Service
public class ShareInfoServiceImpl implements ShareInfoService {

	@Autowired
	private ShareInfoDao shareInfoDao;
	@Override
	public int addShareInfo(ShareInfo share) {
		Integer i = shareInfoDao.addShareInfo(share);
		if(i > 0){
			return share.getShareId();
		}else{
			return 0;
		}
	}

	public ShareInfo getShareInfoByOpenidAndType(ShareInfo shareInfo){
		return shareInfoDao.getShareInfoByOpenidAndType(shareInfo);
	}
	
	/**
	 * 根据openid 和用户类型 查询一个分享信息
	 * create date 2016年6月3日
	 * @author 穆再兴
	 * @param shareId
	 * @return
	 */
	public ShareInfo getShareInfoById(Integer shareId){
		return shareInfoDao.getShareInfoById(shareId);
	}
}
