Commit 73c38f6b by 杨树贤

添加商品ID的录入

parent 88242302
......@@ -91,7 +91,7 @@ class ArticleModel extends Model
public function ApiSaveArticle($AdminID){
$Arr=['art_id','top_type_id','type_id','title','flag','sort_order','art_type','start_review','title_seo','description','keyword','litpic',
'banner_flag','banner_title','banner_img','tag_tag_id','tag_tag','tag_url','tag_status','content','writer'];
'banner_flag','banner_title','banner_img','tag_tag_id','tag_tag','tag_url','tag_status','content','writer','goods_id'];
$collert=Request::only($Arr);
$collert=TrimX($collert,true,$Arr);
//先处理文章主表
......@@ -103,9 +103,8 @@ class ArticleModel extends Model
}
$ArticleArr=['top_type_id','type_id','title','description','keyword','sort_order','writer','title_seo','litpic',
'start_review','art_type','banner_flag','banner_title','banner_img'];
'start_review','art_type','banner_flag','banner_title','banner_img','goods_id'];
foreach ($ArticleArr as $k=>$v) $data[$v]=empty($collert[$v])?'':$collert[$v];
DB::connection($this->connection)->beginTransaction();
$ErrInfo=empty($collert['art_id'])?'新增':'编辑';
if(empty($collert['art_id'])){//新增
......@@ -171,7 +170,6 @@ class ArticleModel extends Model
//删除这一次没有更新的关联标签
$ArticleTagModel->where('art_id','=',$BodyData['art_id'])->where('update_time','<',$time)->update(['flag'=>1,'update_time'=>$time]);
DB::connection($this->connection)->commit();
PushThesaurus($BodyData['art_id']);
return [0,$ErrInfo.'成功'];
}
......
<style>
.layui-input-inline{
.layui-input-inline {
min-width: 280px;
}
.layui-upload-drag{
.layui-upload-drag {
padding: 0;
}
.red{
.red {
color: red;
}
</style>
......@@ -21,7 +23,9 @@
<option value=""></option>
@if(!empty($topTypes) && is_array($topTypes))
@foreach($topTypes as $k=>$v)
<option value="{{$k}}" {{ !empty($info['top_type_id']) && $info['top_type_id']==$k?'selected':'' }}>{{$v}}</option>
<option value="{{$k}}" {{ !empty($info['top_type_id']) && $info['top_type_id']==$k?'selected':'' }}>
{{$v}}
</option>
@endforeach
@endif
</select>
......@@ -33,7 +37,9 @@
<option value="">请选择顶级分类</option>
@if(!empty($secondTypes) && is_array($secondTypes))
@foreach($secondTypes as $k=>$v)
<option value="{{$k}}" {{ !empty($info['type_id']) && $info['type_id']==$k?'selected':'' }}>{{$v}}</option>
<option value="{{$k}}" {{ !empty($info['type_id']) && $info['type_id']==$k?'selected':'' }}>
{{$v}}
</option>
@endforeach
@endif
</select>
......@@ -41,27 +47,32 @@
<label class="layui-form-label"><span class="red">*</span>来源</label>
<div class="layui-input-inline">
<input type="text" name="writer" value="{{$info['writer'] or ''}}" required lay-verify="required" placeholder="请输入来源" autocomplete="off" class="layui-input">
<input type="text" name="writer" value="{{$info['writer'] or ''}}" required lay-verify="required"
placeholder="请输入来源" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="red">*</span>标题</label>
<div class="layui-input-inline" style="width: 51%">
<input type="text" name="title" value="{{$info['title'] or ''}}" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
<input type="text" name="title" value="{{$info['title'] or ''}}" required lay-verify="required"
placeholder="请输入标题" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">30个字符以内</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">资讯设置</label>
<div class="layui-input-inline">
<input type="checkbox" name="flag[a]" value="a" title="推荐" @if(!empty($info['flag']) && strpos($info['flag'],'a')!==false) checked @endif>
<input type="checkbox" name="flag[b]" value="b" title="热点" @if(!empty($info['flag']) && strpos($info['flag'],'b')>=0) checked @endif>
<input type="checkbox" name="flag[a]" value="a" title="推荐"
@if(!empty($info['flag']) && strpos($info['flag'],'a')!==false) checked @endif>
<input type="checkbox" name="flag[b]" value="b" title="热点"
@if(!empty($info['flag']) && strpos($info['flag'],'b')>=0) checked @endif>
</div>
<label class="layui-form-label"><span class="red">*</span>排序</label>
<div class="layui-input-inline">
<input type="text" name="sort_order" value="{{$info['sort_order'] or date('YmdH')}}" required lay-verify="required" placeholder="请输入排序" autocomplete="off" class="layui-input">
<input type="text" name="sort_order" value="{{$info['sort_order'] or date('YmdH')}}" required
lay-verify="required" placeholder="请输入排序" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">数字越大排序越靠前,默认当前时间</div>
</div>
......@@ -69,36 +80,50 @@
<div class="layui-form-item">
<label class="layui-form-label">文章类型</label>
<div class="layui-input-inline">
<input type="radio" name="art_type" value="1" title="原创" {{!empty($info['art_type']) && $info['art_type']==1?'checked':''}}>
<input type="radio" name="art_type" value="2" title="转载" {{!empty($info['art_type']) && $info['art_type']==2?'checked':''}}>
<input type="radio" name="art_type" value="3" title="网络整理" {{!empty($info['art_type']) && $info['art_type']==3?'checked':''}}>
<input type="radio" name="art_type" value="1"
title="原创" {{!empty($info['art_type']) && $info['art_type']==1?'checked':''}}>
<input type="radio" name="art_type" value="2"
title="转载" {{!empty($info['art_type']) && $info['art_type']==2?'checked':''}}>
<input type="radio" name="art_type" value="3"
title="网络整理" {{!empty($info['art_type']) && $info['art_type']==3?'checked':''}}>
</div>
<label class="layui-form-label"><span class="red">*</span>阅读量初始值</label>
<div class="layui-input-inline" style="width: 100px">
<input type="text" name="start_review" value="{{$info['start_review'] or rand(151,200)}}" required lay-verify="required" autocomplete="off" class="layui-input">
<input type="text" name="start_review" value="{{$info['start_review'] or rand(151,200)}}" required
lay-verify="required" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">(初始值为151~200 之间随机数值,发布文章5分钟后生效)</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="red">*</span>标题(SEO使用)</label>
<label class="layui-form-label"><span class="red">*</span>标题(SEO用)</label>
<div class="layui-input-inline" style="width: 51%">
<input type="text" name="title_seo" value="{{$info['title_seo'] or ''}}" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
<input type="text" name="title_seo" value="{{$info['title_seo'] or ''}}" required lay-verify="required"
placeholder="请输入标题" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">80个字符以内</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">商品ID</label>
<div class="layui-input-inline">
<input type="text" name="goods_id" value="{{$info['goods_id'] or ''}}" required
placeholder="案例想关联的商品ID" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">这个商品ID只有新增的文章顶级分类为案例的时候才去填写关联,其它类型的文章可以忽略</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">分类描述(SEO使用)</label>
<div class="layui-input-inline">
<textarea name="description" class="layui-textarea">{{$info['description'] or ''}}</textarea>
<textarea name="description" class="layui-textarea">{{$info['description'] or ''}}</textarea>
</div>
<div class="layui-form-mid layui-word-aux">80个字符以内</div>
<label class="layui-form-label">关键字(SEO使用)</label>
<div class="layui-input-inline">
<textarea name="keyword" class="layui-textarea">{{$info['keyword'] or ''}}</textarea>
<textarea name="keyword" class="layui-textarea">{{$info['keyword'] or ''}}</textarea>
</div>
<div class="layui-form-mid layui-word-aux">80个字符以内</div>
</div>
......@@ -106,7 +131,8 @@
<label class="layui-form-label"><span class="red">*</span>缩略图</label>
<div class="layui-input-inline">
<input type="hidden" name="litpic" value="{{$info['litpic'] or ''}}" id="litpic">
<div class="layui-upload-drag UploadImg" data-obj="litpic" preview="litpic-yl" id="litpic-yl" style="width:204px;height: 101px">
<div class="layui-upload-drag UploadImg" data-obj="litpic" preview="litpic-yl" id="litpic-yl"
style="width:204px;height: 101px">
@if(!empty($info['litpic']))
<img src="{{$info['litpic'] or ''}}" width="204" height="101">
@else
......@@ -119,30 +145,32 @@
<div class="layui-form-item">
<label class="layui-form-label">是否为banner图</label>
<div class="layui-input-block">
<input type="radio" name="banner_flag" value="2" title="是" {{!empty($info['banner_flag']) && $info['banner_flag']==2?'checked':''}}>
<input type="radio" name="banner_flag" value="1" title="否" {{empty($info['banner_flag']) || $info['banner_flag']==1?'checked':''}}>
<input type="radio" name="banner_flag" value="2"
title="是" {{!empty($info['banner_flag']) && $info['banner_flag']==2?'checked':''}}>
<input type="radio" name="banner_flag" value="1"
title="否" {{empty($info['banner_flag']) || $info['banner_flag']==1?'checked':''}}>
</div>
</div>
{{--<div class="layui-form-item">--}}
{{--<label class="layui-form-label">banner图标题</label>--}}
{{--<div class="layui-input-inline">--}}
{{--<input type="text" name="banner_title" value="{{$info['banner_title'] or ''}}" autocomplete="off" class="layui-input">--}}
{{--</div>--}}
{{--<div class="layui-form-mid layui-word-aux">限定20个字</div>--}}
{{--<label class="layui-form-label">banner图标题</label>--}}
{{--<div class="layui-input-inline">--}}
{{--<input type="text" name="banner_title" value="{{$info['banner_title'] or ''}}" autocomplete="off" class="layui-input">--}}
{{--</div>--}}
{{--<div class="layui-form-mid layui-word-aux">限定20个字</div>--}}
{{--<label class="layui-form-label">banner图</label>--}}
{{--<div class="layui-input-inline">--}}
{{--<input type="hidden" name="banner_img" value="{{$info['banner_img'] or ''}}" id="banner_img">--}}
{{--<div class="layui-upload-drag UploadImg" data-obj="banner_img" preview="banner_img-yl" id="banner_img-yl" style="width:204px;height: 101px">--}}
{{--@if(!empty($info['banner_img']))--}}
{{--<img src="{{$info['banner_img'] or ''}}" width="204" height="101">--}}
{{--@else--}}
{{--<i class="layui-icon"></i>--}}
{{--<p>点击上传,或将文件拖拽到此处</p>--}}
{{--@endif--}}
{{--</div>--}}
{{--</div>--}}
{{--<label class="layui-form-label">banner图</label>--}}
{{--<div class="layui-input-inline">--}}
{{--<input type="hidden" name="banner_img" value="{{$info['banner_img'] or ''}}" id="banner_img">--}}
{{--<div class="layui-upload-drag UploadImg" data-obj="banner_img" preview="banner_img-yl" id="banner_img-yl" style="width:204px;height: 101px">--}}
{{--@if(!empty($info['banner_img']))--}}
{{--<img src="{{$info['banner_img'] or ''}}" width="204" height="101">--}}
{{--@else--}}
{{--<i class="layui-icon"></i>--}}
{{--<p>点击上传,或将文件拖拽到此处</p>--}}
{{--@endif--}}
{{--</div>--}}
{{--</div>--}}
{{--</div>--}}
<div class="layui-form-item">
<label class="layui-form-label"><span class="red">*</span>内容</label>
......@@ -171,13 +199,16 @@
<tr>
<input type="hidden" name="tag_tag_id[]" value="{{$v['tag_id']}}">
<td style="text-align: center">
<input style="text-align: center" type="text" name="tag_tag[]" value="{{$v['tag'] or ''}}" class="layui-input tag-tag">
<input style="text-align: center" type="text" name="tag_tag[]"
value="{{$v['tag'] or ''}}" class="layui-input tag-tag">
</td>
<td style="text-align: center">
<input style="text-align: center" type="text" name="tag_url[]" value="{{$v['url'] or ''}}" class="layui-input tag-url">
<input style="text-align: center" type="text" name="tag_url[]"
value="{{$v['url'] or ''}}" class="layui-input tag-url">
</td>
<td style="text-align: center" class="tag-status">
<input type="checkbox" name="tag_status[]" title="新开页面" @if($v['status']==1) checked @endif>
<input type="checkbox" name="tag_status[]" title="新开页面"
@if($v['status']==1) checked @endif>
</td>
<td style="text-align: center">
<a class="layui-icon DeleteTag">&#xe640;</a>
......
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 sign in to comment