账号模块通道、匹配规则功能完成

This commit is contained in:
welsir
2023-11-19 00:24:26 +08:00
parent 2814fe569a
commit beb543ea9f
4 changed files with 24 additions and 118 deletions
@@ -3,6 +3,7 @@ package org.example.core.exchange;
import org.example.api.VedioPublishApi;
import org.example.bean.section.PackageSection;
import org.example.core.route.DefaultRouteRuler;
import org.example.pojo.Video;
import org.example.pojo.VideoQueue;
import org.example.pojo.VideoToPublish;
@@ -38,17 +39,13 @@ public class Exchange {
private void checkAndProcessMessages() {
// 在这里检查消息队列,提取消息并调用publish方法
for (String routingKey : bindings.keySet()) {
if (bindings.containsKey(routingKey)) {
List<VideoQueue> queues = bindings.get(routingKey);
for (VideoQueue queue : queues) {
Object message = queue.dequeue();
if (message != null) {
VedioPublishApi.publishVideo(new VideoToPublish.Buider(message.toString(),queue.getCookies(),1).build());
}
}
}
}
// for (String channel : channels.keySet()) {
// List<PackageSection> packageSections = channels.get(channel);
// for (PackageSection packageSection : packageSections) {
// VedioPublishApi.publishVideo(VideoToPublish.builder()
// .videoPath(packageSection.getVideoPath()).cookies().build())
// }
// }
}
public void publish(String routingKey,PackageSection packageSection) {
@@ -1,7 +1,6 @@
package org.example.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.example.pojo.Video;
import org.example.pojo.VideoLabel;
public interface LabelMapper extends BaseMapper<VideoLabel> {
@@ -1,33 +1,22 @@
package org.example.pojo;
import java.util.List;
import lombok.*;
import org.example.bean.section.PackageSection;
/**
* @Description
* @Author welsir
* @Date 2023/9/4 22:08
*/
public class Video {
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Video extends PackageSection {
private Object message;
private String videoUrl;
private List<VideoType> videoType;
private String cookies;
public Video() {
}
public List<VideoType> getVideoType() {
return this.videoType;
}
public void setVideoType(List<VideoType> videoType) {
this.videoType = videoType;
}
public Object getMessage() {
return this.message;
}
public void setMessage(Object message) {
this.message = message;
}
}
@@ -1,6 +1,9 @@
package org.example.pojo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description
@@ -9,6 +12,9 @@ import lombok.Data;
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class VideoToPublish {
private String videoPath;
@@ -20,89 +26,4 @@ public class VideoToPublish {
private String title;
private String type;
private VideoToPublish(Buider buider){
this.videoPath = buider.videoPath;
this.cookies = buider.cookies;
this.coverPath = buider.coverPath;
this.devicePath = buider.devicePath;
this.tag = buider.tag;
this.title = buider.title;
this.type = buider.type;
}
public static class Buider{
private String videoPath;
private String cookies;
private PlatformType platform;
private String coverPath;
private String devicePath;
private String tag;
private String title;
private String type;
public Buider(String videoPath,String cookies,int platform){
this.videoPath = videoPath;
this.cookies = cookies;
this.platform = PlatformType.getPlatform(platform);
}
public Buider setCoverPath(String coverPath) {
this.coverPath = coverPath;
return this;
}
public Buider setDevicePath(String devicePath) {
this.devicePath = devicePath;
return this;
}
public Buider setTag(String tag) {
this.tag = tag;
return this;
}
public Buider setTitle(String title) {
this.title = title;
return this;
}
public Buider setType(String type) {
this.type = type;
return this;
}
public String getVideoPath() {
return videoPath;
}
public String getCookies() {
return cookies;
}
public String getCoverPath() {
return coverPath;
}
public String getDevicePath() {
return devicePath;
}
public String getTag() {
return tag;
}
public String getTitle() {
return title;
}
public String getType() {
return type;
}
public VideoToPublish build(){
return new VideoToPublish(this);
}
}
}