From feed4da27251241068687061dc77c4e131fa1398 Mon Sep 17 00:00:00 2001 From: kaadon Date: Fri, 15 Aug 2025 11:02:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/command/Yebeveryday.php | 106 ++++ config/app.php | 2 +- public/adminer.php | 874 ---------------------------- 3 files changed, 107 insertions(+), 875 deletions(-) create mode 100644 application/command/Yebeveryday.php delete mode 100644 public/adminer.php diff --git a/application/command/Yebeveryday.php b/application/command/Yebeveryday.php new file mode 100644 index 0000000..388a5df --- /dev/null +++ b/application/command/Yebeveryday.php @@ -0,0 +1,106 @@ +setName('InterestTreasure'); + // 设置参数 + + } + + protected function execute(Input $input, Output $output) + { + // 指令执行 + $this->outputInfo = $output; + + } + + public function closeAccount() + { + $this->outputInfo->writeln('开始结算'); + $this->yebeveryday(); + $this->outputInfo->writeln('结算完成'); + } + + 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']; + } + $second_time = $new_profit_time - $getdoing['profit_time']; + $nowprift = ($getdoing['money'] * $getdoing['lily'] / 100) * floor($second_time / 86400); + if ($nowprift > 0) { + Db::table('lc_yuebao_lists')->where('id='. $getdoing['id']) + ->update([ + 'profit_time' => $getdoing['profit_time'] + $second_time, + 'nowprofit' => $getdoing['nowprofit'] + $nowprift, + 'profit' => $getdoing['profit'] + floor(($nowtime - $getdoing['start_time']) / 86400) + ]); + $keepnum = $keepnum + 1; + //获取用户余额; + addFinance($getdoing['uid'], $nowprift, 1, "余额宝利息返利"); + $getuserinfo = Db::table('lc_user')->where('id=' . $getdoing['uid'])->find(); + //记录日志! + $id = $getdoing['id']; + unset($getdoing['id']); + unset($getdoing['profit_time']); + unset($getdoing['profit']); + $getdoing['status'] = 2; + $getdoing['end_time'] = time(); + $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 ($new_profit_time >= $getdoing['end_time']) { + //更新参保状态。 + Db::table('lc_yuebao_lists')->where('id=' . $id) + ->update(['status' => 2, 'end_time' => $nowtime]); + //获取用户余额; + 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){ + $this->outputInfo->error("结算失败,ID: " . $getdoing['id'] . " 错误信息: " . $e->getMessage()); + } + } + $this->outputInfo->writeln('结算成功:' . $keepnum . '条,结算失败:' . $closenum . '条'); + } +} diff --git a/config/app.php b/config/app.php index 9e674a9..9645278 100755 --- a/config/app.php +++ b/config/app.php @@ -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'] ]; diff --git a/public/adminer.php b/public/adminer.php deleted file mode 100644 index 312dfe2..0000000 --- a/public/adminer.php +++ /dev/null @@ -1,874 +0,0 @@ -$W){unset($kf[$z][$od]);if(is_array($W)){$kf[$z][stripslashes($od)]=$W;$kf[]=&$kf[$z][stripslashes($od)];}else$kf[$z][stripslashes($od)]=($wc?$W:stripslashes($W));}}}}function -bracket_escape($v,$_a=false){static$Sg=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return -strtr($v,($_a?array_flip($Sg):$Sg));}function -min_version($uh,$Id="",$h=null){global$g;if(!$h)$h=$g;$Sf=$h->server_info;if($Id&&preg_match('~([\d.]+)-MariaDB~',$Sf,$C)){$Sf=$C[1];$uh=$Id;}return(version_compare($Sf,$uh)>=0);}function -charset($g){return(min_version("5.5.3",0,$g)?"utf8mb4":"utf8");}function -script($bg,$Rg="\n"){return"$bg$Rg";}function -script_src($kh){return"\n";}function -nonce(){return' nonce="'.get_nonce().'"';}function -target_blank(){return' target="_blank" rel="noreferrer noopener"';}function -h($lg){return -str_replace("\0","�",htmlspecialchars($lg,ENT_QUOTES,'utf-8'));}function -nl_br($lg){return -str_replace("\n","
",$lg);}function -checkbox($E,$Y,$Na,$sd="",$te="",$Ra="",$td=""){$K="".($te?script("qsl('input').onclick = function () { $te };",""):"");return($sd!=""||$Ra?"$K".h($sd)."":$K);}function -optionlist($xe,$Nf=null,$oh=false){$K="";foreach($xe -as$od=>$W){$ye=array($od=>$W);if(is_array($W)){$K.='';$ye=$W;}foreach($ye -as$z=>$X)$K.=''.h($X);if(is_array($W))$K.='';}return$K;}function -html_select($E,$xe,$Y="",$se=true,$td=""){if($se)return"".(is_string($se)?script("qsl('select').onchange = function () { $se };",""):"");$K="";foreach($xe -as$z=>$X)$K.="";return$K;}function -select_input($wa,$xe,$Y="",$se="",$Xe=""){$_g=($xe?"select":"input");return"<$_g$wa".($xe?">