后台优化

master
秀才 11 months ago
parent 136ba653d7
commit feace51b5c
  1. 17
      application/admin/model/special/OfflineCourse.php
  2. 11
      application/admin/view/special/audio_video/add.php
  3. 17
      application/admin/view/special/image_text/add.php
  4. 13
      application/admin/view/special/special_single/add.php
  5. 35
      application/wap/controller/Store.php
  6. 9
      application/wap/model/store/StoreCategory.php

@ -38,6 +38,23 @@ class OfflineCourse extends ModelBasic
return compact('data', 'count');
}
public function getApplyStartTimeAttr($time)
{
return date("Y-m-d", $time);
}
public function getApplyEndTimeAttr($time)
{
return date("Y-m-d", $time);
}
public function getStartTimeAttr($time)
{
return date("Y-m-d", $time);
}
public function getEndTimeAttr($time)
{
return date("Y-m-d", $time);
}
public static function setWhere($where)
{
$model = new self();

@ -99,6 +99,11 @@
<div class="layui-form-mid layui-word-aux">输入标签名称后点击”+“号按钮添加;最多写入6个字;点击标签即可删除</div>
</div>
<div v-if="formData.label.length" class="layui-form-item">
<div class="layui-input-block">
<button v-for="(item,index) in formData.label" :key="index" type="button" class="layui-btn layui-btn-normal layui-btn-sm" @click="delLabel(index)">{{item}}</button>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">热门课程:</label>
<div class="layui-input-block">
@ -106,12 +111,6 @@
<input type="radio" name="is_hot" lay-filter="is_hot" v-model="formData.is_hot" value="1" title="是">
</div>
</div>
<div v-if="formData.label.length" class="layui-form-item">
<div class="layui-input-block">
<button v-for="(item,index) in formData.label" :key="index" type="button" class="layui-btn layui-btn-normal layui-btn-sm" @click="delLabel(index)">{{item}}</button>
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">专题封面:(250*140)</label>
<div class="layui-input-block">

@ -96,14 +96,6 @@
<div class="layui-form-mid layui-word-aux">输入标签名称后点击”+“号按钮添加;最多写入6个字;点击标签即可删除</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">热门课程:</label>
<div class="layui-input-block">
<input type="radio" name="is_hot" lay-filter="is_hot" v-model="formData.is_hot" value="0" title="否">
<input type="radio" name="is_hot" lay-filter="is_hot" v-model="formData.is_hot" value="1" title="是">
</div>
</div>
<div v-if="formData.label.length" class="layui-form-item">
<div class="layui-input-block">
<button v-for="(item,index) in formData.label" :key="index" type="button" class="layui-btn layui-btn-normal layui-btn-sm"
@ -112,6 +104,15 @@
</button>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">热门课程:</label>
<div class="layui-input-block">
<input type="radio" name="is_hot" lay-filter="is_hot" v-model="formData.is_hot" value="0" title="否">
<input type="radio" name="is_hot" lay-filter="is_hot" v-model="formData.is_hot" value="1" title="是">
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">专题封面:(250*140)</label>
<div class="layui-input-block">

@ -105,6 +105,13 @@
<div class="layui-form-mid layui-word-aux">输入标签名称后点击”+“号按钮添加;最多写入6个字;点击标签即可删除</div>
</div>
<div v-if="formData.label.length" class="layui-form-item">
<div class="layui-input-block">
<button v-for="(item,index) in formData.label" :key="index" type="button" class="layui-btn layui-btn-normal layui-btn-sm"
@click="delLabel(index)">{{item}}</button>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">热门课程:</label>
<div class="layui-input-block">
@ -113,12 +120,6 @@
</div>
</div>
<div v-if="formData.label.length" class="layui-form-item">
<div class="layui-input-block">
<button v-for="(item,index) in formData.label" :key="index" type="button" class="layui-btn layui-btn-normal layui-btn-sm"
@click="delLabel(index)">{{item}}</button>
</div>
</div>
<div class="layui-form-item required">
<label class="layui-form-label">专题封面:(250*140)</label>
<div class="layui-input-block">

@ -83,21 +83,38 @@ class Store extends AuthController
*/
public function getCategory()
{
$parentCategory = StoreCategory::pidByCategory(0, 'id,cate_name');
$parentCategory = count($parentCategory) > 0 ? $parentCategory->toArray() : [];
return JsonService::successful($parentCategory);
$cateogry = StoreCategory::with('children')->where(['is_show' => 1])->order('sort desc,id desc')->where('pid', 0)->select();
return JsonService::successful($cateogry->toArray());
}
/**商品列表
* @param string $keyword
* @param int $page
* @param int $limit
* @param int $cId
* @param int $first
* @param string $keyword
* @return null
*/
public function getProductList($page = 1, $limit = 8, $cId = 0, $keyword = '')
{
if (!empty($keyword)) $keyword = base64_decode(htmlspecialchars($keyword));
$model = StoreProduct::validWhere();
if (!empty($cId)) $model = $model->where('cate_id', $cId);
if (!empty($keyword)) $model->where('keyword|store_name', 'LIKE', "%$keyword%");
$model->order('sort DESC, add_time DESC');
$list = $model->page((int)$page, (int)$limit)->field('id,mer_id,store_name,image,sales,price,stock,IFNULL(sales,0) + IFNULL(ficti,0) as sales,keyword')->select();
$list = count($list) > 0 ? $list->toArray() : [];
return JsonService::successful($list);
}
/**商品推荐列表
* @param int $page
* @param int $limit
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @param int $cId
* @param string $keyword
* @return null
*/
public function getProductList($page = 1, $limit = 8, $cId = 0)
public function getRecommendProductList($page = 1, $limit = 8, $cId = 0, $keyword = '')
{
if (!empty($keyword)) $keyword = base64_decode(htmlspecialchars($keyword));
$model = StoreProduct::validWhere();

@ -46,4 +46,13 @@ class StoreCategory extends ModelBasic
return self::where('id', $cateId)->value('pid');
}
/**获取二级分类
* @return \think\model\relation\HasMany
*/
public function children()
{
return $this->hasMany('StoreCategory', 'pid', 'id')->where(['is_show' => 1])->order('sort DESC,id DESC');
}
}

Loading…
Cancel
Save