package com.easyproject.clientbus.service.operate.impl;

import cn.hutool.core.util.ObjectUtil;
import com.easyproject.clientbus.service.operate.IOperateWebsiteSetService;
import com.easyproject.common.core.domain.AjaxClientResult;
import com.easyproject.common.utils.wx.WxAppletNotifyUtils;
import com.easyproject.service.domain.operate.OperateWebsiteSet;
import com.easyproject.service.mapper.operate.OperateWebsiteSetMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 方法说明: 网站设置
 * @param
 * @return
 * @author java-101
 * @date 2025-03-23 16:15:39
 */
@Slf4j
@Service
public class OperateWebsiteSetServiceImpl implements IOperateWebsiteSetService {

    @Resource
    private OperateWebsiteSetMapper operateWebsiteSetMapper;
    @Resource
    private WxAppletNotifyUtils wxAppletNotifyUtils;

    /**
     * 方法说明: 查询网站设置
     * @param
     * @return
     * @author java-101
     * @date 2025-03-23 16:19:20
     */
    @Override
    public AjaxClientResult selWebsiteSet() {
        OperateWebsiteSet websiteSet = operateWebsiteSetMapper.selectById(1);
        if(ObjectUtil.isNotEmpty(websiteSet)){
            //获取微信小程序链接
            websiteSet.setUrlLink(wxAppletNotifyUtils.getWxAppletUrlLink(null, null, 30));
            websiteSet.setShortLink(wxAppletNotifyUtils.getWxAppletShortLink("pages/ index/ index", "蜀商小智", false));
        }
        return AjaxClientResult.success(websiteSet);
    }
}
