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
46d148d8
Commit
46d148d8
authored
Nov 09, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加H5icon
parent
d6adb350
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
184 additions
and
7 deletions
+184
-7
ApplicationController.php
backend/controllers/ApplicationController.php
+34
-3
UploadForm.php
backend/models/UploadForm.php
+4
-1
CoinApplicationForm.php
backend/models/coin/CoinApplicationForm.php
+8
-2
add.php
backend/views/application/add.php
+66
-0
edit.php
backend/views/application/edit.php
+67
-0
CoinImage.php
common/models/psources/CoinImage.php
+5
-1
No files found.
backend/controllers/ApplicationController.php
View file @
46d148d8
...
...
@@ -50,7 +50,7 @@ class ApplicationController extends BaseController
if
(
Yii
::
$app
->
request
->
isPost
){
Yii
::
$app
->
response
->
format
=
'json'
;
$category_id
=
Yii
::
$app
->
request
->
get
(
'category_id'
);
$fields
=
[
'category_id'
,
'name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
];
$fields
=
[
'category_id'
,
'
h5_icon'
,
'official_url'
,
'introduce_image'
,
'
name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
];
$params
=
array_merge
(
Yii
::
$app
->
request
->
post
(),[
'category_id'
=>
$category_id
]);
$params
=
$this
->
initParams
(
$params
,
$fields
);
$coin_applicateion_form
=
new
CoinApplicationForm
();
...
...
@@ -70,7 +70,7 @@ class ApplicationController extends BaseController
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$fields
=
[
'category_id'
,
'id'
,
'name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
];
$fields
=
[
'category_id'
,
'id'
,
'
h5_icon'
,
'official_url'
,
'introduce_image'
,
'
name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
];
$params
=
$this
->
initParams
(
Yii
::
$app
->
request
->
post
(),
$fields
);
$coin_applicateion_form
=
new
CoinApplicationForm
();
$coin_applicateion_form
->
setScenario
(
CoinApplicationForm
::
SCENARIO_EDIT
);
...
...
@@ -81,13 +81,44 @@ class ApplicationController extends BaseController
$category_id
=
Yii
::
$app
->
request
->
get
(
'category_id'
,
null
);
if
(
$id
)
{
$applicate
=
CoinApplication
::
getApplicateById
(
$id
);
$coin_ids
=
[];
if
(
$applicate
[
'icon'
]){
$coin_ids
[]
=
$applicate
[
'icon'
];
}
if
(
$applicate
[
'h5_icon'
]){
$coin_ids
[]
=
$applicate
[
'h5_icon'
];
}
if
(
$applicate
[
'introduce_image'
]){
$coin_ids
[]
=
$applicate
[
'introduce_image'
];
}
if
(
$coin_ids
){
$coin_items
=
CoinImage
::
getItemsByIds
(
$coin_ids
);
}
$app_cate
=
CoinAppCate
::
getAppCate
(
$category_id
,
$id
);
if
(
$applicate
[
'icon'
]){
$icon_info
=
CoinImage
::
getItemById
(
$applicate
[
'icon'
]);
$icon_info
=
$coin_items
[
$applicate
[
'icon'
]];
$applicate
[
'icon_url'
]
=
$icon_info
[
'base_url'
]
.
$icon_info
[
'file_url'
];
}
else
{
$applicate
[
'icon_url'
]
=
""
;
}
if
(
$applicate
[
'icon'
]){
$icon_info
=
$coin_items
[
$applicate
[
'icon'
]];
$applicate
[
'icon_url'
]
=
$icon_info
[
'base_url'
]
.
$icon_info
[
'file_url'
];
}
else
{
$applicate
[
'icon_url'
]
=
""
;
}
if
(
$applicate
[
'h5_icon'
]){
$icon_info
=
$coin_items
[
$applicate
[
'h5_icon'
]];
$applicate
[
'h5_icon_url'
]
=
$icon_info
[
'base_url'
]
.
$icon_info
[
'file_url'
];
}
else
{
$applicate
[
'h5_icon_url'
]
=
""
;
}
if
(
$applicate
[
'introduce_image'
]){
$icon_info
=
$coin_items
[
$applicate
[
'introduce_image'
]];
$applicate
[
'introduce_image_url'
]
=
$icon_info
[
'base_url'
]
.
$icon_info
[
'file_url'
];
}
else
{
$applicate
[
'introduce_image_url'
]
=
""
;
}
$applicate
[
'sort'
]
=
$app_cate
->
sort
;
$this
->
layout
=
false
;
return
$this
->
render
(
'edit'
,
[
'item'
=>
$applicate
,
'category_id'
=>
$category_id
]);
...
...
backend/models/UploadForm.php
View file @
46d148d8
...
...
@@ -18,7 +18,10 @@ class UploadForm extends BaseForm
const
IMAGE_SAVE_DIR
=
[
1
=>
"/coin/"
,
//存放logo
2
=>
"/banner/"
,
//存放banner
3
=>
"/application/"
//存放应用详情图片
3
=>
"/application/"
,
//存放应用详情图片,
4
=>
"/h5_icon/"
,
//存放h5_logo ,
5
=>
"/h5_banner/"
,
//存放h5_banner,
6
=>
"/h5_application/"
//存放h5_application
];
...
...
backend/models/coin/CoinApplicationForm.php
View file @
46d148d8
...
...
@@ -21,6 +21,9 @@ class CoinApplicationForm extends BaseForm
public
$category_id
;
public
$name
;
public
$icon
;
public
$h5_icon
;
public
$official_url
;
public
$introduce_image
;
public
$sort
;
public
$type
;
public
$native_url
;
...
...
@@ -37,8 +40,8 @@ class CoinApplicationForm extends BaseForm
public
function
scenarios
()
{
return
[
self
::
SCENARIO_ADD
=>
[
'category_id'
,
'name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
],
self
::
SCENARIO_EDIT
=>
[
'category_id'
,
'id'
,
'name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
],
self
::
SCENARIO_ADD
=>
[
'category_id'
,
'name'
,
'
h5_icon'
,
'official_url'
,
'introduce_image'
,
'
sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
],
self
::
SCENARIO_EDIT
=>
[
'category_id'
,
'id'
,
'
h5_icon'
,
'official_url'
,
'introduce_image'
,
'
name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
],
];
}
...
...
@@ -50,6 +53,9 @@ class CoinApplicationForm extends BaseForm
'category_id'
=>
'分类ID'
,
'name'
=>
'名称'
,
'icon'
=>
'图标'
,
'h5_icon'
=>
'h5图标'
,
'official_url'
=>
'官方链接'
,
'introduce_image'
=>
'介绍图'
,
'sort'
=>
'排序'
,
'type'
=>
'类型'
,
'native_url'
=>
'原生链接'
,
...
...
backend/views/application/add.php
View file @
46d148d8
...
...
@@ -26,6 +26,21 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
H5图标
</label>
<div
class=
"layui-input-block"
>
<img
src=
""
style=
"margin-top: 11px; max-width: 32px; max-height: 32px"
id=
"icon2"
>
</div>
<input
type=
"hidden"
name=
"h5_icon"
value=
""
>
</div>
<div
class=
"layui-inline"
style=
"margin-left: 50px;"
>
<button
type=
"button"
class=
"layui-btn"
id=
"upload2"
style=
""
>
<i
class=
"layui-icon"
>

</i>
上传新图片
</button>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
应用名称
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name"
value=
""
lay-verify=
"required"
>
...
...
@@ -53,6 +68,12 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
官方链接
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"official_url"
value=
""
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
原生登录链接
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"native_login_url"
value=
""
>
...
...
@@ -83,6 +104,21 @@
</div>
</div>
<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=
"icon3"
>
</div>
<input
type=
"hidden"
name=
"introduce_image"
value=
""
>
</div>
<div
class=
"layui-inline"
style=
"margin-left: 50px;"
>
<button
type=
"button"
class=
"layui-btn"
id=
"upload3"
style=
""
>
<i
class=
"layui-icon"
>

</i>
上传新图片
</button>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
宣传语
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
class=
"layui-input"
name=
"advertise"
value=
""
>
...
...
@@ -135,4 +171,33 @@
}
});
uploader
.
render
({
elem
:
"#upload2"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
,
image_type
:
4
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='h5_icon']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon2"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
uploader
.
render
({
elem
:
"#upload3"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
,
image_type
:
4
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='introduce_image']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon3"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
</script>
\ No newline at end of file
backend/views/application/edit.php
View file @
46d148d8
...
...
@@ -28,6 +28,21 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
H5图标
</label>
<div
class=
"layui-input-block"
>
<img
src=
"
<?=
$item
[
'h5_icon_url'
]
?>
"
style=
"margin-top: 11px; max-width: 32px; max-height: 32px"
id=
"icon2"
>
</div>
<input
type=
"hidden"
name=
"h5_icon"
value=
"
<?=
$item
[
'h5_icon'
]
?>
"
>
</div>
<div
class=
"layui-inline"
style=
"margin-left: 50px;"
>
<button
type=
"button"
class=
"layui-btn"
id=
"upload2"
style=
""
>
<i
class=
"layui-icon"
>

</i>
上传新图片
</button>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
应用名称
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name"
value=
"
<?=
$item
[
'name'
]
?>
"
lay-verify=
"required"
>
...
...
@@ -55,6 +70,12 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
官方链接
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"official_url"
value=
"
<?=
$item
[
'official_url'
]
?>
"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
原生登录链接
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"native_login_url"
value=
"
<?=
$item
[
'native_login_url'
]
?>
"
>
...
...
@@ -85,6 +106,21 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
介绍图
</label>
<div
class=
"layui-input-block"
>
<img
src=
"
<?=
$item
[
'introduce_image_url'
]
?>
"
style=
"margin-top: 11px; max-width: 32px; max-height: 32px"
id=
"icon3"
>
</div>
<input
type=
"hidden"
name=
"introduce_image"
value=
"
<?=
$item
[
'introduce_image'
]
?>
"
>
</div>
<div
class=
"layui-inline"
style=
"margin-left: 50px;"
>
<button
type=
"button"
class=
"layui-btn"
id=
"upload3"
style=
""
>
<i
class=
"layui-icon"
>

</i>
上传新图片
</button>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
宣传语
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
class=
"layui-input"
name=
"advertise"
value=
"
<?=
$item
[
'advertise'
]
?>
"
>
...
...
@@ -131,4 +167,34 @@
}
});
uploader
.
render
({
elem
:
"#upload2"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
,
image_type
:
4
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='h5_icon']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon2"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
uploader
.
render
({
elem
:
"#upload3"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
,
image_type
:
4
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='introduce_image']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon3"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
</script>
\ No newline at end of file
common/models/psources/CoinImage.php
View file @
46d148d8
...
...
@@ -40,8 +40,12 @@ class CoinImage extends BaseActiveRecord
public
static
function
getItemsByImageIds
(
$image_ids
)
{
if
(
$image_ids
){
if
(
$image_ids
)
{
if
(
is_array
(
$image_ids
)){
$idItems
=
$image_ids
;
}
else
{
$idItems
=
explode
(
','
,
$image_ids
);
}
$data
=
self
::
find
()
->
where
([
'in'
,
'id'
,
$idItems
])
->
asArray
()
->
all
();
foreach
(
$data
as
&
$value
){
$value
[
'image_url'
]
=
$value
[
'base_url'
]
.
$value
[
'file_url'
];
...
...
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