Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
clubAdmin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhoujun
clubAdmin
Commits
5bff1ec4
Commit
5bff1ec4
authored
Aug 04, 2021
by
zhoujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预警
parent
a17c5cb9
Pipeline
#2096
passed with stage
in 0 seconds
Changes
14
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
539 additions
and
8 deletions
+539
-8
app/Common/Common.php
app/Common/Common.php
+35
-0
app/Console/Commands/ClearLogData.php
app/Console/Commands/ClearLogData.php
+53
-0
app/Console/Commands/PolymerizeWithdrawal.php
app/Console/Commands/PolymerizeWithdrawal.php
+53
-0
app/Console/Commands/SendDDMsg.php
app/Console/Commands/SendDDMsg.php
+53
-0
app/Console/Commands/SingleDayWithdrawal.php
app/Console/Commands/SingleDayWithdrawal.php
+53
-0
app/Console/Commands/SingleUserDayWithdrawal.php
app/Console/Commands/SingleUserDayWithdrawal.php
+53
-0
app/Console/Kernel.php
app/Console/Kernel.php
+15
-2
app/Models/UserCashModel.php
app/Models/UserCashModel.php
+0
-2
app/Models/WarnWaitModel.php
app/Models/WarnWaitModel.php
+0
-2
app/Services/Script/IScriptService.php
app/Services/Script/IScriptService.php
+10
-0
app/Services/Script/ScriptService.php
app/Services/Script/ScriptService.php
+205
-2
composer.json
composer.json
+3
-0
config/local.php
config/local.php
+3
-0
config/pro.php
config/pro.php
+3
-0
No files found.
app/Common/Common.php
0 → 100644
View file @
5bff1ec4
<?php
/**
* curl方法
* @param $object
* @return array
*/
if
(
!
function_exists
(
'postCurlJson'
)){
function
postCurlJson
(
$url
,
$data
,
$headers
=
[],
$timeout
=
30
){
try
{
$requestHeader
[]
=
"API-RemoteIP: "
;
$requestHeader
[]
=
"Content-type: application/json"
;
$curl
=
curl_init
();
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
json_encode
(
$data
));
curl_setopt
(
$curl
,
CURLOPT_HTTPHEADER
,
$requestHeader
);
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$curl
,
CURLOPT_CUSTOMREQUEST
,
"POST"
);
curl_setopt
(
$curl
,
CURLOPT_HTTP_VERSION
,
CURL_HTTP_VERSION_1_1
);
$timeout
=
intval
(
$timeout
)
?
intval
(
$timeout
)
:
30
;
curl_setopt
(
$curl
,
CURLOPT_TIMEOUT
,
$timeout
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
FALSE
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYHOST
,
FALSE
);
curl_setopt
(
$curl
,
CURLOPT_HEADER
,
0
);
$result
=
curl_exec
(
$curl
);
curl_close
(
$curl
);
return
$result
;
}
catch
(
exception
$e
)
{
throw
new
Exception
(
$e
->
getMessage
());
}
}
}
app/Console/Commands/ClearLogData.php
0 → 100644
View file @
5bff1ec4
<?php
namespace
App\Console\Commands
;
use
Carbon\Carbon
;
use
Illuminate\Console\Command
;
use
App\Facades\Util\Log
;
use
App\Services\Script\IScriptService
;
class
ClearLogData
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'ClearLogData'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'定时清理历史数据'
;
/**
* @var ActivityOrder
*/
private
$scriptService
;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public
function
__construct
(
IScriptService
$scriptService
)
{
parent
::
__construct
();
$this
->
scriptService
=
$scriptService
;
}
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
set_time_limit
(
0
);
$this
->
line
(
'开始'
);
$this
->
scriptService
->
getClearLogData
();
$this
->
line
(
'结束'
);
}
}
\ No newline at end of file
app/Console/Commands/PolymerizeWithdrawal.php
0 → 100644
View file @
5bff1ec4
<?php
namespace
App\Console\Commands
;
use
Carbon\Carbon
;
use
Illuminate\Console\Command
;
use
App\Facades\Util\Log
;
use
App\Services\Script\IScriptService
;
class
PolymerizeWithdrawal
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'PolymerizeWithdrawal'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'聚合玩家提现数据'
;
/**
* @var ActivityOrder
*/
private
$scriptService
;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public
function
__construct
(
IScriptService
$scriptService
)
{
parent
::
__construct
();
$this
->
scriptService
=
$scriptService
;
}
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
set_time_limit
(
0
);
$this
->
line
(
'开始'
);
$this
->
scriptService
->
getPolymerizeWithdrawal
();
$this
->
line
(
'结束'
);
}
}
\ No newline at end of file
app/Console/Commands/SendDDMsg.php
0 → 100644
View file @
5bff1ec4
<?php
namespace
App\Console\Commands
;
use
Carbon\Carbon
;
use
Illuminate\Console\Command
;
use
App\Facades\Util\Log
;
use
App\Services\Script\IScriptService
;
class
SendDDMsg
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'SendDDMsg'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'发送钉钉消息'
;
/**
* @var ActivityOrder
*/
private
$scriptService
;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public
function
__construct
(
IScriptService
$scriptService
)
{
parent
::
__construct
();
$this
->
scriptService
=
$scriptService
;
}
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
set_time_limit
(
0
);
$this
->
line
(
'开始'
);
$this
->
scriptService
->
getSendDDMsg
();
$this
->
line
(
'结束'
);
}
}
\ No newline at end of file
app/Console/Commands/SingleDayWithdrawal.php
0 → 100644
View file @
5bff1ec4
<?php
namespace
App\Console\Commands
;
use
Carbon\Carbon
;
use
Illuminate\Console\Command
;
use
App\Facades\Util\Log
;
use
App\Services\Script\IScriptService
;
class
SingleDayWithdrawal
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'SingleDayWithdrawal'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'单日提现预警'
;
/**
* @var ActivityOrder
*/
private
$scriptService
;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public
function
__construct
(
IScriptService
$scriptService
)
{
parent
::
__construct
();
$this
->
scriptService
=
$scriptService
;
}
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
set_time_limit
(
0
);
$this
->
line
(
'开始'
);
$this
->
scriptService
->
getSingleDayWithdrawal
();
$this
->
line
(
'结束'
);
}
}
\ No newline at end of file
app/Console/Commands/SingleUserDayWithdrawal.php
0 → 100644
View file @
5bff1ec4
<?php
namespace
App\Console\Commands
;
use
Carbon\Carbon
;
use
Illuminate\Console\Command
;
use
App\Facades\Util\Log
;
use
App\Services\Script\IScriptService
;
class
SingleUserDayWithdrawal
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'SingleUserDayWithdrawal'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'单日单用户提现预警'
;
/**
* @var ActivityOrder
*/
private
$scriptService
;
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public
function
__construct
(
IScriptService
$scriptService
)
{
parent
::
__construct
();
$this
->
scriptService
=
$scriptService
;
}
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
set_time_limit
(
0
);
$this
->
line
(
'开始'
);
$this
->
scriptService
->
getSingleUserDayWithdrawal
();
$this
->
line
(
'结束'
);
}
}
\ No newline at end of file
app/Console/Kernel.php
View file @
5bff1ec4
...
...
@@ -12,7 +12,13 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected
$commands
=
[
'App\Console\Commands\ClearLogData'
,
'App\Console\Commands\SingleWithdrawal'
,
'App\Console\Commands\PolymerizeWithdrawal'
,
'App\Console\Commands\SingleDayWithdrawal'
,
'App\Console\Commands\SingleUserDayWithdrawal'
,
'App\Console\Commands\SendDDMsg'
,
];
/**
...
...
@@ -23,7 +29,14 @@ class Kernel extends ConsoleKernel
*/
protected
function
schedule
(
Schedule
$schedule
)
{
$schedule
->
command
(
'SingleWithdrawal'
)
->
everyMinute
()
->
withoutOverlapping
();
//每分钟跑一次
$schedule
->
command
(
'ClearLogData'
)
->
dailyAt
(
'3:00'
)
->
withoutOverlapping
();
//每天凌晨3:00点钟跑一次
$schedule
->
command
(
'SingleWithdrawal'
)
->
everyFiveMinutes
()
->
withoutOverlapping
();
//每5分钟跑一次
$schedule
->
command
(
'PolymerizeWithdrawal'
)
->
everyFiveMinutes
()
->
withoutOverlapping
();
//每5分钟跑一次
$schedule
->
command
(
'SingleDayWithdrawal'
)
->
everyFiveMinutes
()
->
withoutOverlapping
();
//每5分钟跑一次
$schedule
->
command
(
'SingleUserDayWithdrawal'
)
->
everyFiveMinutes
()
->
withoutOverlapping
();
//每5分钟跑一次
$schedule
->
command
(
'SendDDMsg'
)
->
everyMinute
()
->
withoutOverlapping
();
//每分钟跑一次
}
/**
...
...
app/Models/UserCashModel.php
View file @
5bff1ec4
...
...
@@ -2,11 +2,9 @@
namespace
App\Models
;
use
App\Models\BaseModel
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
class
UserCashModel
extends
BaseModel
{
use
SoftDeletes
;
protected
$connection
=
'mysql'
;
protected
$table
=
'club_user_cash'
;
}
\ No newline at end of file
app/Models/WarnWaitModel.php
View file @
5bff1ec4
...
...
@@ -2,11 +2,9 @@
namespace
App\Models
;
use
App\Models\BaseModel
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
class
WarnWaitModel
extends
BaseModel
{
use
SoftDeletes
;
protected
$connection
=
'mysql'
;
protected
$table
=
'club_warn_wait'
;
}
\ No newline at end of file
app/Services/Script/IScriptService.php
View file @
5bff1ec4
...
...
@@ -4,4 +4,14 @@ namespace App\Services\Script;
interface
IScriptService
{
public
function
getSingleWithdrawal
();
//单次最高提现预警
public
function
getPolymerizeWithdrawal
();
//聚合玩家提现数据
public
function
getClearLogData
();
//清理历史数据
public
function
getSingleDayWithdrawal
();
//单日最高提现预警
public
function
getSingleUserDayWithdrawal
();
//单日单用户最高提现预警
public
function
getSendDDMsg
();
//发送钉钉消息
}
app/Services/Script/ScriptService.php
View file @
5bff1ec4
<?php
namespace
App\Services\Script
;
use
App\Models\DepartmentManagerModel
;
use
App\Services\Script\IScriptService
;
use
Carbon\Carbon
;
use
Exception
;
...
...
@@ -37,6 +38,7 @@ class ScriptService implements IScriptService
$lastId
=
self
::
getLastDataId
(
2
);
$warnPeople
=
self
::
getWarnPeople
();
if
(
empty
(
$warnPeople
))
return
true
;
$logs
=
SyceeWithdrawModel
::
where
(
'sycee_withdraw.serial'
,
'>'
,
$lastId
)
->
where
(
'sycee_withdraw.cash'
,
'>'
,
$oneMin
)
->
join
(
'account'
,
'sycee_withdraw.user_id'
,
'account.user_id'
)
->
orderBy
(
'sycee_withdraw.serial'
,
'ASC'
)
->
select
(
'account.user_id'
,
'account.platform'
,
'account.platform_id'
,
'account.channel'
,
'sycee_withdraw.serial'
,
'sycee_withdraw.cash'
,
'sycee_withdraw.withdraw_time'
)
->
limit
(
100
)
->
get
();
$array
=
[];
...
...
@@ -68,10 +70,12 @@ class ScriptService implements IScriptService
try
{
if
(
!
empty
(
$array
))
WarnWaitModel
::
insert
(
$array
);
if
(
$maxId
>
0
)
self
::
getUpdateLastId
(
2
,
$maxId
);
unset
(
$array
,
$tem
,
$config
,
$warnPeople
,
$logs
,
$log
,
$tem
);
DB
::
commit
();
return
true
;
}
catch
(
\Exception
$e
){
DB
::
rollback
();
unset
(
$array
,
$tem
,
$config
,
$warnPeople
,
$logs
,
$log
,
$tem
);
return
false
;
}
}
...
...
@@ -144,10 +148,12 @@ class ScriptService implements IScriptService
* @date 2021/08/02
* @author live
*/
public
static
function
getWarnConfig
(
$type
)
public
static
function
getWarnConfig
(
$type
,
$yf
=
[]
)
{
$array
=
[
'oneMin'
=>
0
,
'dayMin'
=>
0
,
'userMin'
=>
0
];
$configs
=
WarnConfigModel
::
where
(
'status'
,
1
)
->
select
(
'id'
,
'platform'
,
'channel'
,
'one_withdrawal'
,
'day_withdrawal'
,
'people_day_withdrawal'
)
->
get
();
$configs
=
WarnConfigModel
::
where
(
'status'
,
1
);
if
(
!
empty
(
$yf
))
$configs
->
whereNotIn
(
'id'
,
$yf
);
$configs
=
$configs
->
select
(
'id'
,
'platform'
,
'channel'
,
'one_withdrawal'
,
'day_withdrawal'
,
'people_day_withdrawal'
)
->
get
();
if
(
!
$configs
->
count
())
return
[];
foreach
(
$configs
as
$con
){
...
...
@@ -182,4 +188,201 @@ class ScriptService implements IScriptService
unset
(
$configs
,
$con
,
$tem
);
return
$array
;
}
/**
* 聚合玩家提现数据
* @return array
* @date 2021/08/02
* @author live
*/
public
function
getPolymerizeWithdrawal
(){
$lastId
=
self
::
getLastDataId
(
1
);
$logs
=
SyceeWithdrawModel
::
where
(
'sycee_withdraw.serial'
,
'>'
,
$lastId
)
->
join
(
'account'
,
'sycee_withdraw.user_id'
,
'account.user_id'
)
->
orderBy
(
'sycee_withdraw.serial'
,
'ASC'
)
->
select
(
'account.user_id'
,
'account.platform'
,
'account.platform_id'
,
'account.channel'
,
'sycee_withdraw.serial'
,
'sycee_withdraw.cash'
,
'sycee_withdraw.withdraw_time'
)
->
limit
(
300
)
->
get
();
$array
=
[];
$maxId
=
0
;
foreach
(
$logs
as
$log
){
$maxId
=
$log
->
serial
;
$ymd
=
date
(
'Ymd'
,
strtotime
(
$log
->
withdraw_time
));
$key
=
$log
->
platform_id
.
'-'
.
$ymd
;
if
(
isset
(
$array
[
$key
])){
$array
[
$key
][
'cash'
]
=
$array
[
$key
][
'cash'
]
+
$log
->
cash
;
}
else
{
$tem
[
'ymd'
]
=
$ymd
;
$tem
[
'platform'
]
=
$log
->
platform
;
$tem
[
'channel'
]
=
$log
->
channel
;
$tem
[
'user_id'
]
=
$log
->
platform_id
;
$tem
[
'open_id'
]
=
$log
->
user_id
;
$tem
[
'cash'
]
=
$log
->
cash
;
$tem
[
'created_at'
]
=
$this
->
time
;
$tem
[
'updated_at'
]
=
$this
->
time
;
$array
[
$key
]
=
$tem
;
}
}
DB
::
beginTransaction
();
try
{
if
(
!
empty
(
$array
)){
foreach
(
$array
as
$key
=>
$arr
){
$verity
=
UserCashModel
::
where
(
'ymd'
,
$arr
[
'ymd'
])
->
where
(
'user_id'
,
$arr
[
'user_id'
])
->
select
(
'id'
,
'cash'
)
->
first
();
if
(
$verity
){
$verity
->
cash
=
$verity
->
cash
+
$arr
[
'cash'
];
$verity
->
updated_at
=
$this
->
time
;
$verity
->
save
();
}
else
{
unset
(
$array
[
$key
]);
}
}
if
(
!
empty
(
$array
))
UserCashModel
::
insert
(
$array
);
}
if
(
$maxId
>
0
)
self
::
getUpdateLastId
(
1
,
$maxId
);
DB
::
commit
();
unset
(
$logs
,
$log
,
$tem
,
$array
);
return
true
;
}
catch
(
\Exception
$e
){
DB
::
rollback
();
unset
(
$logs
,
$log
,
$tem
,
$array
);
return
false
;
}
}
/**
* 清理历史数据
* @return array
* @date 2021/08/03
* @author live
*/
public
function
getClearLogData
()
{
$day
=
date
(
'Ymd'
,
strtotime
(
date
(
'Y-m-d'
))
-
432000
);
WarnWaitModel
::
where
(
'ymd'
,
'<'
,
$day
)
->
delete
();
UserCashModel
::
where
(
'ymd'
,
'<'
,
$day
)
->
delete
();
return
true
;
}
/**
* 单日最高体现预警
* @return array
* @date 2021/08/03
* @author live
*/
public
function
getSingleDayWithdrawal
()
{
$ymd
=
date
(
'Ymd'
);
$yfConfig
=
WarnWaitModel
::
where
(
'ymd'
,
$ymd
)
->
where
(
'type'
,
2
)
->
groupBy
(
'config_id'
)
->
pluck
(
'config_id'
);
$config
=
self
::
getWarnConfig
(
2
,
$yfConfig
->
toArray
());
$dayMin
=
$config
[
'dayMin'
]
??
0
;
if
(
empty
(
$config
)
||
$dayMin
==
0
)
return
true
;
$warnPeople
=
self
::
getWarnPeople
();
if
(
empty
(
$warnPeople
))
return
true
;
$cash
=
UserCashModel
::
where
(
'ymd'
,
$ymd
)
->
groupBy
(
'platform'
,
'channel'
)
->
select
(
'platform'
,
'channel'
,
DB
::
raw
(
'sum(cash) as cash'
))
->
get
();
$array
=
[];
foreach
(
$cash
as
$log
){
$key
=
$log
->
platform
.
'-'
.
$log
->
channel
;
$warnConfig
=
$config
[
$key
]
??
[];
if
(
empty
(
$warnConfig
))
continue
;
$people
=
$warnPeople
[
$key
]
??
[];
if
(
empty
(
$people
))
continue
;
if
(
$log
->
cash
<
$dayMin
)
continue
;
$tem
[
'ymd'
]
=
date
(
'Ymd'
,
strtotime
(
$this
->
time
));
$tem
[
'config_id'
]
=
$warnConfig
[
'id'
];
$tem
[
'type'
]
=
2
;
$tem
[
'cash'
]
=
$log
->
cash
;
$tem
[
'warn_value'
]
=
$warnConfig
[
'day'
];
$tem
[
'people_id'
]
=
implode
(
'#'
,
$people
[
'id'
]);
$tem
[
'people_phone'
]
=
implode
(
'#'
,
$people
[
'phone'
]);
$tem
[
'people_name'
]
=
implode
(
'#'
,
$people
[
'name'
]);
$tem
[
'user_id'
]
=
0
;
$tem
[
'open_id'
]
=
''
;
$tem
[
'status'
]
=
0
;
$tem
[
'created_at'
]
=
$this
->
time
;
$tem
[
'updated_at'
]
=
$this
->
time
;
$array
[]
=
$tem
;
}
if
(
!
empty
(
$array
)){
foreach
(
$array
as
$key
=>
$arr
){
$verity
=
WarnWaitModel
::
where
(
'ymd'
,
$arr
[
'ymd'
])
->
where
(
'config_id'
,
$arr
[
'config_id'
])
->
where
(
'type'
,
2
)
->
select
(
'id'
)
->
first
();
if
(
$verity
)
unset
(
$array
[
$key
]);
}
if
(
!
empty
(
$array
))
WarnWaitModel
::
insert
(
$array
);
}
unset
(
$logs
,
$log
,
$tem
,
$array
);
return
true
;
}
/**
* 单日单用户最高体现预警
* @return array
* @date 2021/08/03
* @author live
*/
public
function
getSingleUserDayWithdrawal
()
{
$ymd
=
date
(
'Ymd'
);
$config
=
self
::
getWarnConfig
(
3
);
$userMin
=
$config
[
'userMin'
]
??
0
;
if
(
empty
(
$config
)
||
$userMin
==
0
)
return
true
;
$warnPeople
=
self
::
getWarnPeople
();
if
(
empty
(
$warnPeople
))
return
true
;
$cash
=
UserCashModel
::
where
(
'ymd'
,
$ymd
)
->
select
(
'platform'
,
'channel'
,
'user_id'
,
'open_id'
,
'cash'
)
->
get
();
$array
=
[];
foreach
(
$cash
as
$log
){
$key
=
$log
->
platform
.
'-'
.
$log
->
channel
;
$warnConfig
=
$config
[
$key
]
??
[];
if
(
empty
(
$warnConfig
))
continue
;
$people
=
$warnPeople
[
$key
]
??
[];
if
(
empty
(
$people
))
continue
;
if
(
$log
->
cash
<
$userMin
)
continue
;
$tem
[
'ymd'
]
=
date
(
'Ymd'
,
strtotime
(
$this
->
time
));
$tem
[
'config_id'
]
=
$warnConfig
[
'id'
];
$tem
[
'type'
]
=
3
;
$tem
[
'cash'
]
=
$log
->
cash
;
$tem
[
'warn_value'
]
=
$warnConfig
[
'user'
];
$tem
[
'people_id'
]
=
implode
(
'#'
,
$people
[
'id'
]);
$tem
[
'people_phone'
]
=
implode
(
'#'
,
$people
[
'phone'
]);
$tem
[
'people_name'
]
=
implode
(
'#'
,
$people
[
'name'
]);
$tem
[
'user_id'
]
=
$log
->
user_id
;
$tem
[
'open_id'
]
=
$log
->
open_id
;
$tem
[
'status'
]
=
0
;
$tem
[
'created_at'
]
=
$this
->
time
;
$tem
[
'updated_at'
]
=
$this
->
time
;
$array
[]
=
$tem
;
}
if
(
!
empty
(
$array
)){
foreach
(
$array
as
$key
=>
$arr
){
$verity
=
WarnWaitModel
::
where
(
'ymd'
,
$arr
[
'ymd'
])
->
where
(
'user_id'
,
$arr
[
'user_id'
])
->
where
(
'type'
,
3
)
->
select
(
'id'
)
->
first
();
if
(
$verity
)
unset
(
$array
[
$key
]);
}
if
(
!
empty
(
$array
))
WarnWaitModel
::
insert
(
$array
);
}
unset
(
$logs
,
$log
,
$tem
,
$array
);
return
true
;
}
/**
* 发送钉钉消息
* @return array
* @date 2021/08/03
* @author live
*/
public
function
getSendDDMsg
()
{
$sends
=
WarnWaitModel
::
where
(
'status'
,
0
)
->
limit
(
100
)
->
get
();
foreach
(
$sends
as
$send
){
$message
=
''
;
$mobiles
=
str_replace
(
'#'
,
','
,
$send
->
people_phone
);
if
(
$send
->
type
==
1
)
$message
=
'单日单次提现:日期'
.
Carbon
::
parse
(
$send
->
created_at
)
->
format
(
'Y-m-d H:i:s'
)
.
',提现金额:'
.
sprintf
(
'%.2f'
,
$send
->
cash
/
100
);
if
(
$send
->
type
==
2
)
$message
=
'单日累计提现:日期'
.
Carbon
::
parse
(
$send
->
created_at
)
->
format
(
'Y-m-d H:i:s'
)
.
',提现金额:'
.
sprintf
(
'%.2f'
,
$send
->
cash
/
100
);
if
(
$send
->
type
==
3
)
$message
=
'单日单用户提现:日期'
.
Carbon
::
parse
(
$send
->
created_at
)
->
format
(
'Y-m-d H:i:s'
)
.
',提现金额:'
.
sprintf
(
'%.2f'
,
$send
->
cash
/
100
);
$submitData
=
[
'mobile_list'
=>
$mobiles
,
'message'
=>
$message
,
'api_token'
=>
config
(
env
(
'ENVIRONMENT'
)
.
'.DINGDING_TOKEN'
)];
postCurlJson
(
config
(
env
(
'ENVIRONMENT'
)
.
'.DINGDING_URL'
),
$submitData
,
[]);
$send
->
status
=
1
;
$send
->
save
();
}
}
}
\ No newline at end of file
composer.json
View file @
5bff1ec4
...
...
@@ -38,6 +38,9 @@
"classmap"
:
[
"database/seeds"
,
"database/factories"
],
"files"
:
[
"app/Common/Common.php"
]
},
"autoload-dev"
:
{
...
...
config/local.php
View file @
5bff1ec4
...
...
@@ -13,4 +13,7 @@ return [
'CURRENCY'
=>
[
'1'
=>
'元宝'
],
'DINGDING_URL'
=>
'http://api.srccwl.com/dingding/send_message'
,
'DINGDING_TOKEN'
=>
'qPf99DyrCgdSSrJFbhwYHOPEv66HE02FAJy2x3KTx65BfLHbxNlue1Nbbmu5'
,
];
\ No newline at end of file
config/pro.php
View file @
5bff1ec4
...
...
@@ -13,4 +13,7 @@ return [
'CURRENCY'
=>
[
'1'
=>
'元宝'
],
'DINGDING_URL'
=>
'http://api.srccwl.com/dingding/send_message'
,
'DINGDING_TOKEN'
=>
'qPf99DyrCgdSSrJFbhwYHOPEv66HE02FAJy2x3KTx65BfLHbxNlue1Nbbmu5'
,
];
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment