master
cn.yimian.xyz 4 years ago
parent 6e788b4d24
commit 4a759671b3
  1. 2
      api/checkout.php
  2. 20
      api/functions.php
  3. 1
      api/newItem.php
  4. 15
      index.html
  5. 8
      records.html

@ -37,4 +37,4 @@ db__pushData($cnn, "user", array(
"table" => $tableId
));
echo '<script>alert("您已退出!请根据邮件提示进行checkout!!");window.location.href="https://cp-acc.yimian.xyz/"</script>';
echo '<script>alert("您已退出!请根据邮件提示进行checkout!!");window.location.href="https://cp-acc.yimian.xyz/"</script>';

@ -1,5 +1,6 @@
<?php
include '/mnt/config/dbKeys/settlement.php';
include '/mnt/config/dbKeys/log.php';
include '/mnt/config/php/config.php';
/**database connection**/
@ -652,6 +653,14 @@ function getUsers($cnn, $tableId){
return $arr;
}
function getAllUsers($cnn, $tableId){
$res = db__getData($cnn, 'user', 'table', $tableId);
$arr = array();
foreach($res as $item){
array_push($arr, $item['user']);
}
return $arr;
}
function getItems($cnn, $tableId){
return db__getData($cnn, "account", "table", $tableId);
}
@ -662,6 +671,7 @@ function getTableInfo($cnn, $tableId){
function getTableData($cnn, $tableId){
$o = getTableInfo($cnn, $tableId);
$o['users'] = getUsers($cnn, $tableId);
$o['allUsers'] = getAllUsers($cnn, $tableId);
$o['items'] = getItems($cnn, $tableId);
return $o;
}
@ -717,7 +727,7 @@ function getAverage($tableData){
function getUsersInfo($tableData){
$auth = db__connect("","","","auth");
$tableData['usersName'] = array();
foreach($tableData['users'] as $user){
foreach($tableData['allUsers'] as $user){
$tableData['usersName'][$user] = db__getData($auth, "account", "hash", $user)[0]['nickname'];
}
return $tableData;
@ -742,7 +752,6 @@ function getThreshold($cnn, $tableId){
function checkBalance($data, $threshold){
foreach($data['virtualTotals'] as $user => $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."磅/元,以保持大家的公共支出相对公平。请在转账后提醒对方从网站或邮件中确认您的支出。您可以通过<a href='https://cp-acc.yimian.xyz/'>CP-ACC网站</a>查看具体账目细节。如有任何疑问,请联系站长呓喵酱(i@iotcat.me)。
感谢您使用本站服务,祝您生活愉悦!
呓喵酱(@iotcat)", array());
呓喵酱(@iotcat)", "CP-ACC");
}

@ -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);
}

@ -53,6 +53,9 @@
<li class="">
<a href="#" id="setTable"><img src="img/content/icons/11.png" alt=""><strong>Setting</strong> </a>
</li>
<li class="">
<a href="#" id="checkout" data-loader="show"><img src="https://cdn.yimian.xyz/smart-settlement/img/content/icons/7.png" alt=""><strong>Checkout</strong></a>
</li>
<li class="">
<a href="https://login.yimian.xyz/logout.html" data-loader="show"><img src="https://cdn.yimian.xyz/smart-settlement/img/content/icons/7.png" alt=""><strong>Log out</strong></a>
</li>
@ -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)+'% <i style="color:red;" class="fa fa-arrow-up ml-10"></i>');
if(lastSecodeWeekTotal < lastSecodeWeekTotal) $('#week-avg-rate').html(((lastSecodeWeekTotal - lastWeekTotal)/lastSecodeWeekTotal).toFixed(2)+'% <i style="color:green;" class="fa fa-arrow-down ml-10"></i>');
@ -450,8 +455,8 @@ function load(){
<div class="ml-10">
<h4 class="coin-name">`;
if(item.value < 0) s += `You will Get £50 from `+ data.usersName[item.comments] + ` <button style="color: green;" onClick="javascript:page.confirm('`+item.created_at+`');">Confirm to Recived</button>`;
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] + ` <button style="color: green;" onClick="javascript:page.confirm('`+item.created_at+`');">Confirm to Recived</button>`;
if(item.value > 0) s += `Please Give £`+Number(item.value)+` to `+ data.usersName[item.comments];
s += `</h4>
<small class="text-muted">`;

@ -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 @@
</div>
<div class="ml-10">
<h4 class="coin-name">`;
if(item.value < 0) s += `You will Get £50 from `+ data.usersName[item.comments] + ` <button style="color: green;" onClick="javascript:confirm(`+item.created_at+`);">Confirm to Recived</button>`;
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] + ` <button style="color: green;" onClick="javascript:page.confirm('`+item.created_at+`');">Confirm to Recived</button>`;
if(item.value > 0) s += `Please Give £`+Number(item.value)+` to `+ data.usersName[item.comments];
s += `</h4>
<small class="text-muted">`;

Loading…
Cancel
Save