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
95564d73
Commit
95564d73
authored
Aug 02, 2021
by
zhoujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预警接口
parent
ac66175f
Pipeline
#2072
passed with stage
in 0 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
0 deletions
+91
-0
app/Http/Controllers/Api/WarnController.php
app/Http/Controllers/Api/WarnController.php
+17
-0
app/Models/WarnLogModel.php
app/Models/WarnLogModel.php
+12
-0
app/Services/Warn/IWarnService.php
app/Services/Warn/IWarnService.php
+2
-0
app/Services/Warn/WarnService.php
app/Services/Warn/WarnService.php
+58
-0
routes/api.php
routes/api.php
+2
-0
No files found.
app/Http/Controllers/Api/WarnController.php
View file @
95564d73
...
@@ -267,5 +267,22 @@ class WarnController extends BaseController
...
@@ -267,5 +267,22 @@ class WarnController extends BaseController
}
}
}
}
/**
* 预警日志
* @return array
* @date 2021/07/31
* @author live
*/
public
function
getWarnLog
(
Request
$request
)
{
$postData
=
$request
->
all
();
try
{
$data
=
$this
->
warnService
->
getWarnLog
(
$postData
);
return
$this
->
getSuccessMsg
(
$data
);
}
catch
(
Exception
$e
)
{
return
$this
->
getErrorMsg
(
$e
->
getCode
(),
$e
->
getMessage
());
}
}
}
}
\ No newline at end of file
app/Models/WarnLogModel.php
0 → 100644
View file @
95564d73
<?php
namespace
App\Models
;
use
App\Models\BaseModel
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
class
WarnLogModel
extends
BaseModel
{
use
SoftDeletes
;
protected
$connection
=
'mysql'
;
protected
$table
=
'club_warn_log'
;
}
app/Services/Warn/IWarnService.php
View file @
95564d73
...
@@ -24,4 +24,6 @@ interface IWarnService
...
@@ -24,4 +24,6 @@ interface IWarnService
public
function
getConfigSetStatus
(
$postData
);
//设置预警配置状态
public
function
getConfigSetStatus
(
$postData
);
//设置预警配置状态
public
function
getConfigSetAllStatus
(
$postData
);
//批量设置预警状态
public
function
getConfigSetAllStatus
(
$postData
);
//批量设置预警状态
public
function
getWarnLog
(
$postData
);
//预警日志
}
}
\ No newline at end of file
app/Services/Warn/WarnService.php
View file @
95564d73
...
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\DB;
...
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\DB;
use
Illuminate\Support\Str
;
use
Illuminate\Support\Str
;
use
App\Models\WarnPeopleModel
;
use
App\Models\WarnPeopleModel
;
use
App\Models\WarnConfigModel
;
use
App\Models\WarnConfigModel
;
use
App\Models\WarnLogModel
;
use
Illuminate\Support\Facades\Cache
;
use
Illuminate\Support\Facades\Cache
;
class
WarnService
implements
IWarnService
class
WarnService
implements
IWarnService
...
@@ -79,7 +80,9 @@ class WarnService implements IWarnService
...
@@ -79,7 +80,9 @@ class WarnService implements IWarnService
foreach
(
$lists
as
$list
)
{
foreach
(
$lists
as
$list
)
{
$tem
[
'id'
]
=
$list
->
id
;
$tem
[
'id'
]
=
$list
->
id
;
$tem
[
'platform'
]
=
$platformArr
[
$list
->
platform
]
??
''
;
$tem
[
'platform'
]
=
$platformArr
[
$list
->
platform
]
??
''
;
$tem
[
'platformId'
]
=
$list
->
platform
;
$tem
[
'channel'
]
=
$channelArr
[
$list
->
channel
]
??
''
;
$tem
[
'channel'
]
=
$channelArr
[
$list
->
channel
]
??
''
;
$tem
[
'channelId'
]
=
$list
->
channel
;
$tem
[
'name'
]
=
$list
->
name
;
$tem
[
'name'
]
=
$list
->
name
;
$tem
[
'phone'
]
=
$list
->
phone
;
$tem
[
'phone'
]
=
$list
->
phone
;
$tem
[
'status'
]
=
$list
->
status
;
$tem
[
'status'
]
=
$list
->
status
;
...
@@ -204,8 +207,11 @@ class WarnService implements IWarnService
...
@@ -204,8 +207,11 @@ class WarnService implements IWarnService
foreach
(
$lists
as
$list
)
{
foreach
(
$lists
as
$list
)
{
$tem
[
'id'
]
=
$list
->
id
;
$tem
[
'id'
]
=
$list
->
id
;
$tem
[
'platform'
]
=
$platformArr
[
$list
->
platform
]
??
''
;
$tem
[
'platform'
]
=
$platformArr
[
$list
->
platform
]
??
''
;
$tem
[
'platformId'
]
=
$list
->
platform
;
$tem
[
'channel'
]
=
$channelArr
[
$list
->
channel
]
??
''
;
$tem
[
'channel'
]
=
$channelArr
[
$list
->
channel
]
??
''
;
$tem
[
'channelId'
]
=
$list
->
channel
;
$tem
[
'type'
]
=
$typeArr
[
$list
->
type
]
??
''
;
$tem
[
'type'
]
=
$typeArr
[
$list
->
type
]
??
''
;
$tem
[
'typeId'
]
=
$list
->
type
;
$tem
[
'oneWithdrawal'
]
=
sprintf
(
'%.2f'
,
$list
->
one_withdrawal
/
100
);
$tem
[
'oneWithdrawal'
]
=
sprintf
(
'%.2f'
,
$list
->
one_withdrawal
/
100
);
$tem
[
'dayWithdrawal'
]
=
sprintf
(
'%.2f'
,
$list
->
day_withdrawal
/
100
);
$tem
[
'dayWithdrawal'
]
=
sprintf
(
'%.2f'
,
$list
->
day_withdrawal
/
100
);
$tem
[
'userDayWithdrawal'
]
=
sprintf
(
'%.2f'
,
$list
->
people_day_withdrawal
/
100
);
$tem
[
'userDayWithdrawal'
]
=
sprintf
(
'%.2f'
,
$list
->
people_day_withdrawal
/
100
);
...
@@ -311,4 +317,56 @@ class WarnService implements IWarnService
...
@@ -311,4 +317,56 @@ class WarnService implements IWarnService
$array
[
'msg'
]
=
'总共操作'
.
$total
.
'条数据,其中成功'
.
$succuss
.
'条,失败'
.
$fail
.
'条'
;
$array
[
'msg'
]
=
'总共操作'
.
$total
.
'条数据,其中成功'
.
$succuss
.
'条,失败'
.
$fail
.
'条'
;
return
$array
;
return
$array
;
}
}
/**
* 预警日志
* @return araay
* @date 2021/07/31
* @author live
*/
public
function
getWarnLog
(
$postData
)
{
$start
=
$postData
[
'startTime'
]
??
''
;
$end
=
$postData
[
'endTime'
]
??
''
;
$platform
=
$postData
[
'platform'
]
??
0
;
$id
=
$postData
[
'id'
]
??
0
;
$pagePerNum
=
$postData
[
'pageSize'
]
??
20
;
$currentPage
=
$postData
[
'page'
]
??
1
;
$lists
=
WarnConfigModel
::
when
(
$id
>
0
,
function
(
$query
)
use
(
$id
)
{
return
$query
->
where
(
'id'
,
$id
);
})
->
when
(
$platform
>
0
,
function
(
$query
)
use
(
$platform
)
{
return
$query
->
where
(
'platform'
,
$platform
);
})
->
when
(
$start
>
0
,
function
(
$query
)
use
(
$start
)
{
$startTime
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$start
)
-
1
);
return
$query
->
where
(
'send_time'
,
'>'
,
$startTime
);
})
->
when
(
$end
>
0
,
function
(
$query
)
use
(
$end
)
{
$endTime
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$end
)
+
1
);
return
$query
->
where
(
'send_time'
,
'<'
,
$endTime
);
})
->
select
(
'id'
,
'platform'
,
'channel'
,
'cash'
,
'status'
,
'config_id'
,
'people_id'
,
'msg'
,
'remark'
,
'send_time'
,
'created_at'
)
->
orderBy
(
'id'
,
'DESC'
)
->
paginate
(
$pagePerNum
,
[
'*'
],
'currentPage'
,
$currentPage
);
$array
[
'totalNum'
]
=
$lists
->
total
();
$array
[
'totalPage'
]
=
$lists
->
lastPage
();
$platformArr
=
config
(
env
(
'ENVIRONMENT'
)
.
'.PLATFORM'
);
$channelArr
=
config
(
env
(
'ENVIRONMENT'
)
.
'.CHANNEL'
);
$typeArr
=
config
(
env
(
'ENVIRONMENT'
)
.
'.CURRENCY'
);
foreach
(
$lists
as
$list
)
{
$tem
[
'id'
]
=
$list
->
id
;
$tem
[
'platform'
]
=
$platformArr
[
$list
->
platform
]
??
''
;
$tem
[
'channel'
]
=
$channelArr
[
$list
->
channel
]
??
''
;
$tem
[
'type'
]
=
$typeArr
[
$list
->
type
]
??
''
;
$tem
[
'oneWithdrawal'
]
=
sprintf
(
'%.2f'
,
$list
->
one_withdrawal
/
100
);
$tem
[
'dayWithdrawal'
]
=
sprintf
(
'%.2f'
,
$list
->
day_withdrawal
/
100
);
$tem
[
'userDayWithdrawal'
]
=
sprintf
(
'%.2f'
,
$list
->
people_day_withdrawal
/
100
);
$tem
[
'status'
]
=
$list
->
status
;
$statusName
=
'停用'
;
if
(
$list
->
status
==
1
)
$statusName
=
'正常'
;
$tem
[
'statusName'
]
=
$statusName
;
$tem
[
'optionUser'
]
=
$list
->
op_user
;
$tem
[
'createdAt'
]
=
Carbon
::
parse
(
$list
->
created_at
)
->
format
(
'Y-m-d H:i:s'
);
$array
[
'data'
][]
=
$tem
;
}
unset
(
$lists
,
$list
);
return
$array
;
}
}
}
\ No newline at end of file
routes/api.php
View file @
95564d73
...
@@ -51,6 +51,8 @@ Route::group(['namespace' => 'Api','middleware' => ['user.login']], function ()
...
@@ -51,6 +51,8 @@ Route::group(['namespace' => 'Api','middleware' => ['user.login']], function ()
Route
::
post
(
'/config/del'
,
'WarnController@getConfigDel'
);
//删除预警配置
Route
::
post
(
'/config/del'
,
'WarnController@getConfigDel'
);
//删除预警配置
Route
::
post
(
'/config/set/status'
,
'WarnController@getConfigSetStatus'
);
//设置预警配置状态
Route
::
post
(
'/config/set/status'
,
'WarnController@getConfigSetStatus'
);
//设置预警配置状态
Route
::
post
(
'/config/set/all/status'
,
'WarnController@getConfigSetAllStatus'
);
//批量设置预警配置状态
Route
::
post
(
'/config/set/all/status'
,
'WarnController@getConfigSetAllStatus'
);
//批量设置预警配置状态
Route
::
post
(
'/log'
,
'WarnController@getWarnLog'
);
//预警日志
});
});
Route
::
group
([
'prefix'
=>
'account'
],
function
()
{
Route
::
group
([
'prefix'
=>
'account'
],
function
()
{
...
...
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