package com.cm.central.control.client.socket.service.socket.error;

import com.alibaba.fastjson.JSONObject;
import com.cm.central.control.client.socket.service.socket.BaseSocketService;
import com.cm.socket.pojo.Message;
import com.cm.socket.pojo.SocketResult;
import io.netty.channel.ChannelHandlerContext;
import org.springframework.stereotype.Service;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: ErrorServiceImpl
 * @Description: error业务
 * @Author: WangGeng
 * @Date: 2020/7/29 10:22 下午
 * @Version: 1.0
 **/
@Service("errorServiceImpl")
public class ErrorServiceImpl extends BaseSocketService {

    @Override
    protected void readMessageService(ChannelHandlerContext channelHandlerContext, Message readMessage) {
        SocketResult<String> result = JSONObject.parseObject(readMessage.getContent(), SocketResult.class);
        LOG.error(result.getErrorMsg());
    }

    @Override
    public void autoReply(ChannelHandlerContext channelHandlerContext) {

    }
}
