package cn.exploring.engine.server.admin.web;

import cn.exploring.engine.server.core.util.ResponseUtil;
import cn.exploring.engine.server.db.service.WxUserService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

@RestController
@RequestMapping("/admin/dashboard")
@Validated
public class AdminDashbordController {
    private final Log logger = LogFactory.getLog(AdminDashbordController.class);

    @Autowired
    private WxUserService userService;

    @GetMapping("")
    public Object info() {
        int userTotal = userService.count();

        Map<String, Integer> data = new HashMap<>();
        data.put("userTotal", userTotal);


        return ResponseUtil.ok(data);
    }

}
