作者 jinglong
1 个管道 的构建 通过 耗费 8 秒

修改bug

... ... @@ -35,12 +35,34 @@ class Dashboard extends Backend
$config = Config::get("composer");
$addonVersion = isset($config['version']) ? $config['version'] : __('Unknown');
//查询订单数量
$order_total = Db::name('order')->useSoftDelete('deletetime')->count();
$status = config('verify.status');
//查询订单待发货数
$delivery = $this->orderNumber(['status'=>$status[2]]);
//待退换货订单数
$return_flag = $this->orderNumber(['status'=>$status[6]]);
//待退款订单数
$refund_flag = $this->orderNumber(['status'=>$status[3]]);
//今日销售额
$today_sales = Db::name('order')->where(['status'=>['not in',[$status[0],$status[1],$status[4]]]])->whereTime('paytime','today')->useSoftDelete('deletetime')->sum('total_price');
//今日订单数
$today_order = Db::name('order')->whereTime('createtime','today')->useSoftDelete('deletetime')->count();
//今日下单人数
$today_person_order = Db::name('order')->where(['status'=>['>=',$status[2]]])->whereTime('paytime','today')->useSoftDelete('deletetime')->group('uid')->count();
//今日访客数
$type = config('verify.browse_type');
$today_person_browse = Db::name('statistics')->where(['type'=>$type[0]])->whereTime('createtime','day')->group('uid')->count();
//今日商品浏览量
$today_goods_browser = Db::name('statistics')->where(['type'=>$type[1]])->whereTime('createtime','day')->count();
//今日商品收藏量
$today_goods_collection = Db::name('statistics')->where(['type'=>$type[2]])->whereTime('createtime','day')->count();
$this->view->assign([
'totaluser' => 35200,
'totalviews' => 219390,
'totalorder' => $order_total,
'totalorder' => 1000,
'totalorderamount' => 174800,
'todayuserlogin' => 321,
'todayusersignup' => 430,
... ... @@ -51,10 +73,32 @@ class Dashboard extends Backend
'paylist' => $paylist,
'createlist' => $createlist,
'addonversion' => $addonVersion,
'uploadmode' => $uploadmode
'uploadmode' => $uploadmode,
'delivery' => $delivery,//待发货数
'return_flag' => $return_flag,//待退换货订单数
'refund_flag' => $refund_flag,//待退款订单数
'today_sales' => number_format($today_sales,'2'),//今日销售额
'today_order' => $today_order,//今日订单数
'today_person_order' => $today_person_order,//今日下单人数
'today_person_browse' => $today_person_browse??'0',//今日访客数
'today_goods_browser' => $today_goods_browser??'0',//今日商品浏览量
'today_goods_collection' => $today_goods_collection??'0',//今日商品收藏量
]);
return $this->view->fetch();
}
public function orderNumber($where){
$count = Db::name('order')
->where($where)
->useSoftDelete('deletetime')
->count();
return $count;
}
}
... ...
... ... @@ -33,8 +33,19 @@ class Ggoods extends Backend
}
$this->assign('gtype',$arr);
//品牌分类名称
$res = Db::name('btype')->field('id,name,address')->select();
$arr = [];
foreach($res as $value){
$arr[$value['id']] = $value['name'].'------'.$value['address'];
}
$this->assign('btype',$arr);
//商品标识
$this->assign('flag',[1=>'推荐',2=>'设计师作品',3=>'新人特惠']);
//商品分类
$this->assign('g_type',[1=>'品类',2=>'品牌',3=>'全部']);
}
/**
... ... @@ -132,10 +143,47 @@ class Ggoods extends Backend
$params['is_new'] = 0;
}
$params['type'] = 0;
$res = Db::name('gtype')->where('id',$params['t_id'])->field('id,name')->find();
$params['type_name'] = $res['name'];
$result = $this->model->allowField(true)->save($params);
//处理商品分类逻辑
$g_type = $params['g_type'];
if($g_type == 1){
//品类,销毁商品分类变量,品牌分类字段
unset($params['g_type'],$params['b_id']);
$params['type'] = 0;
$res = Db::name('gtype')->where('id',$params['t_id'])->field('id,name')->find();
$params['type_name'] = $res['name'];
$result = $this->model->allowField(true)->save($params);
}else if($g_type == 2){
//品牌,销毁商品分类变量,品类分类,品牌分类字段
$params['t_id'] = $params['b_id'];
unset($params['g_type'],$params['b_id']);
$params['type'] = 1;
$res = Db::name('btype')->where('id',$params['t_id'])->field('id,name')->find();
$params['type_name'] = $res['name'];
$result = $this->model->allowField(true)->save($params);
}else{
//全部
unset($params['g_type']);
//品类
$same_time = time();
$arr = [];
$arr[0] = $params;
$arr[0]['type'] = 0;
$res = Db::name('gtype')->where('id',$params['t_id'])->field('id,name')->find();
$arr[0]['type_name'] = $res['name'];
$arr[0]['same'] = $same_time;
//品牌
$arr[1] = $params;
$arr[1]['type'] = 1;
$arr[1]['t_id'] = $params['b_id'];
$res1 = Db::name('btype')->where('id',$params['t_id'])->field('id,name')->find();
$arr[1]['type_name'] = $res1['name'];
$arr[1]['same'] = $same_time;
$result = $this->model->allowField(true)->saveAll($arr);
}
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
... ... @@ -208,9 +256,31 @@ class Ggoods extends Backend
$params['is_new'] = 0;
}
$res = Db::name('gtype')->where('id',$params['t_id'])->field('id,name')->find();
$params['type_name'] = $res['name'];
$result = $row->allowField(true)->save($params);
//查询是否为相同的商品
$res1 = Db::name('goods')->where(['id'=>$ids])->field('id,same')->find();
if($res1['same'] == 0){
$res = Db::name('gtype')->where('id',$params['t_id'])->field('id,name')->find();
$params['type_name'] = $res['name'];
$result = $row->allowField(true)->save($params);
}else{
//更新品类商品,也更相同的品牌商品
$arr = [];
$arr[0] = $params;
$arr[0]['id'] = $ids;
$res = Db::name('gtype')->where('id',$params['t_id'])->field('id,name')->find();
$arr[0]['type_name'] = $res['name'];
//品牌
$count = Db::name('goods')->where(['same'=>$res1['same']])->useSoftDelete('deletetime')->count();
if($count == 2){
$res2 = Db::name('goods')->where(['same'=>$res1['same']])->field('id,type,type_name,t_id')->order('id desc')->find();
$arr[1] = $params;
$arr[1]['id'] = $res2['id'];
$arr[1]['type'] = $res2['type'];
$arr[1]['type_name'] = $res2['type_name'];
$arr[1]['t_id'] = $res2['t_id'];
}
$result = $this->model->allowField(true)->saveAll($arr);
}
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
... ...
... ... @@ -206,10 +206,31 @@ class Goods extends Backend
}else{
$params['is_new'] = 0;
}
$res = Db::name('btype')->where('id',$params['t_id'])->field('id,name')->find();
$params['type_name'] = $res['name'];
$result = $row->allowField(true)->save($params);
//查询是否为相同的商品
$res1 = Db::name('goods')->where(['id'=>$ids])->field('id,same')->find();
if($res1['same'] == 0){
$res = Db::name('btype')->where('id',$params['t_id'])->field('id,name')->find();
$params['type_name'] = $res['name'];
$result = $row->allowField(true)->save($params);
}else{
//更新品牌商品,也更相同的品类商品
$arr = [];
$arr[0] = $params;
$arr[0]['id'] = $ids;
$res = Db::name('btype')->where('id',$params['t_id'])->field('id,name')->find();
$arr[0]['type_name'] = $res['name'];
//品类
$count = Db::name('goods')->where(['same'=>$res1['same']])->useSoftDelete('deletetime')->count();
if($count == 2){
$res2 = Db::name('goods')->where(['same'=>$res1['same']])->field('id,type,type_name,t_id')->order('id asc')->find();
$arr[1] = $params;
$arr[1]['id'] = $res2['id'];
$arr[1]['type'] = $res2['type'];
$arr[1]['type_name'] = $res2['type_name'];
$arr[1]['t_id'] = $res2['t_id'];
}
$result = $this->model->allowField(true)->saveAll($arr);
}
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
... ...
... ... @@ -4,10 +4,13 @@ return [
'Id' => 'ID',
'Flag' => '商品标识',
'T_id' => '品类分类',
'B_id' => '品牌分类',
'G_type' => '商品分类',
'File' => '商品视频',
'Name' => '商品名称',
'Name_en' => '商品名称(英文)',
'Image' => '商品图片',
'Images' => '商品轮播图片',
'New_price' => '新人价格',
'Sale_price' => '销售价格',
'Market_price' => '市场价格',
... ...
... ... @@ -8,6 +8,7 @@ return [
'Name' => '商品名称',
'Name_en' => '商品名称(英文)',
'Image' => '商品图片',
'Images' => '商品轮播图片',
'New_price' => '新人价格',
'Sale_price' => '销售价格',
'Market_price' => '市场价格',
... ...
... ... @@ -37,19 +37,19 @@
<!--</a>-->
<!--</li>-->
<!--&lt;!&ndash; 清除缓存 &ndash;&gt;-->
<!--<li>-->
<!--<a href="javascript:;" data-toggle="dropdown" title="{:__('Wipe cache')}">-->
<!--<i class="fa fa-trash"></i>-->
<!--</a>-->
<!--<ul class="dropdown-menu wipecache">-->
<!--<li><a href="javascript:;" data-type="all"><i class="fa fa-trash"></i> {:__('Wipe all cache')}</a></li>-->
<!--<li class="divider"></li>-->
<!--<li><a href="javascript:;" data-type="content"><i class="fa fa-file-text"></i> {:__('Wipe content cache')}</a></li>-->
<!--<li><a href="javascript:;" data-type="template"><i class="fa fa-file-image-o"></i> {:__('Wipe template cache')}</a></li>-->
<!--<li><a href="javascript:;" data-type="addons"><i class="fa fa-rocket"></i> {:__('Wipe addons cache')}</a></li>-->
<!--</ul>-->
<!--</li>-->
<!-- 清除缓存 -->
<li>
<a href="javascript:;" data-toggle="dropdown" title="{:__('Wipe cache')}">
<i class="fa fa-trash"></i>
</a>
<ul class="dropdown-menu wipecache">
<li><a href="javascript:;" data-type="all"><i class="fa fa-trash"></i> {:__('Wipe all cache')}</a></li>
<li class="divider"></li>
<li><a href="javascript:;" data-type="content"><i class="fa fa-file-text"></i> {:__('Wipe content cache')}</a></li>
<li><a href="javascript:;" data-type="template"><i class="fa fa-file-image-o"></i> {:__('Wipe template cache')}</a></li>
<li><a href="javascript:;" data-type="addons"><i class="fa fa-rocket"></i> {:__('Wipe addons cache')}</a></li>
</ul>
</li>
<!-- 多语言列表 -->
{if $Think.config.lang_switch_on}
... ...
... ... @@ -140,42 +140,91 @@
<div class="tab-pane fade active in" id="one">
<div class="row">
<!--<div class="col-sm-3 col-xs-6">-->
<!--<div class="sm-st clearfix">-->
<!--<span class="sm-st-icon st-red"><i class="fa fa-users"></i></span>-->
<!--<div class="sm-st-info">-->
<!--<span>{$totaluser}</span>-->
<!--{:__('Total user')}-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="col-sm-3 col-xs-6">-->
<!--<div class="sm-st clearfix">-->
<!--<span class="sm-st-icon st-violet"><i class="fa fa-book"></i></span>-->
<!--<div class="sm-st-info">-->
<!--<span>{$totalviews}</span>-->
<!--{:__('Total view')}-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="col-sm-3 col-xs-6">
<div class="col-sm-4 col-xs-6">
<div class="sm-st clearfix">
<span class="sm-st-icon st-blue"><i class="fa fa-shopping-bag"></i></span>
<span class="sm-st-icon st-red"><i class="fa fa-users"></i></span>
<div class="sm-st-info">
<span>{$totalorder}</span>
{:__('Total order')}
<span>{$delivery}</span>
待发货数
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="sm-st clearfix">
<span class="sm-st-icon st-red"><i class="fa fa-shopping-bag"></i></span>
<div class="sm-st-info">
<span>{$return_flag}</span>
待退换货订单数
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="sm-st clearfix">
<span class="sm-st-icon st-red"><i class="fa fa-users"></i></span>
<div class="sm-st-info">
<span>{$refund_flag}</span>
待退款订单数
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="sm-st clearfix">
<span class="sm-st-icon st-red"><i class="fa fa-cny"></i></span>
<div class="sm-st-info">
<span>{$today_sales}</span>
今日销售额
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="sm-st clearfix">
<span class="sm-st-icon st-red"><i class="fa fa-shopping-bag"></i></span>
<div class="sm-st-info">
<span>{$today_order}</span>
今日订单数
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="sm-st clearfix">
<span class="sm-st-icon st-red"><i class="fa fa-users"></i></span>
<div class="sm-st-info">
<span>{$today_person_order}</span>
今日下单人数
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="sm-st clearfix">
<span class="sm-st-icon st-red"><i class="fa fa-users"></i></span>
<div class="sm-st-info">
<span>{$today_person_browse}</span>
今日访客数
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="sm-st clearfix">
<span class="sm-st-icon st-red"><i class="fa fa-shopping-bag"></i></span>
<div class="sm-st-info">
<span>{$today_goods_browser}</span>
今日商品浏览量
</div>
</div>
</div>
<div class="col-sm-4 col-xs-6">
<div class="sm-st clearfix">
<span class="sm-st-icon st-red"><i class="fa fa-users"></i></span>
<div class="sm-st-info">
<span>{$today_goods_collection}</span>
今日商品收藏量
</div>
</div>
</div>
<!--<div class="col-sm-3 col-xs-6">-->
<!--<div class="sm-st clearfix">-->
<!--<span class="sm-st-icon st-green"><i class="fa fa-cny"></i></span>-->
<!--<div class="sm-st-info">-->
<!--<span>{$totalorderamount}</span>-->
<!--{:__('Total order amount')}-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
</div>
<!--<div class="row">-->
... ...
<style>
.goods_type{
display: none;
}
.band_type{
display: none;
}
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('G_type')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[g_type]', $g_type,1, ['class'=>'form-control', 'required'=>''])}
</div>
</div>
<div class="form-group goods_type">
<label class="control-label col-xs-12 col-sm-2">{:__('T_id')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_select('row[t_id]', $gtype, null, ['class'=>'form-control', 'required'=>''])}
</div>
</div>
<div class="form-group band_type">
<label class="control-label col-xs-12 col-sm-2">{:__('B_id')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_select('row[b_id]', $btype, null, ['class'=>'form-control', 'required'=>''])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Flag')}:</label>
<div class="col-xs-12 col-sm-8">
... ... @@ -16,7 +37,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('File')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-file" data-rule="required" class="form-control" size="50" name="row[file]" type="text" placeholder="请上传视频">
<input id="c-file" class="form-control" size="50" name="row[file]" type="text" placeholder="请上传视频">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-file" class="btn btn-danger plupload" data-input-id="c-file" data-multiple="false" data-preview-id="p-file"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-file" class="btn btn-primary fachoose" data-input-id="c-file" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
... ... @@ -54,6 +75,21 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-images"></ul>
<span style="color:red;">图片尺寸:750*750</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sale_price" data-rule="required" class="form-control" name="row[sale_price1]" type="text" placeholder="请输入商品销售价格(多个以'|'隔开)">
... ... @@ -115,3 +151,30 @@
</div>
</div>
</form>
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script>
$(function(){
var value1 = $('input[type=radio]:checked').val();
type(value1);
$('input[type=radio]').change(function () {
var value = $(this).val();
type(value);
});
});
function type(value){
if(value == 1){
//品类显示,品牌隐藏
$('.goods_type').css('display','block');
$('.band_type').css('display','none');
}else if(value == 2){
//品类隐藏,品牌显示
$('.goods_type').css('display','none');
$('.band_type').css('display','block');
}else if(value == 3){
//品类显示,品牌显示
$('.goods_type').css('display','block');
$('.band_type').css('display','block');
}
}
</script>
... ...
... ... @@ -16,7 +16,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('File')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-file" data-rule="required" class="form-control" size="50" name="row[file]" type="text" value="{$row.file|htmlentities}" placeholder="请上传视频">
<input id="c-file" class="form-control" size="50" name="row[file]" type="text" value="{$row.file|htmlentities}" placeholder="请上传视频">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-file" class="btn btn-danger plupload" data-input-id="c-file" data-multiple="false" data-preview-id="p-file"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-file" class="btn btn-primary fachoose" data-input-id="c-file" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
... ... @@ -54,6 +54,21 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-images"></ul>
<span style="color:red;">图片尺寸:750*750</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sale_price" data-rule="required" class="form-control" name="row[sale_price1]" type="text" value="{$row.sale_price1|htmlentities}" placeholder="请输入商品销售价格(多个以'|'隔开)">
... ...
... ... @@ -16,7 +16,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('File')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-file" data-rule="required" class="form-control" size="50" name="row[file]" type="text" placeholder="请上传视频">
<input id="c-file" class="form-control" size="50" name="row[file]" type="text" placeholder="请上传视频">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-file" class="btn btn-danger plupload" data-input-id="c-file" data-multiple="false" data-preview-id="p-file"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-file" class="btn btn-primary fachoose" data-input-id="c-file" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
... ... @@ -54,6 +54,21 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-images"></ul>
<span style="color:red;">图片尺寸:750*750</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sale_price" data-rule="required" class="form-control" name="row[sale_price1]" type="text" placeholder="请输入商品销售价格(多个以'|'隔开)">
... ...
... ... @@ -16,7 +16,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('File')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-file" data-rule="required" class="form-control" size="50" name="row[file]" type="text" value="{$row.file|htmlentities}" placeholder="请上传视频">
<input id="c-file" class="form-control" size="50" name="row[file]" type="text" value="{$row.file|htmlentities}" placeholder="请上传视频">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-file" class="btn btn-danger plupload" data-input-id="c-file" data-multiple="false" data-preview-id="p-file"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-file" class="btn btn-primary fachoose" data-input-id="c-file" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
... ... @@ -54,6 +54,21 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-images"></ul>
<span style="color:red;">图片尺寸:750*750</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sale_price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sale_price" data-rule="required" class="form-control" name="row[sale_price1]" type="text" value="{$row.sale_price1|htmlentities}" placeholder="请输入商品销售价格(多个以'|'隔开)">
... ...
... ... @@ -7,7 +7,7 @@
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('goods/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('goods/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('goods/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('goods/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('goods/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
... ...
... ... @@ -584,7 +584,7 @@ class Common
$status = config('verify.status');
//更新订单号成功
$orderModel = new Order();
$orderModel->where(['pay_order_sn'=>$out_trade_no,'status'=>$status[0]])->update(['status'=>$status[2]]);//待发货
$orderModel->where(['pay_order_sn'=>$out_trade_no,'status'=>$status[0]])->update(['status'=>$status[2],'pay_time'=>time()]);//待发货
//销量增加1
$res = self::findSoftWhereData('order',['pay_order_sn'=>$out_trade_no,'status'=>$status[2]],'id,uid,coupon_id');
if($res){
... ... @@ -648,4 +648,18 @@ class Common
}
return true;
}
/**
* @param $type (0:首页,1:商品浏览,2:商品收藏 )
* @param int $uid
* @param int $g_id
* @ApiInternal
*/
public static function statistics($type=0,$uid=0,$g_id=0){
$arr['type'] = $type;
$arr['uid'] = $uid;
$arr['g_id'] = $g_id;
$arr['createtime'] = time();
Db::name('statistics')->insert($arr);
}
}
... ...
... ... @@ -34,7 +34,9 @@ class Goods extends Api
"id": 1,//商品id
"type": 1,
"t_id": 1,
"file": "http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4",//视频路径
"file": [//视频路径,只有一个视频(无视频返回空数组)
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4",//视频路径
]
"image": "http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.jpg",//缩略图路径
"name": "MONENT 动感系列",//商品名称
"name_en": "Monent dynamic series",//商品名称(英文)
... ... @@ -63,13 +65,9 @@ class Goods extends Api
],//商品库存
"introduce": "轻波款,为客厅缀上霞光淡雾",//商品简介
"detail": "",//商品详情(富文本)
"frame": [//视频第一到第六帧图片(无视频返回空数组)
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/1",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/2",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/3",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/4",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/5",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/6"
"images": [//轮播图片
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.png",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.png",
],
"b_type": {//所属品牌(品类则返回空字符串)
"id": 1,//品牌id
... ... @@ -91,24 +89,19 @@ class Goods extends Api
$res = Common::findSoftWhereData('goods',['id'=>$goods_id],'type_name,is_design,is_recommend,sort,createtime,updatetime,deletetime,flag,hots,sales',true);
if($res){
if($res['file']){
//图片取视频帧
$frame = [];
for($i=1;$i<7;$i++){
$image_url = $this->auth->absolutionUrlOneFrame($res['file'],$i);
array_push($frame,$image_url);
}
$res['frame'] = $frame;
$res['file'] = $this->auth->absolutionUrlOne($res['file']);
}else{
$res['frame'] = [];
$res['file'] = '';
}
$res['style'] = explode('|',$res['style']);
$res['tag'] = explode('|',$res['tag']);
$res['sale_price'] = explode('|',$res['sale_price1']);
$res['stock'] = explode('|',$res['stock']);
$res['image'] = $this->auth->absolutionUrlOne($res['image']);
$res['images'] = $this->auth->absolutionUrl($res['images']);
if(!empty($res['file'])){
$res['file'] = [
$this->auth->absolutionUrlOne($res['file'])
];
}else{
$res['file'] = [];
}
//所属品牌分类
if($res['type'] == 1){
//查询所属品牌
... ... @@ -154,6 +147,10 @@ class Goods extends Api
$goodsModel->where(['id'=>$goods_id])->setInc('hots',1);
unset($res['is_new']);
//增加商品浏览数
$type = config('verify.browse_type')[1];
Common::statistics($type,$this->uid,$goods_id);
}
$this->success('成功',$res);
}else{
... ...
... ... @@ -79,6 +79,10 @@ class User extends Api
if ($ret) {
$data = $this->auth->getUserinfo();
$data['nickname'] = $this->auth->emoji_decode($data['nickname']);
//增加访客数
$type = config('verify.browse_type')[0];
Common::statistics($type,$this->uid);
$this->success('登录成功', $data);
}else {
$this->error($this->auth->getError());
... ... @@ -222,6 +226,10 @@ class User extends Api
if($res){
$goodsModel = new \app\admin\model\Goods();
$goodsModel->where(['id'=>$goods_id])->setInc('collections',1);
//增加商品收藏数
$type = config('verify.browse_type')[2];
Common::statistics($type,$this->uid,$goods_id);
$this->success('成功');
}else{
$this->error('失败');
... ...
... ... @@ -33,6 +33,8 @@ return [
'status' => [0,1,2,3,4,5,6,7,8,9,10],//0: 待付款, 1: 已取消,2: 待发货, 3: 退款申请中,4: 已退款, 5: 待收货,6: 退换货申请中, 7: 已退换货,8: 已完成,9:退换货驳回,10:退款申请驳回
//优惠券类型
'type' => [0,1,2],//0:全场,1:品牌,2:商品
//统计类型
'browse_type' => [0,1,2],//0:首页(个人中心),1:商品浏览,2:商品收藏
//分页数
'limit' => 10,
//商品分页
... ...
... ... @@ -2482,7 +2482,9 @@
"id": 1,//商品id
"type": 1,
"t_id": 1,
"file": "http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4",//视频路径
"file": [//视频路径,只有一个视频(无视频返回空数组)
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4",//视频路径
]
"image": "http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.jpg",//缩略图路径
"name": "MONENT 动感系列",//商品名称
"name_en": "Monent dynamic series",//商品名称(英文)
... ... @@ -2511,13 +2513,9 @@
],//商品库存
"introduce": "轻波款,为客厅缀上霞光淡雾",//商品简介
"detail": "",//商品详情(富文本)
"frame": [//视频第一到第六帧图片(无视频返回空数组)
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/1",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/2",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/3",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/4",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/5",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.mp4?vframe/jpg/offset/6"
"images": [//轮播图片
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.png",
"http://jinglong.springchunjia.cn/uploads/20191127/05d216e117e11bd3de352c155b42eaaa.png",
],
"b_type": {//所属品牌(品类则返回空字符串)
"id": 1,//品牌id
... ... @@ -7504,7 +7502,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2019-12-17 16:21:49 </div>
Generated on 2019-12-20 10:58:19 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...