Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wallet
token
Commits
e71c922b
Commit
e71c922b
authored
Aug 26, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into 'master'
SFT 海报增加 类型 See merge request
!101
parents
9845b193
7de66c6c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
20 deletions
+32
-20
CoinPlatformBannerController.php
api/controllers/CoinPlatformBannerController.php
+4
-3
CoinPlatformBannerController.php
backend/controllers/CoinPlatformBannerController.php
+16
-14
index.php
backend/views/coin-platform-banner/index.php
+12
-3
No files found.
api/controllers/CoinPlatformBannerController.php
View file @
e71c922b
...
...
@@ -13,14 +13,15 @@ class CoinPlatformBannerController extends BaseController
$code
=
0
;
$msg
=
'success'
;
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
''
);
if
(
empty
(
$platform_id
)){
$msg
=
'参数不能为空'
;
$type
=
Yii
::
$app
->
request
->
get
(
'type'
,
''
);
if
(
empty
(
$platform_id
)
||
empty
(
$type
))
{
$msg
=
'参数错误'
;
$code
=
-
1
;
$data
=
null
;
goto
doEnd
;
}
$data
=
CoinPlatformBanner
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
asArray
()
->
all
();
$data
=
CoinPlatformBanner
::
find
()
->
where
([
'platform_id'
=>
$platform_id
,
'type'
=>
$type
])
->
asArray
()
->
all
();
doEnd
:
return
[
'code'
=>
$code
,
'data'
=>
$data
,
'msg'
=>
$msg
];
...
...
backend/controllers/CoinPlatformBannerController.php
View file @
e71c922b
...
...
@@ -14,14 +14,16 @@ class CoinPlatformBannerController extends BaseController
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$image_url
=
$request
->
post
(
'image_url'
,
''
);
if
(
$image_url
){
$type
=
$request
->
post
(
'banner_type'
,
1
);
if
(
$image_url
)
{
$banner_item
=
new
CoinPlatformBanner
();
$banner_item
->
image_url
=
$image_url
;
$banner_item
->
platform_id
=
$user_platform_id
;
$banner_item
->
type
=
$type
;
$banner_item
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'banner添加成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'banner添加加失败'
];
return
[
'code'
=>
0
,
'msg'
=>
'banner添加成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'banner添加加失败'
];
}
}
}
...
...
@@ -36,15 +38,15 @@ class CoinPlatformBannerController extends BaseController
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
get
(
'id'
,
''
);
if
(
$id
)
{
if
(
$id
)
{
$banner
=
CoinPlatformBanner
::
getBanner
(
$id
);
if
(
!
$banner
)
{
return
[
'code'
=>
1
,
'msg'
=>
'banner不存在,不能删除'
];
if
(
!
$banner
)
{
return
[
'code'
=>
1
,
'msg'
=>
'banner不存在,不能删除'
];
}
$banner
->
delete
();
return
[
'code'
=>
0
,
'msg'
=>
'banner删除成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'banner删除失败'
];
return
[
'code'
=>
0
,
'msg'
=>
'banner删除成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'banner删除失败'
];
}
}
}
...
...
@@ -55,17 +57,17 @@ class CoinPlatformBannerController extends BaseController
public
function
actionIndex
()
{
$user_platform_id
=
Yii
::
$app
->
user
->
identity
->
platform_id
;
if
(
Yii
::
$app
->
request
->
isAjax
)
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$condition
=
[];
if
(
1
!==
$user_platform_id
)
{
if
(
1
!==
$user_platform_id
)
{
$condition
=
[
'platform_id'
=>
$user_platform_id
];
}
$data
=
CoinPlatformBanner
::
getItems
(
$condition
);
foreach
(
$data
as
$key
=>
&
$val
){
foreach
(
$data
as
$key
=>
&
$val
)
{
$val
[
'coin_name'
]
=
isset
(
$val
[
'platform'
][
'name'
])
?
$val
[
'platform'
][
'name'
]
:
''
;
}
return
[
'data'
=>
$data
,
'code'
=>
0
];
return
[
'data'
=>
$data
,
'code'
=>
0
];
}
return
$this
->
render
(
'index'
);
}
...
...
backend/views/coin-platform-banner/index.php
View file @
e71c922b
...
...
@@ -12,7 +12,7 @@
<div
class=
"layui-col-md9"
>
<table
class=
"layui-table"
id=
"table1"
lay-filter=
"table1"
></table>
</div>
<div
class=
"layui-row add"
style=
"display: none;padding: 5px;"
id=
"_form"
>
<div
class=
"layui-row add"
style=
"display: none;padding: 5
0
px;"
id=
"_form"
>
<div
class=
"layui-col-xs6 layui-col-sm6 layui-col-md11"
>
<form
class=
"layui-form"
action=
"javascript:void(0)"
id=
"form1"
method=
"post"
lay-filter=
"form1"
>
<input
type=
"hidden"
name=
"_csrf"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
...
...
@@ -31,6 +31,15 @@
</button>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
图片类型
</label>
<div
class=
"layui-input-block"
>
<select
name=
"banner_type"
>
<option
value=
"1"
>
banner
</option>
<option
value=
"2"
>
海报
</option>
</select>
</div>
</div>
</form>
</div>
</div>
...
...
@@ -54,7 +63,7 @@
},
{
field
:
'image_url'
,
title
:
'图片
跳转
地址'
,
title
:
'图片地址'
,
width
:
600
},
{
...
...
@@ -87,7 +96,7 @@
$
(
'#add'
).
click
(
function
()
{
var
index
=
layer
.
open
({
title
:
'添加banner'
,
area
:
'
80
0px'
,
area
:
'
75
0px'
,
type
:
1
,
content
:
$
(
"#_form"
),
btn
:
[
'保存'
,
'取消'
],
...
...
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