作者 郭盛
1 个管道 的构建 通过 耗费 1 秒

新增置顶功能

... ... @@ -111,14 +111,15 @@ class Teacher extends Backend
->find();
Db::name('user')->where('id',$teacher['user_id'])->update(['identity'=>2]);
}
// $params['level'] = ($params['help_num'] * 5)/$params['help_num'];
if($params['is_recommend'] == 1){
$params['level'] = ($params['help_num'] * 5)/$params['help_num'];
if($params['is_stick'] == 1){
$teacher_list = Db::name('teacher')
->where('status',1)
->where('is_recommend',1)
->where('is_stick',1)
->count();
if($teacher_list >= 3){
$this->error('已有三个推荐老师,请重新选择');
$this->error('已有三个置顶老师');
}
}
$result = false;
... ...
... ... @@ -114,6 +114,12 @@
{:build_radios('row[is_recommend]', ['0'=>__('不推荐'), '1'=>__('推荐')], $row['is_recommend'])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('是否置顶')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[is_stick]', ['0'=>__('不置顶'), '1'=>__('置顶')], $row['is_stick'])}
</div>
</div>
<!--<div class="form-group">-->
<!--<label class="control-label col-xs-12 col-sm-2">{:__('Territory_id')}:</label>-->
<!--<div class="col-xs-12 col-sm-8">-->
... ...
... ... @@ -244,6 +244,7 @@ class Index extends Api
->where('status',1)
->where('is_recommend',1)
->field('status,updatetime',true)
->order('is_stick desc')
->page($page,$pageNum)
->select();
}else{
... ... @@ -285,12 +286,14 @@ class Index extends Api
->whereOr('honor','Like',"%$keyword%")
->whereOr('user_id','In',$territory)
->field('status,updatetime',true)
->order('is_stick desc')
->page($page,$pageNum)
->select();
}else{
$data = Db::name('teacher')
->where('status',1)
->field('status,updatetime',true)
->order('is_stick desc')
->page($page,$pageNum)
->select();
}
... ...
... ... @@ -9412,7 +9412,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-03-18 10:55:18 </div>
Generated on 2020-03-18 11:23:28 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...
... ... @@ -39,6 +39,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'online', title: __('Online'), operate:false},
{field: 'status', title: __('Status'),formatter: Table.api.formatter.status,searchList:{'0':'待审核','1': '审核通过','2':'审核未通过'}},
{field: 'is_recommend', title: __('Is_recommend'),formatter: Table.api.formatter.toggle,yes:'1',no:'0',searchList:{'0': '不推荐','1':'推荐'}},
{field: 'is_stick', title: __('是否置顶'),formatter: Table.api.formatter.status,searchList:{'0':'不置顶','1': '置顶'}},
{field: 'territory_id', title: __('Territory_id'), operate:false},
// {field: 'help_num', title: __('Help_num'), operate:false},
// {field: 'level', title: __('Level'), operate:false},
... ...