package com.muyu.cloud.mart.controller;

import com.alibaba.fastjson.JSON;

import com.muyu.cloud.mart.config.IPLocation;
import com.muyu.cloud.mart.service.MarketService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.domain.Birthday;
import com.muyu.domain.IdCard;
import com.muyu.domain.Market;
import com.muyu.domain.Postcode;
import com.muyu.domain.res.BirthdayRes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author：chaiyapeng
 * @Package：com.muyu.cloud.etl.controller
 * @Project：cloud-mart
 * @name：MarketController
 * @Date：2024/8/21 21:53
 */
@RestController
@RequestMapping("list")
public class MarketController extends BaseController {

    @Autowired
    private MarketService marketService;
    @Autowired
    private RedisTemplate<String,String>redisTemplate;

//    @RequiresPermissions("mart:info:list")

    /**
     * 两千万条数据查询
     * @return
     */


    /**
     * 手机号查询归属地
     */
    @GetMapping("phonePlace")
    public Result cphonePlace(@RequestParam(name = "tel") String tel){
           return marketService.phonePlace(tel);
    }
    /**
     * IP查询归属地
     */
    @GetMapping("getIpPlace")
    public Result getIpPlace(@RequestParam(name = "ip") String ip){
        return marketService.getIpPlace(ip);
    }
    /**
     * 新闻头条
     */
    @GetMapping("getHeadlines")
    public Result getHeadlines(){
        return marketService.getHeadlines();
    }
    /**
     * 气象预警
     */
    @GetMapping("getWeather")
    public Result getWeather(){
        return marketService.getWeather();
    }
    /**
     * 生辰助手
     */
    @PostMapping("getBirthday")
    public Result getBirthday(@RequestBody BirthdayRes birthdayRes){
        return marketService.getBirthday(birthdayRes);
    }
    /**
     * 邮编查询
     */
    @GetMapping("getPostcode")
    public Result getPostcode(@RequestParam(name = "code") String code){
        return marketService.getPostcode(code);
    }
    /**
     * 天气预报
     */
    @GetMapping("getWeatherForecast")
    public Result getWeatherForecast(@RequestParam(name = "cityName") String cityName){
        return marketService.getWeatherForecast(cityName);
    }
    /**
     * 实名认证接口
     */
    @PostMapping("realName")
    public Result realName(@RequestBody IdCard idCard){
        return marketService.realName(idCard);
    }

}
