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

修改新老师注册时候提醒

@@ -5,6 +5,7 @@ namespace app\admin\controller; @@ -5,6 +5,7 @@ namespace app\admin\controller;
5 use app\admin\model\AdminLog; 5 use app\admin\model\AdminLog;
6 use app\common\controller\Backend; 6 use app\common\controller\Backend;
7 use think\Config; 7 use think\Config;
  8 +use think\Db;
8 use think\Hook; 9 use think\Hook;
9 use think\Validate; 10 use think\Validate;
10 11
@@ -31,12 +32,17 @@ class Index extends Backend @@ -31,12 +32,17 @@ class Index extends Backend
31 */ 32 */
32 public function index() 33 public function index()
33 { 34 {
  35 + //查出所有待审核老师的个数
  36 + $data = Db::name('teacher')
  37 + ->where('status',0)
  38 + ->count();
34 //左侧菜单 39 //左侧菜单
35 list($menulist, $navlist, $fixedmenu, $referermenu) = $this->auth->getSidebar([ 40 list($menulist, $navlist, $fixedmenu, $referermenu) = $this->auth->getSidebar([
36 'dashboard' => 'hot', 41 'dashboard' => 'hot',
37 'addon' => ['new', 'red', 'badge'], 42 'addon' => ['new', 'red', 'badge'],
38 'auth/rule' => __('Menu'), 43 'auth/rule' => __('Menu'),
39 'general' => ['new', 'purple'], 44 'general' => ['new', 'purple'],
  45 + 'teacher' =>[$data,'red']
40 ], $this->view->site['fixedpage']); 46 ], $this->view->site['fixedpage']);
41 $action = $this->request->request('action'); 47 $action = $this->request->request('action');
42 if ($this->request->isPost()) { 48 if ($this->request->isPost()) {
@@ -23,6 +23,7 @@ class Teacher extends Backend @@ -23,6 +23,7 @@ class Teacher extends Backend
23 { 23 {
24 parent::_initialize(); 24 parent::_initialize();
25 $this->model = new \app\admin\model\Teacher; 25 $this->model = new \app\admin\model\Teacher;
  26 + $this->view->assign("statusList", $this->model->getStatusList());
26 27
27 } 28 }
28 29
@@ -120,9 +121,11 @@ class Teacher extends Backend @@ -120,9 +121,11 @@ class Teacher extends Backend
120 ->where('status',1) 121 ->where('status',1)
121 ->where('is_recommend',1) 122 ->where('is_recommend',1)
122 ->where('is_stick',1) 123 ->where('is_stick',1)
123 - ->count();  
124 - if($teacher_list >= 3){  
125 - $this->error('已有三个置顶老师'); 124 + ->column('id');
  125 + if(!in_array($ids,$teacher_list)){
  126 + if(count($teacher_list) >= 3){
  127 + $this->error('已有三个置顶老师');
  128 + }
126 } 129 }
127 } 130 }
128 $result = false; 131 $result = false;
@@ -27,9 +27,12 @@ class Teacher extends Model @@ -27,9 +27,12 @@ class Teacher extends Model
27 protected $append = [ 27 protected $append = [
28 'onlinetime_text' 28 'onlinetime_text'
29 ]; 29 ];
30 -  
31 30
32 - 31 +
  32 + public function getStatusList()
  33 + {
  34 + return ['0' => __('待审核'),'1' => __('审核通过'),'2'=>__('未通过')];
  35 + }
33 36
34 37
35 38
1 <div class="panel panel-default panel-intro"> 1 <div class="panel panel-default panel-intro">
2 - {:build_heading()} 2 + <div class="panel-heading">
  3 + {:build_heading(null,FALSE)}
  4 + <ul class="nav nav-tabs" data-field="status">
  5 + <li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
  6 + {foreach name="statusList" item="vo"}
  7 + <li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
  8 + {/foreach}
  9 + </ul>
  10 + </div>
3 11
4 <div class="panel-body"> 12 <div class="panel-body">
5 <div id="myTabContent" class="tab-content"> 13 <div id="myTabContent" class="tab-content">