Commit 88973940 authored by Administrator's avatar Administrator

Merge branch 'staging' into 'master'

Staging

See merge request !179
parents 6c09e200 b5409c9a
...@@ -101,7 +101,7 @@ public class AdministratorController { ...@@ -101,7 +101,7 @@ public class AdministratorController {
public HashMap bankTransferInsert(@RequestBody UserBalance userBalance) { public HashMap bankTransferInsert(@RequestBody UserBalance userBalance) {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
try { try {
map.put("userbalance", paymentService.bankTransferInsertion(userBalance.getUsername(), (int) userBalance.getBalanced())); map.put("userbalance", paymentService.bankTransferInsertion(userBalance.getUsername(), (int) userBalance.getBalanced(), 3));
map.put("status", "success"); map.put("status", "success");
} catch (Exception e) { } catch (Exception e) {
map.put("status", "failed"); map.put("status", "failed");
......
...@@ -42,6 +42,8 @@ public class AccountDto { ...@@ -42,6 +42,8 @@ public class AccountDto {
private List<String> whiteList = new ArrayList<>(); private List<String> whiteList = new ArrayList<>();
private List<String> userWhiteList = new ArrayList<>();
private ShopSummary shopSummary; private ShopSummary shopSummary;
private IpSummary ipSummary; private IpSummary ipSummary;
...@@ -69,6 +71,7 @@ public class AccountDto { ...@@ -69,6 +71,7 @@ public class AccountDto {
this.setToken(account.getToken()); this.setToken(account.getToken());
this.setPermission(account.getPermission()); this.setPermission(account.getPermission());
this.setWhiteList(account.getWhiteList()); this.setWhiteList(account.getWhiteList());
this.setUserWhiteList(account.getWhiteList());
this.setQueryIpUrlList(account.getQueryIpUrlList()); this.setQueryIpUrlList(account.getQueryIpUrlList());
if (account.getPromotion() != null) { if (account.getPromotion() != null) {
this.setPromotion(account.getPromotion()); this.setPromotion(account.getPromotion());
...@@ -256,4 +259,12 @@ public class AccountDto { ...@@ -256,4 +259,12 @@ public class AccountDto {
public void setPromotionCode(String promotionCode) { public void setPromotionCode(String promotionCode) {
this.promotionCode = promotionCode; this.promotionCode = promotionCode;
} }
public List<String> getUserWhiteList() {
return userWhiteList;
}
public void setUserWhiteList(List<String> userWhiteList) {
this.userWhiteList = userWhiteList;
}
} }
...@@ -41,7 +41,7 @@ public class UserPrePaidBilling { ...@@ -41,7 +41,7 @@ public class UserPrePaidBilling {
private BillStatus status; private BillStatus status;
/** /**
* 0 -- 余额, 1 -- 支付宝, 2 -- 微信, 3 -- 银行转账 * 0 -- 余额, 1 -- 支付宝, 2 -- 微信, 3 -- 银行转账, 4--注册时赠送
*/ */
private int payMethod; private int payMethod;
......
...@@ -6,19 +6,19 @@ import com.edgec.browserbackend.account.domain.UserPaymentDto; ...@@ -6,19 +6,19 @@ import com.edgec.browserbackend.account.domain.UserPaymentDto;
public interface PaymentService { public interface PaymentService {
UserPaymentDto wxPutPayOrder(String username, int amount); UserPaymentDto wxPutPayOrder(String username, int amount);
String alipayPutPayOrder(String username, int amount, String by); String alipayPutPayOrder(String username, int amount, String by);
String wechatPayCallback(String tradno); String wechatPayCallback(String tradno);
UserPaymentDto wxCheckOrderStatus(String tradno, int chargeType); UserPaymentDto wxCheckOrderStatus(String tradno, int chargeType);
UserPaymentDto aliCheckOrderStatus(String tradno, int chargeType); UserPaymentDto aliCheckOrderStatus(String tradno, int chargeType);
void alipaCallback(String tradno); void alipaCallback(String tradno);
UserBalance bankTransferInsertion(String username, int amount); UserBalance bankTransferInsertion(String username, int amount, int payMethod);
UserPaymentDto h5wxPayOrder(String ip, String username, int amount); UserPaymentDto h5wxPayOrder(String ip, String username, int amount);
......
...@@ -477,7 +477,7 @@ public class AccountServiceImpl implements AccountService { ...@@ -477,7 +477,7 @@ public class AccountServiceImpl implements AccountService {
list.add("184"); list.add("184");
list.add("170"); list.add("170");
if (!StringUtils.isEmpty(account.getPhoneNumber()) && !list.contains(account.getPhoneNumber().substring(0, 3)) && inviter != null) { if (!StringUtils.isEmpty(account.getPhoneNumber()) && !list.contains(account.getPhoneNumber().substring(0, 3)) && inviter != null) {
paymentService.bankTransferInsertion(account.getName(), globalFieldRepository.findAll().get(0).getRegisterGift()); paymentService.bankTransferInsertion(account.getName(), globalFieldRepository.findAll().get(0).getRegisterGift(), 4);
} }
log.info("new account has been created: " + account.getName()); log.info("new account has been created: " + account.getName());
......
...@@ -310,7 +310,7 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -310,7 +310,7 @@ public class PaymentServiceImpl implements PaymentService {
} }
@Override @Override
public UserBalance bankTransferInsertion(String username, int amount) { public UserBalance bankTransferInsertion(String username, int amount, int payMethod) {
UserPayment bankOrder = new UserPayment(); UserPayment bankOrder = new UserPayment();
bankOrder.setUsername(username); bankOrder.setUsername(username);
...@@ -332,7 +332,7 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -332,7 +332,7 @@ public class PaymentServiceImpl implements PaymentService {
bill.setAmount(0); bill.setAmount(0);
bill.setUnit(null); bill.setUnit(null);
bill.setPeriod(0); bill.setPeriod(0);
bill.setPayMethod(3); bill.setPayMethod(payMethod);
bill.setUsername(username); bill.setUsername(username);
bill.setTotal((float) amount); bill.setTotal((float) amount);
bill.setStatus(BillStatus.PAID); bill.setStatus(BillStatus.PAID);
......
...@@ -3,7 +3,10 @@ package com.edgec.browserbackend.browser.controller; ...@@ -3,7 +3,10 @@ package com.edgec.browserbackend.browser.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.edgec.browserbackend.account.dto.ResultDto; import com.edgec.browserbackend.account.dto.ResultDto;
import com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode; import com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode;
import com.edgec.browserbackend.browser.dto.*; import com.edgec.browserbackend.browser.dto.ShopPageResultDto;
import com.edgec.browserbackend.browser.dto.ShopRequestDto;
import com.edgec.browserbackend.browser.dto.ShopResultDto;
import com.edgec.browserbackend.browser.dto.ShopStringResultDto;
import com.edgec.browserbackend.browser.service.IpAndShopService; import com.edgec.browserbackend.browser.service.IpAndShopService;
import com.edgec.browserbackend.browser.service.ShopService; import com.edgec.browserbackend.browser.service.ShopService;
import com.edgec.browserbackend.common.commons.error.ClientRequestException; import com.edgec.browserbackend.common.commons.error.ClientRequestException;
...@@ -275,52 +278,6 @@ public class ShopController { ...@@ -275,52 +278,6 @@ public class ShopController {
} }
/**
* 店铺收藏夹
*//*
@GetMapping("/favorites/{shopId}")
public ResultDto getFavoritesByShopId(Principal principal, @PathVariable("shopId") String shopId) {
ResultDto resultDto = new ResultDto();
try {
List<FavoriteUrl> list = shopService.getFavoritesByShopId(principal.getName(), shopId);
resultDto.setData(list);
resultDto.setStatus(0);
} catch (ClientRequestException e) {
dealClientRequestException(resultDto, e);
}
return resultDto;
}
*//**
* 店铺收藏夹 删除收藏
*//*
@DeleteMapping("/favorites/{shopId}")
public ResultDto deleteFavoritesByShopId(Principal principal, @PathVariable("shopId") String shopId, @RequestBody FavoriteUrl favoriteUrl) {
ResultDto resultDto = new ResultDto();
try {
resultDto.setData(shopService.deleteFavoritesByShopId(principal.getName(), shopId, favoriteUrl));
resultDto.setStatus(0);
} catch (ClientRequestException e) {
dealClientRequestException(resultDto, e);
}
return resultDto;
}
*//**
* 店铺收藏夹 新增收藏
*//*
@PostMapping("/favorites/{shopId}")
public ResultDto saveFavoritesByShopId(Principal principal, @PathVariable("shopId") String shopId, @RequestBody FavoriteUrl favoriteUrl) {
ResultDto resultDto = new ResultDto();
try {
resultDto.setData(shopService.saveFavoritesByShopId(principal.getName(), shopId, favoriteUrl));
resultDto.setStatus(0);
} catch (ClientRequestException e) {
dealClientRequestException(resultDto, e);
}
return resultDto;
}*/
private void dealClientRequestException(ResultDto resultDto, ClientRequestException e) { private void dealClientRequestException(ResultDto resultDto, ClientRequestException e) {
resultDto.setStatus(-1); resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>(); Map<String, Object> statusInfo = new HashMap<>();
......
...@@ -146,6 +146,11 @@ public class IpResource implements Serializable { ...@@ -146,6 +146,11 @@ public class IpResource implements Serializable {
*/ */
private int period; private int period;
/**
* KCP端口号
*/
private int secondaryProxyPort = -1;
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) { if (this == o) {
......
package com.edgec.browserbackend.browser.domain;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
/**
* @author xuxin
* @date 2020/9/25 14:54
* @description
*/
@Document(collection = "shopua")
public class ShopUA {
@Id
private String id;
private String platform;
private List<String> uaList;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public List<String> getUaList() {
return uaList;
}
public void setUaList(List<String> uaList) {
this.uaList = uaList;
}
}
...@@ -35,6 +35,8 @@ public class IpResourceDto { ...@@ -35,6 +35,8 @@ public class IpResourceDto {
private String specialLineIp; private String specialLineIp;
private int secondaryProxyPort = -1;
public IpResourceDto() { public IpResourceDto() {
} }
...@@ -52,6 +54,7 @@ public class IpResourceDto { ...@@ -52,6 +54,7 @@ public class IpResourceDto {
this.password = ipResource.getPassword(); this.password = ipResource.getPassword();
this.protocol = ipResource.getProtocol(); this.protocol = ipResource.getProtocol();
this.specialLine = ipResource.isSpecialLine(); this.specialLine = ipResource.isSpecialLine();
this.secondaryProxyPort = ipResource.getSecondaryProxyPort();
if (CollectionUtils.isNotEmpty(shopDtos)) { if (CollectionUtils.isNotEmpty(shopDtos)) {
this.bindShops = shopDtos; this.bindShops = shopDtos;
this.bindShop = shopDtos.get(0); this.bindShop = shopDtos.get(0);
...@@ -63,7 +66,6 @@ public class IpResourceDto { ...@@ -63,7 +66,6 @@ public class IpResourceDto {
this.bindHistories = ipResource.getBindHistory(); this.bindHistories = ipResource.getBindHistory();
else else
this.bindHistories = new ArrayList<>(); this.bindHistories = new ArrayList<>();
} }
public IpResourceDto(IpResource ipResource, List<ShopDto> shopDtos, boolean useHistory, SpecialLine specialLine1) { public IpResourceDto(IpResource ipResource, List<ShopDto> shopDtos, boolean useHistory, SpecialLine specialLine1) {
...@@ -84,6 +86,7 @@ public class IpResourceDto { ...@@ -84,6 +86,7 @@ public class IpResourceDto {
this.proxyPort = specialLine1.getProxyPort(); this.proxyPort = specialLine1.getProxyPort();
this.proxyProtocol = specialLine1.getProxyProtocol(); this.proxyProtocol = specialLine1.getProxyProtocol();
this.specialLine = ipResource.isSpecialLine(); this.specialLine = ipResource.isSpecialLine();
this.secondaryProxyPort = ipResource.getSecondaryProxyPort();
if (CollectionUtils.isNotEmpty(shopDtos)) { if (CollectionUtils.isNotEmpty(shopDtos)) {
this.bindShops = shopDtos; this.bindShops = shopDtos;
this.bindShop = shopDtos.get(0); this.bindShop = shopDtos.get(0);
...@@ -265,4 +268,12 @@ public class IpResourceDto { ...@@ -265,4 +268,12 @@ public class IpResourceDto {
public void setBindShop(ShopDto bindShop) { public void setBindShop(ShopDto bindShop) {
this.bindShop = bindShop; this.bindShop = bindShop;
} }
public int getSecondaryProxyPort() {
return secondaryProxyPort;
}
public void setSecondaryProxyPort(int secondaryProxyPort) {
this.secondaryProxyPort = secondaryProxyPort;
}
} }
...@@ -9,4 +9,6 @@ import com.edgec.browserbackend.browser.domain.WinHistory; ...@@ -9,4 +9,6 @@ import com.edgec.browserbackend.browser.domain.WinHistory;
*/ */
public interface BrowserWinLogRepositoryCustom { public interface BrowserWinLogRepositoryCustom {
void addWinLog(String username, WinHistory winHistory); void addWinLog(String username, WinHistory winHistory);
void deleteBeforeWinLog(String username, int daysBefore);
} }
...@@ -6,8 +6,13 @@ import org.bson.Document; ...@@ -6,8 +6,13 @@ import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.BasicQuery; import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update; import org.springframework.data.mongodb.core.query.Update;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import static org.springframework.data.mongodb.core.query.Criteria.where; import static org.springframework.data.mongodb.core.query.Criteria.where;
/** /**
...@@ -26,8 +31,18 @@ public class BrowserWinLogRepositoryCustomImpl implements BrowserWinLogRepositor ...@@ -26,8 +31,18 @@ public class BrowserWinLogRepositoryCustomImpl implements BrowserWinLogRepositor
basicQuery.addCriteria(where("_id").is(username)); basicQuery.addCriteria(where("_id").is(username));
Update update = new Update(); Update update = new Update();
update.set("_id", username); update.addToSet("list", winHistory);
update.push("list", winHistory); mongoTemplate.upsert(basicQuery, update, BrowserWinLog.class);
}
@Override
public void deleteBeforeWinLog(String username, int daysBefore) {
Document doc = new Document();
BasicQuery basicQuery = new BasicQuery(doc);
basicQuery.addCriteria(where("_id").is(username));
Update update = new Update();
update.pull("list", Query.query(Criteria.where("time").lte(Instant.now().minus(daysBefore, ChronoUnit.DAYS).toEpochMilli())));
mongoTemplate.upsert(basicQuery, update, BrowserWinLog.class); mongoTemplate.upsert(basicQuery, update, BrowserWinLog.class);
} }
} }
package com.edgec.browserbackend.browser.repository;
import com.edgec.browserbackend.browser.domain.ShopUA;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
* @author xuxin
* @date 2020/9/25 14:56
* @description
*/
public interface ShopUARepository extends MongoRepository<ShopUA, String> {
}
...@@ -148,6 +148,7 @@ public class HistoryServiceImpl implements HistoryService { ...@@ -148,6 +148,7 @@ public class HistoryServiceImpl implements HistoryService {
@Override @Override
public void addBrowserWinLog(String username, WinHistory winHistory) { public void addBrowserWinLog(String username, WinHistory winHistory) {
browserWinLogRepository.deleteBeforeWinLog(username, 1);
browserWinLogRepository.addWinLog(username, winHistory); browserWinLogRepository.addWinLog(username, winHistory);
} }
} }
...@@ -59,6 +59,9 @@ public class ShopServiceImpl implements ShopService { ...@@ -59,6 +59,9 @@ public class ShopServiceImpl implements ShopService {
@Autowired @Autowired
SpecialLineRepository specialLineRepository; SpecialLineRepository specialLineRepository;
@Autowired
ShopUARepository shopUARepository;
@Override @Override
public String addShop(String username, ShopResultDto shopResultDto) { public String addShop(String username, ShopResultDto shopResultDto) {
// 1. 对商铺的分组信息校验 // 1. 对商铺的分组信息校验
...@@ -705,6 +708,17 @@ public class ShopServiceImpl implements ShopService { ...@@ -705,6 +708,17 @@ public class ShopServiceImpl implements ShopService {
shopResultDto.setOwner(username); shopResultDto.setOwner(username);
shop.of(shopResultDto); shop.of(shopResultDto);
shop.setCreateTime(Instant.now().toEpochMilli()); shop.setCreateTime(Instant.now().toEpochMilli());
List<ShopUA> all = shopUARepository.findAll();
List<String> uaList = new ArrayList<>();
for (ShopUA shopUA : all) {
uaList.addAll(shopUA.getUaList());
}
if (!uaList.contains(shop.getShopUA())) {
Random random = new Random();
shop.setShopUA(uaList.get(random.nextInt(uaList.size())));
}
String id = shopRepository.save(shop).getShopId(); String id = shopRepository.save(shop).getShopId();
return id; return id;
} }
......
...@@ -88,7 +88,7 @@ public class VpsServiceImpl implements VpsService { ...@@ -88,7 +88,7 @@ public class VpsServiceImpl implements VpsService {
"use redirection server name:i:0\n" + "use redirection server name:i:0\n" +
"rdgiskdcproxy:i:0\n" + "rdgiskdcproxy:i:0\n" +
"kdcproxyname:s:\n" + "kdcproxyname:s:\n" +
"drivestoredirect:s:C:\\:s:D:\\\n" + "drivestoredirect:s:C:\\;D:\\\n" +
"username:s:#VPS_USER#\n" + "username:s:#VPS_USER#\n" +
"password 51:b:#VPS_PASSWORD#\n"; "password 51:b:#VPS_PASSWORD#\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment