From 6dc658f7c529a79ae433e3177b58a31db79f7d4f Mon Sep 17 00:00:00 2001
From: haptear <haptear@hotmail.com>
Date: Fri, 17 Jun 2022 17:49:10 +0800
Subject: [PATCH] 123213

---
 xcx_cgfh.js          | 60 ++++++++++++++++++++++++++++++++++++--------
 xcx_cgfh_withdraw.js |  2 +-
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/xcx_cgfh.js b/xcx_cgfh.js
index b545ec7..766a604 100644
--- a/xcx_cgfh.js
+++ b/xcx_cgfh.js
@@ -1,10 +1,3 @@
-/*
-获取token 自动刷题得分
-# new Env("猜歌-小程序")
-# cron 13 8,11,19 * * * xcx_cgfh.js
- */
- 
-
 const jobname = '猜歌'
 
 const $ = Env(jobname)
@@ -23,19 +16,20 @@ let useridArr=[
 'we7sid-d84303f9a35ad508f9ca24b027a5a024'
 ]
 let power,cashaccount,answercount
-
+let total=500
 !(async () => {
     if (typeof $request !== "undefined") {
         await GetRewrite()
     }else {
 		if(!(await checkEnv())) return;
           
-
-         for (let f = 0; f < 500; f++) {
+		console.log(`用户设置循环次数:${total}`)
+         for (let f = 0; f < total; f++) {
 			console.log(`\n===开始第${f+1}次答题`)
 			let i=1
 			for (userid of useridArr){
 				console.log(`\n===开始用户${i}`)
+                    redid=0
 				await acc33(userid)	//通过次数
 				await $.wait(500)
 				if (f%3)await acc0(userid)
@@ -50,6 +44,21 @@ let power,cashaccount,answercount
                 i+=1
 			}		
 		}
+		console.log(`开始检查提现:`)
+		let i=1
+		for (userid of useridArr){
+			console.log(`\n===开始用户${i}`)
+			await acc33(userid)
+            if (redid>=58888)wid=39
+            else if (redid>=25888)wid=38
+			else if (redid>=8888)wid=37
+			else if (redid>=1888)wid=36
+			else if (redid>=188)wid=35
+			else if (redid>=8)wid=34
+			$.log(`兑换ID${wid}`)
+            await Widthdra()	
+			i+=1
+		}
 		//await showmsg()
     }
 })()
@@ -86,6 +95,36 @@ async function showmsg() {
         if($.isNode()){await notify.sendNotify($.name, notifyBody );}
     }
 }
+
+
+
+
+
+
+
+//提现
+async function Widthdra() {
+    let url =`https://nb.xinhuachuanmeijs.com/app/index.php?i=51&t=0&v=1.0.6&from=wxapp&c=entry&a=wxapp&do=cmd&&state=${userid}&m=niuuniu_dvr_muti&sign=c63a62672aafdd283805f6f8cc943bd5`
+
+min=`{"cmd":"WEAPP.userWidthdrawal","params":{"id":"${wid}"}}`
+
+a=Base64.encode(min)
+	let body=`{"execRaw":"${a}"}`
+    
+    let urlObject = populateUrlObject(url,body)
+    await httpRequest('post',urlObject)
+	if(!httpResult || httpResult.statusCode != 200) {return;}
+	let result = JSON.parse(httpResult.body);
+    if(!result) return
+console.log(`兑换:${result.message}`);
+	}
+
+
+
+
+
+
+
 //个人信息
 async function acc33() {
     let url =`https://nb.xinhuachuanmeijs.com/app/index.php?i=51&t=0&v=1.0.6&from=wxapp&c=entry&a=wxapp&do=cmd&&state=${userid}&m=niuuniu_dvr_muti&sign=986688499c1e4084542fc6d9989e91d1`
@@ -96,6 +135,7 @@ async function acc33() {
 	let result = JSON.parse(httpResult.body);
     if(!result) return
     if(result.errno == 0) {	
+    redid=result.data.userAnswerCount
 		answercount=result.data.userAnswerCount
 		console.log(`通过次数:${result.data.userAnswerCount} `)
 	}else console.log(`${JSON.stringify(result)}`)
diff --git a/xcx_cgfh_withdraw.js b/xcx_cgfh_withdraw.js
index 6c35e14..e88b10c 100644
--- a/xcx_cgfh_withdraw.js
+++ b/xcx_cgfh_withdraw.js
@@ -71,7 +71,7 @@ let power,cashaccount,answercount
          await $.wait(500)
          await acc33(userid)
          await $.wait(500)
-		 //if (cashaccount>1&&answercount>188)await withdraw(userid)
+		 if (cashaccount>1&&answercount>188)await withdraw(userid)
 		
 		}
 		//await showmsg()