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
761b431b
Commit
761b431b
authored
Jul 15, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多语言信息
parent
df7d1dd5
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
354 additions
and
538 deletions
+354
-538
ApplicationCategoryController.php
backend/controllers/ApplicationCategoryController.php
+118
-54
ApplicationController.php
backend/controllers/ApplicationController.php
+4
-0
add.php
backend/views/application-category/add.php
+131
-0
banner-index.php
backend/views/application-category/banner-index.php
+1
-1
edit.php
backend/views/application-category/edit.php
+32
-16
index.php
backend/views/application-category/index.php
+29
-356
index_v.php
backend/views/application-category/index_v.php
+0
-69
list.php
backend/views/application/list.php
+4
-7
index.js
backend/web/js/application-category/index.js
+30
-35
CoinApplicationCategory.php
common/models/psources/CoinApplicationCategory.php
+5
-0
No files found.
backend/controllers/ApplicationCategoryController.php
View file @
761b431b
...
...
@@ -11,6 +11,7 @@ namespace backend\controllers;
use
backend\models\coin\CoinApplicationCategoryForm
;
use
common\models\psources\CoinApplicationCategory
;
use
common\models\psources\CoinBanner
;
use
common\models\psources\CoinImage
;
use
Yii
;
...
...
@@ -27,19 +28,22 @@ class ApplicationCategoryController extends BaseController
if
(
Yii
::
$app
->
request
->
isAjax
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
get
(
'page'
,
1
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$name
=
$request
->
get
(
'category_name'
,
''
);
$page
=
$request
->
get
(
'page'
,
1
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$name
=
$request
->
get
(
'category_name'
,
''
);
$where
=
[];
if
(
1
!==
$user_platform_id
)
{
if
(
1
!==
$user_platform_id
)
{
$where
[]
=
[
'platform_id'
=>
$user_platform_id
];
}
if
(
$name
)
{
if
(
$name
)
{
$where
[]
=
[
'name'
=>
$name
];
}
$data
=
CoinApplicationCategory
::
getList
(
$page
,
$limit
,
$where
);
foreach
(
$data
[
'data'
]
as
$key
=>
&
$val
){
$data
=
CoinApplicationCategory
::
getList
(
$page
,
$limit
,
$where
);
foreach
(
$data
[
'data'
]
as
&
$val
)
{
$val
[
'name'
]
=
str_replace
(
'en-US'
,
'en'
,
$val
[
'name'
]);
$val
[
'name'
]
=
str_replace
(
'zh-CN'
,
'zh'
,
$val
[
'name'
]);
}
foreach
(
$data
[
'data'
]
as
$key
=>
&
$val
)
{
$val
[
'coin_name'
]
=
isset
(
$val
[
'platform'
][
'name'
])
?
$val
[
'platform'
][
'name'
]
:
''
;
}
...
...
@@ -55,34 +59,94 @@ class ApplicationCategoryController extends BaseController
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$fields
=
[
'id'
,
'name'
,
'sort'
,
'icon'
,
'banner'
,
'banner_url'
];
$fields
=
[
'id'
,
'name'
,
'sort'
,
'icon'
,
'banner'
,
'banner_url'
];
$params
=
$this
->
initParams
(
Yii
::
$app
->
request
->
post
(),
$fields
);
$application_category
=
new
CoinApplicationCategoryForm
();
if
(
$params
[
'id'
])
{
//edit
if
(
$params
[
'id'
])
{
//edit
$category
=
CoinApplicationCategory
::
getCategoryById
(
$params
[
'id'
]);
$params
[
'platform_id'
]
=
$category
->
platform_id
;
$application_category
->
setScenario
(
CoinApplicationCategoryForm
::
SCENARIO_EDIT
);
$application_category
->
load
(
$params
,
''
);
$application_category
->
load
(
$params
,
''
);
return
$application_category
->
edit
();
}
else
{
}
else
{
$params
[
'platform_id'
]
=
Yii
::
$app
->
user
->
identity
->
platform_id
;
$application_category
->
setScenario
(
CoinApplicationCategoryForm
::
SCENARIO_ADD
);
$application_category
->
load
(
$params
,
''
);
$application_category
->
load
(
$params
,
''
);
return
$application_category
->
add
();
}
}
}
public
function
actionAdd
()
{
$model
=
new
CoinApplicationCategoryForm
();
$model
->
setScenario
(
CoinApplicationCategoryForm
::
SCENARIO_ADD
);
if
(
Yii
::
$app
->
request
->
isPost
)
{
$fields
=
[
'id'
,
'name'
,
'sort'
,
'icon'
,
'banner'
,
'banner_url'
];
$params
=
$this
->
initParams
(
Yii
::
$app
->
request
->
post
(),
$fields
);
$params
[
'platform_id'
]
=
Yii
::
$app
->
user
->
identity
->
platform_id
;
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
];
$name_arr
=
$params
[
'name'
];
$name
=
[];
foreach
(
$name_arr
as
$key
=>
$val
)
{
$name
[
$lang
[
$key
]]
=
$val
;
}
unset
(
$params
[
'name'
]);
$params
[
'name'
]
=
$name
;
$model
->
load
(
$params
,
''
);
$result
=
$model
->
add
();
if
(
0
===
$result
[
'code'
])
{
$this
->
success
(
'添加成功'
,
'/admin/application-category/index'
);
}
}
return
$this
->
render
(
'add'
,
[
'model'
=>
$model
]);
}
public
function
actionEdit
()
{
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
null
);
if
(
$id
)
{
$coin
=
CoinApplicationCategory
::
getCategoryById
(
$id
);
$this
->
layout
=
false
;
return
$this
->
render
(
'edit'
,
[
'model'
=>
$coin
]);
if
(
Yii
::
$app
->
request
->
isPost
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$fields
=
[
'id'
,
'name'
,
'sort'
,
'icon'
,
'banner'
,
'banner_url'
];
$params
=
$this
->
initParams
(
Yii
::
$app
->
request
->
post
(),
$fields
);
$application_category
=
new
CoinApplicationCategoryForm
();
$category
=
CoinApplicationCategory
::
getCategoryById
(
$params
[
'id'
]);
$params
[
'platform_id'
]
=
$category
->
platform_id
;
$application_category
->
setScenario
(
CoinApplicationCategoryForm
::
SCENARIO_EDIT
);
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
];
$name_arr
=
$params
[
'name'
];
$name
=
[];
foreach
(
$name_arr
as
$key
=>
$val
)
{
$name
[
$lang
[
$key
]]
=
$val
;
}
unset
(
$params
[
'name'
]);
$params
[
'name'
]
=
$name
;
$application_category
->
load
(
$params
,
''
);
return
$application_category
->
edit
();
}
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
null
);
$coin
=
CoinApplicationCategory
::
getAppCategory
(
$id
);
$icon_model
=
CoinImage
::
findOne
(
$coin
[
'icon'
]);
$banner_model
=
CoinImage
::
findOne
(
$coin
[
'banner'
]);
$coin
[
'icon_url'
]
=
empty
(
$icon_model
)
?
''
:
$icon_model
->
base_url
.
$icon_model
->
file_url
;
$coin
[
'banner_image_url'
]
=
empty
(
$banner_model
)
?
''
:
$banner_model
->
base_url
.
$banner_model
->
file_url
;
$name_arr
=
json_decode
(
$coin
[
'name'
],
true
);
$coin
[
'name_ja'
]
=
isset
(
$name_arr
[
'ja'
])
?
$name_arr
[
'ja'
]
:
''
;
$coin
[
'name_zh'
]
=
isset
(
$name_arr
[
'zh-CN'
])
?
$name_arr
[
'zh-CN'
]
:
''
;
$coin
[
'name_en'
]
=
isset
(
$name_arr
[
'en-US'
])
?
$name_arr
[
'en-US'
]
:
''
;
$this
->
layout
=
false
;
return
$this
->
render
(
'edit'
,
[
'model'
=>
$coin
]);
}
/**
...
...
@@ -112,18 +176,18 @@ class ApplicationCategoryController extends BaseController
if
(
Yii
::
$app
->
request
->
isAjax
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
get
(
'id'
,
''
);
$sort
=
$request
->
get
(
'sort'
,
1
);
if
(
$id
)
{
$id
=
$request
->
get
(
'id'
,
''
);
$sort
=
$request
->
get
(
'sort'
,
1
);
if
(
$id
)
{
$category
=
CoinApplicationCategory
::
getCategoryById
(
$id
);
if
(
!
$category
)
{
return
[
'code'
=>
1
,
'msg'
=>
'分类不存在,不能设置排序'
];
if
(
!
$category
)
{
return
[
'code'
=>
1
,
'msg'
=>
'分类不存在,不能设置排序'
];
}
$category
->
sort
=
$sort
;
$category
->
sort
=
$sort
;
$category
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'分类排序设置成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'分类排序设置失败'
];
return
[
'code'
=>
0
,
'msg'
=>
'分类排序设置成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'分类排序设置失败'
];
}
}
}
...
...
@@ -134,26 +198,26 @@ class ApplicationCategoryController extends BaseController
*/
public
function
actionBannerIndex
()
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
$id
=
Yii
::
$app
->
request
->
get
(
'id'
);
Yii
::
$app
->
response
->
format
=
'json'
;
$applicate_category
=
CoinApplicationCategory
::
getCategoryById
(
$id
);
if
(
$applicate_category
)
{
if
(
$applicate_category
)
{
$data
=
CoinBanner
::
getBannerInfoByIds
(
$applicate_category
->
h5_banner
);
}
else
{
$data
=
[
'code'
=>
0
,
'data'
=>
[]];
}
else
{
$data
=
[
'code'
=>
0
,
'data'
=>
[]];
}
return
$data
;
}
else
{
}
else
{
$id
=
Yii
::
$app
->
request
->
get
(
'id'
);
if
(
$id
)
{
if
(
$id
)
{
$applicate_category
=
CoinApplicationCategory
::
getCategoryById
(
$id
);
if
(
$applicate_category
)
{
return
$this
->
render
(
'banner-index'
,[
'applicate_category'
=>
$applicate_category
]);
}
else
{
if
(
$applicate_category
)
{
return
$this
->
render
(
'banner-index'
,
[
'applicate_category'
=>
$applicate_category
]);
}
else
{
$this
->
error
(
'id参数不合法'
,
Yii
::
$app
->
request
->
getReferrer
());
}
}
else
{
}
else
{
$this
->
error
(
'id参数不能为空'
,
Yii
::
$app
->
request
->
getReferrer
());
}
}
...
...
@@ -165,16 +229,16 @@ class ApplicationCategoryController extends BaseController
*/
public
function
actionAddBanner
()
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$id
=
Yii
::
$app
->
request
->
post
(
'applicate_category_id'
,
0
);
$image_id
=
Yii
::
$app
->
request
->
post
(
'image'
,
0
);
$banner_url
=
Yii
::
$app
->
request
->
post
(
'banner_url'
,
0
);
if
(
$id
&&
$image_id
)
{
$id
=
Yii
::
$app
->
request
->
post
(
'applicate_category_id'
,
0
);
$image_id
=
Yii
::
$app
->
request
->
post
(
'image'
,
0
);
$banner_url
=
Yii
::
$app
->
request
->
post
(
'banner_url'
,
0
);
if
(
$id
&&
$image_id
)
{
$coin_applicate_category_form
=
new
CoinApplicationCategoryForm
();
return
$coin_applicate_category_form
->
addBanner
(
$id
,
$image_id
,
$banner_url
);
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'banner添加失败'
];
return
$coin_applicate_category_form
->
addBanner
(
$id
,
$image_id
,
$banner_url
);
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'banner添加失败'
];
}
}
}
...
...
@@ -190,7 +254,7 @@ class ApplicationCategoryController extends BaseController
$applicate_category_id
=
Yii
::
$app
->
request
->
get
(
'applicate_category_id'
);
if
(
$id
&&
$applicate_category_id
)
{
$coin_applicateion_category_form
=
new
CoinApplicationCategoryForm
();
return
$coin_applicateion_category_form
->
delBanner
(
$id
,
$applicate_category_id
);
return
$coin_applicateion_category_form
->
delBanner
(
$id
,
$applicate_category_id
);
}
return
[
'code'
=>
1
,
'msg'
=>
'failed'
];
}
...
...
@@ -204,18 +268,18 @@ class ApplicationCategoryController extends BaseController
if
(
Yii
::
$app
->
request
->
isAjax
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
get
(
'id'
,
''
);
$enable
=
$request
->
get
(
'enable'
,
1
);
if
(
$id
)
{
$id
=
$request
->
get
(
'id'
,
''
);
$enable
=
$request
->
get
(
'enable'
,
1
);
if
(
$id
)
{
$category
=
CoinApplicationCategory
::
getCategoryById
(
$id
);
if
(
!
$category
)
{
return
[
'code'
=>
1
,
'msg'
=>
'分类不存在,不能设置启用状态'
];
if
(
!
$category
)
{
return
[
'code'
=>
1
,
'msg'
=>
'分类不存在,不能设置启用状态'
];
}
$category
->
enable
=
$enable
;
$category
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'分类使用状态设置成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'分类使用状态设置失败'
];
return
[
'code'
=>
0
,
'msg'
=>
'分类使用状态设置成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'分类使用状态设置失败'
];
}
}
}
...
...
backend/controllers/ApplicationController.php
View file @
761b431b
...
...
@@ -30,6 +30,10 @@ class ApplicationController extends BaseController
$page
=
$request
->
get
(
'page'
,
1
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$data
=
CoinApplication
::
getListByCategory
(
$page
,
$limit
,
$id
);
foreach
(
$data
[
'data'
]
as
&
$val
){
$val
[
'name'
]
=
str_replace
(
'en-US'
,
'en'
,
$val
[
'name'
]);
$val
[
'name'
]
=
str_replace
(
'zh-CN'
,
'zh'
,
$val
[
'name'
]);
}
return
$data
;
}
else
{
$id
=
Yii
::
$app
->
request
->
get
(
'id'
);
...
...
backend/views/application-category/add.php
0 → 100644
View file @
761b431b
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 下午6:23
*/
?>
<h4>
添加应用分类
</h4>
<style>
.layui-form-label
{
width
:
100px
;
}
</style>
<div
class=
"layui-row"
style=
"padding: 5px;"
>
<div
class=
"layui-col-md12"
>
<form
class=
"layui-form"
method=
"post"
action=
""
id=
"application-category-edit"
>
<input
name=
"_csrf"
type=
"hidden"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<input
name=
"id"
type=
"hidden"
value=
""
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[]"
required
lay-verify=
"required"
placeholder=
""
autocomplete=
"off"
value=
""
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
英文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[]"
value=
""
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
日文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[]"
value=
""
>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
排序
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
type=
"text"
name=
"sort"
required
lay-verify=
"required"
placeholder=
""
autocomplete=
"off"
value=
""
class=
"layui-input"
>
</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=
"icon1"
>
</div>
<input
type=
"hidden"
name=
"icon"
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>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
banner
</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=
"banner"
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"
>
banner链接
</label>
<div
class=
"layui-input-block"
style=
"width: 500px"
>
<input
type=
"text"
name=
"banner_url"
required
lay-verify=
"required"
placeholder=
""
autocomplete=
"off"
class=
"layui-input"
value=
""
>
</div>
</div>
<div
class=
"layui-form-item"
>
<button
class=
"layui-btn"
>
提交
</button>
</div>
</form>
</div>
</div>
<script>
var
laydate
=
layui
.
laydate
;
laydate
.
render
({
elem
:
"#time1"
});
//图片上传
var
uploader
=
layui
.
upload
;
$_csrf
=
$
(
"input[name='_csrf']"
).
val
();
uploader
.
render
({
elem
:
"#upload1"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='icon']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon1"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
uploader
.
render
({
elem
:
"#upload2"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
,
image_type
:
2
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='banner']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon2"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
//form render
var
form
=
layui
.
form
;
form
.
render
();
</script>
backend/views/application-category/banner-index.php
View file @
761b431b
...
...
@@ -11,7 +11,7 @@
width
:
100px
;
}
</style>
<h4>
所属分类---
<?=
$applicate_category
->
name
?>
</h4>
<h4>
所属分类---
<?=
$applicate_category
->
name
[
"zh-CN"
]
?>
</h4>
<div
class=
"layui-row"
style=
"padding: 5px;"
>
<div
class=
"layui-tab layui-tab-card"
>
<ul
class=
"layui-tab-title"
>
...
...
backend/views/application-category/edit.php
View file @
761b431b
...
...
@@ -14,33 +14,33 @@
</style>
<div
class=
"layui-row"
style=
"padding: 5px;"
>
<div
class=
"layui-col-md12"
>
<form
class=
"layui-form"
method=
"post"
action=
""
id=
"
coinE
dit"
>
<form
class=
"layui-form"
method=
"post"
action=
""
id=
"
application-category-e
dit"
>
<input
name=
"_csrf"
type=
"hidden"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<input
name=
"id"
type=
"hidden"
value=
"
<?=
$model
->
id
?>
"
>
<input
name=
"id"
type=
"hidden"
value=
"
<?=
$model
[
'id'
]
?>
"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name
_json[]"
value=
"
<?=
$model
->
name_json
[
'zh-CN
'
]
?>
"
>
<input
class=
"layui-input"
name=
"name
[]"
value=
"
<?=
$model
[
'name_zh
'
]
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
英文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name
_json[]"
value=
"
<?=
$model
->
name_json
[
'en-US
'
]
?>
"
>
<input
class=
"layui-input"
name=
"name
[]"
value=
"
<?=
$model
[
'name_en
'
]
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
日文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name
_json[]"
value=
"
<?=
$model
->
name_json
[
'
ja'
]
?>
"
>
<input
class=
"layui-input"
name=
"name
[]"
value=
"
<?=
$model
[
'name_
ja'
]
?>
"
>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
排序
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
type=
"text"
name=
"sort"
required
lay-verify=
"required"
placeholder=
""
autocomplete=
"off"
autocomplete=
"off"
value=
"
<?=
$model
[
'sort'
]
?>
"
class=
"layui-input"
>
</div>
</div>
...
...
@@ -48,10 +48,10 @@
<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"
<img
src=
"
<?=
$model
[
'icon_url'
]
?>
"
style=
"margin-top: 11px; max-width: 32px; max-height: 32px"
id=
"icon1"
>
</div>
<input
type=
"hidden"
name=
"icon"
value=
""
>
<input
type=
"hidden"
name=
"icon"
value=
"
<?=
$model
[
'icon'
]
?>
"
>
</div>
<div
class=
"layui-inline"
style=
"margin-left: 50px;"
>
<button
type=
"button"
class=
"layui-btn"
id=
"upload1"
style=
""
>
...
...
@@ -63,9 +63,9 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
banner
</label>
<div
class=
"layui-input-block"
>
<img
src=
"
<?=
$model
->
banner_image_url
?>
"
style=
"margin-top: 11px; max-width: 32px; max-height: 32px"
id=
"icon2"
>
<img
src=
"
<?=
$model
[
'banner_image_url'
]
?>
"
style=
"margin-top: 11px; max-width: 32px; max-height: 32px"
id=
"icon2"
>
</div>
<input
type=
"hidden"
name=
"banner"
value=
""
>
<input
type=
"hidden"
name=
"banner"
value=
"
<?=
$model
[
'banner'
]
?>
"
>
</div>
<div
class=
"layui-inline"
style=
"margin-left: 50px;"
>
<button
type=
"button"
class=
"layui-btn"
id=
"upload2"
style=
""
>
...
...
@@ -77,7 +77,7 @@
<label
class=
"layui-form-label"
>
banner链接
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"banner_url"
required
lay-verify=
"required"
placeholder=
""
autocomplete=
"off"
class=
"layui-input"
value=
"
<?=
$model
->
banner_url
?>
"
>
autocomplete=
"off"
class=
"layui-input"
value=
"
<?=
$model
[
'banner_url'
]
?>
"
>
</div>
</div>
</form>
...
...
@@ -93,12 +93,28 @@
$_csrf
=
$
(
"input[name='_csrf']"
).
val
();
uploader
.
render
({
elem
:
"#upload1"
,
url
:
'/admin/
coin
/upload'
,
url
:
'/admin/
image
/upload'
,
data
:
{
_csrf
:
$_csrf
},
done
:
function
(
res
)
{
console
.
log
(
res
.
data
.
src
);
$
(
"input[name='icon']"
).
val
(
res
.
data
.
src
);
$
(
"#icon1"
).
attr
(
'src'
,
res
.
data
.
src
);
if
(
res
.
code
==
0
){
$
(
"input[name='icon']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon1"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
uploader
.
render
({
elem
:
"#upload2"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
,
image_type
:
2
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='banner']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon2"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
...
...
backend/views/application-category/index.php
View file @
761b431b
<?php
/**
* Created by PhpStorm.
* User:
ZCY
* Date:
2018/10/1
1
* Time:
17:41
* User:
rlgyzhcn
* Date:
18-5-3
1
* Time:
上午9:59
*/
?>
use
backend\assets\applicationCategory\IndexAsset
;
IndexAsset
::
register
(
$this
);
?>
<style>
.layui-table-tips-c
{
padding
:
0px
;
}
</style>
<h4>
应用分类列表
</h4>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md1"
>
<a
href=
"/admin/application-category/add"
>
<button
class=
"layui-btn layui-btn-default"
id=
"add"
>
添加应用分类
</button>
</div>
<div
class=
"layui-col-md8"
>
<form
class=
"layui-form"
method=
"get"
action=
""
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
style=
"margin-bottom: 0; width: 120px;"
>
应用分类名称
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
name=
"category_name"
>
</div>
</div>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"search"
>
搜索
</button>
</div>
</form>
</a>
</div>
</div>
<div
class=
"layui-
col-md10
"
>
<div
class=
"layui-
row
"
>
<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-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=
"id"
value=
""
>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
名称
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"name"
required
lay-verify=
"required"
placeholder=
""
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
排序
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"sort"
required
lay-verify=
"required"
placeholder=
""
autocomplete=
"off"
class=
"layui-input"
>
</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=
"icon1"
>
</div>
<input
type=
"hidden"
name=
"icon"
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>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
banner
</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=
"banner"
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"
>
banner链接
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"banner_url"
required
lay-verify=
"required"
placeholder=
""
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
</form>
</div>
</div>
<script
type=
"text/html"
id=
"iconTpl"
>
<
img
src
=
"{{d.icon_url}}"
style
=
"max-width: 32px; max-height: 32px;"
/>
</script>
<script
type=
"text/html"
id=
"bannerTpl"
>
{{
#
if
(
d
.
banner
>
0
){
}}
有
{{
#
}
else
{
}}
无
{{
#
}
}}
</script>
<!--<script type="text/html" id="operationTpl">-->
<!-- <a lay-event="edit">-->
<!-- <button class="layui-btn layui-btn-sm"><i class="layui-icon"></i></button>-->
<!-- </a>-->
<!-- <a lay-event="delete">-->
<!-- <button class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon"></i></button>-->
<!-- </a>-->
<!--</script>-->
<script
type=
"text/html"
id=
"operationTpl"
>
<
a
class
=
"layui-btn layui-btn-xs"
lay
-
event
=
"edit"
>
编辑
<
/a>
<
a
class
=
"layui-btn layui-btn-danger layui-btn-xs"
lay
-
event
=
"del"
>
删除
<
/a>
<
a
class
=
"layui-btn layui-btn-primary layui-btn-xs"
href
=
"/admin/application/list?id={{d.id}}"
>
应用列表
<
/a>
<
a
class
=
"layui-btn layui-btn-normal layui-btn-xs"
href
=
"/admin/application-category/banner-index?id={{d.id}}"
>
banner
图管理
<
/a>
<
a
class
=
"layui-btn layui-btn-xs"
lay
-
event
=
"edit"
>
编辑
<
/a>
<
a
class
=
"layui-btn layui-btn-danger layui-btn-xs"
lay
-
event
=
"del"
>
删除
<
/a>
<
a
class
=
"layui-btn layui-btn-primary layui-btn-xs"
href
=
"/admin/application/list?id={{d.id}}"
>
应用列表
<
/a>
<
a
class
=
"layui-btn layui-btn-normal layui-btn-xs"
href
=
"/admin/application-category/banner-index?id={{d.id}}"
>
banner
图管理
<
/a>
</script>
<script
type=
"text/html"
id=
"recommendTpl"
>
<
input
type
=
"checkbox"
name
=
"isrecommend"
value
=
"{{d.id}}"
lay
-
skin
=
"switch"
lay
-
text
=
"是|否"
lay
-
filter
=
"recommendDemo"
{{
d
.
isrecommend
==
1
?
'checked'
:
''
}}
>
...
...
@@ -115,268 +53,4 @@
<script
type=
"text/html"
id=
"enableTpl"
>
<
input
type
=
"checkbox"
name
=
"isenable"
value
=
"{{d.id}}"
lay
-
skin
=
"switch"
lay
-
text
=
"启用|禁用"
lay
-
filter
=
"enableDemo"
{{
d
.
enable
==
1
?
'checked'
:
''
}}
>
</script>
<script
type=
"text/javascript"
>
var
table
=
layui
.
table
;
table
.
render
({
elem
:
'#table1'
,
page
:
true
,
limit
:
10
,
skin
:
'row'
,
url
:
'/admin/application-category/index'
,
cols
:
[[
{
field
:
'id'
,
title
:
'ID'
},
{
field
:
'name'
,
title
:
'名称'
,
},
{
field
:
'coin_name'
,
title
:
'钱包'
,
},
{
field
:
'app_count'
,
title
:
'应用'
,
},
{
field
:
'icon_url'
,
title
:
'图标'
,
templet
:
'#iconTpl'
},
{
field
:
'sort'
,
title
:
'排序'
,
edit
:
'text'
},
{
field
:
'banner'
,
title
:
'banner'
,
templet
:
'#bannerTpl'
},
{
title
:
'操作'
,
templet
:
'#operationTpl'
,
width
:
300
},
{
title
:
'首页推荐'
,
field
:
'isrecommend'
,
templet
:
'#recommendTpl'
,
width
:
100
},
{
title
:
'状态'
,
field
:
'enable'
,
templet
:
'#enableTpl'
,
width
:
100
},
]],
});
var
form
=
layui
.
form
;
form
.
render
();
table
.
on
(
'tool(table1)'
,
function
(
obj
)
{
var
event
=
obj
.
event
;
var
data
=
obj
.
data
;
if
(
event
===
'edit'
)
{
console
.
log
(
data
);
var
index
=
layer
.
open
({
title
:
'编辑应用分类'
,
area
:
'800px'
,
type
:
1
,
content
:
$
(
"#_form"
),
btn
:
[
'保存'
,
'取消'
],
success
:
function
()
{
form
.
val
(
"form1"
,
{
id
:
data
.
id
,
name
:
data
.
name
,
icon
:
data
.
icon
,
sort
:
data
.
sort
,
banner
:
data
.
banner
,
banner_url
:
data
.
banner_url
});
$
(
"#icon1"
).
attr
(
'src'
,
data
.
icon_url
);
$
(
"#icon2"
).
attr
(
'src'
,
data
.
banner_image_url
);
},
btn1
:
function
()
{
$
.
post
(
'/admin/application-category/add-and-edit'
,
$
(
"#form1"
).
serialize
(),
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
layer
.
close
(
index
);
$
(
"#_form"
).
css
(
'display'
,
'none'
);
table
.
reload
(
'table1'
,
{
page
:
{
curr
:
1
}
});
}
});
},
btn2
:
function
()
{
layer
.
close
(
index
);
$
(
"#_form"
).
css
(
'display'
,
'none'
);
},
cancel
:
function
()
{
layer
.
close
(
index
);
$
(
"#_form"
).
css
(
'display'
,
'none'
);
}
});
}
else
if
(
'del'
===
event
)
{
var
index
=
layer
.
confirm
(
"确认删除?"
,
{
icon
:
3
,
title
:
'删除'
},
function
()
{
$
.
get
(
'/admin/application-category/delete'
,
{
id
:
data
.
id
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
table
.
reload
(
'table1'
,{
page
:{
curr
:
1
}
});
}
});
});
}
});
form
.
on
(
'submit(search)'
,
function
(
obj
)
{
console
.
log
(
obj
.
field
);
table
.
reload
(
"table1"
,
{
where
:
obj
.
field
,
page
:
{
curr
:
1
}
});
return
false
;
});
$
(
'#add'
).
click
(
function
()
{
var
index
=
layer
.
open
({
title
:
'添加应用分类'
,
area
:
'800px'
,
type
:
1
,
content
:
$
(
"#_form"
),
btn
:
[
'保存'
,
'取消'
],
success
:
function
()
{
clearForm
();
},
btn1
:
function
()
{
$
.
post
(
'/admin/application-category/add-and-edit'
,
$
(
"#form1"
).
serialize
(),
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
layer
.
close
(
index
);
$
(
"#_form"
).
css
(
'display'
,
'none'
);
clearForm
();
table
.
reload
(
'table1'
,
{
page
:
{
curr
:
1
}
});
}
});
},
btn2
:
function
()
{
layer
.
close
(
index
);
$
(
"#_form"
).
css
(
'display'
,
'none'
);
},
cancel
:
function
()
{
layer
.
close
(
index
);
$
(
"#_form"
).
css
(
'display'
,
'none'
);
}
});
})
//图片上传
var
uploader
=
layui
.
upload
;
$_csrf
=
$
(
"input[name='_csrf']"
).
val
();
uploader
.
render
({
elem
:
"#upload1"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='icon']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon1"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
uploader
.
render
({
elem
:
"#upload2"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
,
image_type
:
2
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
){
$
(
"input[name='banner']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon2"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
function
clearForm
(){
form
.
val
(
"form1"
,
{
id
:
''
,
name
:
''
,
icon
:
''
,
sort
:
''
,
banner
:
''
,
banner_url
:
''
});
$
(
"#icon1"
).
attr
(
'src'
,
''
);
$
(
"#icon2"
).
attr
(
'src'
,
''
);
}
form
.
on
(
'switch(recommendDemo)'
,
function
(
obj
){
//layer.tips(this.value + ' ' + this.name + ':'+ obj.elem.checked, obj.othis);return;
if
(
obj
.
elem
.
checked
){
$
.
get
(
'/admin/applicate-recommend/add'
,
{
id
:
this
.
value
,
type
:
1
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
}
else
{
}
});
}
else
{
$
.
get
(
'/admin/applicate-recommend/delete'
,
{
id
:
this
.
value
,
type
:
1
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
}
else
{
}
});
}
});
form
.
on
(
'switch(enableDemo)'
,
function
(
obj
){
var
enable
=
1
;
if
(
obj
.
elem
.
checked
){
enable
=
1
}
else
{
enable
=
0
;
}
$
.
get
(
'/admin/application-category/set-enable'
,
{
id
:
this
.
value
,
enable
:
enable
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
}
else
{
}
});
});
//监听单元格编辑
table
.
on
(
'edit(table1)'
,
function
(
obj
){
var
value
=
obj
.
value
;
//得到修改后的值
var
data
=
obj
.
data
;
//得到所在行所有键值
$
.
get
(
'/admin/application-category/set-sort'
,
{
id
:
data
.
id
,
sort
:
value
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
table
.
reload
(
'table1'
,{});
}
else
{
}
});
});
</script>
\ No newline at end of file
backend/views/application-category/index_v.php
deleted
100644 → 0
View file @
df7d1dd5
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 上午9:59
*/
use
backend\assets\applicationCategory\IndexAsset
;
IndexAsset
::
register
(
$this
);
?>
<style>
.layui-table-tips-c
{
padding
:
0px
;
}
</style>
<h4>
应用分类列表
</h4>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md1"
>
<a
href=
"/admin/coin/add"
>
<button
class=
"layui-btn layui-btn-default"
id=
"add"
>
添加应用分类
</button>
</a>
</div>
<div
class=
"layui-col-md8"
>
<form
class=
"layui-form"
method=
"get"
action=
""
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
style=
"margin-bottom: 0; width: 100px;"
>
币种名称
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
name=
"name"
>
</div>
</div>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"form1"
>
搜索
</button>
</div>
</form>
</div>
</div>
<div
class=
"layui-row"
>
<table
class=
"layui-table"
id=
"table1"
lay-filter=
"table1"
></table>
</div>
<script
type=
"text/html"
id=
"iconTpl"
>
<
img
src
=
"{{d.icon_url}}"
style
=
"max-width: 32px; max-height: 32px;"
/>
</script>
<!--<script type="text/html" id="operationTpl">-->
<!-- <a lay-event="edit">-->
<!-- <button class="layui-btn layui-btn-sm"><i class="layui-icon"></i></button>-->
<!-- </a>-->
<!-- <a lay-event="delete">-->
<!-- <button class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon"></i></button>-->
<!-- </a>-->
<!--</script>-->
<script
type=
"text/html"
id=
"operationTpl"
>
<
a
class
=
"layui-btn layui-btn-xs"
lay
-
event
=
"edit"
>
编辑
<
/a>
<
a
class
=
"layui-btn layui-btn-danger layui-btn-xs"
lay
-
event
=
"del"
>
删除
<
/a>
<
a
class
=
"layui-btn layui-btn-primary layui-btn-xs"
href
=
"/admin/application/list?id={{d.id}}"
>
应用列表
<
/a>
<
a
class
=
"layui-btn layui-btn-normal layui-btn-xs"
href
=
"/admin/application-category/banner-index?id={{d.id}}"
>
banner
图管理
<
/a>
</script>
<script
type=
"text/html"
id=
"recommendTpl"
>
<
input
type
=
"checkbox"
name
=
"isrecommend"
value
=
"{{d.id}}"
lay
-
skin
=
"switch"
lay
-
text
=
"是|否"
lay
-
filter
=
"recommendDemo"
{{
d
.
isrecommend
==
1
?
'checked'
:
''
}}
>
</script>
<script
type=
"text/html"
id=
"enableTpl"
>
<
input
type
=
"checkbox"
name
=
"isenable"
value
=
"{{d.id}}"
lay
-
skin
=
"switch"
lay
-
text
=
"启用|禁用"
lay
-
filter
=
"enableDemo"
{{
d
.
enable
==
1
?
'checked'
:
''
}}
>
</script>
backend/views/application/list.php
View file @
761b431b
...
...
@@ -11,7 +11,7 @@
width
:
100px
;
}
</style>
<h4>
所属分类---
<?=
$parent_category
->
name
?>
</h4>
<h4>
所属分类---
<?=
$parent_category
->
name
[
"zh-CN"
]
?>
</h4>
<div
class=
"layui-row"
style=
"padding: 5px;"
>
<div
class=
"layui-col-md1"
>
<a
href=
"/admin/application/add?category_id=
<?=
$parent_category
->
id
?>
"
>
...
...
@@ -87,12 +87,9 @@
field
:
'name'
,
title
:
'名称'
,
templet
:
function
(
data
)
{
//var name = JSON.parse(data.name);
//var name = eval("(" + data.name + ")")
// var obj = eval("(" + data.name + ')');
// console.log(obj);
// console.log(data.name);
return
data
.
name
;
var
name
=
JSON
.
parse
(
data
.
name
);
console
.
log
(
typeof
(
data
.
name
),
name
.
zh
);
return
name
.
zh
}
},
...
...
backend/web/js/application-category/index.js
View file @
761b431b
...
...
@@ -12,11 +12,16 @@ var tableIns = table.render({
page
:
1
,
loading
:
true
,
cols
:
[[
{
field
:
'name'
,
title
:
'名称'
},
{
field
:
'coin_name'
,
title
:
'名称'
},
{
field
:
'coin_name'
,
title
:
'名称'
,
templet
:
function
(
data
)
{
var
name
=
JSON
.
parse
(
data
.
name
);
console
.
log
(
typeof
(
data
.
name
),
name
.
zh
);
return
name
.
zh
}
},
{
field
:
'icon_url'
,
title
:
'图标'
,
templet
:
'#iconTpl'
},
{
field
:
'isrecommend'
,
title
:
'首页推荐'
,
templet
:
'#recommendTpl'
,
width
:
100
},
{
field
:
'enable'
,
title
:
'状态'
,
templet
:
'#enableTpl'
,
width
:
100
},
{
field
:
'isrecommend'
,
title
:
'首页推荐'
,
templet
:
'#recommendTpl'
,
width
:
100
},
{
field
:
'enable'
,
title
:
'状态'
,
templet
:
'#enableTpl'
,
width
:
100
},
{
field
:
'id'
,
title
:
'操作'
,
templet
:
'#operationTpl'
}
]],
});
...
...
@@ -30,25 +35,15 @@ form.on('submit(form1)', function (data) {
//监听单元格事件
table
.
on
(
'tool(table1)'
,
function
(
obj
)
{
var
data
=
obj
.
data
;
if
(
obj
.
event
===
'getExchange'
)
{
var
load
=
layer
.
load
(
1
);
$
.
get
(
'/admin/coin/get-exchange-list-by-id?id='
+
obj
.
data
.
id
,
{},
function
(
str
)
{
layer
.
close
(
load
);
layer
.
open
({
type
:
1
,
title
:
'上架交易所列表'
,
content
:
str
,
});
});
}
else
if
(
obj
.
event
==
'delete'
)
{
layer
.
confirm
(
'真的要删除'
+
data
.
name
+
'吗?'
,
{
icon
:
3
,
title
:
'删除'
},
function
(
index
)
{
layer
.
close
(
index
);
//向服务端发送删除指令
$
.
get
(
'/admin/coin/delete?id='
+
obj
.
data
.
id
,
function
(
data
,
status
)
{
if
(
data
.
code
==
0
)
{
obj
.
del
();
//删除对应行(tr)的DOM结构
if
(
'del'
===
obj
.
event
)
{
var
index
=
layer
.
confirm
(
"确认删除?"
,
{
icon
:
3
,
title
:
'删除'
},
function
()
{
$
.
get
(
'/admin/application-category/delete'
,
{
id
:
data
.
id
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
table
.
reload
(
'table1'
,
{
page
:
{
curr
:
1
}
});
}
layer
.
msg
(
data
.
msg
);
});
});
}
else
if
(
obj
.
event
==
'edit'
)
{
...
...
@@ -61,7 +56,7 @@ table.on('tool(table1)', function (obj) {
btn
:
[
'保存'
,
'取消'
],
btn1
:
function
()
{
// console.log();
$
.
post
(
'/admin/
coin/edit'
,
$
(
"#coinE
dit"
).
serialize
(),
function
(
rev
)
{
$
.
post
(
'/admin/
application-category/edit'
,
$
(
"#application-category-e
dit"
).
serialize
(),
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
rev
.
code
==
0
)
{
table
.
reload
(
"table1"
,
{
...
...
@@ -75,38 +70,38 @@ table.on('tool(table1)', function (obj) {
});
}
});
form
.
on
(
'switch(recommendDemo)'
,
function
(
obj
)
{
form
.
on
(
'switch(recommendDemo)'
,
function
(
obj
)
{
//layer.tips(this.value + ' ' + this.name + ':'+ obj.elem.checked, obj.othis);return;
if
(
obj
.
elem
.
checked
)
{
$
.
get
(
'/admin/applicate-recommend/add'
,
{
id
:
this
.
value
,
type
:
1
},
function
(
rev
)
{
if
(
obj
.
elem
.
checked
)
{
$
.
get
(
'/admin/applicate-recommend/add'
,
{
id
:
this
.
value
,
type
:
1
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
}
else
{
}
else
{
}
});
}
else
{
$
.
get
(
'/admin/applicate-recommend/delete'
,
{
id
:
this
.
value
,
type
:
1
},
function
(
rev
)
{
}
else
{
$
.
get
(
'/admin/applicate-recommend/delete'
,
{
id
:
this
.
value
,
type
:
1
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
}
else
{
}
else
{
}
});
}
});
form
.
on
(
'switch(enableDemo)'
,
function
(
obj
)
{
form
.
on
(
'switch(enableDemo)'
,
function
(
obj
)
{
var
enable
=
1
;
if
(
obj
.
elem
.
checked
)
{
if
(
obj
.
elem
.
checked
)
{
enable
=
1
}
else
{
}
else
{
enable
=
0
;
}
$
.
get
(
'/admin/application-category/set-enable'
,
{
id
:
this
.
value
,
enable
:
enable
},
function
(
rev
)
{
$
.
get
(
'/admin/application-category/set-enable'
,
{
id
:
this
.
value
,
enable
:
enable
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
}
else
{
}
else
{
}
});
...
...
common/models/psources/CoinApplicationCategory.php
View file @
761b431b
...
...
@@ -92,6 +92,11 @@ class CoinApplicationCategory extends BaseActiveRecord
return
self
::
find
()
->
where
([
'id'
=>
$id
])
->
one
();
}
public
static
function
getAppCategory
(
$id
)
{
return
self
::
find
()
->
where
([
'id'
=>
$id
])
->
asArray
()
->
one
();
}
public
static
function
getCateItemsArray
(
$condition
=
[])
{
return
self
::
find
()
->
where
(
$condition
)
->
asArray
()
->
all
();
...
...
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