Commit a9577677 authored by rlgy's avatar rlgy

app版本更新管理后台

parent b3ec1b80
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-22
* Time: 下午1:32
*/
namespace backend\controllers;
use Yii;
use common\models\pwallet\AppVersion;
class AppController extends BaseController
{
public function actionList()
{
if (Yii::$app->request->isAjax) {
Yii::$app->response->format = 'json';
$request = Yii::$app->request;
$type = $request->get('type', '0');
$page = $request->get('page', 1);
$limit = $request->get('limit', 10);
$where = [];
$where[] = ['type' => $type];
$data = AppVersion::getList($page, $limit, $where);
return $data;
}
return $this->render('list');
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-22
* Time: 下午1:34
*/
use yii\helpers\Html;
$this->registerJsFile('@web/js/app/index.js');
?>
<div class="layui-row">
<div>
<a class="layui-btn btn-primary btn_add">添加<i class="fa fa-plus"></i></a>
</div>
<div class="layui-tab layui-tab-card">
<ul class="layui-tab-title">
<li class="layui-this">Android</li>
<li>IOS</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<table class="layui-table" id="table1"></table>
</div>
<div class="layui-tab-item">
<table class="layui-table" id="table2"></table>
</div>
</div>
</div>
</div>
<!-- 添加页面 -->
<div class="layui-row add" style="display: none">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md11">
<form class="layui-form form_add" action="javascript:void(0)" method="post">
<div class="layui-form-item">
<label class="layui-form-label">类型</label>
<div class="layui-input-block">
<!-- <?= Html::dropDownList('type', null,
[1 => '安卓稳定版', 2 => '安卓公测版', 3 => '安卓内测版', 4 => 'IOS稳定版', 5 => 'IOS公测版', 6 => 'IOS内测版'],
['class' => 'my-select select-hand']) ?> -->
<?= Html::dropDownList('type', null, [1 => '安卓稳定版', 4 => 'IOS稳定版', 7 => 'IOS商店版'],
['class' => 'my-select select-hand']) ?>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<!-- <?= Html::dropDownList('status', null, [1 => '上线', 2 => '推荐更新', 3 => '下线'],
['class' => 'my-select select-hand']) ?> -->
<?= Html::dropDownList('status', null, [1 => '上线', 3 => '下线'],
['class' => 'my-select select-hand']) ?>
</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="version" required lay-verify="required" placeholder="" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">下载链接</label>
<div class="layui-input-block">
<input type="text" name="download_url" 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">
<textarea name="log" placeholder="请输入内容" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn btn_add_submit" lay-submit lay-filter="formDemo">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
</div>
</div>
<script type="text/html" id="operTpl">
<a class="btn_edit"><i class="layui-icon">&#xe642;</i></a>
<a class="btn_detail"><i class="layui-icon">&#xe60a;</i></a>
<a class="btn_delete"><i class="layui-icon" style="color: red">&#xe640;</i></a>
</script>
\ No newline at end of file
This diff is collapsed.
var table1 = layui.table;
var table2 = layui.table;
var type = [
{code: 0, name: ''},
{code: 1, name: '安卓稳定版'},
{code: 2, name: '安卓公测版'},
{code: 3, name: '安卓内侧版'},
{code: 4, name: 'IOS稳定版'},
{code: 5, name: 'IOS公测版'},
{code: 6, name: 'IOS内侧版'}
];
var vstatus = [
{code: 0, name: ''},
{code: 1, name: '上线'},
{code: 2, name: '推荐更新'},
{code: 3, name: '下线'},
];
table1.render({
elem: '#table1',
page: 1,
limit: 10,
where: {type: type[1].code},
url: '/admin/app/list',
cols: [[
{field: 'id', title: '编号'},
{field: 'version', title: '版本号'},
{field: 'type', title: '类型', templet: '<div>{{type[d.type].name}}</div>'},
{field: 'status', title: '状态', templet: '<div>{{vstatus[d.status].name}}</div>'},
{
field: 'download_url',
title: '下载链接',
width: 900,
templet: '<div><a href="{{d.download_url}}">{{d.download_url}}</a> </div>'
},
{field: 'updated_at', title: '更新时间'},
{title: '操作', templet: '#operTpl'},
]]
});
table2.render({
elem: '#table2',
page: 1,
limit: 10,
where: {type: type[4].code},
url: '/admin/app/list',
cols: [[
{field: 'id', title: '编号'},
{field: 'version', title: '版本号'},
{field: 'type', title: '类型', templet: '<div>{{type[d.type].name}}</div>'},
{field: 'status', title: '状态', templet: '<div>{{vstatus[d.status].name}}</div>'},
{
field: 'download_url',
title: '下载链接',
width: 900,
templet: '<div><a href="{{d.download_url}}">{{d.download_url}}</a> </div>'
},
{field: 'updated_at', title: '更新时间'},
{title: '操作', templet: '#operTpl'},
]]
});
//添加图层
$(".btn_add").click(function(){
layer.open({
type: 1,
title: '版本信息',
content: $('.add'), //这里content是一个普通的String
scrollbar: false,
area: '700px',
cancel: function(index, layero){
$('.add').attr('style', 'display:none')
}
})
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment