diff --git a/api/createTable.php b/api/createTable.php index 99c6c56..b2a75cc 100644 --- a/api/createTable.php +++ b/api/createTable.php @@ -34,6 +34,6 @@ db__pushData($cnn, "user", array( )); -return json_encode(array( +echo json_encode(array( "tableId" => $tableId -)); \ No newline at end of file +)); diff --git a/api/functions.php b/api/functions.php index 3333f85..4ecdde2 100644 --- a/api/functions.php +++ b/api/functions.php @@ -592,7 +592,7 @@ function getPostHttpBody($param) /* sms */ -require __DIR__ . "/../../lib/qcloudsms/src/index.php"; +require __DIR__ . "/../../../lib/qcloudsms/src/index.php"; use Qcloud\Sms\SmsSingleSender; use Qcloud\Sms\SmsMultiSender; @@ -656,7 +656,7 @@ function getItems($cnn, $tableId){ return db__getData($cnn, "account", "table", $tableId); } function getTableInfo($cnn, $tableId){ - $res = db__getData($cnn, "table", "table", $tableId); + $res = db__getData($cnn, "table", "id", $tableId); return $res[0]; } function getTableData($cnn, $tableId){ @@ -675,7 +675,7 @@ function getTableDataByUsers($cnn, $tableId){ array_push($arr, $item); } } - array_push($o['itemsByUser'], $arr); + $o['itemsByUser'][$user] = $arr; } return $o; } @@ -716,7 +716,7 @@ function getUsersInfo($tableData){ $auth = db__connect("","","","auth"); $tableData['usersName'] = array(); foreach($tableData['users'] as $user){ - array_push($tableData['usersName'], db__getData($auth, "account", "hash", $user)[0]['nickname']); + $tableData['usersName'][$user] = db__getData($auth, "account", "hash", $user)[0]['nickname']; } return $tableData; } @@ -725,8 +725,8 @@ function getUsersInfo($tableData){ function getFinalData($cnn, $tableId){ $d = getTableDataByUsers($cnn, $tableId); $o = getTotals($d); - $o = getAverage($o); $o = getUsersInfo($o); + $o = getAverage($o); return $o; } @@ -795,4 +795,4 @@ function setBalance($first, $last, $threshold, $tableId, $cnn){ 感谢您使用本站服务,祝您生活愉悦! 呓喵酱(@iotcat)", "CP-ACC"); -} \ No newline at end of file +} diff --git a/api/getData.php b/api/getData.php index 58775ad..5c74b82 100644 --- a/api/getData.php +++ b/api/getData.php @@ -7,7 +7,7 @@ $hash = $_REQUEST['hash']; if(!isset($hash)) die(); -$cnn = connect(); +$cnn = db__connect(); $res = db__getData($cnn, "user", "user", $hash, "state", '1'); $o = []; @@ -18,4 +18,4 @@ foreach($res as $item){ -echo json_encode($o); \ No newline at end of file +echo json_encode($o); diff --git a/api/newItem.php b/api/newItem.php index 1bb52d0..a134f3e 100644 --- a/api/newItem.php +++ b/api/newItem.php @@ -7,7 +7,7 @@ $url = $_REQUEST['url']; $passby = $_REQUEST['passby']; -if(!isset($hash) || !isset($passby)) die(); +if(!isset($url) || !isset($passby)) die(); $passby = json_decode(base64_decode($passby), true); @@ -49,4 +49,4 @@ while(!checkBalance($data, $threshold)){ -header("Location: https://cp-acc.yimian.xyz/"); \ No newline at end of file +header("Location: https://cp-acc.yimian.xyz/"); diff --git a/api/updateTable.php b/api/updateTable.php index e3c22fe..96f9fe4 100644 --- a/api/updateTable.php +++ b/api/updateTable.php @@ -15,8 +15,7 @@ db__pushData($cnn, "table", array( "state" => '1', "name" => $name, "threshold" => $threshold, - "created_by" => $hash, - "created_at" => date("Y-m-d H:i:s", time()) + "updated_at" => date("Y-m-d H:i:s", time()) ), array( "id" => $tableId )); diff --git a/index.html b/index.html index 485ca4a..9c7a30a 100644 --- a/index.html +++ b/index.html @@ -51,7 +51,7 @@
Weekly Payment
+Average Daily Payment