Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
note-library
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
1e758226
authored
Feb 20, 2023
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
获取销售的标签列表
parent
dfae2965
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
app/Http/Controllers/ApiController.php
app/Services/LabelService.php
app/Http/Controllers/ApiController.php
View file @
1e758226
...
...
@@ -4,15 +4,17 @@ namespace App\Http\Controllers;
use
App\Model\TemplateExtendModel
;
use
App\Services\LabelService
;
use
Illuminate\Http\Request
;
Class
ApiController
extends
Controller
{
public
function
getUserLabels
(){
public
function
getUserLabels
(
Request
$request
){
$list
=
\DB
::
connection
(
"label"
)
->
table
(
"template_list"
)
->
where
(
"template_list.status"
,
1
)
->
leftJoin
(
"template_extend"
,
"template_list.id"
,
"="
,
"template_extend.template_id"
)
->
select
(
"template_list.id"
,
"template_list.template_name"
,
"template_extend.html"
,
"template_extend.attribute"
)
->
get
(
);
$user_id
=
$request
->
input
(
"user_id"
,
0
);
$list
=
LabelService
::
getUserLabels
(
$user_id
);
$list
=
collect
(
$list
)
->
toArray
();
$arr
=
[];
...
...
app/Services/LabelService.php
View file @
1e758226
...
...
@@ -164,4 +164,16 @@ class LabelService {
return
false
;
}
}
public
static
function
getUserLabels
(
$user_id
){
$list
=
\DB
::
connection
(
"label"
)
->
table
(
"template_list"
)
->
where
(
"template_list.status"
,
1
)
->
leftJoin
(
"template_extend"
,
"template_list.id"
,
"="
,
"template_extend.template_id"
)
->
where
(
function
(
$q
)
use
(
$user_id
){
$q
->
where
(
"create_userid"
,
$user_id
)
->
orWhere
(
"create_userid"
,
1000
);
})
->
select
(
"template_list.id"
,
"template_list.template_name"
,
"template_extend.html"
,
"template_extend.attribute"
)
->
get
();
return
$list
;
}
}
\ No newline at end of file
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