package com.platform.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

@Service
public class FdkkService {

    @Value("${fdkankan.host}")
    private String kankanHost;

    @Autowired
    private RestTemplate restTemplate;

    /**
     * 登录指房宝
     * @param username
     * @param password
     * @return
     */
    public ResponseEntity<String> login(String username, String password) {
        Map<String,String> params = new HashMap<>();
        params.put("password",password);
        params.put("phoneNum",username);
        String url = kankanHost + "api/sso/user/getToken";
        return restTemplate.postForEntity(url, params, String.class);
    }
}
