Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-collect-api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyi.chen
data-collect-api
Commits
29b53431
Commit
29b53431
authored
Mar 21, 2024
by
wenyi.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
綫上
parent
4d163dd7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
335 additions
and
80 deletions
+335
-80
app/api/business/NormListBus.php
+3
-0
app/api/business/NormReceivesBus.php
+8
-2
app/api/controller/Norm.php
+19
-19
app/api/controller/NormCollects.php
+0
-0
app/api/controller/NormCollectsaaaaaa.php
+154
-0
app/api/controller/NormList.php
+1
-0
app/api/controller/NormReceives.php
+10
-58
app/api/route/api.php
+2
-1
app/common/model/mysql/NormCollectsExtend.php
+138
-0
No files found.
app/api/business/NormListBus.php
View file @
29b53431
...
...
@@ -40,6 +40,9 @@ class NormListBus extends BaseBus
if
(
!
empty
(
$data
[
'normListIds'
]))
{
$where
[]
=
[
'norm_list.id'
,
'not in'
,
$data
[
'normListIds'
]];
}
if
(
!
empty
(
$data
[
'num'
]))
{
$where
[]
=
[
'norm_list.num'
,
'<>'
,
0
];
}
// 需要显示的字段,默认空全部显示
$displayField
=
[];
// 需要排除显示的字段,默认空全部显示,优先级大
...
...
app/api/business/NormReceivesBus.php
View file @
29b53431
...
...
@@ -37,7 +37,9 @@ class NormReceivesBus extends BaseBus
if
(
!
empty
(
$data
[
'name'
]))
{
$where
[]
=
[
'name'
,
'like'
,
"%
{
$data
[
'name'
]
}
%"
];
}
if
(
!
empty
(
$data
[
'user_id'
]))
{
$where
[]
=
[
'user_id'
,
'='
,
$data
[
'user_id'
]];
}
if
(
!
empty
(
$data
[
'status'
])
||
$data
[
'status'
]
==
0
)
{
$where
[]
=
[
'status'
,
'in'
,
"
{
$data
[
'status'
]
}
"
];
}
...
...
@@ -46,7 +48,11 @@ class NormReceivesBus extends BaseBus
// 需要排除显示的字段,默认空全部显示,优先级大
$hideField
=
[];
// 排序
$order
=
[
"id"
=>
"desc"
];
if
(
$data
[
'order'
]){
$order
=
[
"id"
=>
$data
[
'order'
]];
}
else
{
$order
=
[
"id"
=>
"desc"
];
}
// 分页
$page
=
$data
[
'page'
];
$limit
=
$data
[
'limit'
];
...
...
app/api/controller/Norm.php
View file @
29b53431
...
...
@@ -53,22 +53,21 @@ class Norm
$result
=
$normBus
->
pagingListData
(
$data
);
//获取所有数据带分页
// 指标详情
foreach
(
$result
[
'data'
]
as
$index
=>
$value
){
$
r
es
=
$normBus
->
getConditionalQuery
([
'id'
=>
$value
[
'id'
]]);
$
normR
es
=
$normBus
->
getConditionalQuery
([
'id'
=>
$value
[
'id'
]]);
// 指标扩展详情
$result
[
'data'
][
$index
][
'addItem'
]
=
$
r
es
;
$result
[
'data'
][
$index
][
'addItem'
]
=
$
normR
es
;
$normExtendBus
=
new
CommonBus
(
'NormExtendBus'
);
$res
=
$normExtendBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$result
[
'data'
][
$index
][
'custom'
]
=
$res
;
$normExtendRes
=
$normExtendBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$result
[
'data'
][
$index
][
'custom'
]
=
$normExtendRes
;
// 领取进度
$NormListBus
=
new
CommonBus
(
'NormListBus'
);
// 通过公共业务初始化指标类
$totalDegree
=
$NormListBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$NormReceivesBus
=
new
CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化指标类
$receivedTimes
=
$NormReceivesBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$result
[
'data'
][
$index
][
'receivedQuantity'
]
=
count
(
$receivedTimes
)
.
'/'
.
count
(
$totalDegree
);
$result
[
'data'
][
$index
][
'receivedQuantity'
]
=
count
(
$receivedTimes
)
.
'/'
.
count
(
$totalDegree
)
*
$normRes
[
'num'
]
;
$NormCollectsBus
=
new
CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$collectsTimes
=
$NormCollectsBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$result
[
'data'
][
$index
][
'collectsQuantity'
]
=
count
(
$collectsTimes
)
.
'/'
.
count
(
$totalDegree
);
$result
[
'data'
][
$index
][
'collectsQuantity'
]
=
count
(
$collectsTimes
)
.
'/'
.
count
(
$totalDegree
)
*
$normRes
[
'num'
]
;
}
}
if
(
$result
){
...
...
@@ -250,18 +249,15 @@ class Norm
$data
[
'receivesList'
][
$index
][
'norm_list_info'
]
=
$NormListBus
->
getConditionalQuery
([
'id'
=>
$vlues
[
'norm_list_id'
]]);
$NormListExtendBus
=
new
CommonBus
(
'NormListExtendBus'
);
// 通过公共业务初始化指标类
$data
[
'receivesList'
][
$index
][
'norm_list_extend'
]
=
$NormListExtendBus
->
getConditionalQueryAll
([
'norm_list_id'
=>
$vlues
[
'norm_list_id'
]]);
}
}
$NormCollectsBus
=
new
CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$data
[
'collectsList'
]
=
$NormCollectsBus
->
getConditionalQueryAll
([
'norm_id'
=>
$id
]);
if
(
!
empty
(
$data
[
'collectsList'
])){
foreach
(
$data
[
'collectsList'
]
as
$index
=>
$vlues
){
$TaskPackageBus
=
new
CommonBus
(
'TaskPackageBus'
);
// 通过公共业务初始化指标类
$data
[
'collectsList'
][
$index
][
'task_info'
]
=
$TaskPackageBus
->
getConditionalQuery
([
'id'
=>
$vlues
[
'task_id'
]]);
$NormListBus
=
new
CommonBus
(
'NormListBus'
);
// 通过公共业务初始化指标类
$data
[
'collectsList'
][
$index
][
'norm_list_info'
]
=
$NormListBus
->
getConditionalQuery
([
'id'
=>
$vlues
[
'norm_list_id'
]]);
$NormListExtendBus
=
new
CommonBus
(
'NormListExtendBus'
);
// 通过公共业务初始化指标类
$data
[
'collectsList'
][
$index
][
'norm_list_extend'
]
=
$NormListExtendBus
->
getConditionalQueryAll
([
'norm_list_id'
=>
$vlues
[
'norm_list_id'
]]);
$NormCollectsBus
=
new
CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$collectsInfo
=
$NormCollectsBus
->
getConditionalQueryAll
([
'norm_receive_id'
=>
$vlues
[
'id'
]]);
if
(
$collectsInfo
){
$data
[
'receivesList'
][
$index
][
'receives_status'
]
=
1
;
$data
[
'receivesList'
][
$index
][
'completion_status'
]
=
1
;
}
else
{
$data
[
'receivesList'
][
$index
][
'receives_status'
]
=
1
;
$data
[
'receivesList'
][
$index
][
'completion_status'
]
=
0
;
}
}
}
if
(
$data
){
...
...
@@ -293,12 +289,16 @@ class Norm
$normListBus
=
new
CommonBus
(
'NormListBus'
);
// 通过公共业务初始化用户待领取指标类
$normListExtendBus
=
new
CommonBus
(
'NormListExtendBus'
);
// 通过公共业务初始化用户待领取指标扩展类
$normReceivesBus
=
new
CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化用户待领取指标扩展类
$NormCollectsBus
=
new
CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化用户待领取指标扩展类
$NormCollectsExtendBus
=
new
CommonBus
(
'NormCollectsExtendBus'
);
// 通过公共业务初始化用户待领取指标扩展类
// 删除原有的指标信息
$normBus
->
deleteData
(
$normId
);
$normExtendBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$normListBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$normListExtendBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$normReceivesBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$NormCollectsBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$NormCollectsExtendBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
// 数据接收
$data
[
'task_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'task_id'
]);
$data
[
'name'
]
=
trim
(
$queryArr
[
'addItem'
][
'name'
]);
...
...
app/api/controller/NormCollects.php
View file @
29b53431
This diff is collapsed.
Click to expand it.
app/api/controller/NormCollectsaaaaaa.php
0 → 100644
View file @
29b53431
<?php
/**
* 用户填写指标详情
* User: raisound
*/
namespace
app\api\controller
;
use
app\common\business\CommonBus
as
CommonBus
;
use
app\common\model\redis\RedisModel
;
use
think\facade\Db
;
class
NormCollectsaaaaaa
extends
AuthBase
{
/**
* 指标领取
*
* @param \think\Request $request
* @return \think\Response
*/
public
function
add
()
{
try
{
$queryArr
=
json_decode
(
file_get_contents
(
'php://input'
),
true
);
$data
=
array
();
$data
[
'norm_list_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'norm_list_id'
]);
$data
[
'task_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'task_id'
]);
$data
[
'norm_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'norm_id'
]);
$data
[
'norm_receive_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'norm_receive_id'
]);
$data
[
'refer_type'
]
=
trim
(
$queryArr
[
'addItem'
][
'refer_type'
]);
$data
[
'remark'
]
=
trim
(
$queryArr
[
'addItem'
][
'remark'
]);
$data
[
'imgPath'
]
=
$queryArr
[
'editorImgList'
];
$data
[
'editorContent'
]
=
$queryArr
[
'editorContent'
];
$data
[
'user_id'
]
=
$this
->
userId
;
if
(
empty
(
$data
[
'norm_list_id'
])
||
empty
(
$data
[
'task_id'
])
||
empty
(
$data
[
'norm_id'
])
||
empty
(
$data
[
'norm_receive_id'
])
||
empty
(
$data
[
'user_id'
])){
errorRecord
(
'NormCollects.add'
,
json_encode
(
$data
),
true
);
return
returnResult
(
config
(
"config.code.error"
),
'无法获取相关信息!'
,
''
);
}
$NormCollectsBus
=
new
\app\api\business\NormReceivesBus
;
// 通过公共业务初始化指标类
$res
=
$NormCollectsBus
->
getConditionalQuery
([
'id'
=>
$data
[
'norm_receive_id'
]]);
if
(
$res
[
'status'
]
==
3
||
$res
[
'status'
]
==
4
){
errorRecord
(
'NormCollects.add'
,
$res
[
'status'
],
true
);
return
returnResult
(
config
(
"config.code.error"
),
'管理员已审核无法修改!'
,
''
);
}
// 开启数据库事务
Db
::
startTrans
();
$index
=
1
;
// 查询是否已经填写了
$arr
=
[
'norm_list_id'
=>
$data
[
'norm_list_id'
],
'task_id'
=>
$data
[
'task_id'
],
'norm_id'
=>
$data
[
'norm_id'
],
'user_id'
=>
$data
[
'user_id'
]
];
if
(
$data
[
'imgPath'
]){
$data
[
'imgPath'
]
=
implode
(
','
,
$data
[
'imgPath'
]);
}
else
{
$data
[
'imgPath'
]
=
''
;
}
$NormCollectsBus
=
new
\app\api\business\CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$res
=
$NormCollectsBus
->
getConditionalQuery
(
$arr
);
if
(
empty
(
$res
)){
$add
=
$NormCollectsBus
->
addData
(
$data
);
if
(
empty
(
$add
)){
$index
++
;
}
}
else
{
$where
=
[
'norm_list_id'
=>
$data
[
'norm_list_id'
],
'task_id'
=>
$data
[
'task_id'
],
'norm_id'
=>
$data
[
'norm_id'
],
'user_id'
=>
$data
[
'user_id'
],
];
$updateData
=
[
'refer_type'
=>
$data
[
'refer_type'
],
'remark'
=>
$data
[
'remark'
],
'imgPath'
=>
$data
[
'imgPath'
],
'editorContent'
=>
$data
[
'editorContent'
],
];
$update
=
$NormCollectsBus
->
updateData
(
$updateData
,
$where
);
if
(
empty
(
$update
)){
$index
++
;
}
}
// 用户填写区域
$userFilled
=
$queryArr
[
'userFilled'
];
$NormExtendBus
=
new
\app\api\business\CommonBus
(
'NormExtendBus'
);
// 通过公共业务初始化指标类
foreach
(
$userFilled
as
$value
){
$update
=
$NormExtendBus
->
updateData
([
'id'
=>
$value
[
'id'
],
'extend_value'
=>
$value
[
'value'
]]);
if
(
empty
(
$update
)){
$index
++
;
}
}
$NormReceivesBus
=
new
\app\api\business\NormReceivesBus
;
$res
=
$NormReceivesBus
->
updateData
([
'id'
=>
$data
[
'norm_receive_id'
],
'status'
=>
1
]);
if
(
empty
(
$res
)){
$index
++
;
}
if
(
$index
==
1
){
Db
::
commit
();
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$res
);
}
else
{
Db
::
rollback
();
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.null_data"
),[]);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
'NormCollects.add'
);
}
}
/**
* 数据保存
* @return void
*/
public
function
preserve
()
{
try
{
$data
=
[];
$data
[
'norm_receive_id'
]
=
input
(
"param.norm_receive_id"
,
''
,
"trim"
);
$data
[
'content'
]
=
input
(
"param.content"
,
''
,
"trim"
);
$data
[
'editor'
]
=
input
(
"param.editor"
);
$PreserveBus
=
new
\app\api\business\CommonBus
(
'PreserveBus'
);
// 通过公共业务初始化指标类
$info
=
$PreserveBus
->
getConditionalQuery
([
'norm_receive_id'
=>
$data
[
'norm_receive_id'
]]);
if
(
empty
(
$info
)){
$res
=
$PreserveBus
->
addData
(
$data
);
}
else
{
$res
=
$PreserveBus
->
updateData
([
'content'
=>
$data
[
'content'
],
'editor'
=>
$data
[
'editor'
]],[
'norm_receive_id'
=>
$data
[
'norm_receive_id'
]]);
}
if
(
$res
){
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$res
);
}
else
{
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.null_data"
),[]);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
'NormCollects.preserve'
);
}
}
/**
* 数据保存
* @return void
*/
public
function
getPreserve
()
{
try
{
$id
=
input
(
"param.id"
,
''
,
"trim"
);
$PreserveBus
=
new
\app\api\business\CommonBus
(
'PreserveBus'
);
// 通过公共业务初始化指标类
$info
=
$PreserveBus
->
getConditionalQuery
([
'norm_receive_id'
=>
$id
]);
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$info
);
}
catch
(
\Exception
$e
){
exception
(
$e
,
'NormCollects.getPreserve'
);
}
}
}
\ No newline at end of file
app/api/controller/NormList.php
View file @
29b53431
...
...
@@ -21,6 +21,7 @@ class NormList extends AuthBase
$data
[
'page'
]
=
input
(
"param.page"
,
0
,
"intval"
);
$data
[
'limit'
]
=
input
(
"param.limit"
,
0
,
"intval"
);
$data
[
'name'
]
=
input
(
"param.name"
);
$data
[
'num'
]
=
1
;
// 分页数据
$NormReceivesBus
=
new
\app\api\business\CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化用户待领取指标类
$res
=
$NormReceivesBus
->
getConditionalQueryAll
([
'user_id'
=>
$this
->
userId
]);
...
...
app/api/controller/NormReceives.php
View file @
29b53431
...
...
@@ -24,6 +24,8 @@ class NormReceives extends AuthBase
$data
[
'name'
]
=
input
(
"param.name"
);
$data
[
'task_id'
]
=
input
(
"param.task_id"
);
$data
[
'status'
]
=
input
(
"param.status"
);
$data
[
'order'
]
=
input
(
"param.order"
)
?
input
(
"param.order"
)
:
'desc'
;
// $data['user_id'] = $this->userId;
$data
[
'admin'
]
=
input
(
"param.admin"
)
?
input
(
"param.admin"
)
:
0
;
if
(
$data
[
'admin'
]
==
0
){
$data
[
'user_id'
]
=
$this
->
userId
;
...
...
@@ -113,9 +115,14 @@ class NormReceives extends AuthBase
$NormListBus
=
new
\app\api\business\CommonBus
(
'NormListBus'
);
$info
=
$NormListBus
->
getConditionalQuery
([
'id'
=>
$data
[
'norm_list_id'
]]);
if
(
$info
){
$NormListBus
->
decrementing
(
$data
[
'norm_list_id'
],
1
);
//添加数据
$result
=
$NormReceivesBus
->
addData
(
$data
);
if
(
$info
[
'num'
]
>
0
){
$NormListBus
->
decrementing
(
$data
[
'norm_list_id'
],
1
);
//添加数据
$result
=
$NormReceivesBus
->
addData
(
$data
);
}
else
{
return
returnResult
(
config
(
"config.code.error"
),
'任务已领完!'
,
''
);
}
}
else
{
return
returnResult
(
config
(
"config.code.error"
),
'待领取指标ID错误!'
,
''
);
}
...
...
@@ -189,61 +196,6 @@ class NormReceives extends AuthBase
}
}
/**
* 指标详情
* @return void
*/
public
function
detail
()
{
try
{
$id
=
input
(
"id"
);
$NormReceivesBus
=
new
\app\api\business\NormReceivesBus
;
$NormListBus
=
new
\app\api\business\NormListBus
();
$res
=
$NormReceivesBus
->
getConditionalQuery
([
'id'
=>
$id
]);
if
(
empty
(
$res
)){
return
returnResult
(
config
(
"config.code.error"
),
'无法获取领取指标信息!'
,
''
);
}
$data
=
[];
// 指标领取详情
$normlistInfo
=
$NormListBus
->
getConditionalQuery
([
'id'
=>
$res
[
'norm_list_id'
]]);
$data
[
'addItem'
]
=
array_merge
(
$data
,
$normlistInfo
);
//指标详情
$NormBus
=
new
\app\api\business\CommonBus
(
'NormBus'
);
// 通过公共业务初始化用户待领取指标类
$normInfo
=
$NormBus
->
getConditionalQuery
([
'id'
=>
$res
[
'norm_id'
]]);
//任务详情
$TaskPackageBus
=
new
\app\api\business\CommonBus
(
'TaskPackageBus'
);
// 通过公共业务初始化用户待领取指标类
$taskInfo
=
$TaskPackageBus
->
getConditionalQuery
([
'id'
=>
$normInfo
[
'task_id'
]]);
$data
[
'addItem'
][
'task_name'
]
=
$taskInfo
[
'name'
];
$data
[
'addItem'
][
'task_unit'
]
=
$taskInfo
[
'unit'
];
//管理员发布指标自定义内容
$NormListExtendBus
=
new
\app\api\business\CommonBus
(
'NormListExtendBus'
);
// 通过公共业务初始化用户待领取指标类
$normListExtendInfo
=
$NormListExtendBus
->
getConditionalQueryAll
([
'norm_list_id'
=>
$res
[
'norm_list_id'
]]);
$data
[
'adminFilled'
]
=
$normListExtendInfo
;
//管理员发布指标允许用户填写内容
$NormExtendBus
=
new
\app\api\business\CommonBus
(
'NormExtendBus'
);
// 通过公共业务初始化用户待领取指标类
$normExtendInfo
=
$NormExtendBus
->
getConditionalQueryAll
([
'norm_id'
=>
$res
[
'norm_id'
],
'user_filled'
=>
1
]);
$data
[
'userFilled'
]
=
$normExtendInfo
;
// 用户是否已经填写了内容
$NormCollectsBus
=
new
\app\api\business\CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化用户待领取指标类
$normCollectInfo
=
$NormCollectsBus
->
getConditionalQuery
([
'norm_receive_id'
=>
$id
]);
if
(
$normCollectInfo
){
$data
[
'normCollectInfo'
]
=
$normCollectInfo
;
}
// 管理员审核内容
$receivesBus
=
new
\app\api\business\CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化用户待领取指标类
$reviewInfo
=
$receivesBus
->
getConditionalQuery
([
'id'
=>
$id
]);
if
(
$reviewInfo
){
$data
[
'review'
]
=
$reviewInfo
;
}
if
(
$data
){
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$data
);
}
else
{
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.null_data"
),
$data
);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
'NormReceives.list'
);
}
}
/**
* 指标退回
...
...
app/api/route/api.php
View file @
29b53431
...
...
@@ -70,7 +70,6 @@ Route::rule("normList/add","NormList/add"); // 指标领取
/***************************用保护指标领取相关 */
Route
::
rule
(
"normReceives/list"
,
"normReceives/list"
);
// 已领取的指标
Route
::
rule
(
"normReceives/detail"
,
"normReceives/detail"
);
// 查看领取指标详情
Route
::
rule
(
"normReceives/revoke"
,
"normReceives/revoke"
);
// 指标撤销
Route
::
rule
(
"normReceives/add"
,
"normReceives/add"
);
// 指标领取
Route
::
rule
(
"normReceives/batchAdd"
,
"normReceives/batchAdd"
);
// 指标批量领取
...
...
@@ -80,6 +79,8 @@ Route::rule("normReceives/reviewTask","normReceives/reviewTask");//审核任务
Route
::
rule
(
"normCollects/add"
,
"NormCollects/add"
);
// 填写指标
Route
::
rule
(
"normCollects/preserve"
,
"NormCollects/preserve"
);
// 填写数据保存
Route
::
rule
(
"normCollects/getPreserve"
,
"NormCollects/getPreserve"
);
// 数据获取
Route
::
rule
(
"normCollects/detail"
,
"normCollects/detail"
);
// 查看指标填写详情
Route
::
rule
(
"normCollects/modify"
,
"normCollects/modify"
);
// 修改指标填写详情
/***************************上传 */
Route
::
rule
(
"upload/picture"
,
"upload/picture"
);
...
...
app/common/model/mysql/NormCollectsExtend.php
0 → 100644
View file @
29b53431
<?php
/**
*
*/
namespace
app\common\model\mysql
;
use
think\Model
;
class
NormCollectsExtend
extends
Model
{
protected
$name
=
'norm_collects_extend'
;
/**
* 分页列表数据
* @param $where
* @param $displayField
* @param $hideField
* @param $order
* @param $page
* @param $limit
* @return \think\Paginator|void
*/
public
function
pagingListDataSql
(
$where
=
[],
$displayField
=
[],
$hideField
=
[],
$order
=
[],
$page
=
1
,
$limit
=
10
)
{
try
{
return
$this
->
where
(
$where
)
->
field
(
$displayField
)
->
withoutField
(
$hideField
)
->
order
(
$order
)
->
paginate
([
'list_rows'
=>
$limit
,
'page'
=>
$page
]);
}
catch
(
\Exception
$e
){
exception
(
$e
,
'mysql.NormCollectsExtend.pagingListDataSql'
);
}
}
/**
* 列表数据
* @param $where
* @param $displayField
* @param $hideField
* @param $order
* @return UserInfo[]|array|\think\Collection|void
*/
public
function
listDataSql
(
$where
=
[],
$displayField
=
[],
$hideField
=
[],
$order
=
[])
{
try
{
return
$this
->
where
(
$where
)
->
field
(
$displayField
)
->
withoutField
(
$hideField
)
->
order
(
$order
)
->
select
();
}
catch
(
\Exception
$e
){
exception
(
$e
,
'mysql.NormCollectsExtend.listDataSql'
);
}
}
/**
* 更新信息
* @param $query //更新条件
* @return array|false|void
*/
public
function
updateDataModel
(
$query
,
$where
=
[]){
try
{
if
(
!
is_array
(
$query
)){
return
false
;
}
return
$this
->
update
(
$query
,
$where
);
}
catch
(
\Exception
$e
){
exception
(
$e
,
'mysql.NormCollectsExtend.updateDataModel'
);
}
}
/**
* 根据用户条件返回信息
* @param $where //查询条件
* @return UserInfo|array|false|Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public
function
getUserByCriteria
(
$where
)
{
try
{
return
$this
->
where
(
$where
)
->
find
();
}
catch
(
\Exception
$e
){
exception
(
$e
,
'mysql.NormCollectsExtend.getFindModel'
);
}
}
/**
* 根据用户条件返回信息
* @param $where //查询条件
* @return UserInfo|array|false|Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public
function
getConditionalQuery
(
$where
)
{
try
{
return
$this
->
where
(
$where
)
->
find
();
}
catch
(
\Exception
$e
){
exception
(
$e
,
'mysql.NormCollectsExtend.getFindModel'
);
}
}
/**
* 根据用户条件返回多条信息
* @param $where //查询条件
* @return UserInfo|array|false|Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public
function
getConditionalQueryAll
(
$where
)
{
try
{
return
$this
->
where
(
$where
)
->
select
();
}
catch
(
\Exception
$e
){
exception
(
$e
,
'mysql.NormCollectsExtend.getFindModel'
);
}
}
/**
* 根据条件获取多个值
* @param $where
* @return Menu[]|array|\think\Collection|void
*/
public
function
getMultipleData
(
$where
){
try
{
return
$this
->
select
(
$where
);
}
catch
(
\Exception
$e
){
exception
(
$e
,
'mysql.NormCollectsExtend.getMultipleData'
);
}
}
}
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