|
@ -5,6 +5,7 @@ import awesome.group.game.dao.bean.MatrixApp; |
|
|
import awesome.group.game.dao.mapper.MatrixAdvRecordMapper; |
|
|
import awesome.group.game.dao.mapper.MatrixAdvRecordMapper; |
|
|
import awesome.group.game.dao.mapper.MatrixAppMapper; |
|
|
import awesome.group.game.dao.mapper.MatrixAppMapper; |
|
|
import awesome.group.game.service.bo.MatrixAdvRecordEditBo; |
|
|
import awesome.group.game.service.bo.MatrixAdvRecordEditBo; |
|
|
|
|
|
import awesome.group.game.service.util.EncryptUtil; |
|
|
import jakarta.annotation.Resource; |
|
|
import jakarta.annotation.Resource; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.util.Assert; |
|
|
import org.springframework.util.Assert; |
|
@ -21,13 +22,13 @@ public class MatrixService { |
|
|
|
|
|
|
|
|
public void saveRecord(MatrixAdvRecordEditBo bo, String ip) { |
|
|
public void saveRecord(MatrixAdvRecordEditBo bo, String ip) { |
|
|
Assert.isTrue(StringUtils.hasText(bo.appCode), "appCode不能为空"); |
|
|
Assert.isTrue(StringUtils.hasText(bo.appCode), "appCode不能为空"); |
|
|
Integer appId = mapper.queryAppId(bo.appCode); |
|
|
MatrixApp app = mapper.queryApp(bo.appCode); |
|
|
if (appId == null) { |
|
|
if (app == null) { |
|
|
return;//非法请求,直接忽略
|
|
|
return;//非法请求,直接忽略
|
|
|
} |
|
|
} |
|
|
MatrixAdvRecord record = new MatrixAdvRecord(); |
|
|
MatrixAdvRecord record = new MatrixAdvRecord(); |
|
|
record.setDeviceId(bo.deviceId); |
|
|
record.setDeviceId(bo.deviceId); |
|
|
record.setAppId(appId); |
|
|
record.setAppId(app.getId()); |
|
|
record.setPlatform(bo.platform); |
|
|
record.setPlatform(bo.platform); |
|
|
record.setAdvType(bo.advType); |
|
|
record.setAdvType(bo.advType); |
|
|
record.setEcpm(bo.advType > 1000 ? 0 : bo.ecpm); |
|
|
record.setEcpm(bo.advType > 1000 ? 0 : bo.ecpm); |
|
@ -38,6 +39,22 @@ public class MatrixService { |
|
|
mapper.insert(record); |
|
|
mapper.insert(record); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void saveRecordV2(MatrixAdvRecordEditBo bo, String ip) { |
|
|
|
|
|
if (!StringUtils.hasText(bo.appCode) || !StringUtils.hasText(bo.sign)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
MatrixApp app = mapper.queryApp(bo.appCode); |
|
|
|
|
|
if (app == null) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
String secret = app.getSecret(); |
|
|
|
|
|
String str = bo.getSignStr(secret); |
|
|
|
|
|
if (!bo.sign.equalsIgnoreCase(EncryptUtil.sha1(str))) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
saveRecord(bo, ip); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public boolean whiteList(String deviceId, String appCode) { |
|
|
public boolean whiteList(String deviceId, String appCode) { |
|
|
MatrixApp app = appMapper.queryByCode(appCode); |
|
|
MatrixApp app = appMapper.queryByCode(appCode); |
|
|
if (app == null) { |
|
|
if (app == null) { |
|
|