|
|
@@ -8,6 +8,7 @@ import cn.reghao.tnb.account.api.iface.AccountQuery;
|
|
|
import cn.reghao.tnb.content.api.dto.DanmakuSbtDto;
|
|
|
import cn.reghao.tnb.content.app.vod.db.mongo.UserDanmakuMongo;
|
|
|
import cn.reghao.tnb.content.app.vod.model.po.UserDanmaku;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
@@ -19,6 +20,7 @@ import java.util.List;
|
|
|
*/
|
|
|
@Service
|
|
|
public class DanmakuService {
|
|
|
+ @DubboReference(check = false, retries = 0, timeout = 60_000)
|
|
|
private AccountQuery accountQuery;
|
|
|
|
|
|
private final UserDanmakuMongo userDanmakuMongo;
|
|
|
@@ -30,13 +32,18 @@ public class DanmakuService {
|
|
|
}
|
|
|
|
|
|
public Result submit(DanmakuSbtDto danmakuSbtDto) {
|
|
|
- String token = danmakuSbtDto.getToken();
|
|
|
- AuthedAccount authedAccount = accountQuery.getAuthedAccount(TokenType.token.getValue(), token);
|
|
|
- if (authedAccount == null) {
|
|
|
- return Result.fail("not auth");
|
|
|
+ long loginUser = -1L;
|
|
|
+ String midHash = danmakuSbtDto.getMidHash();
|
|
|
+ if (midHash == null) {
|
|
|
+ String token = danmakuSbtDto.getToken();
|
|
|
+ AuthedAccount authedAccount = accountQuery.getAuthedAccount(TokenType.token.getValue(), token);
|
|
|
+ if (authedAccount == null) {
|
|
|
+ return Result.fail("not auth");
|
|
|
+ }
|
|
|
+
|
|
|
+ loginUser = authedAccount.getUserId();
|
|
|
}
|
|
|
|
|
|
- long loginUser = authedAccount.getUserId();
|
|
|
long dmId = snowFlake.nextId();
|
|
|
UserDanmaku userDanmaku = new UserDanmaku(dmId, danmakuSbtDto, loginUser);
|
|
|
userDanmakuMongo.save(userDanmaku);
|