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
8e2effe3
Commit
8e2effe3
authored
Sep 28, 2024
by
wenyi.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
线上
parent
e270b40c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
171 additions
and
2 deletions
+171
-2
app/api/controller/Task.php
+170
-0
app/api/route/api.php
+1
-2
No files found.
app/api/controller/Task.php
0 → 100644
View file @
8e2effe3
<?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
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
(
'statues'
,
1
)
->
paginate
([
'list_rows'
=>
$limit
,
'page'
=>
$page
]);
if
(
$result
){
$result
=
$result
->
toArray
();
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'
);
}
}
public
function
getNameInfo
()
{
try
{
$name
=
input
(
"param.name"
);
$enterpriseAudit
=
new
EnterpriseInfoModel
();
$result
=
$enterpriseAudit
->
where
(
'enterprise_name'
,
$name
)
->
find
();
if
(
$result
){
$result
=
$result
->
toArray
();
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
.
'.getNameInfo'
);
}
}
/**
*
* @return \josn|void
*/
public
function
add
()
{
try
{
$data
=
array
();
// 数据接收
$data
[
'enterprise_name'
]
=
input
(
"param.enterprise_name"
,
''
,
"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"
);
$timestamp
=
time
();
// 当前时间戳
$randomNumber
=
mt_rand
(
100000
,
999999
);
// 生成一个六位的随机数
$uniqueIdentifier
=
$timestamp
.
$randomNumber
;
// 时间戳和随机数拼接
$data
[
'enterprise_id'
]
=
$uniqueIdentifier
;
$enterpriseAudit
=
new
EnterpriseInfoModel
();
$result
=
$enterpriseAudit
->
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 @
8e2effe3
...
@@ -88,12 +88,11 @@ Route::rule("product/save","Product/save");
...
@@ -88,12 +88,11 @@ Route::rule("product/save","Product/save");
Route
::
rule
(
"product/delete"
,
"Product/delete"
);
Route
::
rule
(
"product/delete"
,
"Product/delete"
);
Route
::
rule
(
"product/add"
,
"Product/add"
);
Route
::
rule
(
"product/add"
,
"Product/add"
);
Route
::
rule
(
"product/unallocatedProducts"
,
"product/unallocatedProducts"
);
Route
::
rule
(
"product/unallocatedProducts"
,
"product/unallocatedProducts"
);
// 未分配的产品列表
Route
::
rule
(
"productAllocation/add"
,
"productAllocation/add"
);
Route
::
rule
(
"productAllocation/add"
,
"productAllocation/add"
);
Route
::
rule
(
"productAllocation/list"
,
"productAllocation/list"
);
Route
::
rule
(
"productAllocation/list"
,
"productAllocation/list"
);
Route
::
rule
(
"productAllocation/see"
,
"productAllocation/see"
);
Route
::
rule
(
"productAllocation/see"
,
"productAllocation/see"
);
Route
::
rule
(
"productAllocation/save"
,
"productAllocation/save"
);
Route
::
rule
(
"productAllocation/save"
,
"productAllocation/save"
);
Route
::
rule
(
"productAllocation/abnormal"
,
"productAllocation/abnormal"
);
Route
::
rule
(
"service/product"
,
"Service/product"
);
Route
::
rule
(
"service/product"
,
"Service/product"
);
...
...
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