Browse Source

0820_2.0

master
zy_Java 5 years ago
parent
commit
3990542fdd
  1. 1
      game/src/main/java/com/ccsens/game/service/MessageService.java
  2. 23
      game/src/main/java/com/ccsens/game/service/ScreenService.java
  3. 2
      game/src/main/java/com/ccsens/game/util/GameConstant.java
  4. 1
      game/src/main/resources/application-dev.yml
  5. 1
      game/src/main/resources/application-prod.yml
  6. 1
      game/src/main/resources/application-test.yml
  7. 4
      game/src/main/resources/application.yml
  8. 4
      tall/src/main/resources/application.yml
  9. 6
      util/src/main/java/com/ccsens/util/PropUtil.java
  10. 6
      util/src/main/java/com/ccsens/util/wx/WxXcxUtil.java

1
game/src/main/java/com/ccsens/game/service/MessageService.java

@ -44,6 +44,7 @@ public class MessageService implements IMessageService {
inMessage.setToDomain(MessageConstant.DomainType.User);
inMessage.setTos(userIdSet);
inMessage.setData(JSONObject.toJSONString(message));
log.info("新建或再玩一次发送消息:{}",inMessage);
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME, JSONObject.toJSONString(inMessage));
}

23
game/src/main/java/com/ccsens/game/service/ScreenService.java

@ -29,7 +29,6 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@ -76,8 +75,6 @@ public class ScreenService implements IScreenService {
private SendMsg sendMsg;
@Resource
private RedisUtil redisUtil;
@Value("${spring.profiles.active}")
private String active;
/**
* 创建游戏
@ -123,8 +120,7 @@ public class ScreenService implements IScreenService {
gameRecord.setUrl(gameUrl + gameType.getScreenUrl() + "?id=" + gameRecord.getId());
// gameRecord.setQrCodeUrl(gameUrl + gameRecord.getId() + File.separator + gameType.getClientUrl());
log.info("active:{}", active);
if ("prod".equals(active)) {
if("1".equalsIgnoreCase(PropUtil.openWx)){
//生成二维码
String fileName = "/gameQrCode/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png";
String path = WebConstant.UPLOAD_PATH_BASE + fileName;
@ -137,6 +133,7 @@ public class ScreenService implements IScreenService {
//给一个默认测试的
gameRecord.setQrCodeUrl(PropUtil.qrCode + "/gameQrCode/2020-08-19/1597822577181.png");
}
//查找此任务下的游戏配置表
byte businessType = 8;
if( GameConstant.GAME_TYPE_SP.equalsIgnoreCase(memberGame.getGameType())){
@ -876,7 +873,20 @@ public class ScreenService implements IScreenService {
default:break;
}
gameRecordNew.setUrl(gameUrl + gameType.getScreenUrl() + "?id=" + gameRecordNew.getId());
gameRecordNew.setQrCodeUrl(gameUrl+ gameRecordNew.getId() + File.separator + gameType.getClientUrl());
// gameRecordNew.setQrCodeUrl(gameUrl+ gameRecordNew.getId() + File.separator + gameType.getClientUrl());
if("1".equalsIgnoreCase(PropUtil.openWx)){
//生成二维码
String fileName = "/gameQrCode/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png";
String path = WebConstant.UPLOAD_PATH_BASE + fileName;
WxXcxUtil.getWxCode(WebConstant.QRCODE_GAME
, "id=" + gameRecord.getId() + "&type=" + gameType.getCode(), null, path,gameType.getCode());
gameRecord.setQrCodeUrl(PropUtil.qrCode + fileName);
log.info("调用微信生成二维码");
} else {
log.info("测试环境,不调用生成二维码");
//给一个默认测试的
gameRecord.setQrCodeUrl(PropUtil.qrCode + "/gameQrCode/2020-08-19/1597822577181.png");
}
gameRecordDao.insertSelective(gameRecordNew);
//修改购买的游戏的使用次数
gameUserPay.setUsedCount(gameUserPay.getUsedCount() + 1);
@ -915,6 +925,7 @@ public class ScreenService implements IScreenService {
}
}
chromeMessageDto.setReceivers(messageUserList);
log.info("再玩一次发送消息:{}",chromeMessageDto);
messageService.sendGameMessageWithGetUrl(chromeMessageDto,userIdSet);
return gameRecordNew.getUrl();

2
game/src/main/java/com/ccsens/game/util/GameConstant.java

@ -57,7 +57,7 @@ public class GameConstant {
/**游戏:分组*/
public static final byte GAME_GROUP = 1;
/**游戏:单人*/
public static final byte GAME_SINGLE = 1;
public static final byte GAME_SINGLE = 0;
/**
* 生成游戏key

1
game/src/main/resources/application-dev.yml

@ -31,3 +31,4 @@ gatewayUrl: https://test.tall.wiki/gateway/
notGatewayUrl: https://test.tall.wiki/
file:
qrCode: https://test.tall.wiki/gateway/tall/uploads/
openWX: 0

1
game/src/main/resources/application-prod.yml

@ -34,3 +34,4 @@ gatewayUrl: https://www.tall.wiki/gateway/
notGatewayUrl: https://www.tall.wiki/
file:
qrCode: https://www.tall.wiki/gateway/tall/v1.0/uploads/
openWX: 1

1
game/src/main/resources/application-test.yml

@ -34,3 +34,4 @@ gatewayUrl: https://test.tall.wiki/gateway/
notGatewayUrl: https://test.tall.wiki/
file:
qrCode: https://test.tall.wiki/gateway/tall/v1.0/uploads/
openWX: 1

4
game/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: test
include: common, util-test
active: prod
include: common, util-prod

4
tall/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: dev
include: util-dev,common
active: prod
include: util-prod,common

6
util/src/main/java/com/ccsens/util/PropUtil.java

@ -21,6 +21,8 @@ public class PropUtil {
public static String qrCode;
public static String wxPrefix;
public static String smsCode;
public static String openWx;
@Value("${gatewayUrl:}")
public void setGatewayUrl(String gatewayUrl) {
@ -63,4 +65,8 @@ public class PropUtil {
public void setSmsCode(String smsCode) {
PropUtil.smsCode = smsCode;
}
@Value("${file.openWX:}")
public static void setOpenWx(String openWx) {
PropUtil.openWx = openWx;
}
}

6
util/src/main/java/com/ccsens/util/wx/WxXcxUtil.java

@ -12,6 +12,7 @@ import lombok.Data;
import org.apache.commons.codec.digest.DigestUtils;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.ConnectException;
@ -234,7 +235,10 @@ public class WxXcxUtil {
* @throws Exception
*/
public static void getWxCode(String page,String scene,LineColor color,String path,String code) throws Exception {
File file = new File(path);
if(!file.getParentFile().exists()){
file.getParentFile().mkdirs();
}
String url = String.format(URL_GET_WX_CODE_B, WxGzhUtil.getAccessToken(appId(code),secret(code)));
WechatCode wechatCode = new WechatCode();

Loading…
Cancel
Save