package com.caimei.www.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 兼容旧链接
 *
 * @author : Charles
 * @date : 2020/6/12
 */
@Controller
public class RedirectController {
	/**
	 * 供应商首页【旧】
	 */
	@GetMapping("/supplier/prolist-{id}.html")
	public String toSupplier(@PathVariable("id") Integer supplierId) {
		return "redirect:/supplier/index.html?id=" + supplierId;
	}
	/**
	 * 供应商商品页【旧】
	 */
	@GetMapping("/supplier/productlist-{id}.html")
	public String toSupplierProduct(@PathVariable("id") Integer supplierId) {
		return "redirect:/supplier/index.html?id=" + supplierId;
	}
	/**
	 * 二级页面（找产品/找仪器/找项目/正品联盟）【旧】
	 */
	@GetMapping("/cmpage/info-1-{id}.html")
	public String toTopic(@PathVariable("id") Integer type) {
		return "redirect:/topic.html?type=" + type;
	}
	/**
	 * 项目仪器详情【旧】
	 */
	@GetMapping("/cmpage/info-2-{id}.html")
	public String toequipment(@PathVariable("id") Integer equipmentId) {
		return "redirect:/equipment/detail.html?id=" + equipmentId;
	}
	/**
	 * 直播页面【旧】
	 */
	@GetMapping("/cmpage/info-3-{id}.html")
	public String toLive(@PathVariable("id") Integer id) {
		return "redirect:/live.html?id=" + id;
	}
	/**
	 * 自由页面【旧】
	 */
	@GetMapping("/cmpage/info-4-{id}.html")
	public String toFreePage(@PathVariable("id") Integer id) {
		return "redirect:/page.html?id=" + id;
	}
	/**
	 * 专题活动列表页【旧】
	 */
	@GetMapping("/cmpage/area.html")
	public String toPromotions() {
		return "redirect:/promotions.html";
	}

    /**
     * 品牌招商介绍页【旧】
     */
	@GetMapping("/html/InvestmentCaiMei/investmentpage.jsp")
	public String toInvestment() {
		return "redirect:/investment.html";
	}

    /**
     * 维修保养介绍页【旧】
     */
    @GetMapping("/html/maintenance/view/mt-entry-index.jsp")
    public String torepair() {
		return "redirect:/repair.html";
	}

    /**
     * 二手市场介绍
     */
    @GetMapping("/html/secondHand/introduction.jsp")
    public String toFleaMarket() {
        return "redirect:/flea-market/intro.html";
    }
    /**
     * 二手商品列表
     */
    @GetMapping("/html/secondHand/secondList.jsp")
    public String toFleaMarketList() {
        return "redirect:/flea-market/list.html";
    }
    /**
     * 二手商品发布
     */
    @GetMapping("/html/maintenance/view/secondtransactions.jsp")
    public String toFleaMarketForm() {
        return "redirect:/flea-market/form.html";
    }

    /**
     * 商品搜索列表
     */
    @GetMapping("/product/search/list/0-0-0-1-0.html")
    public String toSearchProduct(@RequestParam("wd") String keyword) {
        return "redirect:/product/list.html?keyword=" + keyword;
    }
    @GetMapping("/product/search.shtml")
    public String toSearchProduct2(@RequestParam("keyword") String keyword) {
        return "redirect:/product/list.html?keyword=" + keyword;
    }


}
