Compare commits
6 Commits
e2e869327a
...
53463867db
| Author | SHA1 | Date | |
|---|---|---|---|
| 53463867db | |||
| feed4da272 | |||
| ca4a943678 | |||
| 2068f57c69 | |||
| fb52f6d5db | |||
| c30ca28cd0 |
@ -0,0 +1,7 @@
|
||||
[DATABASE]
|
||||
HOSTNAME=localhost
|
||||
DATABASE=mydatabase
|
||||
USERNAME=myuser
|
||||
PASSWORD=mypassword
|
||||
CHARSET=utf8mb4
|
||||
PORT=3306
|
||||
@ -50,6 +50,7 @@
|
||||
<th class='text-left nowrap'>当前收益(元)</th>
|
||||
<th class='text-left nowrap'>预期收益(元)</th>
|
||||
<th class='text-left nowrap'>开始时间</th>
|
||||
<th class='text-left nowrap'>结算时间</th>
|
||||
<th class='text-left nowrap'>结束时间</th>
|
||||
<th class='text-left nowrap'>状态</th>
|
||||
<th class='text-left nowrap'></th>
|
||||
@ -89,6 +90,9 @@
|
||||
<td class='text-left nowrap'>
|
||||
{$vo.start_time}
|
||||
</td>
|
||||
<td class='text-left nowrap'>
|
||||
{:date('Y-m-d H:i:s',$vo.profit_time)}
|
||||
</td>
|
||||
<td class='text-left nowrap'>
|
||||
{$vo.end_time}
|
||||
</td>
|
||||
|
||||
115
application/command/Yebeveryday.php
Normal file
115
application/command/Yebeveryday.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace app\command;
|
||||
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
|
||||
class InterestTreasure extends Command
|
||||
{
|
||||
protected $outputInfo;
|
||||
protected function configure()
|
||||
{
|
||||
// 指令配置
|
||||
$this->setName('InterestTreasure');
|
||||
// 设置参数
|
||||
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
// 指令执行
|
||||
$this->outputInfo = $output;
|
||||
$this->closeAccount();
|
||||
|
||||
}
|
||||
|
||||
public function closeAccount()
|
||||
{
|
||||
$this->outputInfo->writeln('开始结算');
|
||||
try {
|
||||
//逻辑代码
|
||||
$this->yebeveryday();
|
||||
} catch (\Exception $exception) {
|
||||
//Log::info($exception->getMessage());
|
||||
var_dump($exception->getTrace());
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
public function yebeveryday()
|
||||
{
|
||||
$nowtime = time();
|
||||
$keepnum = 0;
|
||||
$closenum = 0;
|
||||
$getdoings = Db::table('lc_yuebao_lists')->where('status=1 and profit_time<=' . (time() - 86400))->select();
|
||||
foreach ($getdoings as $getdoing) {
|
||||
try {
|
||||
$new_profit_time = $nowtime;
|
||||
if ($new_profit_time >= $getdoing['end_time']) {
|
||||
$new_profit_time = $getdoing['end_time'];
|
||||
}
|
||||
$seconds = floor(($new_profit_time - $getdoing['profit_time']) / 86400);
|
||||
$nowprift = ($getdoing['money'] * $getdoing['lily'] / 100) * $seconds;
|
||||
$profit = $getdoing['profit'] + $seconds;
|
||||
$id = $getdoing['id'];
|
||||
var_dump($seconds);
|
||||
var_dump($getdoing['profit_time'] + $seconds * 86400);
|
||||
if ($nowprift > 0) {
|
||||
Db::table('lc_yuebao_lists')->where('id='. $getdoing['id'])
|
||||
->update([
|
||||
'profit_time' => $getdoing['profit_time'] + $seconds * 86400,
|
||||
'nowprofit' => $getdoing['nowprofit'] + $nowprift,
|
||||
'profit' => $getdoing['profit'] + $seconds
|
||||
]);
|
||||
$keepnum = $keepnum + 1;
|
||||
//获取用户余额;
|
||||
addFinance($getdoing['uid'], $nowprift, 1, "余额宝利息返利");
|
||||
$getuserinfo = Db::table('lc_user')->where('id=' . $getdoing['uid'])->find();
|
||||
//记录日志!
|
||||
unset($getdoing['id']);
|
||||
unset($getdoing['profit_time']);
|
||||
unset($getdoing['profit']);
|
||||
$getdoing['status'] = 2;
|
||||
$getdoing['nowprofit'] = $nowprift;
|
||||
$getdoing['balance'] = $getuserinfo['money'];
|
||||
$getdoing['closetime'] = time();
|
||||
$getdoing['remarks'] = "自动结算";
|
||||
Db::table('lc_yuebao_log')->insert($getdoing);
|
||||
//更新用户余额
|
||||
$newbalance = $getuserinfo['money'] + $nowprift;
|
||||
Db::table('lc_user')->where('id=' . $getdoing['uid'])->update(['money' => $newbalance]);
|
||||
}
|
||||
//第二步,已到期待结算
|
||||
if ($profit >= $getdoing['days']) {
|
||||
//更新参保状态。
|
||||
Db::table('lc_yuebao_lists')->where('id=' . $id)
|
||||
->update(['status' => 2]);
|
||||
//获取用户余额;
|
||||
addFinance($getdoing['uid'], $getdoing['money'], 1, "余额宝返还本金");
|
||||
$getuserinfo = Db::table('lc_user')->where('id=' . $getdoing['uid'])->find();
|
||||
//更新用户余额
|
||||
$newbalance = $getuserinfo['money'] + $getdoing['money'];
|
||||
Db::table('lc_user')->where('id=' . $getdoing['uid'])->update(['money' => $newbalance]);
|
||||
$getuc = Db::table('lc_yuebao_uc')->where('uid=' . $getdoing['uid'])->find();
|
||||
Db::table('lc_yuebao_uc')->where('uid=' . $getdoing['uid'])->update(['balance' => $getuc['balance'] - $getdoing['money']]);
|
||||
$saveuclog = array(
|
||||
'uid' => $getdoing['uid'],
|
||||
'balance' => $getuc['balance'],
|
||||
'money' => "-" . $getdoing['money'],
|
||||
'addtime' => time(),
|
||||
'remarks' => $getdoing['yebtitle'] . "到期结算"
|
||||
);
|
||||
Db::table('lc_yuebao_uclog')->insert($saveuclog);
|
||||
$closenum = $closenum + 1;
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
var_dump($e->getTraceAsString());
|
||||
$this->outputInfo->error("结算失败,ID: " . $getdoing['id'] . " 错误信息: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
$this->outputInfo->writeln('结算成功:' . $keepnum . '条,到期:' . $closenum . '条');
|
||||
}
|
||||
}
|
||||
40
composer.json
Normal file
40
composer.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"type": "project",
|
||||
"name": "zoujingli/thinkadmin",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anyon",
|
||||
"email": "zoujingli@qq.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "~7.2",
|
||||
"aliyuncs/oss-sdk-php": "^2.3",
|
||||
"endroid/qr-code": "^1.9",
|
||||
"qiniu/php-sdk": "^7.2",
|
||||
"symfony/options-resolver": "^3.4",
|
||||
"topthink/framework": "^5.1",
|
||||
"zoujingli/ip2region": "^1.0",
|
||||
"zoujingli/think-library": "5.1.x-dev",
|
||||
"zoujingli/wechat-developer": "^1.2",
|
||||
"zoujingli/weopen-developer": "dev-master"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0|^5.0",
|
||||
"squizlabs/php_codesniffer": "~2.3",
|
||||
"phploc/phploc": "2.*",
|
||||
"sebastian/phpcpd": "2.*"
|
||||
},
|
||||
"repositories": {
|
||||
"packagist": {
|
||||
"type": "composer",
|
||||
"url": "https://mirrors.aliyun.com/composer"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"topthink/think-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -27,5 +27,5 @@ return [
|
||||
'DEFAULT_TIMEZONE' => 'America/Sao_Paulo',
|
||||
'default_lang' => 'zh-cn', // 设置默认语言
|
||||
'lang_switch_on' => true, // 开启多语言切换
|
||||
'deny_module_list' => ['akszadmin']
|
||||
'deny_module_list' => ['akszadmin','command','lang']
|
||||
];
|
||||
|
||||
20
config/console.php
Normal file
20
config/console.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 控制台配置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
'name' => 'Think Console',
|
||||
'version' => '0.1',
|
||||
'user' => null,
|
||||
'auto_path' => env('app_path') . 'command' . DIRECTORY_SEPARATOR,
|
||||
];
|
||||
1
db/.gitignore
vendored
Executable file
1
db/.gitignore
vendored
Executable file
@ -0,0 +1 @@
|
||||
*.sql
|
||||
BIN
db/0302-2_2025-08-15_01-49-45_mysql_data_Dl1OJ.sql.zip
Normal file
BIN
db/0302-2_2025-08-15_01-49-45_mysql_data_Dl1OJ.sql.zip
Normal file
Binary file not shown.
55
index.html
55
index.html
@ -1,55 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Site is created successfully! </title>
|
||||
<style>
|
||||
.container {
|
||||
width: 60%;
|
||||
margin: 10% auto 0;
|
||||
background-color: #f0f0f0;
|
||||
padding: 2% 5%;
|
||||
border-radius: 10px
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
ul li {
|
||||
line-height: 2.3
|
||||
}
|
||||
|
||||
a {
|
||||
color: #20a53a
|
||||
}
|
||||
.footer {
|
||||
/* position: absolute;
|
||||
left: 0;
|
||||
bottom: 32px;
|
||||
width: 100%; */
|
||||
margin-top: 24px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
}
|
||||
.footer .btlink {
|
||||
color: #20a53a;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Congratulations, the site is created successfully! </h1>
|
||||
<h3>This is the default index.html, this page is automatically generated by the system</h3>
|
||||
<ul>
|
||||
<li>The index.html of this page is in the site root directory</li>
|
||||
<li>You can modify, delete or overwrite this page</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--<div class="footer">
|
||||
Power by
|
||||
<a class="btlink" href="https://www.aapanel.com/new/download.html?invite_code=aapanele" target="_blank">aaPanel (The Free, Efficient and secure hosting control panel)</a>
|
||||
</div> -->
|
||||
</body>
|
||||
</html>
|
||||
3
public/.gitignore
vendored
3
public/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.well-known
|
||||
.user.ini
|
||||
.user.ini
|
||||
h5
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user