package com.qxgmat.controller.api;

import com.alibaba.fastjson.JSONObject;
import com.nuliji.tools.Response;
import com.nuliji.tools.ResponseHelp;
import com.qxgmat.data.constants.enums.SettingKey;
import com.qxgmat.data.dao.entity.*;
import com.qxgmat.service.inline.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/base")
@Api(tags = "商城接口", description = "商城相关接口", produces = MediaType.APPLICATION_JSON_VALUE)
public class ShopController {

    @Autowired
    private SettingService settingService;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ApiOperation(value = "商品信息", httpMethod = "GET")
    private Response<JSONObject> index(){
        Setting entity = settingService.getByKey(SettingKey.INDEX);
        return ResponseHelp.success(entity.getValue());
    }

    @RequestMapping(value = "/pay/wechat", method = RequestMethod.POST)
    @ApiOperation(value = "通过微信支付", notes = "通过微信支付", httpMethod = "POST")
    public Response<Boolean> wechat() {
        return ResponseHelp.success(null);
    }

    @RequestMapping(value = "/pay/alipay", method = RequestMethod.POST)
    @ApiOperation(value = "通过支付宝支付", notes = "通过支付宝支付", httpMethod = "POST")
    public Response<Boolean> alipay() {
        return ResponseHelp.success(null);
    }

    @RequestMapping(value = "/pay/query", method = RequestMethod.GET)
    @ApiOperation(value = "支付结果查询", notes = "支付结果查询", httpMethod = "GET")
    public Response<Boolean> response(
            @RequestParam(required = true, name="id") Long payId
    ) {
        return ResponseHelp.success(null);
    }
}
