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
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
522 additions
and
106 deletions
+522
-106
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
+187
-26
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
...
@@ -40,6 +40,9 @@ class NormListBus extends BaseBus
if
(
!
empty
(
$data
[
'normListIds'
]))
{
if
(
!
empty
(
$data
[
'normListIds'
]))
{
$where
[]
=
[
'norm_list.id'
,
'not in'
,
$data
[
'normListIds'
]];
$where
[]
=
[
'norm_list.id'
,
'not in'
,
$data
[
'normListIds'
]];
}
}
if
(
!
empty
(
$data
[
'num'
]))
{
$where
[]
=
[
'norm_list.num'
,
'<>'
,
0
];
}
// 需要显示的字段,默认空全部显示
// 需要显示的字段,默认空全部显示
$displayField
=
[];
$displayField
=
[];
// 需要排除显示的字段,默认空全部显示,优先级大
// 需要排除显示的字段,默认空全部显示,优先级大
...
...
app/api/business/NormReceivesBus.php
View file @
29b53431
...
@@ -37,7 +37,9 @@ class NormReceivesBus extends BaseBus
...
@@ -37,7 +37,9 @@ class NormReceivesBus extends BaseBus
if
(
!
empty
(
$data
[
'name'
]))
{
if
(
!
empty
(
$data
[
'name'
]))
{
$where
[]
=
[
'name'
,
'like'
,
"%
{
$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
)
{
if
(
!
empty
(
$data
[
'status'
])
||
$data
[
'status'
]
==
0
)
{
$where
[]
=
[
'status'
,
'in'
,
"
{
$data
[
'status'
]
}
"
];
$where
[]
=
[
'status'
,
'in'
,
"
{
$data
[
'status'
]
}
"
];
}
}
...
@@ -46,7 +48,11 @@ class NormReceivesBus extends BaseBus
...
@@ -46,7 +48,11 @@ class NormReceivesBus extends BaseBus
// 需要排除显示的字段,默认空全部显示,优先级大
// 需要排除显示的字段,默认空全部显示,优先级大
$hideField
=
[];
$hideField
=
[];
// 排序
// 排序
$order
=
[
"id"
=>
"desc"
];
if
(
$data
[
'order'
]){
$order
=
[
"id"
=>
$data
[
'order'
]];
}
else
{
$order
=
[
"id"
=>
"desc"
];
}
// 分页
// 分页
$page
=
$data
[
'page'
];
$page
=
$data
[
'page'
];
$limit
=
$data
[
'limit'
];
$limit
=
$data
[
'limit'
];
...
...
app/api/controller/Norm.php
View file @
29b53431
...
@@ -53,22 +53,21 @@ class Norm
...
@@ -53,22 +53,21 @@ class Norm
$result
=
$normBus
->
pagingListData
(
$data
);
//获取所有数据带分页
$result
=
$normBus
->
pagingListData
(
$data
);
//获取所有数据带分页
// 指标详情
// 指标详情
foreach
(
$result
[
'data'
]
as
$index
=>
$value
){
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'
);
$normExtendBus
=
new
CommonBus
(
'NormExtendBus'
);
$res
=
$normExtendBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$normExtendRes
=
$normExtendBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$result
[
'data'
][
$index
][
'custom'
]
=
$res
;
$result
[
'data'
][
$index
][
'custom'
]
=
$normExtendRes
;
// 领取进度
// 领取进度
$NormListBus
=
new
CommonBus
(
'NormListBus'
);
// 通过公共业务初始化指标类
$NormListBus
=
new
CommonBus
(
'NormListBus'
);
// 通过公共业务初始化指标类
$totalDegree
=
$NormListBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$totalDegree
=
$NormListBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$NormReceivesBus
=
new
CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化指标类
$NormReceivesBus
=
new
CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化指标类
$receivedTimes
=
$NormReceivesBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$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'
);
// 通过公共业务初始化指标类
$NormCollectsBus
=
new
CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$collectsTimes
=
$NormCollectsBus
->
getConditionalQueryAll
([
'norm_id'
=>
$value
[
'id'
]]);
$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
){
if
(
$result
){
...
@@ -250,18 +249,15 @@ class Norm
...
@@ -250,18 +249,15 @@ class Norm
$data
[
'receivesList'
][
$index
][
'norm_list_info'
]
=
$NormListBus
->
getConditionalQuery
([
'id'
=>
$vlues
[
'norm_list_id'
]]);
$data
[
'receivesList'
][
$index
][
'norm_list_info'
]
=
$NormListBus
->
getConditionalQuery
([
'id'
=>
$vlues
[
'norm_list_id'
]]);
$NormListExtendBus
=
new
CommonBus
(
'NormListExtendBus'
);
// 通过公共业务初始化指标类
$NormListExtendBus
=
new
CommonBus
(
'NormListExtendBus'
);
// 通过公共业务初始化指标类
$data
[
'receivesList'
][
$index
][
'norm_list_extend'
]
=
$NormListExtendBus
->
getConditionalQueryAll
([
'norm_list_id'
=>
$vlues
[
'norm_list_id'
]]);
$data
[
'receivesList'
][
$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'
]]);
$NormCollectsBus
=
new
CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
if
(
$collectsInfo
){
$data
[
'collectsList'
]
=
$NormCollectsBus
->
getConditionalQueryAll
([
'norm_id'
=>
$id
]);
$data
[
'receivesList'
][
$index
][
'receives_status'
]
=
1
;
if
(
!
empty
(
$data
[
'collectsList'
])){
$data
[
'receivesList'
][
$index
][
'completion_status'
]
=
1
;
foreach
(
$data
[
'collectsList'
]
as
$index
=>
$vlues
){
}
else
{
$TaskPackageBus
=
new
CommonBus
(
'TaskPackageBus'
);
// 通过公共业务初始化指标类
$data
[
'receivesList'
][
$index
][
'receives_status'
]
=
1
;
$data
[
'collectsList'
][
$index
][
'task_info'
]
=
$TaskPackageBus
->
getConditionalQuery
([
'id'
=>
$vlues
[
'task_id'
]]);
$data
[
'receivesList'
][
$index
][
'completion_status'
]
=
0
;
$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'
]]);
}
}
}
}
if
(
$data
){
if
(
$data
){
...
@@ -293,12 +289,16 @@ class Norm
...
@@ -293,12 +289,16 @@ class Norm
$normListBus
=
new
CommonBus
(
'NormListBus'
);
// 通过公共业务初始化用户待领取指标类
$normListBus
=
new
CommonBus
(
'NormListBus'
);
// 通过公共业务初始化用户待领取指标类
$normListExtendBus
=
new
CommonBus
(
'NormListExtendBus'
);
// 通过公共业务初始化用户待领取指标扩展类
$normListExtendBus
=
new
CommonBus
(
'NormListExtendBus'
);
// 通过公共业务初始化用户待领取指标扩展类
$normReceivesBus
=
new
CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化用户待领取指标扩展类
$normReceivesBus
=
new
CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化用户待领取指标扩展类
$NormCollectsBus
=
new
CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化用户待领取指标扩展类
$NormCollectsExtendBus
=
new
CommonBus
(
'NormCollectsExtendBus'
);
// 通过公共业务初始化用户待领取指标扩展类
// 删除原有的指标信息
// 删除原有的指标信息
$normBus
->
deleteData
(
$normId
);
$normBus
->
deleteData
(
$normId
);
$normExtendBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$normExtendBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$normListBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$normListBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$normListExtendBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$normListExtendBus
->
conditionDeletion
([
'norm_id'
=>
$normId
]);
$normReceivesBus
->
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
[
'task_id'
]
=
trim
(
$queryArr
[
'addItem'
][
'task_id'
]);
$data
[
'name'
]
=
trim
(
$queryArr
[
'addItem'
][
'name'
]);
$data
[
'name'
]
=
trim
(
$queryArr
[
'addItem'
][
'name'
]);
...
...
app/api/controller/NormCollects.php
View file @
29b53431
...
@@ -12,7 +12,7 @@ use think\facade\Db;
...
@@ -12,7 +12,7 @@ use think\facade\Db;
class
NormCollects
extends
AuthBase
class
NormCollects
extends
AuthBase
{
{
/**
/**
* 指标
领取
* 指标
填写
*
*
* @param \think\Request $request
* @param \think\Request $request
* @return \think\Response
* @return \think\Response
...
@@ -46,9 +46,7 @@ class NormCollects extends AuthBase
...
@@ -46,9 +46,7 @@ class NormCollects extends AuthBase
$index
=
1
;
$index
=
1
;
// 查询是否已经填写了
// 查询是否已经填写了
$arr
=
[
$arr
=
[
'norm_list_id'
=>
$data
[
'norm_list_id'
],
'norm_receive_id'
=>
$data
[
'norm_receive_id'
],
'task_id'
=>
$data
[
'task_id'
],
'norm_id'
=>
$data
[
'norm_id'
],
'user_id'
=>
$data
[
'user_id'
]
'user_id'
=>
$data
[
'user_id'
]
];
];
if
(
$data
[
'imgPath'
]){
if
(
$data
[
'imgPath'
]){
...
@@ -58,40 +56,202 @@ class NormCollects extends AuthBase
...
@@ -58,40 +56,202 @@ class NormCollects extends AuthBase
}
}
$NormCollectsBus
=
new
\app\api\business\CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$NormCollectsBus
=
new
\app\api\business\CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化指标类
$res
=
$NormCollectsBus
->
getConditionalQuery
(
$arr
);
$res
=
$NormCollectsBus
->
getConditionalQuery
(
$arr
);
if
(
empty
(
$res
)){
if
(
$res
){
$add
=
$NormCollectsBus
->
addData
(
$data
);
return
returnResult
(
config
(
"config.code.error"
),
'信息已填写!'
,
''
);
if
(
empty
(
$add
)){
}
$index
++
;
$addCollectsId
=
$NormCollectsBus
->
addData
(
$data
);
}
if
(
empty
(
$addCollectsId
)){
}
else
{
$index
++
;
$where
=
[
}
'norm_list_id'
=>
$data
[
'norm_list_id'
],
// 用户填写区域
$userFilled
=
$queryArr
[
'userFilled'
];
$NormCollectsExtendBus
=
new
\app\api\business\CommonBus
(
'NormCollectsExtendBus'
);
// 通过公共业务初始化指标类
$addList
=
[];
foreach
(
$userFilled
as
$value
){
$list
=
[
'norm_receive_id'
=>
$data
[
'norm_receive_id'
],
'task_id'
=>
$data
[
'task_id'
],
'task_id'
=>
$data
[
'task_id'
],
'norm_id'
=>
$data
[
'norm_id'
],
'norm_id'
=>
$data
[
'norm_id'
],
'user_id'
=>
$data
[
'user_id'
],
'norm_collects_id'
=>
$addCollectsId
,
'norm_list_extend_id'
=>
$value
[
'id'
],
'extend_name'
=>
$value
[
'name'
],
'extend_value'
=>
$value
[
'value'
],
'extend_type'
=>
1
];
];
$updateData
=
[
array_push
(
$addList
,
$list
);
'refer_type'
=>
$data
[
'refer_type'
],
}
'remark'
=>
$data
[
'remark'
],
$collectsExtendAdd
=
$NormCollectsExtendBus
->
addData
(
$addList
);
'imgPath'
=>
$data
[
'imgPath'
],
if
(
empty
(
$collectsExtendAdd
)){
'editorContent'
=>
$data
[
'editorContent'
],
$index
++
;
];
}
$update
=
$NormCollectsBus
->
updateData
(
$updateData
,
$where
);
$NormReceivesBus
=
new
\app\api\business\NormReceivesBus
;
if
(
empty
(
$update
)){
$res
=
$NormReceivesBus
->
updateData
([
'id'
=>
$data
[
'norm_receive_id'
],
'status'
=>
1
]);
$index
++
;
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
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
;
// 用户是否已经填写了内容
$NormCollectsBus
=
new
\app\api\business\CommonBus
(
'NormCollectsBus'
);
// 通过公共业务初始化用户待领取指标类
$normCollectInfo
=
$NormCollectsBus
->
getConditionalQuery
([
'norm_receive_id'
=>
$id
]);
if
(
$normCollectInfo
){
$data
[
'normCollectInfo'
]
=
$normCollectInfo
;
}
//用户填写的内容
$NormExtendBus
=
new
\app\api\business\CommonBus
(
'NormExtendBus'
);
// 通过公共业务初始化用户待领取指标类
$normExtendInfo
=
$NormExtendBus
->
getConditionalQueryAll
([
'norm_id'
=>
$res
[
'norm_id'
],
'user_filled'
=>
1
]);
if
(
$normExtendInfo
){
// 判断用户是否已经填写
if
(
$normCollectInfo
){
foreach
(
$normExtendInfo
as
$index
=>
$value
){
$NormCollectsExtendBus
=
new
\app\api\business\CommonBus
(
'NormCollectsExtendBus'
);
// 通过公共业务初始化用户待领取指标类
$collectsExtendInfo
=
$NormCollectsExtendBus
->
getConditionalQuery
([
'norm_collects_id'
=>
$normCollectInfo
[
'id'
],
'norm_list_extend_id'
=>
$value
[
'id'
]]);
if
(
$collectsExtendInfo
){
$normExtendInfo
[
$index
][
'extend_value'
]
=
$collectsExtendInfo
[
'extend_value'
];
}
}
}
}
$data
[
'userFilled'
]
=
$normExtendInfo
;
}
// 管理员审核内容
$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'
);
}
}
/**
* 指标填写信息修改
*
* @param \think\Request $request
* @return \think\Response
*/
public
function
modify
()
{
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_receive_id'
=>
$data
[
'norm_receive_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
)){
return
returnResult
(
config
(
"config.code.error"
),
'修改信息有误!'
,
''
);
}
$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'
];
$userFilled
=
$queryArr
[
'userFilled'
];
$Norm
ExtendBus
=
new
\app\api\business\CommonBus
(
'Norm
ExtendBus'
);
// 通过公共业务初始化指标类
$Norm
CollectsExtendBus
=
new
\app\api\business\CommonBus
(
'NormCollects
ExtendBus'
);
// 通过公共业务初始化指标类
foreach
(
$userFilled
as
$value
){
foreach
(
$userFilled
as
$value
){
$update
=
$NormExtendBus
->
updateData
([
'id'
=>
$value
[
'id'
],
'extend_value'
=>
$value
[
'value'
]]);
$where
=
[
'norm_collects_id'
=>
$res
[
'id'
],
'norm_list_extend_id'
=>
$value
[
'id'
],
];
$updateData
=
[
'extend_value'
=>
$value
[
'value'
],
];
$update
=
$NormCollectsExtendBus
->
updateData
(
$updateData
,
$where
);
if
(
empty
(
$update
)){
if
(
empty
(
$update
)){
$index
++
;
$index
++
;
}
}
}
}
$NormReceivesBus
=
new
\app\api\business\NormReceivesBus
;
$NormReceivesBus
=
new
\app\api\business\NormReceivesBus
;
$res
=
$NormReceivesBus
->
updateData
([
'id'
=>
$data
[
'norm_receive_id'
],
'status'
=>
1
]);
$res
=
$NormReceivesBus
->
updateData
([
'id'
=>
$data
[
'norm_receive_id'
],
'status'
=>
1
,
'review_remarks'
=>
''
,
'review_time'
=>
''
]);
if
(
empty
(
$res
)){
if
(
empty
(
$res
)){
$index
++
;
$index
++
;
}
}
...
@@ -117,12 +277,13 @@ class NormCollects extends AuthBase
...
@@ -117,12 +277,13 @@ class NormCollects extends AuthBase
$data
=
[];
$data
=
[];
$data
[
'norm_receive_id'
]
=
input
(
"param.norm_receive_id"
,
''
,
"trim"
);
$data
[
'norm_receive_id'
]
=
input
(
"param.norm_receive_id"
,
''
,
"trim"
);
$data
[
'content'
]
=
input
(
"param.content"
,
''
,
"trim"
);
$data
[
'content'
]
=
input
(
"param.content"
,
''
,
"trim"
);
$data
[
'editor'
]
=
input
(
"param.editor"
);
$PreserveBus
=
new
\app\api\business\CommonBus
(
'PreserveBus'
);
// 通过公共业务初始化指标类
$PreserveBus
=
new
\app\api\business\CommonBus
(
'PreserveBus'
);
// 通过公共业务初始化指标类
$info
=
$PreserveBus
->
getConditionalQuery
([
'norm_receive_id'
=>
$data
[
'norm_receive_id'
]]);
$info
=
$PreserveBus
->
getConditionalQuery
([
'norm_receive_id'
=>
$data
[
'norm_receive_id'
]]);
if
(
empty
(
$info
)){
if
(
empty
(
$info
)){
$res
=
$PreserveBus
->
addData
(
$data
);
$res
=
$PreserveBus
->
addData
(
$data
);
}
else
{
}
else
{
$res
=
$PreserveBus
->
updateData
([
'content'
=>
$data
[
'content'
]],[
'norm_receive_id'
=>
$data
[
'norm_receive_id'
]]);
$res
=
$PreserveBus
->
updateData
([
'content'
=>
$data
[
'content'
]
,
'editor'
=>
$data
[
'editor'
]
],[
'norm_receive_id'
=>
$data
[
'norm_receive_id'
]]);
}
}
if
(
$res
){
if
(
$res
){
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$res
);
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$res
);
...
...
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
...
@@ -21,6 +21,7 @@ class NormList extends AuthBase
$data
[
'page'
]
=
input
(
"param.page"
,
0
,
"intval"
);
$data
[
'page'
]
=
input
(
"param.page"
,
0
,
"intval"
);
$data
[
'limit'
]
=
input
(
"param.limit"
,
0
,
"intval"
);
$data
[
'limit'
]
=
input
(
"param.limit"
,
0
,
"intval"
);
$data
[
'name'
]
=
input
(
"param.name"
);
$data
[
'name'
]
=
input
(
"param.name"
);
$data
[
'num'
]
=
1
;
// 分页数据
// 分页数据
$NormReceivesBus
=
new
\app\api\business\CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化用户待领取指标类
$NormReceivesBus
=
new
\app\api\business\CommonBus
(
'NormReceivesBus'
);
// 通过公共业务初始化用户待领取指标类
$res
=
$NormReceivesBus
->
getConditionalQueryAll
([
'user_id'
=>
$this
->
userId
]);
$res
=
$NormReceivesBus
->
getConditionalQueryAll
([
'user_id'
=>
$this
->
userId
]);
...
...
app/api/controller/NormReceives.php
View file @
29b53431
...
@@ -24,6 +24,8 @@ class NormReceives extends AuthBase
...
@@ -24,6 +24,8 @@ class NormReceives extends AuthBase
$data
[
'name'
]
=
input
(
"param.name"
);
$data
[
'name'
]
=
input
(
"param.name"
);
$data
[
'task_id'
]
=
input
(
"param.task_id"
);
$data
[
'task_id'
]
=
input
(
"param.task_id"
);
$data
[
'status'
]
=
input
(
"param.status"
);
$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
;
$data
[
'admin'
]
=
input
(
"param.admin"
)
?
input
(
"param.admin"
)
:
0
;
if
(
$data
[
'admin'
]
==
0
){
if
(
$data
[
'admin'
]
==
0
){
$data
[
'user_id'
]
=
$this
->
userId
;
$data
[
'user_id'
]
=
$this
->
userId
;
...
@@ -113,9 +115,14 @@ class NormReceives extends AuthBase
...
@@ -113,9 +115,14 @@ class NormReceives extends AuthBase
$NormListBus
=
new
\app\api\business\CommonBus
(
'NormListBus'
);
$NormListBus
=
new
\app\api\business\CommonBus
(
'NormListBus'
);
$info
=
$NormListBus
->
getConditionalQuery
([
'id'
=>
$data
[
'norm_list_id'
]]);
$info
=
$NormListBus
->
getConditionalQuery
([
'id'
=>
$data
[
'norm_list_id'
]]);
if
(
$info
){
if
(
$info
){
$NormListBus
->
decrementing
(
$data
[
'norm_list_id'
],
1
);
if
(
$info
[
'num'
]
>
0
){
//添加数据
$NormListBus
->
decrementing
(
$data
[
'norm_list_id'
],
1
);
$result
=
$NormReceivesBus
->
addData
(
$data
);
//添加数据
$result
=
$NormReceivesBus
->
addData
(
$data
);
}
else
{
return
returnResult
(
config
(
"config.code.error"
),
'任务已领完!'
,
''
);
}
}
else
{
}
else
{
return
returnResult
(
config
(
"config.code.error"
),
'待领取指标ID错误!'
,
''
);
return
returnResult
(
config
(
"config.code.error"
),
'待领取指标ID错误!'
,
''
);
}
}
...
@@ -189,61 +196,6 @@ class NormReceives extends AuthBase
...
@@ -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"); // 指标领取
...
@@ -70,7 +70,6 @@ Route::rule("normList/add","NormList/add"); // 指标领取
/***************************用保护指标领取相关 */
/***************************用保护指标领取相关 */
Route
::
rule
(
"normReceives/list"
,
"normReceives/list"
);
// 已领取的指标
Route
::
rule
(
"normReceives/list"
,
"normReceives/list"
);
// 已领取的指标
Route
::
rule
(
"normReceives/detail"
,
"normReceives/detail"
);
// 查看领取指标详情
Route
::
rule
(
"normReceives/revoke"
,
"normReceives/revoke"
);
// 指标撤销
Route
::
rule
(
"normReceives/revoke"
,
"normReceives/revoke"
);
// 指标撤销
Route
::
rule
(
"normReceives/add"
,
"normReceives/add"
);
// 指标领取
Route
::
rule
(
"normReceives/add"
,
"normReceives/add"
);
// 指标领取
Route
::
rule
(
"normReceives/batchAdd"
,
"normReceives/batchAdd"
);
// 指标批量领取
Route
::
rule
(
"normReceives/batchAdd"
,
"normReceives/batchAdd"
);
// 指标批量领取
...
@@ -80,6 +79,8 @@ Route::rule("normReceives/reviewTask","normReceives/reviewTask");//审核任务
...
@@ -80,6 +79,8 @@ Route::rule("normReceives/reviewTask","normReceives/reviewTask");//审核任务
Route
::
rule
(
"normCollects/add"
,
"NormCollects/add"
);
// 填写指标
Route
::
rule
(
"normCollects/add"
,
"NormCollects/add"
);
// 填写指标
Route
::
rule
(
"normCollects/preserve"
,
"NormCollects/preserve"
);
// 填写数据保存
Route
::
rule
(
"normCollects/preserve"
,
"NormCollects/preserve"
);
// 填写数据保存
Route
::
rule
(
"normCollects/getPreserve"
,
"NormCollects/getPreserve"
);
// 数据获取
Route
::
rule
(
"normCollects/getPreserve"
,
"NormCollects/getPreserve"
);
// 数据获取
Route
::
rule
(
"normCollects/detail"
,
"normCollects/detail"
);
// 查看指标填写详情
Route
::
rule
(
"normCollects/modify"
,
"normCollects/modify"
);
// 修改指标填写详情
/***************************上传 */
/***************************上传 */
Route
::
rule
(
"upload/picture"
,
"upload/picture"
);
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