Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev back end #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified back-end/common/target/common.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,12 @@ public UserDetails loadUserByUsername(String username) {

@Override
public User getCurrentLoginUser(String username) {
// SecurityContext ctx = SecurityContextHolder.getContext();
// Authentication auth = ctx.getAuthentication();
// AdminUserDetails adminUserDetails = (AdminUserDetails)auth.getPrincipal();
// return adminUserDetails.getUser();

return getAdminByUsername(username);
}

@Override
public Long getCurrentUserId() {
// return getCurrentLoginUser().getId();
return 0l;
}

Expand Down
Binary file modified back-end/framework/target/framework.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
where
account.state = 1 and info.is_deleted = 0
order by onlineNumber DESC
LIMIT 4;
LIMIT 5;
</select>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.live.entry.LiveAccount;
import com.live.entry.LiveInfo;
import com.live.entry.LiveTag;
import com.live.entry.LiveType;
Expand Down Expand Up @@ -83,6 +84,8 @@ public ResultObject getEditInfo(Long userID) {

LiveType liveType = liveTypeService.getBaseMapper().selectById(liveInfo.getTypeId());

QueryWrapper<LiveAccount> liveAccountQueryWrapper = new QueryWrapper<>();
liveAccountQueryWrapper.eq("user_id",userID);


LiveInfoShowVo liveInfoShowVo = new LiveInfoShowVo();
Expand All @@ -92,10 +95,8 @@ public ResultObject getEditInfo(Long userID) {
if(liveType != null){
liveInfoShowVo.setType(liveType.getType());
liveInfoShowVo.setTypeId(liveType.getId());

}


return ResultObject.success(liveInfoShowVo,"获取成功");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public Boolean creteLiveRoom(User user) {
liveAccount.setLivePath(livePath);
liveAccount.setState(0);
liveAccount.setUserId(user.getId());
liveAccount.setOnlineNumber(0l);

return save(liveAccount);
}
Expand Down Expand Up @@ -196,7 +197,7 @@ public Boolean judgeUnPublish(String livePath) {
//修改为暂时下播状态
status.setTime(System.currentTimeMillis());
status.setResultCode(ResultCode.UNPUBLISH_TEMP);

LiveConstant.statusMap.put(usersService.getUserNameById(userId),status);
//将直播间里的状态修改为0
liveAccount.setState(0);
if(baseMapper.updateById(liveAccount) > 0){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ public class LiveInfoShowVo {
private long typeId;
private String type;
private List<LiveTag> tag;
private String coverUrl;
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
where
account.state = 1 and info.is_deleted = 0
order by onlineNumber DESC
LIMIT 4;
LIMIT 5;
</select>


Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified back-end/liveStream/target/classes/com/live/vo/LiveInfoShowVo.class
Binary file not shown.
Binary file modified back-end/liveStream/target/liveStream.jar
Binary file not shown.
Binary file modified back-end/user/target/user.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion back-end/web/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ spring:
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/live?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://localhost:3306/live?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
type: com.alibaba.druid.pool.DruidDataSource
druid:
#初始化连接池大小
Expand Down
78 changes: 77 additions & 1 deletion back-end/web/src/test/java/com/live/web/WebApplicationTests.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,89 @@
package com.live.web;

import com.live.entry.User;
import com.live.service.impl.LiveInfoServiceImpl;
import com.live.service.impl.LiveRoomServiceImpl;
import com.live.service.impl.UserServiceImpl;
import com.live.services.impls.IUsersServiceImpl;
import com.live.vo.LiveInfoVo;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;

@SpringBootTest
import javax.annotation.Resource;

@SpringBootTest(classes = WebApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class WebApplicationTests {

@Resource
private IUsersServiceImpl usersService;
@Autowired
private LiveRoomServiceImpl liveRoomService;
@Autowired
private LiveInfoServiceImpl liveInfoService;
@Test
void contextLoads() {

}

@Test
void createUser(){
//创建测试数据
String[] usernames = {"小酒窝","赴情深","薄情辞","慢半拍","踏歌行","初相识","饮晚风","江寰词" ,"耿风词","顾清辞"};
String[] titles = {"英雄联盟" ,
"DOTA2" ,
"CS:GO" ,
"APEX英雄" ,
"永劫无间" ,
"穿越火线" ,
"守望先锋" ,
"吃鸡行动" ,
"逃离塔科夫" ,
"传奇" };
String[] introduction = {"1","2","3","4","5","6","7","8","9","10"};


for (int i = 0; i < usernames.length; i++) {
User user = new User();
user.setName(usernames[i]);
user.setPwd("123456");
user.setMail("[email protected]");
//注册
usersService.register(user);
//创建直播间
user = usersService.getAdminByUsername(user.getName());
liveRoomService.creteLiveRoom(user);
//创建编辑直播间信息
LiveInfoVo liveInfoVo = new LiveInfoVo();
liveInfoVo.setTitle(titles[i]);
liveInfoVo.setIntroduction(introduction[i]);
liveInfoVo.setTypeId(2);

liveInfoService.saveLiveRoomInfo(liveInfoVo,user.getId());
}


}


















}
2 changes: 1 addition & 1 deletion back-end/web/target/classes/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ spring:
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/live?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://18.163.79.28:3306/live?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
type: com.alibaba.druid.pool.DruidDataSource
druid:
#初始化连接池大小
Expand Down
Binary file not shown.
Binary file modified back-end/web/target/web-0.0.1-SNAPSHOT.jar
Binary file not shown.
Binary file modified back-end/web/target/web-0.0.1-SNAPSHOT.jar.original
Binary file not shown.