|
|
@@ -165,6 +165,7 @@ var Table = function (cPlayerId,cUserId,cName,cHead,game, id, cell, round, type,
|
|
|
this.state = STATE.FREE;
|
|
|
//断线 结束定时器
|
|
|
this.endTimer = null;
|
|
|
+ this.calculateTimer = null
|
|
|
//结束时的继线用户 为了在销毁房间的时候让这些用户退出房间
|
|
|
this.leaveUsers = [];
|
|
|
//////以下全为TL++
|
|
|
@@ -203,12 +204,14 @@ proto.isFull = function (playerId) {
|
|
|
// return (this.lookers.length >= 1);
|
|
|
// console.warn("是否站满 "+this.users.length);
|
|
|
// console.warn("是否站满 "+JSON.stringify(this.users));
|
|
|
+ return false;
|
|
|
+
|
|
|
if(this.users.length > 0){
|
|
|
// console.warn("是否站满222 ",this.users[0].id , playerId);
|
|
|
if(this.users[0] && this.users[0].id == playerId) return false;
|
|
|
return true;
|
|
|
}
|
|
|
- return false;
|
|
|
+
|
|
|
};
|
|
|
|
|
|
// 是否准备
|
|
|
@@ -323,6 +326,7 @@ proto.getTableInfo = function () {
|
|
|
diamond:user.diamond, state: user.state2, taskQuan: user.taskQuan,
|
|
|
drCount: user.drCount,chairId: user.chairId
|
|
|
};
|
|
|
+ console.warn("uinfo:",uinfo)
|
|
|
tableInfo.users.push(uinfo);
|
|
|
}
|
|
|
}
|
|
|
@@ -428,6 +432,58 @@ proto.creatPHBItem = cor(function* (user) {
|
|
|
// }
|
|
|
// })
|
|
|
|
|
|
+proto.getYesterdaySJC = function (){
|
|
|
+ var today = new Date();
|
|
|
+ today.setHours(0);
|
|
|
+ today.setMinutes(0);
|
|
|
+ today.setSeconds(0);
|
|
|
+ today.setMilliseconds(0);
|
|
|
+ let jrsjc = today.getTime()- 24 * 60 * 60 * 1000;
|
|
|
+ console.warn("getYesterdaySJC:",jrsjc)
|
|
|
+ // console.warn("111得到今日0点的时间戳 ",jrsjc, typeof jrsjc);
|
|
|
+ return jrsjc;
|
|
|
+};
|
|
|
+
|
|
|
+proto.getUSDTSum = cor(function* () {
|
|
|
+ var today = new Date();
|
|
|
+ today.setHours(0);
|
|
|
+ today.setMinutes(0);
|
|
|
+ today.setSeconds(0);
|
|
|
+ today.setMilliseconds(0);
|
|
|
+ let jrsjc = today.getTime()- 24 * 60 * 60 * 1000;
|
|
|
+
|
|
|
+ jrsjc = today.getTime()
|
|
|
+ console.warn("jrsjc:",jrsjc)
|
|
|
+ var SGJUserTongjis = yield this.app.models.SGJUserTongji.findMongoAsync({todaytime:jrsjc})
|
|
|
+ var limit = 1000
|
|
|
+ var page = 0
|
|
|
+ var skip = 0
|
|
|
+ var all = 0
|
|
|
+ if (SGJUserTongjis.length >= 1) {
|
|
|
+ for(;;) {
|
|
|
+ skip = page * limit
|
|
|
+ let players = yield this.app.models.Player.findMongoAsync({}, {}, {
|
|
|
+ skip: skip,
|
|
|
+ limit: Number(limit)
|
|
|
+ });
|
|
|
+ console.warn("players:",players.length)
|
|
|
+ if (players.length > 0) {
|
|
|
+ for (let player of players) {
|
|
|
+ console.warn("player.diamond:",player.diamond)
|
|
|
+ all += player.diamond
|
|
|
+ console.warn("all:",all)
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ page += 1
|
|
|
+
|
|
|
+ }
|
|
|
+ SGJUserTongjis[0].usdt = all.toFixed(2)
|
|
|
+ yield SGJUserTongjis[0].saveAsync()
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
// 加入桌子
|
|
|
proto.joinAsync = cor(function* (user) {
|
|
|
// 加入桌子之前
|
|
|
@@ -438,13 +494,20 @@ proto.joinAsync = cor(function* (user) {
|
|
|
let taskQuan = 0;//用户的任务券
|
|
|
let drCount = 0;
|
|
|
var sgjUser = yield this.app.models.SGJUser.findByIdAsync(user.id, 'taskQuan yazhuList jrkbcdrs drCount drTime lastJoinTime');
|
|
|
+ if (!this.calculateTimer) {
|
|
|
+ this.calculateTimer = this.app.timer.setTimeout(() => this.getUSDTSum(), 100000);
|
|
|
+ }
|
|
|
if (sgjUser) {
|
|
|
+ sgjUser.drCount = sgjUser.drCount.toFixed(2)
|
|
|
+ sgjUser.taskQuan = sgjUser.taskQuan.toFixed(2)
|
|
|
taskQuan = sgjUser.taskQuan;
|
|
|
// console.warn("加入桌子 taskQuan "+taskQuan+" sgjUser.taskQuan "+sgjUser.taskQuan+" "+ typeof(taskQuan)+" "+ typeof(sgjUser.taskQuan) );
|
|
|
this.yazhus = sgjUser.yazhuList//玩家本场押注情况
|
|
|
let jrStart = this.logic.getTodaySJC();////今日0时的时间戳
|
|
|
+
|
|
|
if(sgjUser.drTime == jrStart) {
|
|
|
- drCount = sgjUser.drCount;
|
|
|
+ drCount = sgjUser.drCount.toFixed(2);
|
|
|
+ console.warn("drCount:",drCount)
|
|
|
let ssbkdrdd = user.diamond - drCount;//身上比可带入多的钻石
|
|
|
// console.warn("加入桌子非今天首次000=== drCount "+drCount+" ssbkdrdd "+ssbkdrdd+" sgjUser.jrkbcdrs "+sgjUser.jrkbcdrs+ " user.diamond "+user.diamond);
|
|
|
if(ssbkdrdd > this.logic.dairuMax - sgjUser.drCount && this.logic.dairuMax - sgjUser.drCount > 0){
|
|
|
@@ -452,13 +515,15 @@ proto.joinAsync = cor(function* (user) {
|
|
|
}
|
|
|
if(ssbkdrdd < 0){
|
|
|
//适合比如身上有14w钻石,带入10w之后,被系统扣钻了8w,那这时候数据表的drCount字段就要改了
|
|
|
- drCount = Math.floor(user.diamond / this.logic.nowCell)*this.logic.nowCell;//1分=10钻石,每日上限1w分)
|
|
|
+ console.warn("457:",sgjUser.drCount)
|
|
|
+ drCount = user.diamond.toFixed(2);//1分=10钻石,每日上限1w分)
|
|
|
+ console.warn("457:",sgjUser.drCount)
|
|
|
// console.warn("加入桌子非今天首次1=== drCount "+drCount+" ssbkdrdd "+ssbkdrdd+" sgjUser.jrkbcdrs "+sgjUser.jrkbcdrs);
|
|
|
}
|
|
|
// console.warn("加入桌子非今天首次111=== drCount "+drCount+" ssbkdrdd "+ssbkdrdd+" sgjUser.jrkbcdrs "+sgjUser.jrkbcdrs);
|
|
|
if(ssbkdrdd >= this.logic.nowCell && sgjUser.jrkbcdrs > 0){
|
|
|
- let bckddrd = Math.floor(ssbkdrdd / this.logic.nowCell)*this.logic.nowCell;//本次可多带入的
|
|
|
- drCount += bckddrd;
|
|
|
+ let bckddrd = ssbkdrdd.toFixed(2);//本次可多带入的
|
|
|
+ drCount = Number(drCount)+ Number(bckddrd);
|
|
|
// sgjUser.jrkbcdrs -= bckddrd;
|
|
|
// yield sgjUser.saveAsync();
|
|
|
// console.warn("加入桌子非今天首次222=== drCount "+drCount+" ssbkdrdd "+ssbkdrdd+" sgjUser.jrkbcdrs "+sgjUser.jrkbcdrs);
|
|
|
@@ -466,17 +531,20 @@ proto.joinAsync = cor(function* (user) {
|
|
|
}
|
|
|
else {
|
|
|
if(user.diamond >= this.logic.dairuMax){
|
|
|
- drCount = this.logic.dairuMax;//(钻石)
|
|
|
+ drCount = this.logic.dairuMax.toFixed(2);//(钻石)
|
|
|
}
|
|
|
else{
|
|
|
- drCount = Math.floor(user.diamond / this.logic.nowCell)*this.logic.nowCell;//1分=10钻石,每日上限1w分)
|
|
|
+ drCount = user.diamond.toFixed(2);//1分=10钻石,每日上限1w分)
|
|
|
let ssbkdrdd = user.diamond - drCount;//身上比可带入多的钻石
|
|
|
+ console.warn("ssbkdrdd:",ssbkdrdd)
|
|
|
if(ssbkdrdd > this.logic.dairuMax - sgjUser.drCount){
|
|
|
ssbkdrdd = this.logic.dairuMax - sgjUser.drCount
|
|
|
}
|
|
|
// console.warn("加入桌子首次111=== drCount "+drCount+" ssbkdrdd "+ssbkdrdd+" sgjUser.jrkbcdrs "+sgjUser.jrkbcdrs);
|
|
|
if(ssbkdrdd >= this.logic.nowCell && sgjUser.jrkbcdrs > 0){
|
|
|
- let bckddrd = Math.floor(ssbkdrdd / this.logic.nowCell)*this.logic.nowCell;//本次可多带入的
|
|
|
+ //let bckddrd = Math.floor(Math.floor(ssbkdrdd / this.logic.nowCell)*this.logic.nowCell);//本次可多带入的
|
|
|
+ let bckddrd = ssbkdrdd.toFixed(2)
|
|
|
+ console.warn("bckddrd:",bckddrd)
|
|
|
drCount += bckddrd;
|
|
|
// sgjUser.jrkbcdrs -= bckddrd;
|
|
|
// yield sgjUser.saveAsync();
|
|
|
@@ -487,13 +555,17 @@ proto.joinAsync = cor(function* (user) {
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
+ console.warn("500")
|
|
|
if(user.diamond >= this.logic.dairuMax){
|
|
|
- drCount = this.logic.dairuMax;//(钻石)
|
|
|
+ drCount = this.logic.dairuMax.toFixed(2);//(钻石)
|
|
|
}
|
|
|
else{
|
|
|
- drCount = Math.floor(user.diamond / this.logic.nowCell)*this.logic.nowCell;//1分=10钻石,每日上限1w分)
|
|
|
+ console.warn("user.diamond;",user.diamond)
|
|
|
+ drCount = user.diamond.toFixed(2);//1分=10钻石,每日上限1w分)
|
|
|
+ console.warn("drCount",drCount)
|
|
|
}
|
|
|
}
|
|
|
+ user.diamond = user.diamond.toFixed(2)
|
|
|
let str3 = "加入水果 "+ this.nowDiamond2 +" ud "+user.diamond + " drCount " + drCount;
|
|
|
if(this.users.length == 0) {
|
|
|
this.users[0] = user;
|
|
|
@@ -501,7 +573,7 @@ proto.joinAsync = cor(function* (user) {
|
|
|
user.chairId = 0;
|
|
|
user.state = User.STATE.READY;
|
|
|
user.state2 = User.STATE.READY;
|
|
|
- user.taskQuan = taskQuan;
|
|
|
+ user.taskQuan = taskQuan.toFixed(2);
|
|
|
user.drCount = drCount;
|
|
|
// console.warn("加入桌子 user.taskQuan222 ",user.taskQuan,user.diamond);
|
|
|
this.nowDiamond = user.diamond;//玩家目前游戏内的钻石(带入的)
|
|
|
@@ -510,6 +582,7 @@ proto.joinAsync = cor(function* (user) {
|
|
|
}
|
|
|
logger.warn(str3);////cssj
|
|
|
// 加入桌子之后
|
|
|
+
|
|
|
yield this.afterJoinAsync(user);
|
|
|
// 数据返回处理
|
|
|
var data = { chairId: String(user.chairId) };
|
|
|
@@ -574,7 +647,7 @@ proto.zsbgjlAsync = cor(function* (user, chairId) {
|
|
|
logger.warn(str3);////cssj
|
|
|
// 站起通知
|
|
|
if(this.wjcsDiamond >= 0){
|
|
|
- let wjxzzs = this.nowDiamond + this.nowDiamond2;
|
|
|
+ let wjxzzs = Number(this.nowDiamond) + Number(this.nowDiamond2);
|
|
|
let gbsz = wjxzzs - this.wjcsDiamond;
|
|
|
// let str1 = "table 记录钻石记录111.......id: "+ this.id + " nd " + this.nowDiamond + " nd2: " + this.nowDiamond2;
|
|
|
// logger.warn(str1);////cssj
|
|
|
@@ -587,10 +660,11 @@ proto.zsbgjlAsync = cor(function* (user, chairId) {
|
|
|
playerId: user.id,
|
|
|
dType: 20,//水果游戏
|
|
|
dSource: this.wjcsDiamond,
|
|
|
- dSwap: gbsz,
|
|
|
- dNow: wjxzzs,
|
|
|
+ dSwap: gbsz.toFixed(2),
|
|
|
+ dNow: wjxzzs.toFixed(2),
|
|
|
tableId: this.recordid
|
|
|
});
|
|
|
+ console.warn("597:",diamondrecord)
|
|
|
yield diamondrecord.saveAsync();
|
|
|
this.wjcsDiamond = -1;
|
|
|
// console.warn("站起桌子之后 保存钻石记录完成 ",this.wjcsDiamond,wjxzzs,user.diamond,gbsz);
|
|
|
@@ -609,18 +683,19 @@ proto.zsbgjlAsync = cor(function* (user, chairId) {
|
|
|
let jrStart = ""+this.logic.getTodaySJC();////更新今日0时的时间戳
|
|
|
var sgmrtj = yield this.app.models.SGJMRTJ.findByIdAsync(jrStart);
|
|
|
if (sgmrtj) {
|
|
|
- sgmrtj.zqqCost += this.zqqCost; //所有玩家游戏转圈总下注
|
|
|
- sgmrtj.zqqwin += this.zqqwin; //所有玩家游戏转圈总赢得
|
|
|
- sgmrtj.zqqxh += this.zqqxh; //所有玩家游戏转圈总消耗(总赢得 - 总下注)
|
|
|
- sgmrtj.ydxCost += this.ydxCost; //所有玩家押大小总下注
|
|
|
- sgmrtj.ydxwin += this.ydxwin; //所有玩家押大小总赢得
|
|
|
- sgmrtj.ydxxh += this.ydxxh; //所有玩家押大小总消耗(总赢得 - 总下注)
|
|
|
- sgmrtj.ydxzcs += this.ydxzcs; //该日押大小总次数
|
|
|
- sgmrtj.allrwq += this.allrwq; //所有奖券产生总量
|
|
|
- sgmrtj.rwxhjq1 += this.rwxhjq1; //钻石任务消耗奖券总量(领任务时记录)
|
|
|
- sgmrtj.rwxhjq2 += this.rwxhjq2; //RMB任务消耗奖券总量(领任务时记录)
|
|
|
- sgmrtj.rwdcze1 += this.rwdcze1; //钻石任务兑出总额(领奖时记录)
|
|
|
- sgmrtj.rwdcze2 += this.rwdcze2; //RMB(分)任务兑出总额(领奖时记录)
|
|
|
+ sgmrtj.zqqCost = (Number(sgmrtj.zqqCost)+Number(this.zqqCost)).toFixed(2); //所有玩家游戏转圈总下注
|
|
|
+ sgmrtj.zqqwin = (Number(sgmrtj.zqqwin)+Number(this.zqqwin)).toFixed(2); //所有玩家游戏转圈总赢得
|
|
|
+ sgmrtj.zqqxh = (Number(sgmrtj.zqqxh)+Number(this.zqqxh)).toFixed(2); //所有玩家游戏转圈总消耗(总赢得 - 总下注)
|
|
|
+ sgmrtj.ydxCost = (Number(sgmrtj.ydxCost)+Number(this.ydxCost)).toFixed(2); //所有玩家押大小总下注
|
|
|
+ sgmrtj.ydxwin = (Number(sgmrtj.ydxwin)+Number(this.ydxwin)).toFixed(2); //所有玩家押大小总赢得
|
|
|
+ sgmrtj.ydxxh = (Number(sgmrtj.ydxxh)+Number(this.ydxxh)).toFixed(2); //所有玩家押大小总消耗(总赢得 - 总下注)
|
|
|
+ sgmrtj.ydxzcs = (Number(sgmrtj.ydxzcs)+Number(this.ydxzcs)).toFixed(2); //该日押大小总次数
|
|
|
+ sgmrtj.allrwq = (Number(sgmrtj.allrwq )+ Number(this.allrwq)).toFixed(2); //所有奖券产生总量
|
|
|
+
|
|
|
+ sgmrtj.rwxhjq1 = (Number(sgmrtj.rwxhjq1)+Number(this.rwxhjq1)).toFixed(2); //钻石任务消耗奖券总量(领任务时记录)
|
|
|
+ sgmrtj.rwxhjq2 = (Number(sgmrtj.rwxhjq2)+Number(this.rwxhjq2)).toFixed(2); //RMB任务消耗奖券总量(领任务时记录)
|
|
|
+ sgmrtj.rwdcze1 = (Number(sgmrtj.rwdcze1)+Number(this.rwdcze1)).toFixed(2); //钻石任务兑出总额(领奖时记录)
|
|
|
+ sgmrtj.rwdcze2 = (Number(sgmrtj.rwdcze2)+Number(this.rwdcze2)).toFixed(2); //RMB(分)任务兑出总额(领奖时记录)
|
|
|
yield sgmrtj.saveAsync();
|
|
|
// console.warn("更改每日 ",sgmrtj);
|
|
|
}
|
|
|
@@ -656,7 +731,7 @@ proto.zsbgjlAsync = cor(function* (user, chairId) {
|
|
|
sgjztj.ydxCost += this.ydxCost; //所有玩家押大小总下注
|
|
|
sgjztj.ydxwin += this.ydxwin; //所有玩家押大小总赢得
|
|
|
sgjztj.ydxxh += this.ydxxh; //所有玩家押大小总消耗(总赢得 - 总下注)
|
|
|
- sgjztj.allrwq += this.allrwq; //所有奖券产生总量
|
|
|
+ sgjztj.allrwq += Number(this.allrwq); //所有奖券产生总量
|
|
|
sgjztj.rwxhjq1 += this.rwxhjq1; //钻石任务消耗奖券总量(领任务时记录)
|
|
|
sgjztj.rwxhjq2 += this.rwxhjq2; //RMB任务消耗奖券总量(领任务时记录)
|
|
|
sgjztj.rwxhjq3 = 0; //备用任务1消耗奖券总量(领任务时记录)
|
|
|
@@ -1000,7 +1075,7 @@ proto.dairuAsync = cor(function* (playerId,chairId) {
|
|
|
this.wjcsDiamond = user.diamond;//玩家进入房间初始的钻石数,用于判断离开的时候是否需要记录钻石变更
|
|
|
return { code: C.OK, data: data };
|
|
|
}
|
|
|
- let drCount = 0;
|
|
|
+ let drCount = Number(0);
|
|
|
let nowTime = Date.now();//当前时间戳
|
|
|
let jrStart = this.logic.getTodaySJC();////今日0时的时间戳
|
|
|
var sgjUser = yield this.app.models.SGJUser.findByIdAsync(this.ownerId, 'jrkbcdrs drCount drTime jzjrldzcz jzjrldzczjlsj lastJoinTime');
|
|
|
@@ -1011,9 +1086,10 @@ proto.dairuAsync = cor(function* (playerId,chairId) {
|
|
|
sgjUser.jzjrldzcz = jzjrldzcz;
|
|
|
sgjUser.jzjrldzczjlsj = jrStart;
|
|
|
}
|
|
|
+ sgjUser.drCount = sgjUser.drCount.toFixed(2)
|
|
|
if(sgjUser.drTime == jrStart){
|
|
|
if(this.nowDiamond2 >= sgjUser.drCount){
|
|
|
- drCount = sgjUser.drCount;
|
|
|
+ drCount = sgjUser.drCount.toFixed(1);
|
|
|
let ssbkdrdd = this.nowDiamond2 - drCount;//身上比可带入多的钻石
|
|
|
if(ssbkdrdd > this.logic.dairuMax - sgjUser.drCount && this.logic.dairuMax - sgjUser.drCount > 0){
|
|
|
ssbkdrdd = this.logic.dairuMax - sgjUser.drCount
|
|
|
@@ -1029,7 +1105,9 @@ proto.dairuAsync = cor(function* (playerId,chairId) {
|
|
|
// console.warn("带入 ??? ",sgjUser.jzjrldzcz,sgjUser.jzjrldzczjlsj);
|
|
|
if(ssbkdrdd >= this.logic.nowCell && sgjUser.jrkbcdrs > 0){
|
|
|
let bckddrd = Math.floor(ssbkdrdd / this.logic.nowCell)*this.logic.nowCell;//本次可多带入的
|
|
|
- drCount += bckddrd;
|
|
|
+ console.warn("bckddrd:",bckddrd," drCount:",drCount)
|
|
|
+ drCount = Number(drCount)+ Number(bckddrd);
|
|
|
+ console.warn("bckddrd:",bckddrd," drCount:",drCount)
|
|
|
sgjUser.drCount = drCount;
|
|
|
sgjUser.jrkbcdrs -= bckddrd;
|
|
|
sgjUser.lastJoinTime = nowTime; // 玩家上次进入果游戏时间(留存人数)
|
|
|
@@ -1075,7 +1153,7 @@ proto.dairuAsync = cor(function* (playerId,chairId) {
|
|
|
let jzjrldzcz = yield this.getjzjrldzcz();
|
|
|
var newsgjUser = new this.app.models.SGJUser({
|
|
|
_id: this.ownerId, // 标识
|
|
|
- userId: 0, // 号码
|
|
|
+ userId: Number(user.userId), // 号码
|
|
|
cost: 0, // 消费
|
|
|
win: 0, // 总赢得分
|
|
|
zfbAcc: "", // 支付宝账号
|
|
|
@@ -1102,17 +1180,22 @@ proto.dairuAsync = cor(function* (playerId,chairId) {
|
|
|
}
|
|
|
this.wjcsDiamond = this.nowDiamond2;//user.diamond;//玩家进入房间初始的钻石数,用于判断离开的时候是否需要记录钻石变更
|
|
|
// console.warn("玩家进入之后记录初始钻石数 ",this.wjcsDiamond,this.nowDiamond,this.nowDiamond2);
|
|
|
- this.nowDiamond = drCount;
|
|
|
- this.nowDiamond2 -= drCount;
|
|
|
+ this.nowDiamond = Number(drCount);
|
|
|
+ console.warn(" this.nowDiamond2:", this.nowDiamond2, " drCount:",drCount)
|
|
|
+ this.nowDiamond2 -= Number(drCount);
|
|
|
+ console.warn(" this.nowDiamond2:", this.nowDiamond2)
|
|
|
if(this.nowDiamond2 < 0){
|
|
|
let str4 = "table 带入出错了---id:"+this.id +" 当前局 "+ (this.over+1)+" nd2 "+this.nowDiamond2;
|
|
|
logger.warn(str4);////cssj
|
|
|
return { code: C.FAILD, msg: C.GAME_PARAM_ERROR };
|
|
|
}
|
|
|
+ console.warn("this.nowDiamond2:",this.nowDiamond2)
|
|
|
+ console.warn("drCount:",drCount)
|
|
|
var data = {
|
|
|
- diamond: this.nowDiamond2,
|
|
|
+ diamond: this.nowDiamond2.toFixed(2),
|
|
|
drCount: drCount,
|
|
|
}
|
|
|
+ console.warn("data:",data)
|
|
|
return { code: C.OK, data: data };
|
|
|
});
|
|
|
|
|
|
@@ -1121,26 +1204,42 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
let str4 = "table 开始游戏---id:"+this.id +" 当前局 "+ (this.over+1)+" nowDiamond "+this.nowDiamond+" yazhus "+JSON.stringify(yazhus);
|
|
|
logger.warn(str4);////cssj
|
|
|
// 状态设置
|
|
|
+ //现在钻石数量 玩家初始钻石数量不得小于0
|
|
|
+ let wh = yield this.app.models.WHstate.findByIdReadOnlyAsync('wh', 'stateWH whTip');
|
|
|
+ // console.warn("22检查是否维护状态",whdata);
|
|
|
+ if (wh) {
|
|
|
+ // console.warn("--33检查是否维护状态",whdata.stateWH,whdata.whTip);
|
|
|
+ if(wh.stateWH){
|
|
|
+ /////维护状态中
|
|
|
+ return { code: C.SERVER_WEIHU, tip: wh.whTip };
|
|
|
+ }
|
|
|
+ }
|
|
|
if(this.nowDiamond2 < 0 || this.wjcsDiamond < 0){
|
|
|
let str1 = "table nowDiamond2出错了---id:"+this.id +" 当前局 "+ (this.over+1)+" nd2 "+this.nowDiamond2+" csd "+this.wjcsDiamond;
|
|
|
logger.warn(str1);////cssj
|
|
|
return { code: C.FAILD, msg: C.GAME_PARAM_ERROR };
|
|
|
}
|
|
|
+ //押注长度必须为8
|
|
|
if(yazhus.length != 8){
|
|
|
let str = "table 押注长度出错了---id:"+this.id +" 当前局 "+ (this.over+1)+" this.ownerUid "+this.ownerUid+" yazhus "+JSON.stringify(yazhus);
|
|
|
logger.warn(str);////cssj
|
|
|
return { code: C.FAILD, msg: "押注长度出错了 前端的问题 "+JSON.stringify(yazhus) };
|
|
|
}
|
|
|
+
|
|
|
+ //押注值必须为10的倍数
|
|
|
for (var i = 0; i < yazhus.length; i++) {
|
|
|
- if((yazhus[i]%this.logic.nowCell) != 0){
|
|
|
+ yazhus[i] = parseFloat(yazhus[i].toFixed(2));
|
|
|
+ if(((yazhus[i]*1000)%(this.logic.nowCell*1000)) != 0){
|
|
|
let str = "table 押注数值出错了---id:"+this.id +" 当前局 "+ (this.over+1)+" this.ownerUid "+this.ownerUid+" yazhus "+JSON.stringify(yazhus);
|
|
|
logger.warn(str);////cssj
|
|
|
return { code: C.FAILD, msg: "押注数值出错了 前端的问题 "+JSON.stringify(yazhus) };
|
|
|
}
|
|
|
}
|
|
|
+ //本次总押注 身上的钱是否够
|
|
|
if(this.nowDiamond < _.sum(yazhus)){ //本次总下注
|
|
|
return { code: C.FAILD, msg: C.GAME_DIAMOND_LOW };//玩家钻石不足
|
|
|
}
|
|
|
+ //时间戳 != 每日人数统计时间
|
|
|
if(this.logic.getTodaySJC() != this.mrrstjsj){
|
|
|
// console.warn("昨日数据还未统计111");
|
|
|
yield this.tjbjlmryxrs();
|
|
|
@@ -1175,11 +1274,13 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
let nowTime = Date.now();//当前时间戳
|
|
|
let jrStart = this.logic.getTodaySJC();////今日0时的时间戳
|
|
|
this.stime = nowTime;
|
|
|
- let scoreBefore = this.nowDiamond + this.nowDiamond2;//下注之前玩家的钻石
|
|
|
+ let scoreBefore = Number(this.nowDiamond) + Number(this.nowDiamond2);//下注之前玩家的钻石
|
|
|
this.over++;
|
|
|
this.yazhus = this.logic.deepCloneTL(yazhus)//玩家本场押注情况
|
|
|
let bczxz = _.sum(this.yazhus);//本次总下注
|
|
|
+ console.warn("bczxz:",bczxz)
|
|
|
let jcPools = yield this.app.models.SGJJC.findByIdAsync('sgjjcs');
|
|
|
+ console.warn("jcpools:",jcPools)
|
|
|
let mqdw = -1;//目前挡位
|
|
|
let cjjcsjk = 1;//是否创建奖池数据库
|
|
|
if (jcPools) {
|
|
|
@@ -1272,8 +1373,8 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
let str7 = "sgjtable 游戏开始计算结果之后保存钻石成功id: "+ this.id + " userId: " + player.userId + " name: " + player.name+" nowDiamond "+this.nowDiamond ;
|
|
|
logger.warn(str7);////cssj
|
|
|
}
|
|
|
- this.users[0].diamond = this.nowDiamond + this.nowDiamond2;
|
|
|
- this.users[0].drCount = this.nowDiamond;
|
|
|
+ this.users[0].diamond = (this.nowDiamond + this.nowDiamond2).toFixed(2);;
|
|
|
+ this.users[0].drCount = this.nowDiamond.toFixed(2);
|
|
|
// 水果机战绩
|
|
|
var sgjtable = new this.app.models.SGJTables({
|
|
|
_id: this.yxjlid,//ts++游戏记录id,
|
|
|
@@ -1291,10 +1392,12 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
win: win, // 本局结果赢得分数(不包含下注的即winsList元素总和)
|
|
|
bsIndex:bsIndex,//本次发牌对应的倍数下标,
|
|
|
huafenList:[], // 本局划分数据列表
|
|
|
- scoreBefore: scoreBefore, // 本局开始前的分数(钻石)
|
|
|
- scoreEnd: this.nowDiamond + this.nowDiamond2, // 本局结束后的分数(=scoreBefore-押注总额+win)
|
|
|
+ scoreBefore: scoreBefore.toFixed(2), // 本局开始前的分数(钻石)
|
|
|
+ scoreEnd: (Number(this.nowDiamond) + (this.nowDiamond2)).toFixed(2), // 本局结束后的分数(=scoreBefore-押注总额+win)
|
|
|
});
|
|
|
- let addTaskQuan = bczxz*this.logic.toTaskQuanReate;
|
|
|
+ //let addTaskQuan = bczxz*this.logic.toTaskQuanReate;
|
|
|
+ let addTaskQuan = bczxz/this.logic.nowCell*this.logic.toTaskQuanReate;
|
|
|
+ console.warn("bczxz:",bczxz," nowCell:",this.logic.nowCell, " toTaskQuanReate:",this.logic.toTaskQuanReate," addTaskQuan:",addTaskQuan)
|
|
|
let nowTaskQuan = 0;
|
|
|
yield sgjtable.saveAsync();
|
|
|
let getList = [];
|
|
|
@@ -1302,6 +1405,17 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
let zfbName = "";
|
|
|
var sgjUser = yield this.app.models.SGJUser.findByIdAsync(this.ownerId, 'userId cost win zfbAcc zfbName gameCount wingames taskQuan yazhuList getList getTime drCount drTime lastPlayTime');
|
|
|
if (sgjUser) {
|
|
|
+ var resTaskQuan = this.logic.jisuanFloat(sgjUser.taskQuan,addTaskQuan,1);
|
|
|
+ // 钻石记录
|
|
|
+ var taskquanrecord = new this.app.models.TaskQuanRecord({
|
|
|
+ _id: uuid.v1(),
|
|
|
+ playerId: player._id,
|
|
|
+ dType: 1,//下注
|
|
|
+ dSource: sgjUser.taskQuan,
|
|
|
+ dSwap: addTaskQuan.toFixed(2),
|
|
|
+ dNow: resTaskQuan
|
|
|
+ });
|
|
|
+ yield taskquanrecord.saveAsync()
|
|
|
// sgjUser.zfbAcc = "";
|
|
|
// sgjUser.zfbName = "";
|
|
|
zfbAcc = sgjUser.zfbAcc;
|
|
|
@@ -1362,17 +1476,44 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
// }
|
|
|
// console.warn("本次总下注 "+bczxz+" addTaskQuan "+addTaskQuan+" nowTaskQuan "+nowTaskQuan);
|
|
|
// 掷骰子
|
|
|
+
|
|
|
+ var SGJUserTongjis = yield this.app.models.SGJUserTongji.findMongoAsync({todaytime:this.logic.getTodaySJC()})
|
|
|
+ if (SGJUserTongjis.length == 0) {
|
|
|
+ var SGJUserTongji = this.app.models.SGJUserTongji({
|
|
|
+ _id: uuid.v1(),
|
|
|
+ //userId: player.userId,
|
|
|
+ //usdt: this.users[0].diamond,
|
|
|
+ sgjwinlose: (Number(win)-Number(_.sum(yazhus))).toFixed(2),//下注
|
|
|
+ taskquanget: addTaskQuan,
|
|
|
+ nowtaskquan: sgjUser.taskQuan,
|
|
|
+ todaytime: this.logic.getTodaySJC()
|
|
|
+ });
|
|
|
+ console.warn("empty win:",win)
|
|
|
+ console.warn("_.sum(yazhus):",_.sum(yazhus))
|
|
|
+ yield SGJUserTongji.saveAsync()
|
|
|
+ }else {
|
|
|
+ var SGJUserTongji = SGJUserTongjis[0]
|
|
|
+ console.warn("SGJUserTongji:",SGJUserTongji)
|
|
|
+ SGJUserTongji.sgjwinlose = (Number(SGJUserTongji.sgjwinlose) - Number(_.sum(yazhus))+Number(win)).toFixed(2)//下注
|
|
|
+ SGJUserTongji.nowtaskquan = sgjUser.taskQuan
|
|
|
+ SGJUserTongji.taskquanget = (Number(SGJUserTongji.taskquanget)+Number(addTaskQuan)).toFixed(2)
|
|
|
+ console.warn("have data win:",win)
|
|
|
+ console.warn("_.sum(yazhus):",_.sum(yazhus))
|
|
|
+ console.warn("SGJUserTongji:sgjwinlose",SGJUserTongji.sgjwinlose)
|
|
|
+ yield SGJUserTongji.saveAsync()
|
|
|
+ }
|
|
|
+
|
|
|
var sttGame = {
|
|
|
over: this.over,
|
|
|
state: this.state,
|
|
|
yazhus:this.logic.deepCloneTL(this.yazhus),
|
|
|
- nowDiamond:this.nowDiamond,
|
|
|
- win:win,
|
|
|
+ nowDiamond:this.nowDiamond.toFixed(2),
|
|
|
+ win:win.toFixed(2),
|
|
|
handCards:handCards,
|
|
|
bsIndex:bsIndex,//本次发牌对应的倍数下标,
|
|
|
tspx:tspx,//特殊牌型,0:没有,1:小三元,2:大三元,3:大四喜
|
|
|
prizePool: this.logic.prizePool,
|
|
|
- nowTaskQuan:nowTaskQuan,
|
|
|
+ nowTaskQuan:nowTaskQuan.toFixed(2),
|
|
|
yxndlbTime:this.yxndlbTime,
|
|
|
yxndlbTip:this.yxndlbTip,
|
|
|
};
|
|
|
@@ -1383,13 +1524,16 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
if(bcsy >= 0){//押中赢了,奖池要亏
|
|
|
let jczs = this.logic.jisuanFloat(bcsy,xkcsl,1)*-1;//进出钻石
|
|
|
jjcsl = this.logic.jisuanFloat(jczs,this.logic.jcdwzhwzs,3);
|
|
|
+ console.warn("bcsy:",bcsy," xkcsl:",xkcsl, " jczs:",jczs, " jjcsl:",jjcsl)
|
|
|
}
|
|
|
else{//未押中输了,奖池要盈
|
|
|
let bcsd = bczxz-win;//本次输的
|
|
|
let jczs = this.logic.jisuanFloat(bcsd,xkcsl,2);//进出钻石
|
|
|
jjcsl = this.logic.jisuanFloat(jczs,this.logic.jcdwzhwzs,3);//下的太多赢得太少情况下这里出现负数很正常
|
|
|
+ console.warn("bcsd:",bcsd," bczxz:",bczxz," win:",win," xkcsl:",xkcsl, " jczs:",jczs, " jjcsl:",jjcsl)
|
|
|
}
|
|
|
if (jcPools) {
|
|
|
+ console.warn(1433)
|
|
|
if(mqdw >= 0 && mqdw < jcPools.pools.length){
|
|
|
let xzpool = _.cloneDeep(jcPools.pools);
|
|
|
xzpool[mqdw] += jjcsl;
|
|
|
@@ -1399,10 +1543,13 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
// console.warn("奖池保存结果222 ",mqdw,jcPools.kouchus, xzkouchu,xkcsl);
|
|
|
jcPools.pools = _.cloneDeep(xzpool);
|
|
|
jcPools.kouchus = _.cloneDeep(xzkouchu);
|
|
|
+ console.warn("xzpool:",xzpool)
|
|
|
+ console.warn("pools:",jcPools.pools)
|
|
|
yield jcPools.saveAsync();
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
+ console.warn("1454")
|
|
|
var sgjjc = yield this.app.models.SGJJC.findByIdAsync('sgjjcs', 'pools cspools levels kouchus');
|
|
|
if(sgjjc){
|
|
|
if(mqdw >= 0 && mqdw < sgjjc.pools.length){
|
|
|
@@ -1414,6 +1561,8 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
// console.warn("奖池保存结果444 ",mqdw,sgjjc.kouchus, xzkouchu,xkcsl);
|
|
|
sgjjc.pools = _.cloneDeep(xzpool);
|
|
|
sgjjc.kouchus = _.cloneDeep(xzkouchu);
|
|
|
+ console.warn("xzpool:",xzpool)
|
|
|
+ console.warn("pools:",sgjjc.pools)
|
|
|
yield sgjjc.saveAsync();
|
|
|
}
|
|
|
}
|
|
|
@@ -1469,6 +1618,7 @@ proto.startGameAsync = cor(function* (yazhus) {
|
|
|
// console.warn("游侠开始*******************this.chBanker",this.chBanker);
|
|
|
this.setPaijuHuiFangData(M.START_GAME,sttGame);/////TL++ 牌局回放 push游戏开始
|
|
|
// 开始通知
|
|
|
+ console.warn("sttGame:",sttGame)
|
|
|
yield this.pushMsgAsync(-1, 'shuiguo_event', { type: M.START_GAME, data: sttGame });
|
|
|
// let endmode=ENDMODE.NORMALEND//局数完成--正常结束
|
|
|
// let endmode=ENDMODE.PLAYING;
|
|
|
@@ -1560,12 +1710,14 @@ proto.taskReward = cor(function* (playerId,zfbAcc,zfbName,_getList) {
|
|
|
// 划分
|
|
|
proto.huafenAsync = cor(function* (type,value) {
|
|
|
if(this.win <= 0){//本局结果赢得分数(不包含下注的即winsList元素总和)用于判断用户是否可以押分
|
|
|
+ console.warn("remove 1616")
|
|
|
return { code: C.FAILD, msg: C.TABLE_MASK_ERROR };
|
|
|
}
|
|
|
+ value = parseFloat(value.toFixed(2));
|
|
|
if(this.nowDiamond < value){
|
|
|
return { code: C.FAILD, msg: "不能超出身上已有钻石" };
|
|
|
}
|
|
|
- if((value%this.logic.nowCell) != 0){
|
|
|
+ if((value*1000)%((this.logic.nowCell*1000)) != 0){
|
|
|
let str = "table 押大小数值出错了---id:"+this.id +" 当前局 "+ (this.over+1)+" this.ownerUid "+this.ownerUid+" value "+value;
|
|
|
logger.warn(str);////cssj
|
|
|
return { code: C.FAILD, msg: "押大小数值出错了 前端的问题 "+value };
|
|
|
@@ -1597,7 +1749,7 @@ proto.huafenAsync = cor(function* (type,value) {
|
|
|
};//本局的押大小发牌
|
|
|
this.win += res.win;//本局结果赢得分数(不包含下注的即winsList元素总和)用于判断用户是否可以押分
|
|
|
this.nowDiamond = this.nowDiamond - value + this.win;//玩家目前的钻石
|
|
|
- let addTaskQuan = res.addTaskQuan;
|
|
|
+ let addTaskQuan = 0//res.addTaskQuan.toFixed(2);;
|
|
|
let str5 = "table sgj划分 数据---id:"+this.id +" 当前局 "+ this.over+" type "+type+" value "+value;
|
|
|
str5+=(" nd "+this.nowDiamond+" win "+this.win+" pP "+this.logic.prizePool+" hc "+JSON.stringify(res))
|
|
|
logger.warn(str5);
|
|
|
@@ -1638,11 +1790,11 @@ proto.huafenAsync = cor(function* (type,value) {
|
|
|
}
|
|
|
|
|
|
let nowTaskQuan = 0;
|
|
|
- var sgjUser = yield this.app.models.SGJUser.findByIdAsync(this.ownerId, 'cost win taskQuan drCount drTime lastYDXTime');
|
|
|
+ var sgjUser = yield this.app.models.SGJUser.findByIdAsync(this.ownerId, 'userId cost win taskQuan drCount drTime lastYDXTime');
|
|
|
if (sgjUser) {
|
|
|
sgjUser.cost+= value;
|
|
|
sgjUser.win+= this.win;
|
|
|
- sgjUser.taskQuan = this.logic.jisuanFloat(sgjUser.taskQuan,addTaskQuan,1);
|
|
|
+ //sgjUser.taskQuan = this.logic.jisuanFloat(sgjUser.taskQuan,addTaskQuan,1);
|
|
|
nowTaskQuan = sgjUser.taskQuan;
|
|
|
sgjUser.drCount = this.nowDiamond;
|
|
|
sgjUser.lastYDXTime = nowTime;
|
|
|
@@ -1650,6 +1802,7 @@ proto.huafenAsync = cor(function* (type,value) {
|
|
|
yield sgjUser.saveAsync();
|
|
|
}
|
|
|
if (jcPools) {
|
|
|
+
|
|
|
if(mqdw >= 0 && mqdw <jcPools.ydxpools.length){
|
|
|
let jjcsl = 0//进奖池数量
|
|
|
let xkcsl = this.logic.jisuanFloat(value,this.logic.fqjjckcReate,3);//进出奖池需扣掉的数量
|
|
|
@@ -1677,13 +1830,13 @@ proto.huafenAsync = cor(function* (type,value) {
|
|
|
if(res.win >= 0) this.ydxwin += res.win*2; //所有玩家押大小总赢得
|
|
|
this.ydxxh += res.win*-1; //所有玩家押大小总消耗(总下注-总赢得)
|
|
|
this.ydxzcs += 1; //该日押大小总次数
|
|
|
- this.allrwq = this.logic.jisuanFloat(this.allrwq,addTaskQuan,1); //所有奖券产生总量
|
|
|
+ this.allrwq = this.logic.jisuanFloat(this.allrwq,addTaskQuan,1).toFixed(2); //所有奖券产生总量
|
|
|
this.allCost += value; //所有玩家总下注
|
|
|
if(res.win >= 0) this.allwin += res.win*2; //所有玩家总赢得
|
|
|
this.allxh += res.win*-1; //所有玩家总消耗(总下注-总赢得)
|
|
|
|
|
|
let phdata = {
|
|
|
- bczxz: value,//本次总下注
|
|
|
+ bczxz: value.toFixed(2),//本次总下注
|
|
|
addTaskQuan: addTaskQuan,//本次增加的任务券
|
|
|
jrStart: jrStart,//本次游戏时间对应的0点时间戳
|
|
|
nowTime: nowTime//本次游戏的时间
|
|
|
@@ -1694,8 +1847,27 @@ proto.huafenAsync = cor(function* (type,value) {
|
|
|
data.ydxcs = ydxcs; // 本局押大小次数
|
|
|
data.nowDiamond = this.nowDiamond;
|
|
|
data.value = value;
|
|
|
- data.nowTaskQuan = nowTaskQuan;
|
|
|
+ data.nowTaskQuan = nowTaskQuan.toFixed(2);
|
|
|
yield this.pushMsgAsync(-1, 'shuiguo_event', { type: M.COMPARE_RESULT, data: data });
|
|
|
+ //console.warn("data:",data)
|
|
|
+ var SGJUserTongjis = yield this.app.models.SGJUserTongji.findMongoAsync({todaytime:this.logic.getTodaySJC()})
|
|
|
+ var SGJUserTongji = null
|
|
|
+ if (SGJUserTongjis.length == 0) {
|
|
|
+ SGJUserTongji = this.app.models.SGJUserTongji({
|
|
|
+ _id: uuid.v1(),
|
|
|
+ userId: user.userId,
|
|
|
+ usdt: user.diamond,
|
|
|
+ taskquanlose: cost,//下注
|
|
|
+ todaytime: this.logic.getTodaySJC()
|
|
|
+ });
|
|
|
+ yield SGJUserTongji.saveAsync()
|
|
|
+ }else {
|
|
|
+ SGJUserTongji = SGJUserTongjis[0]
|
|
|
+ SGJUserTongji.usdt = data.nowDiamond
|
|
|
+ SGJUserTongji.sgjwinlose = (Number(SGJUserTongji.sgjwinlose) +Number(data.win)).toFixed(2)//下注
|
|
|
+
|
|
|
+ yield SGJUserTongji.saveAsync()
|
|
|
+ }
|
|
|
// console.warn("划分返回222 "+JSON.stringify(data));
|
|
|
return { code: C.OK, data: data };
|
|
|
});
|
|
|
@@ -2080,7 +2252,7 @@ proto.setPaiHangData = cor(function* (data) {
|
|
|
var paihang = yield this.app.models.SGJPaiHang.findByIdAsync(this.ownerId, fields);
|
|
|
if (paihang) {
|
|
|
if(data.jrStart == paihang.time1){
|
|
|
- let newcost1 = paihang.cost1 + data.bczxz;
|
|
|
+ let newcost1 = Number(paihang.cost1) + Number(data.bczxz);
|
|
|
let newQuan = this.logic.jisuanFloat(paihang.quan1,data.addTaskQuan,1);
|
|
|
paihang.cost1 = newcost1;
|
|
|
paihang.quan1 = newQuan;
|
|
|
@@ -2148,7 +2320,7 @@ proto.setPaiHangData = cor(function* (data) {
|
|
|
|
|
|
zphblb[zphblb.length] = list[i];
|
|
|
}
|
|
|
- this.phbfjTimer = this.app.timer.setTimeout(() => this.sendPHBJL(zphblb,0),100);
|
|
|
+ //this.phbfjTimer = this.app.timer.setTimeout(() => this.sendPHBJL(zphblb,0),100);
|
|
|
}
|
|
|
}
|
|
|
if(paihang){
|
|
|
@@ -2159,7 +2331,8 @@ proto.setPaiHangData = cor(function* (data) {
|
|
|
|
|
|
//发放排行榜奖励
|
|
|
proto.sendPHBJL = cor(function* (list,_index) {
|
|
|
- let index = _index;
|
|
|
+ return
|
|
|
+ /*let index = _index;
|
|
|
if(index >= list.length) return;
|
|
|
if (this.phbfjTimer) {
|
|
|
clearTimeout(this.phbfjTimer);
|
|
|
@@ -2174,11 +2347,11 @@ proto.sendPHBJL = cor(function* (list,_index) {
|
|
|
if(index < list.length){
|
|
|
//间隔0.1秒给玩家发送排行榜奖励
|
|
|
this.phbfjTimer = this.app.timer.setTimeout(() => this.sendPHBJL(list,index),100);
|
|
|
- }
|
|
|
+ }*/
|
|
|
});
|
|
|
|
|
|
////得到排行榜
|
|
|
-proto.getPaiHangAsync = cor(function* () {
|
|
|
+proto.getPaiHangAsync = cor(function* (playerId) {
|
|
|
let limit = 10;//前10名上榜
|
|
|
let jrStart = this.logic.getTodaySJC();////更新今日0时的时间戳
|
|
|
var opts = {
|
|
|
@@ -2200,11 +2373,20 @@ proto.getPaiHangAsync = cor(function* () {
|
|
|
}
|
|
|
pmInfos[i] = item;
|
|
|
}
|
|
|
- var zjph = yield this.app.models.SGJPaiHang.findByIdAsync(this.ownerId, 'name headurl userId cost1 quan1 time1');
|
|
|
+ let player = yield this.app.models.Player.findByIdAsync(playerId);
|
|
|
+ opts.userId = player.userId
|
|
|
+
|
|
|
+ var zjph = yield this.app.models.SGJPaiHang.findMongoAsync(opts);
|
|
|
+ var d = null
|
|
|
+ if (zjph.length > 0) {
|
|
|
+ d = zjph[0]
|
|
|
+ console.warn("getpaihang self:",d)
|
|
|
+ }
|
|
|
let data = {
|
|
|
pmInfos: pmInfos,
|
|
|
- zjph: zjph
|
|
|
+ zjph: d
|
|
|
}
|
|
|
+
|
|
|
return { code: C.OK, data: data };
|
|
|
});
|
|
|
|
|
|
@@ -2232,7 +2414,7 @@ proto.upZFBInfoAsync = cor(function* (playerId,realName,zfbAcc) {
|
|
|
|
|
|
// 得到任务列表
|
|
|
proto.getTaskInfoAsync = cor(function* (playerId,chairId) {
|
|
|
- // console.log("玩家信息玩家信息玩家信息");
|
|
|
+ console.log("玩家信息玩家信息玩家信息");
|
|
|
var user = this.users[chairId];
|
|
|
if (!user) {
|
|
|
return { code: C.FAILD, msg: C.GAME_PARAM_ERROR };
|
|
|
@@ -2393,6 +2575,7 @@ proto.dealRenWuAsync = cor(function* (playerId,chairId,item) {
|
|
|
});
|
|
|
// console.warn("领取之后存储任务 ",JSON.stringify(newsgjTask),JSON.stringify(item));
|
|
|
yield newsgjTask.saveAsync();
|
|
|
+
|
|
|
let jxzrmbjl = 0;//进行中的rmb奖励
|
|
|
if(item.rewardt == 1) {
|
|
|
this.rwxhjq1 = this.logic.jisuanFloat(this.rwxhjq1,cost,1); //钻石任务消耗奖券总量(领任务时记录)
|
|
|
@@ -2405,12 +2588,40 @@ proto.dealRenWuAsync = cor(function* (playerId,chairId,item) {
|
|
|
// var sgjUser = yield this.app.models.SGJUser.findByIdAsync(playerId, 'taskQuan');
|
|
|
if (sgjUser) {
|
|
|
nowTaskQuan = this.logic.jisuanFloat(sgjUser.taskQuan,cost,2);
|
|
|
+ var resTaskQuan = new this.app.models.TaskQuanRecord({
|
|
|
+ _id: uuid.v1(),
|
|
|
+ playerId: playerId,
|
|
|
+ dType: 2,//领任务
|
|
|
+ dSource: sgjUser.taskQuan,
|
|
|
+ dSwap: 0-cost.toFixed(2),
|
|
|
+ dNow: nowTaskQuan
|
|
|
+ });
|
|
|
+ yield resTaskQuan.saveAsync()
|
|
|
// console.warn("领取之后修改任务券数 ",sgjUser.taskQuan,cost,nowTaskQuan);
|
|
|
sgjUser.taskQuan = nowTaskQuan;
|
|
|
sgjUser.jxzReward += jxzrmbjl;
|
|
|
this.users[0].taskQuan = sgjUser.taskQuan;
|
|
|
yield sgjUser.saveAsync();
|
|
|
}
|
|
|
+ var SGJUserTongjis = yield this.app.models.SGJUserTongji.findMongoAsync({todaytime:this.getTodaySJC()})
|
|
|
+ var SGJUserTongji = null
|
|
|
+ if (SGJUserTongjis.length == 0) {
|
|
|
+ SGJUserTongji = this.app.models.SGJUserTongji({
|
|
|
+ _id: uuid.v1(),
|
|
|
+ //userId: user.userId,
|
|
|
+ usdt: user.diamond,
|
|
|
+ taskquanlose: cost,//下注
|
|
|
+ todaytime: this.logic.getTodaySJC()
|
|
|
+ });
|
|
|
+ yield SGJUserTongji.saveAsync()
|
|
|
+ }else {
|
|
|
+ SGJUserTongji = SGJUserTongjis[0]
|
|
|
+ console.warn("SGJUserTongji:",SGJUserTongji)
|
|
|
+ //SGJUserTongji.usdt = user.diamond,
|
|
|
+ SGJUserTongji.taskquanlose = (Number(SGJUserTongji.taskquanlose) +Number(cost)).toFixed(2)//下注
|
|
|
+ SGJUserTongji.nowtaskquan = nowTaskQuan
|
|
|
+ yield SGJUserTongji.saveAsync()
|
|
|
+ }
|
|
|
if(this.wjrwxylb.length != this.logic.cardKindCount){
|
|
|
this.wjrwxylb = _.fill(Array(this.logic.cardKindCount), 0);
|
|
|
}
|
|
|
@@ -2422,7 +2633,7 @@ proto.dealRenWuAsync = cor(function* (playerId,chairId,item) {
|
|
|
// console.warn("领取任务 玩家已领未完成任务需要的任务要求列表 ",this.wjrwxylb);
|
|
|
ylcs++;
|
|
|
var data = {
|
|
|
- nowTaskQuan:nowTaskQuan,
|
|
|
+ nowTaskQuan:nowTaskQuan.toFixed(2),
|
|
|
ylcs : ylcs,//该任务已领取的次数
|
|
|
renwuInfo: item
|
|
|
}
|