返利代码第一次提交
parent
1b4da6512f
commit
8a2c5bd499
|
@ -1,14 +1,28 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.db.mongo.LjsdMongoTemplate;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.RechargeInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.Recharge;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.aggregation.Fields;
|
||||
import org.springframework.data.mongodb.core.aggregation.ProjectionOperation;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
public class SaveTeamPosHandler extends BaseHandler{
|
||||
|
@ -24,5 +38,43 @@ public class SaveTeamPosHandler extends BaseHandler{
|
|||
int teamId = teamPosInfo.getTeamId();
|
||||
List<CommonProto.TeamHeroInfo> teamHeroInfosList = teamPosInfo.getTeamHeroInfosList();
|
||||
HeroLogic.getInstance().saveTeamPos(iSession,teamId,teamHeroInfosList);
|
||||
MongoTemplate monogTemplate = MongoUtil.getInstence().getMonogTemplate(10154);
|
||||
MongoTemplate coreMongoTemplate = MongoUtil.getCoreMongoTemplate();
|
||||
|
||||
Query query = new Query(Criteria.where("_id").ne("100000"));
|
||||
query.fields().include("playerManager");
|
||||
List<User> allByCondition = monogTemplate.find(query, User.class,"user");
|
||||
|
||||
|
||||
for(User user:allByCondition){
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
NewRechargeInfo newRechargeInfo = playerInfoManager.getNewRechargeInfo();
|
||||
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
|
||||
double rr = (rechargeInfo==null?0:rechargeInfo.getSaveAmt())+(newRechargeInfo==null?0:newRechargeInfo.getRr());
|
||||
if(rr==0){
|
||||
continue;
|
||||
}
|
||||
//判断是否有其他服已经加入过充值信息
|
||||
Query rechargeQuery = new Query(Criteria.where("_id").is(playerInfoManager.getOpenId()));
|
||||
Recharge recharge = coreMongoTemplate.findOne(rechargeQuery, Recharge.class, "recharge");
|
||||
if(recharge==null){
|
||||
recharge = new Recharge();
|
||||
recharge.setId(playerInfoManager.getOpenId());
|
||||
recharge.setRr(rr);
|
||||
Set<Integer> serverIds = new HashSet<>();
|
||||
serverIds.add(10154);
|
||||
recharge.setServerId(serverIds);
|
||||
coreMongoTemplate.save(recharge,"recharge");
|
||||
}else{
|
||||
Set<Integer> serverId = recharge.getServerId();
|
||||
if(serverId!=null&&serverId.contains(10154)){
|
||||
continue;
|
||||
}
|
||||
recharge.setRr(recharge.getRr()+rr);
|
||||
recharge.getServerId().add(10154);
|
||||
coreMongoTemplate.save(recharge,"recharge");
|
||||
}
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package com.ljsd.jieling.logic.dao.root;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/6/11
|
||||
* @discribe
|
||||
*/
|
||||
public class Recharge {
|
||||
private String id;
|
||||
private double rr;
|
||||
|
||||
private Set<Integer> serverId;
|
||||
|
||||
public Recharge() {
|
||||
}
|
||||
|
||||
public Recharge(String id, double rr, Set<Integer> serverId) {
|
||||
this.id = id;
|
||||
this.rr = rr;
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public double getRr() {
|
||||
return rr;
|
||||
}
|
||||
|
||||
public void setRr(double rr) {
|
||||
this.rr = rr;
|
||||
}
|
||||
|
||||
public Set<Integer> getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
public void setServerId(Set<Integer> serverId) {
|
||||
this.serverId = serverId;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue