package com.gree.mall.manager.controller.admin;

import com.gree.mall.manager.helper.ResponseHelper;
import com.gree.mall.manager.logic.admin.AdminCompanyWechatOtherLogic;
import com.gree.mall.manager.plus.entity.AdminCompanyWechatOther;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@Api(value = "小程序其他配置", tags = {"小程序其他配置"})
@RequestMapping(value = "/admin/company/other", produces = "application/json; charset=utf-8")
public class AdminCompanyWechatOtherController {


    @Autowired
    private AdminCompanyWechatOtherLogic adminCompanyWechatOtherLogic;


    @GetMapping("/getOne")
    @ApiOperation("获取企业其他配置")
    public ResponseHelper<AdminCompanyWechatOther> getOne(HttpServletRequest request) {

        return ResponseHelper.success(adminCompanyWechatOtherLogic.getOne(request));
    }

    @PostMapping("/init")
    @ApiOperation("初始化其他配置")
    public ResponseHelper init(
            @ApiParam(value = "企业微信id", required = true) @RequestParam String companyId,
            @ApiParam(value = "企业名称", required = true) @RequestParam String companyName) {
        adminCompanyWechatOtherLogic.init(companyId, companyName);
        return ResponseHelper.success();
    }



    @ApiOperation("更新其他配置")
    @PostMapping("/update")
    public ResponseHelper update(@RequestBody AdminCompanyWechatOther other,HttpServletRequest request) {
        adminCompanyWechatOtherLogic.update(other,request);
        return ResponseHelper.success();
    }
}
