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 = "8FF9B4CE9E24C58994C55609A11DC5FE06FD98980467652F92461A7EBDD1B2397840749ECCD5439D0E607FE90C350FED0D2F51994C5ADD5B88172A47E918D51E171D0F2E2CBED68B2D21229434951991E073311A11B7F5A09302A85343875D91AE682BA8FE2ED567E7B47CA560FF09B5FF3AD4260F282362577E549C2ECC80231D691227A01A8F49645393ECBAE047B15870E08938DEB47CB83D8578B13DDC0786322201B50D4E048A9749EC28FD2E05247E3B89AD7C430C60C8D51CC45B96FFBE6F45C9F0E436492E1CF4816C5FFF4372E4BF9C75F857B172C93A7CF3311604";
        if (!headers.get("Authorization").equals(Authorization)) {
            return Result.error("sign 验证不通过");
        }
        okkiSiteService.save(okkiSite);
        return Result.OK("添加成功！");
    }
}
