Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
product_library_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
product_library_api
Commits
94cf6dfe
Commit
94cf6dfe
authored
Sep 29, 2024
by
cwy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多个pdf文件问题
parent
95630b47
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
203 additions
and
22 deletions
+203
-22
app/api/controller/EnterpriseAllocation.php
+56
-20
app/api/controller/Task.php
+144
-0
app/api/route/api.php
+3
-2
No files found.
app/api/controller/EnterpriseAllocation.php
View file @
94cf6dfe
...
@@ -27,30 +27,66 @@ class EnterpriseAllocation extends AuthBase
...
@@ -27,30 +27,66 @@ class EnterpriseAllocation extends AuthBase
// 数据接收
// 数据接收
$page
=
input
(
"param.page"
,
0
,
"intval"
);
$page
=
input
(
"param.page"
,
0
,
"intval"
);
$limit
=
input
(
"param.limit"
,
10
,
"intval"
);
$limit
=
input
(
"param.limit"
,
10
,
"intval"
);
$department_id
=
input
(
"department_id"
);
$EnterpriseAllocationModel
=
new
EnterpriseAllocationModel
();
$where
=
[];
if
(
$department_id
){
$where
[]
=
[
'department_id'
,
'='
,
$department_id
];
}
$result
=
$EnterpriseAllocationModel
->
with
([
'enterpriseInfo'
=>
function
(
$query
){
},
'adminInfo'
=>
function
(
$query
){
},
])
->
where
(
$where
)
->
paginate
([
'list_rows'
=>
$limit
,
'page'
=>
$page
]);
if
(
$result
){
$result
=
$result
->
toArray
();
foreach
(
$result
[
'data'
]
as
$key
=>
$val
){
$info
=
Db
::
name
(
'product_allocation'
)
->
where
(
'enterprise_id'
,
$val
[
'enterprise_id'
])
->
select
();
$not_checked
=
Db
::
name
(
'product_allocation'
)
->
where
(
'enterprise_id'
,
$val
[
'enterprise_id'
])
->
where
(
'status'
,
0
)
->
select
();
$checked
=
Db
::
name
(
'product_allocation'
)
->
where
(
'enterprise_id'
,
$val
[
'enterprise_id'
])
->
where
(
'status'
,
1
)
->
select
();
$result
[
'data'
][
$key
][
'total'
]
=
count
(
$info
);
$result
[
'data'
][
$key
][
'not_checked'
]
=
count
(
$not_checked
);
$result
[
'data'
][
$key
][
'checked'
]
=
count
(
$checked
);
}
}
if
(
$result
){
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$result
);
}
else
{
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.null_data"
),
$result
);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
self
::
$name
.
'.list'
);
}
}
/**
* 用户分配企业列表
* @return \josn|void
*/
public
function
userEnterpriseList
()
{
try
{
// 数据接收
$page
=
input
(
"param.page"
,
0
,
"intval"
);
$limit
=
input
(
"param.limit"
,
10
,
"intval"
);
$userId
=
$this
->
userId
;
$userId
=
$this
->
userId
;
$EnterpriseAllocationModel
=
new
EnterpriseAllocationModel
();
$EnterpriseAllocationModel
=
new
EnterpriseAllocationModel
();
if
(
$userId
!=
1
){
if
(
$userId
!=
1
){
$result
=
$EnterpriseAllocationModel
->
with
([
$where
[]
=
[
'user_id'
,
'='
,
$userId
];
'enterpriseInfo'
=>
function
(
$query
){
},
'adminInfo'
=>
function
(
$query
){
},
])
->
where
(
'user_id'
,
$userId
)
->
paginate
([
'list_rows'
=>
$limit
,
'page'
=>
$page
]);
}
else
{
$result
=
$EnterpriseAllocationModel
->
with
([
'enterpriseInfo'
=>
function
(
$query
){
},
'adminInfo'
=>
function
(
$query
){
},
])
->
paginate
([
'list_rows'
=>
$limit
,
'page'
=>
$page
]);
}
}
$result
=
$EnterpriseAllocationModel
->
with
([
'enterpriseInfo'
=>
function
(
$query
){
},
'adminInfo'
=>
function
(
$query
){
},
])
->
where
(
$where
)
->
paginate
([
'list_rows'
=>
$limit
,
'page'
=>
$page
]);
if
(
$result
){
if
(
$result
){
$result
=
$result
->
toArray
();
$result
=
$result
->
toArray
();
foreach
(
$result
[
'data'
]
as
$key
=>
$val
){
foreach
(
$result
[
'data'
]
as
$key
=>
$val
){
...
...
app/api/controller/Task.php
0 → 100644
View file @
94cf6dfe
<?php
/**
* Create by wenyi
* E-mail: wesley_prc@163.com
* Description: data-collect-api
* Date: 2024/2/27 23:37
* Update: 2024/2/27 23:37
* 数据管理
*/
namespace
app\api\controller
;
use
app\common\model\redis\RedisModel
;
use
app\common\model\mysql\EnterpriseInfo
as
EnterpriseInfoModel
;
use
app\common\model\mysql\Department
as
DepartmentModel
;
use
app\common\model\mysql\Admin
as
AdminModel
;
use
think\facade\Db
;
class
Task
extends
AuthBase
{
public
static
$name
=
'controller.EnterpriseInfo'
;
/**
* 列表
* @return \josn|void
*/
public
function
list
()
{
try
{
// 数据接收
$page
=
input
(
"param.page"
,
0
,
"intval"
);
$limit
=
input
(
"param.limit"
,
10
,
"intval"
);
$DepartmentModel
=
new
DepartmentModel
();
$result
=
$DepartmentModel
->
where
(
'slug'
,
'gather'
)
->
where
(
'status'
,
1
)
->
paginate
([
'list_rows'
=>
$limit
,
'page'
=>
$page
]);
if
(
$result
){
$result
=
$result
->
toArray
();
foreach
(
$result
[
'data'
]
as
$key
=>
$val
){
$res
=
Db
::
name
(
'admin'
)
->
where
(
'department_id'
,
$val
[
'id'
])
->
select
();
$result
[
'data'
][
$key
][
'number'
]
=
count
(
$res
);
}
}
if
(
$result
){
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$result
);
}
else
{
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.null_data"
),
$result
);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
self
::
$name
.
'.list'
);
}
}
/**
*
* @return \josn|void
*/
public
function
add
()
{
try
{
$data
=
array
();
// 数据接收
$data
[
'name'
]
=
input
(
"name"
);
$data
[
'slug'
]
=
'gather'
;
$DepartmentModel
=
new
DepartmentModel
();
$result
=
$DepartmentModel
->
insert
(
$data
);
if
(
$result
){
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),
$result
);
}
else
{
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.null_data"
),
$result
);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
self
::
$name
.
'.add'
);
}
}
public
function
save
()
{
try
{
$data
=
array
();
// 数据接收
$id
=
input
(
"param.id"
,
''
,
"trim"
);
$data
[
'enterprise_shxydm'
]
=
input
(
"param.enterprise_shxydm"
,
''
,
"trim"
);
$data
[
'enterprise_website_official'
]
=
input
(
"param.enterprise_website_official"
,
''
,
"trim"
);
$data
[
'enterprise_website_language'
]
=
input
(
"param.enterprise_website_language"
,
''
,
"trim"
);
$data
[
'enterprise_website_oriignal'
]
=
input
(
"param.enterprise_website_oriignal"
,
''
,
"trim"
);
$data
[
'enterprise_websitessl'
]
=
input
(
"param.enterprise_websitessl"
,
''
,
"trim"
);
$data
[
'product_source_address'
]
=
input
(
"param.product_source_address"
,
''
,
"trim"
);
$data
[
'unique_product_source'
]
=
input
(
"param.unique_product_source"
,
''
,
"trim"
);
$data
[
'structured_product_source'
]
=
input
(
"param.structured_product_source"
,
''
,
"trim"
);
$data
[
'unavailable'
]
=
input
(
"param.unavailable"
,
''
,
"trim"
);
$data
[
'initial_screening_remarks'
]
=
input
(
"param.initial_screening_remarks"
,
''
,
"trim"
);
$data
[
'collection_type'
]
=
input
(
"param.collection_type"
,
''
,
"trim"
);
$data
[
'collection_status'
]
=
input
(
"param.collection_status"
,
''
,
"trim"
);
$data
[
'enterprise_chain'
]
=
input
(
"param.enterprise_chain"
,
''
,
"trim"
);
$data
[
'enterprise_type'
]
=
input
(
"param.enterprise_type"
,
''
,
"trim"
);
$data
[
'enterprise_note'
]
=
input
(
"param.enterprise_note"
,
''
,
"trim"
);
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
);
$enterpriseAudit
=
new
EnterpriseInfoModel
();
$result
=
$enterpriseAudit
->
where
(
'id'
,
$id
)
->
update
(
$data
);
if
(
$result
){
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),[]);
}
else
{
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.null_data"
),
$result
);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
self
::
$name
.
'.save'
);
}
}
/**
* 删除信息
*
* @param int $id
* @return \think\Response
*/
public
function
delete
()
{
try
{
$id
=
input
(
'param.id'
,
''
,
"intval"
);
if
(
!
is_numeric
(
$id
)
||
$id
==
0
){
return
returnResult
(
config
(
"config.code.error"
),
config
(
"config.describe.error_id"
));
}
// 业务处理
$enterpriseAudit
=
new
EnterpriseInfoModel
();
$res
=
$enterpriseAudit
->
where
(
'id'
,
$id
)
->
find
();
if
(
empty
(
$res
)){
return
returnResult
(
config
(
"config.code.error"
),
config
(
"config.describe.error_id"
));
}
$result
=
$res
->
where
(
'id'
,
$id
)
->
update
([
'status'
=>
0
]);
if
(
$result
){
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.success"
),[]);
}
else
{
return
returnResult
(
config
(
"config.code.success"
),
config
(
"config.describe.deletion_failed"
),[]);
}
}
catch
(
\Exception
$e
){
exception
(
$e
,
'Equipment.delete'
);
}
}
}
\ No newline at end of file
app/api/route/api.php
View file @
94cf6dfe
...
@@ -98,12 +98,13 @@ Route::rule("productAllocation/abnormal","productAllocation/abnormal");
...
@@ -98,12 +98,13 @@ Route::rule("productAllocation/abnormal","productAllocation/abnormal");
Route
::
rule
(
"productAllocation/randomAllocation"
,
"productAllocation/randomAllocation"
);
Route
::
rule
(
"productAllocation/randomAllocation"
,
"productAllocation/randomAllocation"
);
Route
::
rule
(
"productAllocation/importProduct"
,
"productAllocation/importProduct"
);
Route
::
rule
(
"productAllocation/importProduct"
,
"productAllocation/importProduct"
);
Route
::
rule
(
"task/list"
,
"Task/list"
);
Route
::
rule
(
"task/add"
,
"Task/add"
);
Route
::
rule
(
"enterpriseAllocation/list"
,
"EnterpriseAllocation/list"
);
Route
::
rule
(
"enterpriseAllocation/list"
,
"EnterpriseAllocation/list"
);
Route
::
rule
(
"enterpriseAllocation/userEnterpriseList"
,
"EnterpriseAllocation/userEnterpriseList"
);
Route
::
rule
(
"enterpriseAllocation/equalDistributionEnterprise"
,
"EnterpriseAllocation/equalDistributionEnterprise"
);
Route
::
rule
(
"enterpriseAllocation/equalDistributionEnterprise"
,
"EnterpriseAllocation/equalDistributionEnterprise"
);
Route
::
rule
(
"task/list"
,
"Task/list"
);
Route
::
rule
(
"service/product"
,
"Service/product"
);
Route
::
rule
(
"service/product"
,
"Service/product"
);
Route
::
rule
(
"service/product1"
,
"Service/product1"
);
Route
::
rule
(
"service/product1"
,
"Service/product1"
);
Route
::
rule
(
"service/enterpriseName"
,
"Service/enterpriseName"
);
Route
::
rule
(
"service/enterpriseName"
,
"Service/enterpriseName"
);
...
...
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