From 4a759671b3d97740a0b1d8ef28f46d6be7afa9a3 Mon Sep 17 00:00:00 2001 From: "cn.yimian.xyz" Date: Sun, 23 Aug 2020 10:58:26 +0800 Subject: [PATCH] mail --- api/checkout.php | 2 +- api/functions.php | 20 ++++++++++++++------ api/newItem.php | 1 - index.html | 15 ++++++++++----- records.html | 8 ++++---- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/api/checkout.php b/api/checkout.php index 9a0c9ec..b413c14 100644 --- a/api/checkout.php +++ b/api/checkout.php @@ -37,4 +37,4 @@ db__pushData($cnn, "user", array( "table" => $tableId )); -echo ''; \ No newline at end of file +echo ''; diff --git a/api/functions.php b/api/functions.php index 9c66ec3..d3426db 100644 --- a/api/functions.php +++ b/api/functions.php @@ -1,5 +1,6 @@ $item){ if($data['average'] - $item > $threshold){ - }else{ return false; } } @@ -790,14 +799,13 @@ function setBalance($first, $last, $threshold, $tableId, $cnn){ 感谢您使用本站服务,祝您生活愉悦! 呓喵酱(@iotcat)", "CP-ACC"); -Sleep(10); - -curl__post('https://api.yimian.xyz/mail/?to='.$firstData['email'].'&from=CP-ACC&subject=CP-ACC消息: 您需要给'.$lastData['nickname'].$threshold."磅/元"."body=亲爱的".$firstData['nickname'].": +//Sleep(10); +yimian__mail($firstData['email'], 'CP-ACC消息: 您需要给'.$lastData['nickname'].$threshold."磅/元", "亲爱的".$firstData['nickname'].": 根据系统的计算,您需要给".$lastData['nickname']."(".$lastData['email'].")".$threshold."磅/元,以保持大家的公共支出相对公平。请在转账后提醒对方从网站或邮件中确认您的支出。您可以通过CP-ACC网站查看具体账目细节。如有任何疑问,请联系站长呓喵酱(i@iotcat.me)。 感谢您使用本站服务,祝您生活愉悦! -呓喵酱(@iotcat)", array()); +呓喵酱(@iotcat)", "CP-ACC"); } diff --git a/api/newItem.php b/api/newItem.php index 5ee56a8..a134f3e 100644 --- a/api/newItem.php +++ b/api/newItem.php @@ -44,7 +44,6 @@ while(!checkBalance($data, $threshold)){ if($data['average'] - $data['virtualTotals'][$first] > $threshold){ setBalance($first, $last, $threshold, $tableId, $cnn); } - Sleep(5); $data = getFinalData($cnn, $tableId); } diff --git a/index.html b/index.html index c3d5b9e..1f80fce 100644 --- a/index.html +++ b/index.html @@ -53,6 +53,9 @@
  • Setting
  • +
  • + Checkout +
  • Log out
  • @@ -304,8 +307,10 @@ function load(){ $('#total').html(Number(data.total)); $('#total-usr').html(Number(data['actualTotals'][session.get('hash')])); $('#total-usr-bar').css('width', (data['actualTotals'][session.get('hash')] / data.average)*100+'%'); - - + $('#checkout').unbind(); + $('#checkout').click(function(){ + window.location.href="https://cp-acc.yimian.xyz/api/checkout.php?hash="+session.get('hash')+"&tableId="+data.id; + }); var lastWeekTotal = Number(0), lastSecodeWeekTotal = Number(0); @@ -324,7 +329,7 @@ function load(){ - $('#week-avg').html(Number(lastWeekTotal/7).toFixed(2)); + $('#week-avg').html(Number(lastWeekTotal/(7*data.users.length)).toFixed(2)); $('#total-bar').css('width', (data['actualTotals'][session.get('hash')] / lastWeekTotal)*100+'%'); if(lastWeekTotal > lastSecodeWeekTotal) $('#week-avg-rate').html(((lastWeekTotal - lastSecodeWeekTotal)/lastSecodeWeekTotal).toFixed(2)+'% '); if(lastSecodeWeekTotal < lastSecodeWeekTotal) $('#week-avg-rate').html(((lastSecodeWeekTotal - lastWeekTotal)/lastSecodeWeekTotal).toFixed(2)+'% '); @@ -450,8 +455,8 @@ function load(){

    `; - if(item.value < 0) s += `You will Get £50 from `+ data.usersName[item.comments] + ` `; - if(item.value > 0) s += `Please Give £50 to `+ data.usersName[item.comments]; + if(item.value < 0) s += `You will Get £`+Number(-item.value)+` from `+ data.usersName[item.comments] + ` `; + if(item.value > 0) s += `Please Give £`+Number(item.value)+` to `+ data.usersName[item.comments]; s += `

    `; diff --git a/records.html b/records.html index a317cb9..dd82fb0 100644 --- a/records.html +++ b/records.html @@ -181,6 +181,7 @@ $('#usr').html(session.get('nickname')); var s = ''; + data['items'].reverse(); data['items'].forEach((i)=>{ if(i.type == 'external'){ s += ` @@ -213,7 +214,7 @@ $('#account-events').html(s); - + var userNotice = []; @@ -281,9 +282,8 @@

    `; - - if(item.value < 0) s += `You will Get £50 from `+ data.usersName[item.comments] + ` `; - if(item.value > 0) s += `Please Give £50 to `+ data.usersName[item.comments]; + if(item.value < 0) s += `You will Get £`+Number(-item.value)+` from `+ data.usersName[item.comments] + ` `; + if(item.value > 0) s += `Please Give £`+Number(item.value)+` to `+ data.usersName[item.comments]; s += `

    `;