package com.zzsn.api;


import com.zzsn.cache.JedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 后台跳转控制类
 * 创建人：李东亮   
 * 创建时间：2015-5-7 下午6:52:37   
 * 公司 ：郑州数能软件科技有限公司
 * @version  1.0  
 *
 */
@Slf4j
@Controller
@RequestMapping("/wxt")
public class WeixinController {

//	http://localhost:8079/wxt/dofiddlerbackurl?wxurl=1
	@RequestMapping(value ="/test", method = RequestMethod.GET)
	@ResponseBody
	public String  test(){
		return "hello!";
	}
	

	@RequestMapping("dofiddlerbackurl")
	public @ResponseBody String doFiddlerbackforurl(String wxurl,String oldurl) throws Exception
	{
		String keyid= SiteService.getParambyname(oldurl, "signature");
		String wxid= JedisUtil.getString(keyid);

		if(StringUtils.isNotEmpty(wxid)&&StringUtils.isNotEmpty(wxurl)) {
			JedisUtil.setString(oldurl,wxurl,0);
		}

		return "123";
	}


	@RequestMapping("dofiddlerbackurl111")
	public @ResponseBody String doFiddlerbackforurl111(String wxurl,String oldurl) throws Exception
	{
		System.out.println(wxurl);
		System.out.println(oldurl);
		String keyid=SiteService.getParambyname(oldurl, "signature");
		String wxid=JedisUtil.getString(keyid);
//		siteService.updateBasedata(wxid, wxurl);
		return "123";
	}

	
}
