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

import cn.exploring.engine.server.core.util.ResponseUtil;
import cn.exploring.engine.server.db.util.RedisUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 测试服务
 */
@RestController
@RequestMapping("/wx/index")
public class WxIndexController {

    @Resource
    private RedisUtil redisUtil; //redis 缓存

    private final Log logger = LogFactory.getLog(WxIndexController.class);

    /**
     * 测试数据
     *
     * @return 测试数据
     */
    @RequestMapping("/index")
    public Object index() {
        return ResponseUtil.ok("hello world, this is wx service");
    }

    //删除缓存数据
    @GetMapping("/remove/cache")
    public Object removeCache(String key) {
        redisUtil.removeObjFrom1And2Cache(key);
        return cn.exploring.engine.server.db.util.ResponseUtil.ok(key);
    }
}
