Authored by wuxiao

直播间管理

<?php
namespace backend\components;
use Yii;
use yii\data\Pagination as yiiPagination;
class Pagination extends yiiPagination
{
public function __construct($config = [])
{
$config = array_merge([
'defaultPageSize'=>Yii::$app->params['defaultPageSize'],
],$config);
parent::__construct($config);
}
}
\ No newline at end of file
... ...
... ... @@ -15,6 +15,7 @@ return [
'components' => [
'request' => [
'csrfParam' => '_csrf-backend',
'enableCsrfValidation' => false,
],
'user' => [
'identityClass' => 'common\models\User',
... ... @@ -41,6 +42,8 @@ return [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<controller:\w+>/<id:[\d-]+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:[\d-]+>' => '<controller>/<action>',
],
],
],
... ...
... ... @@ -19,4 +19,8 @@ return [
)
),
),
/**
* 分页每页数目
*/
'defaultPageSize'=>10,
];
... ...
... ... @@ -13,6 +13,8 @@ class BaseController extends Controller
public $layout = 'template';
protected $_actionParams = [];
protected $_refer;
public function beforeAction($action) {
Yii::setAlias('@web', Yii::getAlias('@admin'));
... ... @@ -57,7 +59,11 @@ class BaseController extends Controller
* @return type
*/
public function render($view, $params = array()) {
$params = array_merge($this->_actionParams, $params);
$this->_refer = Yii::$app->getRequest()->referrer;
$params = array_merge($this->_actionParams, [
'_refer'=>$this->_refer
], $params);
return parent::render($view, $params);
}
... ...
... ... @@ -2,6 +2,7 @@
namespace backend\controllers;
use Yii;
use backend\components\Pagination;
/**
* Site controller
... ... @@ -15,7 +16,31 @@ class LiveController extends BaseController
*/
public function actionRoom()
{
return $this->render('room');
$model = \app\models\Room::find();
if ($filter = Yii::$app->getRequest()->getQueryParam('filter')){
foreach ($filter as $field=>$value){
if ($field == 'keyword'){
if (!empty($value)){
$model->andWhere(['like','title',"%{$value}%"])
->orWhere(['room_id'=>$value])
->orWhere(['master_id'=>$value]);
}
}else{
$model->andWhere([$field=>$value]);
}
}
}
$count = clone $model;
$pagination = new Pagination(['totalCount' =>$count->count()]);
$list = \app\models\Room::find()->asArray()->offset($pagination->offset)->limit($pagination->limit)->orderBy(['create_time'=>SORT_DESC])->all();
return $this->render('room',[
'filter'=>$filter ? : [],
'pagination'=>$pagination,
'list'=>$list
]);
}
/**
... ... @@ -35,4 +60,72 @@ class LiveController extends BaseController
{
return $this->render('video');
}
/**
* 创建直播间
* @return type
*/
public function actionRoomcreate()
{
$this->setParam('uploader', '');
$model = new \app\models\Room;
if (Yii::$app->getRequest()->isPost){
$post = Yii::$app->getRequest()->post();
$post['starting_time'] = !$post['starting_time'] ? : strtotime($post['starting_time']);
$model->setAttributes($post);
$model->save();
if ($model->save()){
Yii::$app->session->setFlash('success', '创建成功。');
}else{
Yii::$app->session->setFlash('error', '创建失败。');
}
$this->redirect('/live/room');
}
return $this->render('roomedit',[
'model'=> $model
]);
}
/**
* 编辑直播间
* @return type
*/
public function actionRoomedit()
{
if (!$id = Yii::$app->getRequest()->getQueryParam('id')){
$this->redirect($this->_refer);
}
$this->setParam('uploader', '');
$model = new \app\models\Room;
$model = $model->findOne($id) ? : $model;
if (Yii::$app->getRequest()->isPost){
$post = Yii::$app->getRequest()->post();
$post['starting_time'] = !$post['starting_time'] ? : strtotime($post['starting_time']);
$model->setAttributes($post);
if ($model->save()){
Yii::$app->session->setFlash('success', '编辑成功。');
}else{
Yii::$app->session->setFlash('error', '编辑失败。');
}
$this->redirect('/live/room');
}
return $this->render('roomedit',[
'model'=> $model
]);
}
/**
* 直播间操作
* @return type
*/
public function actionRoomoperate()
{
;
}
}
... ...
... ... @@ -40,8 +40,9 @@ class Room extends \yii\db\ActiveRecord
[['room_id', 'master_id', 'starting_time', 'status', 'create_time', 'update_time'], 'integer'],
[['best', 'vest'], 'string'],
[['title'], 'string', 'max' => 100],
[['pic', 'starting_pic'], 'string', 'max' => 255],
[['secret'], 'string', 'max' => 50],
[['pic'], 'string', 'max' => 255],
[['create_time', 'update_time'], 'default', 'value' => time()],
[['create_time', 'update_time'], 'required'],
];
}
... ... @@ -57,8 +58,6 @@ class Room extends \yii\db\ActiveRecord
'master_id' => 'Master ID',
'pic' => 'Pic',
'starting_time' => 'Starting Time',
'starting_pic' => 'Starting Pic',
'secret' => 'Secret',
'best' => 'Best',
'vest' => 'Vest',
'status' => 'Status',
... ... @@ -66,4 +65,38 @@ class Room extends \yii\db\ActiveRecord
'update_time' => 'Update Time',
];
}
/**
* 生成房间ID
*/
public function bornRoomId()
{
$uuid = __FUNCTION__.$this->uuid();
$id = sprintf('%u',crc32($uuid));
return $id;
}
/**
* 生成主播ID
*/
public function bornMasterId()
{
$uuid = __FUNCTION__.$this->uuid();
$id = sprintf('%u',crc32($uuid));
return $id;
}
private function uuid() {
if (function_exists ( 'com_create_guid' )) {
return com_create_guid ();
} else {
mt_srand ( ( double ) microtime () * 10000 ); //optional for php 4.2.0 and up.随便数播种,4.2.0以后不需要了。
$charid = strtoupper ( md5 ( uniqid ( rand (), true ) ) ); //根据当前时间(微秒计)生成唯一id.
$hyphen = chr ( 45 ); // "-"
$uuid = '' . //chr(123)// "{"
substr ( $charid, 0, 8 ) . $hyphen . substr ( $charid, 8, 4 ) . $hyphen . substr ( $charid, 12, 4 ) . $hyphen . substr ( $charid, 16, 4 ) . $hyphen . substr ( $charid, 20, 12 );
//.chr(125);// "}"
return $uuid;
}
}
}
... ...
... ... @@ -7,6 +7,7 @@ use yii\helpers\Html;
use backend\assets\TemplateAsset;
use backend\assets\Ie9Asset;
use yii\web\View;
use backend\widgets\Alert;
TemplateAsset::register($this);
Ie9Asset::register($this);
... ... @@ -49,7 +50,8 @@ Ie9Asset::register($this);
</div><!-- media -->
</div><!-- pageheader -->
<div class="contentpanel">
<div class="contentpanel">
<?php echo Alert::widget() ?>
<?php echo $content;?>
</div><!-- contentpanel -->
... ...
<?php
use yii\helpers\Html;
use backend\widgets\LinkPager;
$this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
?>
... ... @@ -7,107 +9,32 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
<div class="panel-body">
<form aciton="" method="GET" class="form-inline">
<div>
<span id="filterForm1">
<div class="form-group">
<label class="control-label">SKN编号:</label>
<input type="text" class="form-control" name="filter[product_skn]" id="filter_product_skn">
</div>
<div class="form-group">
<label class="control-label">库存情况:</label>
<span class="ckbox ckbox-default">
<input type="checkbox" value="1" name="filter[stock_status][]" id="filter_stock_status_0">
<label for="filter_stock_status_0">有库存</label>
<span class="ckbox ckbox-default">
<input type="checkbox" value="2" name="filter[stock_status][]" id="filter_stock_status_1">
<label for="filter_stock_status_1">无库存</label>
</div>
<br>
<br>
<div class="form-group">
<label class="control-label">商品名称</label>
<label class="control-label">状态</label>
<input type="text" class="form-control" name="filter[product_name]" id="filter_product_name">
<?php echo Html::dropDownList('filter[status]', null,[''=>'==请选择==',0=>'直播未开始',1=>'直播中'], ['class' => 'form-control']);?>
</div>
<br>
<br>
<div class="form-group">
<label class="control-label">全球购隐藏:</label>
<span class="rdio rdio-default">
<input type="radio" value="2" name="filter[is_hide]" id="filter_is_hide_0">
<label for="filter_is_hide_0"></label>
<span class="rdio rdio-default">
<input type="radio" value="1" name="filter[is_hide]" id="filter_is_hide_1">
<label for="filter_is_hide_1"></label>
<label class="control-label">关键字:</label>
<input type="text" class="form-control" name="filter[keyword]" placeholder="输入关键字">
</div>
<input type="submit" class="btn btn-primary btn-sm mr5" value="查询" id="filter_submit">
<input type="reset" onclick="filterReset(this)" class="btn btn-primary btn-sm mr5" value="重置" id="filter_reset">
<input type="hidden" value="1" name="filter[filterFormCount]">
<input type="reset" class="btn btn-primary btn-sm mr5" value="重置" id="filter_reset">
</div>
</form>
</div>
</div>
<form aciton="" method="GET" class="form-inline">
<div>
<div class="form-group">
<span class="rdio rdio-default">
<input type="radio" checked="checked" value="" id="radioDefault1" name="condition[status]">
<label for="radioDefault1">全部 ( <span style="color:blue" id="total_all">11090</span> )</label>
</span>
<span class="rdio rdio-default">
<input type="radio" value="1" id="radioDefault2" name="condition[status]">
<label for="radioDefault2">暂存 ( <span style="color:blue" id="total_storage">18</span> )</label>
</span>
<span class="rdio rdio-default">
<input type="radio" value="2" id="radioDefault3" name="condition[status]">
<label for="radioDefault3">待审核 ( <span style="color:blue" id="total_submit">130</span> )</label>
</span>
<span class="rdio rdio-default">
<input type="radio" value="3" id="radioDefault4" name="condition[status]">
<label for="radioDefault4">待上架 ( <span style="color:blue" id="total_wait">0</span> )</label>
</span>
<span class="rdio rdio-default">
<input type="radio" value="4" id="radioDefault5" name="condition[status]">
<label for="radioDefault5">已上架 ( <span style="color:blue" id="total_on">4051</span> )</label>
</span>
<span class="rdio rdio-default">
<input type="radio" value="5" id="radioDefault6" name="condition[status]">
<label for="radioDefault6">已下架 ( <span style="color:blue" id="total_off">6891</span> )</label>
</span>
</div>
</div>
</form>
<div class="form-group">
<label>
<button onclick="set_shelf($('input[name^=product_skn]:checked'), 'on')" class="btn btn-success">批量上架</button>
</label>
<label>
<button onclick="set_shelf($('input[name^=product_skn]:checked'), 'off')" class="btn btn-danger">批量下架</button>
<a href="/live/roomcreate" class="btn btn-primary">+ 创建房间</a>
</label>
</div>
... ... @@ -118,552 +45,47 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
<thead>
<tr style="white-space:nowrap">
<th><input type="checkbox" onclick="checkall(this)">选择</th>
<th>图片</th>
<th>SKN编号</th>
<th>商品名称</th>
<th>品牌</th>
<th>分类</th>
<th>商品来源</th>
<th>所属网站</th>
<th>国家编号</th>
<th>更新时间</th>
<th>操作人</th>
<th>库存</th>
<th>爬虫链接状态</th>
<th>限量款</th>
<th>上架属性</th>
<th>排序</th>
<th>房间号</th>
<th>直播标题</th>
<th>头图</th>
<th>主播</th>
<th>预告开始时间</th>
<th>是否精选</th>
<th>马甲状态</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($list as $row):?>
<tr data-stock="1" data-source="1" data-status="2" data-id="5011880">
<td><input type="checkbox" value="5011880" name="product_skn[]"></td>
<td><input type="checkbox" value="<?=$row['id']?>" name="room[]"></td>
<td><?=$row['room_id']?></td>
<td><?=$row['title']?></td>
<td><img height="70" alt="商品封面图片" src="http://img13.static.yhbimg.com/global/2016/08/09/17/02c4f32295d862be8d7d332ecf9b42337d.jpg"></td>
<td>5011880</td>
<td>Obey 黑色快干短袖运动T恤</td>
<td>Obey</td>
<td>成人 / 上衣 / T恤 / T恤</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 17:52:38</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span>/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="display:none;">
</td>
<td type="statusName">
<span>待审核</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="display:none">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td>
<button onclick="modalRemote('/product/info/view?product_skn=5011880', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="javascript:void(0)" class="btn btn-default btn-metro not-allowed">编辑商品</a>
<a href="javascript:void(0)" class="btn btn-default btn-metro not-allowed">编辑链接</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed">上架</button>
<button type="close" onclick="set_shelf('5011880', 'off')" class="btn btn-danger btn-metro" style="display:none">下架</button>
<button type="open" onclick="set_shelf('5011880', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011880', 'ever_off')" class="btn btn-danger btn-metro" style="display:none">永久下架</button>
</span>
</td>
</tr>
<tr data-stock="1" data-source="1" data-status="2" data-id="5011879">
<td><input type="checkbox" value="5011879" name="product_skn[]"></td>
<td><img height="70" alt="商品封面图片" src="http://img11.static.yhbimg.com/global/2016/08/09/17/01163f0455a97d6c4d43c55fd929931e88.jpg"></td>
<td>5011879</td>
<td>Obey 墨绿色快干短袖运动T恤</td>
<td>Obey</td>
<td>成人 / 上衣 / T恤 / T恤</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 17:51:39</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span>/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="display:none;">
</td>
<td type="statusName">
<span>待审核</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="display:none">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td>
<button onclick="modalRemote('/product/info/view?product_skn=5011879', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="javascript:void(0)" class="btn btn-default btn-metro not-allowed">编辑商品</a>
<a href="javascript:void(0)" class="btn btn-default btn-metro not-allowed">编辑链接</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed">上架</button>
<button type="close" onclick="set_shelf('5011879', 'off')" class="btn btn-danger btn-metro" style="display:none">下架</button>
<button type="open" onclick="set_shelf('5011879', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011879', 'ever_off')" class="btn btn-danger btn-metro" style="display:none">永久下架</button>
</span>
</td>
</tr>
<tr data-stock="1" data-source="1" data-status="2" data-id="5011878">
<td><input type="checkbox" value="5011878" name="product_skn[]"></td>
<td><img height="70" alt="商品封面图片" src="http://img12.static.yhbimg.com/global/2016/08/09/17/02d209bcf97ecd5acc9420715ce8034fed.jpg"></td>
<td>5011878</td>
<td>Obey 浅褐色快干短袖运动T恤</td>
<td>Obey</td>
<td>成人 / 上衣 / T恤 / T恤</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 17:49:22</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span>/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="display:none;">
</td>
<td type="statusName">
<span>待审核</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="display:none">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td>
<button onclick="modalRemote('/product/info/view?product_skn=5011878', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="javascript:void(0)" class="btn btn-default btn-metro not-allowed">编辑商品</a>
<a href="javascript:void(0)" class="btn btn-default btn-metro not-allowed">编辑链接</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed">上架</button>
<button type="close" onclick="set_shelf('5011878', 'off')" class="btn btn-danger btn-metro" style="display:none">下架</button>
<button type="open" onclick="set_shelf('5011878', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011878', 'ever_off')" class="btn btn-danger btn-metro" style="display:none">永久下架</button>
</span>
</td>
</tr>
<tr data-stock="1" data-source="1" data-status="4" data-id="5011877">
<td><input type="checkbox" value="5011877" name="product_skn[]"></td>
<td><img height="70" alt="商品封面图片" src="http://img10.static.yhbimg.com/global/2016/08/09/00/01e4d9bea54bb37dd6f1c033bcd4d9dc3a.jpg"></td>
<td>5011877</td>
<td>Brixton 棕色棉质带装饰软呢帽</td>
<td>Brixton</td>
<td>成人 / 服配 / 帽子 / 礼帽</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 16:12:43</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName" style="display: inline;">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span style="display: none;">/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="">
</td>
<td type="statusName">
<span style="display: none;">已上架</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td>
<button onclick="modalRemote('/product/info/view?product_skn=5011877', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="/product/info/update?product_skn=5011877&amp;step=1" class="btn btn-primary btn-metro">编辑商品</a>
<a href="/product/info/update?product_skn=5011877&amp;step=2" class="btn btn-primary btn-metro">编辑链接</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">上架</button>
<button type="close" onclick="set_shelf('5011877', 'off')" class="btn btn-danger btn-metro" style="">下架</button>
<button type="open" onclick="set_shelf('5011877', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011877', 'ever_off')" class="btn btn-danger btn-metro" style="">永久下架</button>
</span>
</td>
</tr>
<tr data-stock="1" data-source="1" data-status="4" data-id="5011876">
<td><input type="checkbox" value="5011876" name="product_skn[]"></td>
<td><img height="70" alt="商品封面图片" src="http://img10.static.yhbimg.com/global/2016/08/09/09/0140e7ebcf65f96e787025cb215bb8d873.jpg"></td>
<td>5011876</td>
<td>Brixton 宽檐撞色皮质带装饰呢帽</td>
<td>Brixton</td>
<td>成人 / 服配 / 帽子 / 礼帽</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 16:03:30</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName" style="display: inline;">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span style="display: none;">/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="">
</td>
<td type="statusName">
<span style="display: none;">已上架</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td>
<button onclick="modalRemote('/product/info/view?product_skn=5011876', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="/product/info/update?product_skn=5011876&amp;step=1" class="btn btn-primary btn-metro">编辑商品</a>
<a href="/product/info/update?product_skn=5011876&amp;step=2" class="btn btn-primary btn-metro">编辑链接</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">上架</button>
<button type="close" onclick="set_shelf('5011876', 'off')" class="btn btn-danger btn-metro" style="">下架</button>
<button type="open" onclick="set_shelf('5011876', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011876', 'ever_off')" class="btn btn-danger btn-metro" style="">永久下架</button>
</span>
</td>
</tr>
<tr data-stock="1" data-source="1" data-status="4" data-id="5011875">
<td><input type="checkbox" value="5011875" name="product_skn[]"></td>
<td><img height="70" alt="商品封面图片" src="http://img12.static.yhbimg.com/global/2016/08/09/00/02dffd1e547eadb98ab5b0134d9cbbae51.jpg"></td>
<td>5011875</td>
<td>Brixton Matador黑色皮质带装饰呢帽</td>
<td>Brixton</td>
<td>成人 / 服配 / 帽子 / 礼帽</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 17:49:30</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName" style="display: inline;">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span style="display: none;">/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="">
</td>
<td type="statusName">
<span style="display: none;">已上架</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td>
<button onclick="modalRemote('/product/info/view?product_skn=5011875', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="/product/info/update?product_skn=5011875&amp;step=1" class="btn btn-primary btn-metro">编辑商品</a>
<a href="/product/info/update?product_skn=5011875&amp;step=2" class="btn btn-primary btn-metro">编辑链接</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">上架</button>
<button type="close" onclick="set_shelf('5011875', 'off')" class="btn btn-danger btn-metro" style="">下架</button>
<button type="open" onclick="set_shelf('5011875', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011875', 'ever_off')" class="btn btn-danger btn-metro" style="">永久下架</button>
</span>
</td>
</tr>
<tr data-stock="1" data-source="1" data-status="4" data-id="5011874">
<td><input type="checkbox" value="5011874" name="product_skn[]"></td>
<td><img height="70" alt="商品封面图片" src="http://img12.static.yhbimg.com/global/2016/08/09/09/0271377dc21dfce9163546abe409861e24.jpg"></td>
<td>5011874</td>
<td>Brixton 流苏带宽檐黑色呢帽</td>
<td>Brixton</td>
<td>成人 / 服配 / 帽子 / 礼帽</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 17:51:46</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName" style="display: inline;">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span style="display: none;">/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="">
</td>
<td type="statusName">
<span style="display: none;">已上架</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td>
<button onclick="modalRemote('/product/info/view?product_skn=5011874', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="/product/info/update?product_skn=5011874&amp;step=1" class="btn btn-primary btn-metro">编辑商品</a>
<a href="/product/info/update?product_skn=5011874&amp;step=2" class="btn btn-primary btn-metro">编辑链接</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">上架</button>
<button type="close" onclick="set_shelf('5011874', 'off')" class="btn btn-danger btn-metro" style="">下架</button>
<button type="open" onclick="set_shelf('5011874', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011874', 'ever_off')" class="btn btn-danger btn-metro" style="">永久下架</button>
</span>
</td>
</tr>
<tr data-stock="1" data-source="1" data-status="4" data-id="5011873">
<td><input type="checkbox" value="5011873" name="product_skn[]"></td>
<td><img height="70" alt="商品封面图片" src="http://img12.static.yhbimg.com/global/2016/08/09/00/02428dc77d4f304de513198b0789cf7890.jpg"></td>
<td>5011873</td>
<td>Brixton 黑色皮质带装饰软呢帽</td>
<td>Brixton</td>
<td>成人 / 服配 / 帽子 / 礼帽</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 17:36:27</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName" style="display: inline;">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span style="display: none;">/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="">
</td>
<td type="statusName">
<span style="display: none;">已上架</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td>
<button onclick="modalRemote('/product/info/view?product_skn=5011873', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="/product/info/update?product_skn=5011873&amp;step=1" class="btn btn-primary btn-metro">编辑商品</a>
<a href="/product/info/update?product_skn=5011873&amp;step=2" class="btn btn-primary btn-metro">编辑链接</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">上架</button>
<button type="close" onclick="set_shelf('5011873', 'off')" class="btn btn-danger btn-metro" style="">下架</button>
<button type="open" onclick="set_shelf('5011873', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011873', 'ever_off')" class="btn btn-danger btn-metro" style="">永久下架</button>
</span>
</td>
</tr>
<tr data-stock="1" data-source="1" data-status="4" data-id="5011872">
<td><input type="checkbox" value="5011872" name="product_skn[]"></td>
<td><img height="70" alt="商品封面图片" src="http://img12.static.yhbimg.com/global/2016/08/09/00/02679eecb73a61b151725d59e1039afe7c.jpg"></td>
<td>5011872</td>
<td>Brixton 灰色棉质带装饰软呢帽</td>
<td>Brixton</td>
<td>成人 / 服配 / 帽子 / 礼帽</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 16:12:52</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName" style="display: inline;">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span style="display: none;">/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="">
</td>
<td type="statusName">
<span style="display: none;">已上架</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td>
<button onclick="modalRemote('/product/info/view?product_skn=5011872', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="/product/info/update?product_skn=5011872&amp;step=1" class="btn btn-primary btn-metro">编辑商品</a>
<a href="/product/info/update?product_skn=5011872&amp;step=2" class="btn btn-primary btn-metro">编辑链接</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">上架</button>
<button type="close" onclick="set_shelf('5011872', 'off')" class="btn btn-danger btn-metro" style="">下架</button>
<button type="open" onclick="set_shelf('5011872', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011872', 'ever_off')" class="btn btn-danger btn-metro" style="">永久下架</button>
</span>
</td>
</tr>
<tr data-stock="1" data-source="1" data-status="4" data-id="5011871">
<td><input type="checkbox" value="5011871" name="product_skn[]"></td>
<td><img height="70" alt="商品封面图片" src="http://img11.static.yhbimg.com/global/2016/08/09/09/0195bb4616904c5fe9b0c35fe167f625c5.jpg"></td>
<td>5011871</td>
<td>Brixton 皮质带装饰软呢帽</td>
<td>Brixton</td>
<td>成人 / 服配 / 帽子 / 礼帽</td>
<td style="white-space:nowrap">海外网站爬取</td>
<td>ASOS英国</td>
<td>44:英国</td>
<td>2016-08-09 16:03:39</td>
<td>super_admin</td>
<td></td>
<td type="urlName">
<span type="urlName" style="display: inline;">生效</span>
<span type="close" style="display:none">/</span>
</td>
<td></td>
<td>自动上架</td>
<td type="order">
<span style="display: none;">/</span>
<input type="text" value="0" placeholder="回车保存" class="form-control" name="order" style="">
</td>
<td type="statusName">
<span style="display: none;">已上架</span>
<span type="close" style="display:none">已下架</span>
<span type="open" style="">已上架</span>
<span type="ever_off" style="display:none">永久下架</span>
</td>
<td><?=$row['master_id']?></td>
<td style="white-space:nowrap"><?=date('Y-m-d H:i:s',$row['starting_time'])?></td>
<td><?=Yii::$app->params['config']['best'][$row['best']]?></td>
<td><?=Yii::$app->params['config']['vest'][$row['vest']]?></td>
<td><?=Yii::$app->params['config']['room_status'][$row['status']]?></td>
<td>
<a href="/live/roomedit/<?=$row['id']?>" class="btn btn-default btn-white">编辑</a>
<button onclick="modalRemote('/product/info/view?product_skn=5011871', '#detail-info', 'get');" class="btn btn-white btn-metro">查看</button>
<a href="/product/info/update?product_skn=5011871&amp;step=1" class="btn btn-primary btn-metro">编辑商品</a>
<a href="/product/info/update?product_skn=5011871&amp;step=2" class="btn btn-primary btn-metro">编辑链接</a>
<a href="javascript:void(0)" class="btn btn-default btn-white">禁言</a>
<span type="status">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">上架</button>
<button type="close" onclick="set_shelf('5011871', 'off')" class="btn btn-danger btn-metro" style="">下架</button>
<button type="open" onclick="set_shelf('5011871', 'on')" class="btn btn-success btn-metro" style="display:none">上架</button>
<button type="disable" onclick="javascript:void(0)" class="btn btn-danger btn-metro">删除</button>
<button type="close" onclick="set_shelf('5011880', 'off')" class="btn btn-danger btn-metro" style="display:none">关闭直播</button>
</span>
<span type="ever_off">
<button type="disable" onclick="javascript:void(0)" class="btn btn-default btn-metro not-allowed" style="display: none;">永久下架</button>
<button type="ever_off" onclick="set_shelf('5011871', 'ever_off')" class="btn btn-danger btn-metro" style="">永久下架</button>
</span>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<!-- table-responsive -->
<span>共11090条记录</span><ul class="pagination pagination-metro pagination-split nomargin"><li class="disabled"><a href="javascript:void(0)"><i class="fa fa-angle-left"></i></a></li><li class="active"><a href="javascript:void(0)">1</a></li><li><a href="?page=2">2</a></li><li><a href="?page=3">3</a></li><li><a href="?page=4">4</a></li><li><a href="?page=5">5</a></li><li><a href="?page=1109">1109</a></li><li><a href="?page=2"><i class="fa fa-angle-right"></i></a></li></ul> </div>
<!-- col-md-12 -->
</div>
<div id="detail-info" role="dialog" tabindex="-1" class="modal fade bs-example-modal-lg">
<div class="modal-dialog modal-lg">
<div style="width:1080px" class="modal-content"></div>
<?php echo LinkPager::widget(['pagination' => $pagination]);?>
</div>
</div>
<script src="/js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<style>
.not-allowed{
cursor:not-allowed;
}
</style>
\ No newline at end of file
<!-- col-md-12 -->
</div>
\ No newline at end of file
... ...
<?php
use yii\web\View;
use yii\helpers\Html;
$this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
?>
<?php
$this->registerJsFile('/js/My97DatePicker/WdatePicker.js',array('postion'=>View::POS_END));
?>
<div class="col-md-6">
<form id="form" method="POST" action="">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="form-group">
<label class="col-sm-3 control-label">房间号: </label>
<div class="col-sm-9">
<?=$roomid = $model->room_id?:$model->bornRoomId()?>
<input type="text" name="room_id" class="form-control" required="required" value="<?=$roomid?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">直播标题: <span class="asterisk">*</span></label>
<div class="col-sm-5">
<input type="text" name="title" class="form-control" required="required" value="<?=$model->title?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">主播: <span class="asterisk">*</span></label>
<div class="col-sm-9">
<input type="text" name="master_id" class="form-control" required="required" value="<?=$model->master_id?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">预告开始时间: </label>
<div class="col-sm-5">
<input type="text" name="starting_time" class="form-control" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'%y-%M-%d %H:%m:%s'})" value="<?=$model->starting_time ? date('Y-m-d H:i:s',$model->starting_time) : ''?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否精选: </label>
<div class="col-sm-2">
<?php echo Html::dropDownList('best', $model->best,Yii::$app->params['config']['best'], ['class' => 'form-control']);?>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">马甲状态: </label>
<div class="col-sm-2">
<?php echo Html::dropDownList('vest', $model->vest,Yii::$app->params['config']['vest'], ['class' => 'form-control']);?>
</div>
</div>
<div class="form-group" id="uploader">
<label class="col-sm-3 control-label">头图: <span class="asterisk">*</span></label>
<div class="col-sm-9">
<?=$uploader?>
</div>
</div>
</div><!-- row -->
</div><!-- panel-body -->
<div class="panel-footer">
<div class="row">
<div class="col-sm-9 col-sm-offset-3">
<button class="btn btn-primary mr5" id="upload_button">保存</button>
<a href="<?=$_refer?>" class="btn btn-dark">取消</a>
</div>
</div>
</div><!-- panel-footer -->
</div><!-- panel -->
</form>
</div>
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace common\widgets;
namespace backend\widgets;
use Yii;
... ...
<?php
namespace backend\widgets;
use yii\widgets\LinkPager as yiiLinkPager;
class LinkPager extends yiiLinkPager
{
/**
* Renders the page buttons.
* @return string the rendering result
*/
protected function renderPageButtons()
{
$pageCount = $this->pagination->getPageCount();
if ($pageCount < 2 && $this->hideOnSinglePage) {
return '';
}
$currentPage = $this->pagination->getPage();
return $this->render('yoho',[
'total_pages'=>$pageCount,
'current_first_item'=>$this->pagination->getOffset()+1,
'current_last_item'=>$this->pagination->getOffset()+$this->pagination->getPageSize(),
'total_items'=>$this->pagination->totalCount,
'current_page'=>$currentPage+1,
'page'=>$this->pagination,
]);
}
}
... ...
<?php
use yii\helpers\Html;
/*
First Previous 1 2 3 ... 22 23 24 25 26 [27] 28 29 30 31 32 ... 48 49 50 Next Last
*/
// Number of page links in the begin and end of whole range
$count_out = 2;
// Number of page links on each side of current page
$count_in = 2;
// Beginning group of pages: $n1...$n2
$n1 = 1;
$n2 = min($count_out, $total_pages);
// Ending group of pages: $n7...$n8
$n7 = max(1, $total_pages - $count_out + 1);
$n8 = $total_pages;
// Middle group of pages: $n4...$n5
$n4 = max($n2 + 1, $current_page - $count_in);
$n5 = min($n7 - 1, $current_page + $count_in);
$use_middle = ($n5 >= $n4);
// Point $n3 between $n2 and $n4
$n3 = (int) (($n2 + $n4) / 2);
$use_n3 = ($use_middle && (($n4 - $n2) > 1));
// Point $n6 between $n5 and $n7
$n6 = (int) (($n5 + $n7) / 2);
$use_n6 = ($use_middle && (($n7 - $n5) > 1));
// Links to display as array(page => content)
$links = array();
// Generate links data in accordance with calculated numbers
for ($i = $n1; $i <= $n2; $i++)
{
$links[$i] = $i;
}
if ($use_n3)
{
$links[$n3] = '&hellip;';
}
for ($i = $n4; $i <= $n5; $i++)
{
$links[$i] = $i;
}
if ($use_n6)
{
$links[$n6] = '&hellip;';
}
for ($i = $n7; $i <= $n8; $i++)
{
$links[$i] = $i;
}
?>
<?php
$length = isset($_COOKIE['paginationLength'])?$_COOKIE['paginationLength']:10;
if ($_POST && isset($_POST['paginationLength'])){
setcookie('paginationLength',$_POST['paginationLength']);
$length = $_POST['paginationLength'];
}
?>
<form action="" method="post" id="paginationForm">
<div class="colgroup">
<div class="width3 column first"><p>
每页 <?php echo Html::dropDownList('paginationLength',$length,array('10'=>10,'20'=>20,'40'=>40),array('id'=>'paginationSelect','style'=>'height:24px;font-size:12px;'))?>
&nbsp;&nbsp;
<b><?php echo $current_first_item?>-<?php echo $current_last_item?></b> 项 总共 <b><?php echo $total_items?></b>
</p></div>
<div class="width3 column">
<p class="pagination ta-right">
<?php if ($current_page !== 1): ?>
<a href="<?php echo $page->createUrl(0) ?>">«</a>
<?php else: ?>
<span style="color:#CCCCCC;padding:2px 6px;">«</span>
<?php endif ?>
<?php foreach ($links as $number => $content): ?>
<?php if ($number === $current_page): ?>
<a href="javascript:void(0)" class="pagination-active"><?php echo $content ?></a>
<?php else: ?>
<a href="<?php echo $page->createUrl($number-1) ?>"><?php echo $content ?></a>
<?php endif ?>
<?php endforeach ?>
<?php if ($current_page !== $total_pages): ?>
<a href="<?php echo $page->createUrl($total_pages-1) ?>">»</a>
<?php else: ?>
<span style="color:#CCCCCC;padding:2px 6px;">»</span>
<?php endif ?>
</p>
</div>
</div>
<?php echo Html::hiddenInput(Yii::$app->getRequest()->csrfParam, Yii::$app->getRequest()->getCsrfToken());?>
</form>
<div class="clearfix"></div>
<hr />
<script type="text/javascript">
<!--
document.getElementById('paginationSelect').onchange = function(){
document.getElementById('paginationForm').submit();
};
//-->
</script>
\ No newline at end of file
... ...
<?php
/*
First Previous 1 2 3 ... 22 23 24 25 26 [27] 28 29 30 31 32 ... 48 49 50 Next Last
*/
// Number of page links in the begin and end of whole range
$count_out = 2;
// Number of page links on each side of current page
$count_in = 2;
// Beginning group of pages: $n1...$n2
$n1 = 1;
$n2 = min($count_out, $total_pages);
// Ending group of pages: $n7...$n8
$n7 = max(1, $total_pages - $count_out + 1);
$n8 = $total_pages;
// Middle group of pages: $n4...$n5
$n4 = max($n2 + 1, $current_page - $count_in);
$n5 = min($n7 - 1, $current_page + $count_in);
$use_middle = ($n5 >= $n4);
// Point $n3 between $n2 and $n4
$n3 = (int) (($n2 + $n4) / 2);
$use_n3 = ($use_middle && (($n4 - $n2) > 1));
// Point $n6 between $n5 and $n7
$n6 = (int) (($n5 + $n7) / 2);
$use_n6 = ($use_middle && (($n7 - $n5) > 1));
// Links to display as array(page => content)
$links = array();
// Generate links data in accordance with calculated numbers
for ($i = $n1; $i <= $n2; $i++)
{
$links[$i] = $i;
}
if ($use_n3)
{
$links[$n3] = '&hellip;';
}
for ($i = $n4; $i <= $n5; $i++)
{
$links[$i] = $i;
}
if ($use_n6)
{
$links[$n6] = '&hellip;';
}
for ($i = $n7; $i <= $n8; $i++)
{
$links[$i] = $i;
}
?>
<span><?php echo $total_items?>条记录</span>
<ul class="pagination pagination-metro pagination-split nomargin">
<?php if ($current_page !== 1): ?>
<li><a href="<?php echo $page->createUrl(0) ?>"><i class="fa fa-angle-left"></i></a></li>
<?php else: ?>
<li class="disabled"><a href="javascript:;"><i class="fa fa-angle-left"></i></a></li>
<?php endif ?>
<?php foreach ($links as $number => $content): ?>
<?php if ($number === $current_page): ?>
<li class="active"><a href="javascript:void(0)"><?php echo $content ?></a></li>
<?php else: ?>
<li><a href="<?php echo $page->createUrl($number-1) ?>"><?php echo $content ?></a></li>
<?php endif ?>
<?php endforeach ?>
<?php if ($current_page !== $total_pages): ?>
<li><a href="<?php echo $page->createUrl($total_pages-1) ?>"><i class="fa fa-angle-right"></i></a></li>
<?php else: ?>
<li class="disabled"><a href="javascript:;"><i class="fa fa-angle-right"></i></a></li>
<?php endif ?>
</ul>
\ No newline at end of file
... ...
... ... @@ -12,5 +12,13 @@ return [
'password' => '',
'charset' => 'utf8',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<controller:\w+>/<action:\w+>/<id:[\d-]+>' => '<controller>/<action>',
],
],
],
'defaultRoute'=>'index/index',
];
... ...
... ... @@ -3,4 +3,23 @@ return [
'adminEmail' => 'admin@example.com',
'supportEmail' => 'support@example.com',
'user.passwordResetTokenExpire' => 3600,
'config'=>[
'best'=>[
0=>'否',
1=>'精选1',
2=>'精选2',
],
'vest'=>[
0=>'关闭',
1=>'最慢',
2=>'一般',
3=>'最快'
],
'room_status'=>[
0=>'未开始',
1=>'直播中',
],
],
];
... ...