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
f60145ce
Commit
f60145ce
authored
Nov 16, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
53a0c840
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
1 deletion
+165
-1
CoinController.php
backend/controllers/CoinController.php
+34
-0
UploadForm.php
backend/models/UploadForm.php
+2
-1
platform_coin.php
backend/views/coin/platform_coin.php
+129
-0
No files found.
backend/controllers/CoinController.php
View file @
f60145ce
...
...
@@ -425,4 +425,38 @@ class CoinController extends BaseController
return
[
'code'
=>
-
1
,
'msg'
=>
'没有权限删除'
];
}
}
public
function
actionPlatformCoin
()
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$data
=
Coin
::
getPlatformList
();
foreach
(
$data
as
$item
){
if
(
$item
){
$platformInfo
[
'platform'
]
=
$item
;
$icon
=
Yii
::
$app
->
redis_app
->
hget
(
'platform_image_info'
,
$item
);
$platformInfo
[
'icon'
]
=
$icon
??
''
;
$platformItems
[]
=
$platformInfo
;
}
}
return
[
'data'
=>
$platformItems
,
'code'
=>
0
];
}
return
$this
->
render
(
'platform_coin'
);
}
public
function
actionAddPlatformCoin
()
{
if
(
Yii
::
$app
->
request
->
isPost
){
Yii
::
$app
->
response
->
format
=
'json'
;
$platform
=
Yii
::
$app
->
request
->
post
(
'platform'
);
$image
=
Yii
::
$app
->
request
->
post
(
'image'
);
if
(
$platform
&&
$image
){
Yii
::
$app
->
redis_app
->
hset
(
'platform_image_info'
,
$platform
,
$image
);
return
[
'code'
=>
0
,
'msg'
=>
'图片添加成功'
];
}
return
[
'code'
=>
0
,
'msg'
=>
'图片添加失败'
];
}
}
}
backend/models/UploadForm.php
View file @
f60145ce
...
...
@@ -21,7 +21,8 @@ class UploadForm extends BaseForm
3
=>
"/application/"
,
//存放应用详情图片,
4
=>
"/h5_icon/"
,
//存放h5_logo ,
5
=>
"/h5_banner/"
,
//存放h5_banner,
6
=>
"/h5_application/"
//存放h5_application
6
=>
"/h5_application/"
,
//存放h5_application
7
=>
"/platform_icon/"
,
//平台logo
];
...
...
backend/views/coin/platform_coin.php
0 → 100644
View file @
f60145ce
<?php
/**
* Created by PhpStorm.
* User: ZCY
* Date: 2018/11/16
* Time: 10:53
*/
?>
<h4>
平台币种图片管理
</h4>
<div
class=
"layui-row layui-col-md6"
>
<table
id=
"table1"
class=
"layui-table"
lay-filter=
"table1"
></table>
</div>
<div
class=
"layui-row add"
style=
"display: none;padding: 5px;"
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
()
?>
"
>
<input
type=
"hidden"
name=
"platform"
value=
""
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
图标
</label>
<div
class=
"layui-input-block"
>
<img
src=
""
style=
"margin-top: 11px; max-width: 32px; max-height: 32px"
id=
"image1"
>
</div>
<input
type=
"hidden"
name=
"image"
value=
""
>
</div>
<div
class=
"layui-inline"
style=
"margin-left: 50px;"
>
<button
type=
"button"
class=
"layui-btn"
id=
"upload1"
style=
""
>
<i
class=
"layui-icon"
>

</i>
上传新图片
</button>
</div>
</div>
</form>
</div>
</div>
<script>
var
table
=
layui
.
table
;
table
.
render
({
elem
:
"#table1"
,
cols
:
[[
{
field
:
'platform'
,
title
:
'平台'
},
{
field
:
'icon'
,
title
:
'图标'
,
templet
:
"#iconTpl"
},
{
field
:
'id'
,
title
:
'操作'
,
templet
:
"#operatorTpl"
}
]],
url
:
'/admin/coin/platform-coin'
});
//图片上传
var
uploader
=
layui
.
upload
;
$_csrf
=
$
(
"input[name='_csrf']"
).
val
();
uploader
.
render
({
elem
:
"#upload1"
,
url
:
'/admin/image/upload'
,
data
:{
_csrf
:
$_csrf
,
image_type
:
7
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='image']"
).
val
(
res
.
data
.
image_src
);
$
(
"#image1"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
var
form
=
layui
.
form
;
form
.
render
();
table
.
on
(
'tool(table1)'
,
function
(
obj
)
{
var
event
=
obj
.
event
;
var
data
=
obj
.
data
;
if
(
event
===
'edit'
)
{
var
index
=
layer
.
open
({
title
:
'编辑应用分类'
,
area
:
'500px'
,
type
:
1
,
content
:
$
(
"#_form"
),
btn
:
[
'保存'
,
'取消'
],
success
:
function
()
{
form
.
val
(
"form1"
,
{
platform
:
data
.
platform
,
image
:
data
.
icon
});
$
(
"#image1"
).
attr
(
'src'
,
data
.
icon
);
},
btn1
:
function
()
{
$
.
post
(
'/admin/coin/add-platform-coin'
,
$
(
"#form1"
).
serialize
(),
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
layer
.
close
(
index
);
$
(
"#_form"
).
css
(
'display'
,
'none'
);
table
.
reload
(
'table1'
);
}
clearForm
();
});
},
btn2
:
function
()
{
layer
.
close
(
index
);
$
(
"#_form"
).
css
(
'display'
,
'none'
);
clearForm
();
},
cancel
:
function
()
{
layer
.
close
(
index
);
$
(
"#_form"
).
css
(
'display'
,
'none'
);
clearForm
();
}
});
}
});
function
clearForm
(){
form
.
val
(
"form1"
,
{
image
:
''
,
platform
:
''
});
$
(
"#image1"
).
attr
(
'src'
,
''
);
}
</script>
<script
type=
"text/html"
id=
"operatorTpl"
>
<
button
class
=
"layui-btn layui-btn-xs"
lay
-
event
=
"edit"
>
编辑币种图片
<
/button>
</script>
<script
type=
"text/html"
id=
"iconTpl"
>
<
a
href
=
"{{d.icon}}"
target
=
"_blank"
><
img
src
=
"{{d.icon}}"
style
=
"max-width: 32px; max-height: 32px;"
/><
/a>
</script>
\ 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