package org.jeecg.modules.api.okki.site.controller;

import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.api.okki.site.entity.OkkiSite;
import org.jeecg.modules.api.okki.site.service.IOkkiSiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RequestMapping("website")
public class ShopApiController {

    @Autowired
    private IOkkiSiteService okkiSiteService;

    @PostMapping(value = "/add")
    public Result<String> add(@RequestBody OkkiSite okkiSite, @RequestHeader Map<String, String> headers) {
        String Authorization = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImRlYW4iLCJleHAiOjE3MTQ0NjU5Njl9.QdCBYR8mioXcKGi1n5RdMQ5RbJHCSGbE8dkdwYuOXh4";
        if (!headers.get("Authorization").equals(Authorization)) {
            return Result.error("sign 验证不通过");
        }
        okkiSiteService.save(okkiSite);
        return Result.OK("添加成功！");
    }
}
