package com.ruoyi.pda.controller;


import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.pda.domain.APKVersion;
import com.ruoyi.pda.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangh on 2020/7/17-15:18。
 */
@RestController
@RequestMapping("/api")
public class LoginController {
    @Autowired
    LoginService service;



    @GetMapping("/login/finduser")
    public AjaxResult finduser(String name, String pass){
        System.out.println("登录名称= "+name+" pass= "+pass);
        return service.login(name,pass);
    }

    @GetMapping("/getVersion")
    public String getVersion(){
        APKVersion apkVersion=service.getVersion();
        apkVersion.setCode(0);
        apkVersion.setMsg("");
        if (apkVersion==null){
            apkVersion=new APKVersion();
            apkVersion.setUpdateStatus(0);


        }else {
            apkVersion.setUpdateStatus(1);
        }


        String s = JSONObject.toJSONString(apkVersion);
        System.out.println("请求版本信息"+s);
        return s;
    }



}
