package com.fdkankan.platform.user.controller.sso;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fdkankan.platform.order.entity.SpaceSdk;
import com.fdkankan.platform.user.request.RequestManager;
import com.fdkankan.platform.user.request.RequestSdkVersion;
import com.fdkankan.platform.user.service.sso.SsoManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 登陆管理-app登陆模块
 */
@RestController
@RequestMapping("/service/sso/manager")
public class SsoManagerController {

    @Autowired
    private SsoManagerService ssoManagerService;

    /**
     * 管理员登录
     * userName      手机号
     * password      密码
     * @return
     */
    @PostMapping(value = "/login")
    public JSONObject login(@RequestBody RequestManager param) throws Exception {
        return ssoManagerService.login(param);
    }
    /**
     * 追溯后台管理登陆
     * userName      手机号
     * password      密码
     * @return
     */
    @PostMapping(value = "/companyLogin")
    public JSONObject companyLogin(@RequestBody RequestManager param) throws Exception {
        return ssoManagerService.companyLogin(param);
    }
    /**
     * 登出
     */
    @PostMapping(value = "/logout")
    public String logout(@RequestHeader String token) throws Exception {
        return ssoManagerService.logout(token);
    }
    /**
     * 获取sdk列表
     * @return
     */
    @PostMapping(value = "/space/list")
    public Page<SpaceSdk> spaceList(@RequestBody RequestSdkVersion param) throws Exception {
        return ssoManagerService.spaceList(param);
    }


}
