package com.yonge.cooleshow.admin.controller.open;

import com.yonge.cooleshow.biz.dal.service.UserAccountService;
import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.yonge.cooleshow.common.entity.MallOrderItemDto;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/open")
@Api(value = "开放权限接口", tags = "开放权限接口")
public class OpenUserAccountController extends BaseController {
    private final static Logger log = LoggerFactory.getLogger(OpenUserAccountController.class);



    @Autowired
    private UserAccountService userAccountService;


    /**
     * 设置商城收入分润
     */
    @PostMapping("/mallRecord")
    public HttpResponseResult<Boolean> mallRecord(@RequestBody List<MallOrderItemDto> shareDto ) {
        return succeed(userAccountService.saveMallAccountRecord(shareDto));
    }



    /**
     * 设置商城收入状态
     */
    @PostMapping("/mallRecordState")
    public HttpResponseResult<Boolean> mallRecordState(@RequestBody List<MallOrderItemDto> shareDto ) {
        userAccountService.mallTeacherRecordState(shareDto);
        return succeed();
    }
}
