Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b92aef04
authored
Aug 04, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
标签修改
parent
f9cee5bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
21 deletions
app/Http/Controllers/SupplierController.php
app/Http/Services/SupplierService.php
app/Http/Services/SupplierTagService.php
app/Http/routes.php
app/Http/Controllers/SupplierController.php
View file @
b92aef04
...
@@ -7,6 +7,7 @@ use App\Http\Services\RegionService;
...
@@ -7,6 +7,7 @@ use App\Http\Services\RegionService;
use
App\Http\Services\SupplierAttachmentService
;
use
App\Http\Services\SupplierAttachmentService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierStatisticsService
;
use
App\Http\Services\SupplierStatisticsService
;
use
App\Http\Services\SupplierTagService
;
use
App\Http\Transformers\LogTransformer
;
use
App\Http\Transformers\LogTransformer
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\IntracodeModel
;
use
App\Model\IntracodeModel
;
...
@@ -165,6 +166,12 @@ class SupplierController extends Controller
...
@@ -165,6 +166,12 @@ class SupplierController extends Controller
}
}
//省市id,给控件用
//省市id,给控件用
$this
->
data
[
'province_city'
]
=
[
$supplier
[
'province_id'
],
$supplier
[
'city_id'
]];
$this
->
data
[
'province_city'
]
=
[
$supplier
[
'province_id'
],
$supplier
[
'city_id'
]];
//获取标签情况
$tagService
=
new
SupplierTagService
();
$systemTags
=
$tagService
->
getTagsBySupplierId
(
$supplierId
,
1
);
$customerTags
=
$tagService
->
getTagsBySupplierId
(
$supplierId
,
2
);
$supplier
[
'system_tags'
]
=
$systemTags
?
implode
(
','
,
$systemTags
)
:
''
;
$supplier
[
'customer_tags'
]
=
$customerTags
?
implode
(
','
,
$customerTags
)
:
''
;
$this
->
data
[
'supplier'
]
=
$supplier
;
$this
->
data
[
'supplier'
]
=
$supplier
;
$this
->
data
[
'address'
]
=
$supplierService
->
getAddress
(
$supplierId
);
$this
->
data
[
'address'
]
=
$supplierService
->
getAddress
(
$supplierId
);
$supplierAttachmentService
=
new
SupplierAttachmentService
();
$supplierAttachmentService
=
new
SupplierAttachmentService
();
...
...
app/Http/Services/SupplierService.php
View file @
b92aef04
...
@@ -150,8 +150,8 @@ class SupplierService
...
@@ -150,8 +150,8 @@ class SupplierService
$oldCustomerTags
=
array_get
(
$oldSupplier
,
'customer_tags'
);
$oldCustomerTags
=
array_get
(
$oldSupplier
,
'customer_tags'
);
$oldSystemTags
=
array_get
(
$oldSupplier
,
'system_tags'
);
$oldSystemTags
=
array_get
(
$oldSupplier
,
'system_tags'
);
$tagService
=
new
SupplierTagService
();
$tagService
=
new
SupplierTagService
();
$tagService
->
saveTags
(
$supplierId
,
14
,
$channel
[
'system_tags'
],
$oldSystemTags
);
//
$tagService->saveTags($supplierId, 14, $channel['system_tags'], $oldSystemTags);
$tagService
->
saveTags
(
$supplierId
,
4
,
$channel
[
'customer_tags'
],
$oldCustomerTags
);
//
$tagService->saveTags($supplierId, 4, $channel['customer_tags'], $oldCustomerTags);
}
}
//保存附件
//保存附件
$attachmentService
=
new
SupplierAttachmentService
();
$attachmentService
=
new
SupplierAttachmentService
();
...
...
app/Http/Services/SupplierTagService.php
View file @
b92aef04
...
@@ -29,6 +29,9 @@ class SupplierTagService
...
@@ -29,6 +29,9 @@ class SupplierTagService
$data
=
!
empty
(
$data
[
'data'
])
?
$data
[
'data'
]
:
[];
$data
=
!
empty
(
$data
[
'data'
])
?
$data
[
'data'
]
:
[];
$result
=
[];
$result
=
[];
foreach
(
$data
as
$key
=>
$value
)
{
foreach
(
$data
as
$key
=>
$value
)
{
if
(
empty
(
$value
))
{
continue
;
}
$result
[]
=
[
$result
[]
=
[
'tag_id'
=>
$value
,
'tag_id'
=>
$value
,
'tag_name'
=>
$value
,
'tag_name'
=>
$value
,
...
@@ -38,22 +41,15 @@ class SupplierTagService
...
@@ -38,22 +41,15 @@ class SupplierTagService
}
}
//获取供应商对应的标签
//获取供应商对应的标签
public
function
get
SystemTagsBySupplierId
(
$supplierId
)
public
function
get
TagsBySupplierId
(
$supplierId
,
$type
=
1
)
{
{
// $supplierId = 1;
//1是系统标签,2是自定义标签
$response
=
$this
->
client
->
get
(
'/get?tag_use=14&req_id='
.
$supplierId
);
$tagUse
=
$type
==
1
?
14
:
4
;
$response
=
$this
->
client
->
get
(
'/get?tag_use='
.
$tagUse
.
'&req_id='
.
$supplierId
);
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
return
!
empty
(
$data
[
'data'
])
?
$data
[
'data'
]
:
[];
return
!
empty
(
$data
[
'data'
])
?
$data
[
'data'
]
:
[];
}
}
//获取供应商对应的自定义标签
public
function
getCustomerTagsBySupplierId
(
$supplierId
)
{
// $supplierId = 1;
$response
=
$this
->
client
->
get
(
'/get?tag_use=4&req_id='
.
$supplierId
);
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
return
!
empty
(
$data
[
'data'
])
?
$data
[
'data'
]
:
[];
}
//新增/修改标签和供应商id对应关系到标签系统
//新增/修改标签和供应商id对应关系到标签系统
public
function
saveTags
(
$supplierId
,
$tagUse
,
$newTags
,
$oldTags
)
public
function
saveTags
(
$supplierId
,
$tagUse
,
$newTags
,
$oldTags
)
...
@@ -85,7 +81,7 @@ class SupplierTagService
...
@@ -85,7 +81,7 @@ class SupplierTagService
'modifier_name'
=>
'admin'
,
'modifier_name'
=>
'admin'
,
'data'
=>
[
'data'
=>
[
[
[
'id'
=>
(
int
)
$supplierId
,
'id'
=>
$supplierId
,
'tag_status'
=>
0
,
'tag_status'
=>
0
,
]
]
]
]
...
@@ -114,9 +110,6 @@ class SupplierTagService
...
@@ -114,9 +110,6 @@ class SupplierTagService
RequestOptions
::
JSON
=>
$params
,
RequestOptions
::
JSON
=>
$params
,
]);
]);
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
// if ($tagUse==4) {
// dd($params,$data);
// }
if
(
!
empty
(
$data
[
'status'
])
&&
$data
[
'status'
]
==
1
)
{
if
(
!
empty
(
$data
[
'status'
])
&&
$data
[
'status'
]
==
1
)
{
return
true
;
return
true
;
}
else
{
}
else
{
...
...
app/Http/routes.php
View file @
b92aef04
...
@@ -46,8 +46,4 @@ Route::match(['get', 'post'], '/test', function () {
...
@@ -46,8 +46,4 @@ Route::match(['get', 'post'], '/test', function () {
$service
=
new
\App\Http\Services\DataService
();
$service
=
new
\App\Http\Services\DataService
();
// $service->initSystemTag();
// $service->initSystemTag();
// $service->transferFileData();
// $service->transferFileData();
$tagService
=
new
\App\Http\Services\SupplierTagService
();
// $res = $tagService->getSystemTagsBySupplierId(12293);
$res
=
$tagService
->
getCustomerTagsBySupplierId
(
12293
);
dd
(
$res
);
});
});
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