Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
钱半仙 committed Jan 5, 2018
1 parent d8de6fa commit 2461adc
Show file tree
Hide file tree
Showing 3,034 changed files with 429,547 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#为了能更愉快地 debug,此文件已经作废,请各位 移步 config/config.php 进行设置
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#为了能更愉快地 debug,此文件已经作废,请各位 移步 config/config.php 进行设置
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/.DS_Store
.DS_Store
Empty file added .gitmodules
Empty file.
26 changes: 26 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>404</title>
<style>
body{
background-color:#444;
font-size:14px;
}
h3{
font-size:60px;
color:#eee;
text-align:center;
padding-top:30px;
font-weight:normal;
}
</style>
</head>

<body>
<h3>404,您请求的文件不存在!</h3>
</body>
</html>
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 orvice

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

71 changes: 71 additions & 0 deletions app/Command/DailyMail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php


namespace App\Command;

use App\Models\User;
use App\Models\Ann;
use App\Services\Config;
use App\Services\Mail;
use App\Utils\Telegram;
use App\Utils\Tools;
use App\Services\Analytics;

class DailyMail
{
public static function sendDailyMail()
{
$users = User::all();
$logs = Ann::orderBy('id', 'desc')->get();
$text1="";

foreach ($logs as $log) {
if (strpos($log->content, "Links")===false) {
$text1=$text1.$log->content."<br><br>";
}
}

$lastday_total = 0;

foreach ($users as $user) {
$lastday = (($user->u+$user->d)-$user->last_day_t)/1024/1024;
$lastday_total += (($user->u+$user->d)-$user->last_day_t);

if ($user->sendDailyMail==1) {
echo "Send daily mail to user: ".$user->id;
$subject = Config::get('appName')."-每日流量报告以及公告";
$to = $user->email;
$text = "下面是系统中目前的公告:<br><br>".$text1."<br><br>晚安!";

try {
Mail::send($to, $subject, 'news/daily-traffic-report.tpl', [
"user" => $user,"text" => $text,"lastday"=>$lastday
], [
]);
} catch (Exception $e) {
echo $e->getMessage();
}
$text="";
}
}

$sts = new Analytics();

Telegram::Send("各位老爷少奶奶,我来为大家报告一下系统今天的运行状况哈~".
PHP_EOL.
"今日签到人数:".$sts->getTodayCheckinUser().PHP_EOL.
"今日使用总流量:".Tools::flowAutoShow($lastday_total).PHP_EOL.
"晚安~"
);
}


public static function reall()
{
$users = User::all();
foreach ($users as $user) {
$user->last_day_t=($user->u+$user->d);
$user->save();
}
}
}
53 changes: 53 additions & 0 deletions app/Command/ExtMail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php


namespace App\Command;

use App\Models\User;
use App\Services\Config;
use App\Services\Mail;

class ExtMail
{
public static function sendNoMail()
{
$users = User::all();
foreach ($users as $user) {
if ($user->t==0) {
echo "Send daily mail to user: ".$user->id;
$subject = Config::get('appName')."-期待您的回归";
$to = $user->email;
$text = "似乎您在".Config::get('appName')."上的流量一直是 0 呢(P.S:也可能是您没有使用 ss 而使用了其他还不能计入流量的方式....),如果您在使用上遇到了任何困难,请不要犹豫,登录到".Config::get('appName').",您就会知道如何使用了,特别是对于 iOS 用户,最近在使用的优化上大家都付出了很多的努力。期待您的回归~" ;
try {
Mail::send($to, $subject, 'ext/back.tpl', [
"user" => $user,"text" => $text
], [
]);
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
}

public static function sendOldMail()
{
$users = User::all();
foreach ($users as $user) {
if ($user->t!=0&&$user->t<1451577599) {
echo "Send daily mail to user: ".$user->id;
$subject = Config::get('appName')."-期待您的回归";
$to = $user->email;
$text = "似乎您在 2017 年以来就没有使用过".Config::get('appName')."了呢,如果您在使用上遇到了任何困难,请不要犹豫,登录到".Config::get('appName').",您就会知道如何使用了,特别是对于 iOS 用户,最近在使用的优化上大家都付出了很多的努力。期待您的回归~" ;
try {
Mail::send($to, $subject, 'ext/back.tpl', [
"user" => $user,"text" => $text
], [
]);
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
}
}
Loading

0 comments on commit 2461adc

Please sign in to comment.