package com.yifu.cloud.plus.v1.yifu.common.dapr.util;

import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author fxj
 * @Date 2022/7/11
 * @Description
 * @Version 1.0
 */
@Log4j2
@Component
@EnableConfigurationProperties(DaprArchivesProperties.class)
public class SettleDomainUtil {
	@Autowired
	private DaprArchivesProperties daprArchivesProperties;
	public R<List<String>> 	getSettleDomainIdsByUserId(){
		R<List<String>> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/tsettledomain/getSettleDomainIdsByUserId","", Object.class, SecurityConstants.FROM_IN);
		if (Common.isEmpty(res)){
			return R.failed("获取用户项目权限失败！");
		}
		return res;
	}
}
