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
3bbe8182
Commit
3bbe8182
authored
Jul 31, 2021
by
zhoujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预警接口
parent
1ffa2d95
Pipeline
#2068
passed with stage
in 0 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
136 additions
and
14 deletions
+136
-14
app/Http/Controllers/Api/WarnController.php
app/Http/Controllers/Api/WarnController.php
+38
-5
app/Services/Account/AccountService.php
app/Services/Account/AccountService.php
+1
-1
app/Services/User/UserService.php
app/Services/User/UserService.php
+1
-1
app/Services/Warn/IWarnService.php
app/Services/Warn/IWarnService.php
+6
-0
app/Services/Warn/WarnService.php
app/Services/Warn/WarnService.php
+89
-6
app/Services/White/WhiteService.php
app/Services/White/WhiteService.php
+1
-1
No files found.
app/Http/Controllers/Api/WarnController.php
View file @
3bbe8182
...
...
@@ -163,9 +163,15 @@ class WarnController extends BaseController
* @date 2021/07/31
* @author live
*/
public
function
getConfigList
()
public
function
getConfigList
(
Request
$request
)
{
$postData
=
$request
->
all
();
try
{
$data
=
$this
->
warnService
->
getConfigList
(
$postData
);
return
$this
->
getSuccessMsg
(
$data
);
}
catch
(
Exception
$e
)
{
return
$this
->
getErrorMsg
(
$e
->
getCode
(),
$e
->
getMessage
());
}
}
/**
...
...
@@ -174,9 +180,26 @@ class WarnController extends BaseController
* @date 2021/07/31
* @author live
*/
public
function
getConfigEdit
()
public
function
getConfigEdit
(
Request
$request
)
{
$postData
=
$request
->
all
();
$validate
=
Validator
::
make
(
$postData
,
[
'id'
=>
'required|numeric'
,
'platform'
=>
'required|numeric'
,
'channel'
=>
'required|numeric'
,
'type'
=>
'required|numeric'
,
'oneWithdrawal'
=>
'required|numeric'
,
'dayWithdrawal'
=>
'required|numeric'
,
'userDayWithdrawal'
=>
'required|numeric'
]);
if
(
$validate
->
fails
())
return
$this
->
getErrorMsg
(
'1001'
,
config
(
'msg.common.1001'
));
try
{
$data
=
$this
->
warnService
->
getConfigEdit
(
$postData
);
return
$this
->
getSuccessMsg
(
$data
);
}
catch
(
Exception
$e
)
{
return
$this
->
getErrorMsg
(
$e
->
getCode
(),
$e
->
getMessage
());
}
}
/**
...
...
@@ -185,9 +208,19 @@ class WarnController extends BaseController
* @date 2021/07/31
* @author live
*/
public
function
getConfigDel
()
public
function
getConfigDel
(
Request
$request
)
{
$postData
=
$request
->
all
();
$validate
=
Validator
::
make
(
$postData
,
[
'id'
=>
'required|numeric'
]);
if
(
$validate
->
fails
())
return
$this
->
getErrorMsg
(
'1001'
,
config
(
'msg.common.1001'
));
try
{
$data
=
$this
->
warnService
->
getConfigDel
(
$postData
);
return
$this
->
getSuccessMsg
(
$data
);
}
catch
(
Exception
$e
)
{
return
$this
->
getErrorMsg
(
$e
->
getCode
(),
$e
->
getMessage
());
}
}
/**
...
...
app/Services/Account/AccountService.php
View file @
3bbe8182
...
...
@@ -122,7 +122,7 @@ class AccountService implements IAccountService
$tem
[
'remark'
]
=
$log
->
extra
;
$array
[
'data'
][]
=
$tem
;
}
unset
(
$
users
,
$user
,
$user
);
unset
(
$
logs
,
$log
,
$account
);
return
$array
;
}
}
\ No newline at end of file
app/Services/User/UserService.php
View file @
3bbe8182
...
...
@@ -68,7 +68,7 @@ class UserService implements IUserService{
$tem
[
'created_at'
]
=
Carbon
::
parse
(
$user
->
created_at
)
->
format
(
'Y-m-d H:i:s'
);
$array
[
'data'
][]
=
$tem
;
}
unset
(
$users
,
$user
,
$user
);
unset
(
$users
,
$user
);
return
$array
;
}
...
...
app/Services/Warn/IWarnService.php
View file @
3bbe8182
...
...
@@ -14,4 +14,10 @@ interface IWarnService
public
function
getPeopleSetStatus
(
$postData
);
//设置预警人状态
public
function
getConfigAdd
(
$postData
);
//预警配置添加
public
function
getConfigList
(
$postData
);
//预警配置列表
public
function
getConfigEdit
(
$postData
);
//预警配置编辑
public
function
getConfigDel
(
$postData
);
//预警配置删除
}
\ No newline at end of file
app/Services/Warn/WarnService.php
View file @
3bbe8182
...
...
@@ -90,7 +90,7 @@ class WarnService implements IWarnService
$tem
[
'createdAt'
]
=
Carbon
::
parse
(
$list
->
created_at
)
->
format
(
'Y-m-d H:i:s'
);
$array
[
'data'
][]
=
$tem
;
}
unset
(
$
users
,
$user
,
$user
);
unset
(
$
lists
,
$list
);
return
$array
;
}
...
...
@@ -162,14 +162,16 @@ class WarnService implements IWarnService
*/
public
function
getConfigAdd
(
$postData
)
{
if
(
$postData
[
'platform'
]
<
1
||
$postData
[
'channel'
]
<
1
)
throw
new
Exception
(
config
(
'msg.common.1014'
),
1014
);
$verity
=
Warn
PeopleModel
::
where
(
'platform'
,
$postData
[
'platform'
])
->
where
(
'channel'
,
$postData
[
'channel'
])
->
where
(
'phone'
,
$postData
[
'phone
'
])
->
select
(
'id'
)
->
first
();
if
(
$postData
[
'platform'
]
<
1
||
$postData
[
'channel'
]
<
1
||
$postData
[
'type'
]
<
1
)
throw
new
Exception
(
config
(
'msg.common.1014'
),
1014
);
$verity
=
Warn
ConfigModel
::
where
(
'platform'
,
$postData
[
'platform'
])
->
where
(
'channel'
,
$postData
[
'channel'
])
->
where
(
'type'
,
$postData
[
'type'
])
->
where
(
'one_withdrawal'
,
$postData
[
'oneWithdrawal'
])
->
where
(
'day_withdrawal'
,
$postData
[
'dayWithdrawal'
])
->
where
(
'people_day_withdrawal'
,
$postData
[
'userDayWithdrawal
'
])
->
select
(
'id'
)
->
first
();
if
(
!
$verity
)
{
$row
=
new
Warn
People
Model
();
$row
=
new
Warn
Config
Model
();
$row
->
platform
=
$postData
[
'platform'
]
??
0
;
$row
->
channel
=
$postData
[
'channel'
]
??
0
;
$row
->
name
=
$postData
[
'remarkName'
]
??
''
;
$row
->
phone
=
$postData
[
'phone'
]
??
''
;
$row
->
type
=
$postData
[
'type'
]
??
0
;
$row
->
one_withdrawal
=
$postData
[
'oneWithdrawal'
]
*
100
;
$row
->
day_withdrawal
=
$postData
[
'dayWithdrawal'
]
*
100
;
$row
->
people_day_withdrawal
=
$postData
[
'userDayWithdrawal'
]
*
100
;
$row
->
op_user
=
$postData
[
'user'
]
??
''
;
$row
->
remark
=
$postData
[
'remark'
]
??
''
;
if
(
$row
->
save
())
return
$row
->
id
;
...
...
@@ -178,4 +180,85 @@ class WarnService implements IWarnService
throw
new
Exception
(
config
(
'msg.common.1005'
),
1005
);
}
/**
* 预警配置列表
* @return araay
* @date 2021/07/31
* @author live
*/
public
function
getConfigList
(
$postData
)
{
$status
=
$postData
[
'status'
]
??
0
;
$pagePerNum
=
$postData
[
'pageSize'
]
??
20
;
$currentPage
=
$postData
[
'page'
]
??
1
;
$lists
=
WarnConfigModel
::
when
(
$status
>
0
,
function
(
$query
)
use
(
$status
)
{
return
$query
->
where
(
'status'
,
$status
);
})
->
select
(
'id'
,
'platform'
,
'channel'
,
'type'
,
'one_withdrawal'
,
'day_withdrawal'
,
'people_day_withdrawal'
,
'status'
,
'op_user'
,
'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
;
}
/**
* 预警配置编辑
* @return araay
* @date 2021/07/31
* @author live
*/
public
function
getConfigEdit
(
$postData
)
{
if
(
$postData
[
'platform'
]
<
1
||
$postData
[
'channel'
]
<
1
||
$postData
[
'type'
]
<
1
)
throw
new
Exception
(
config
(
'msg.common.1014'
),
1014
);
$verity
=
WarnConfigModel
::
where
(
'id'
,
'!='
,
$postData
[
'id'
])
->
where
(
'platform'
,
$postData
[
'platform'
])
->
where
(
'channel'
,
$postData
[
'channel'
])
->
where
(
'type'
,
$postData
[
'type'
])
->
where
(
'one_withdrawal'
,
$postData
[
'oneWithdrawal'
])
->
where
(
'day_withdrawal'
,
$postData
[
'dayWithdrawal'
])
->
where
(
'people_day_withdrawal'
,
$postData
[
'userDayWithdrawal'
])
->
select
(
'id'
)
->
first
();
if
(
!
$verity
)
{
$row
=
WarnConfigModel
::
find
(
$postData
[
'id'
]);
$row
->
platform
=
$postData
[
'platform'
]
??
0
;
$row
->
channel
=
$postData
[
'channel'
]
??
0
;
$row
->
type
=
$postData
[
'type'
]
??
0
;
$row
->
one_withdrawal
=
$postData
[
'oneWithdrawal'
]
*
100
;
$row
->
day_withdrawal
=
$postData
[
'dayWithdrawal'
]
*
100
;
$row
->
people_day_withdrawal
=
$postData
[
'userDayWithdrawal'
]
*
100
;
$row
->
op_user
=
$postData
[
'user'
]
??
''
;
$row
->
remark
=
$postData
[
'remark'
]
??
''
;
$row
->
updated_at
=
$this
->
time
;
if
(
$row
->
save
())
return
$row
->
id
;
throw
new
Exception
(
config
(
'msg.common.1006'
),
1006
);
}
throw
new
Exception
(
config
(
'msg.common.1005'
),
1005
);
}
/**
* 预警配置删除
* @return araay
* @date 2021/07/31
* @author live
*/
public
function
getConfigDel
(
$postData
)
{
$list
=
WarnConfigModel
::
where
(
'id'
,
$postData
[
'id'
])
->
first
();
if
(
!
$list
)
throw
new
Exception
(
config
(
'msg.common.1002'
),
1002
);
if
(
$list
->
delete
())
return
true
;
throw
new
Exception
(
config
(
'msg.common.1003'
),
1003
);
}
}
\ No newline at end of file
app/Services/White/WhiteService.php
View file @
3bbe8182
...
...
@@ -74,7 +74,7 @@ class WhiteService implements IWhiteService
$tem
[
'addTime'
]
=
$list
->
add_time
;
$array
[
'data'
][]
=
$tem
;
}
unset
(
$
users
,
$user
,
$user
);
unset
(
$
lists
,
$list
);
return
$array
;
}
...
...
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