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

修改成为老师

@@ -75,11 +75,14 @@ class Teacher extends Api @@ -75,11 +75,14 @@ class Teacher extends Api
75 if (!$validate->check($param)) { 75 if (!$validate->check($param)) {
76 $this->error($validate->getError()); 76 $this->error($validate->getError());
77 } 77 }
78 - //接收所传入的擅长领域ID  
79 - $territory_id = explode(',',$param['territory_id']);  
80 - $count = count($territory_id);  
81 - if($count>4){  
82 - $this->error('最多添加4个擅长领域'); 78 + if(!empty($param['territory_id'])){
  79 + //接收所传入的擅长领域ID
  80 + $territory_id = explode(',',$param['territory_id']);
  81 + $count = count($territory_id);
  82 + if($count>4){
  83 + $this->error('最多添加4个擅长领域');
  84 + }
  85 + unset($param['territory_id']);
83 } 86 }
84 $qiniu = get_addon_config('qiniu'); 87 $qiniu = get_addon_config('qiniu');
85 $http = $qiniu['cdnurl']; 88 $http = $qiniu['cdnurl'];
@@ -87,7 +90,6 @@ class Teacher extends Api @@ -87,7 +90,6 @@ class Teacher extends Api
87 $param['behind'] = str_replace($http, '', $param['behind']); 90 $param['behind'] = str_replace($http, '', $param['behind']);
88 $param['thumbnail'] = str_replace($http, '', $param['thumbnail']); 91 $param['thumbnail'] = str_replace($http, '', $param['thumbnail']);
89 $param['createtime'] = time(); 92 $param['createtime'] = time();
90 - unset($param['territory_id']);  
91 $data = Db::name('teacher')->insertGetId($param); 93 $data = Db::name('teacher')->insertGetId($param);
92 if (empty($data)) { 94 if (empty($data)) {
93 $this->error('提交失败'); 95 $this->error('提交失败');
@@ -9412,7 +9412,7 @@ @@ -9412,7 +9412,7 @@
9412 9412
9413 <div class="row mt0 footer"> 9413 <div class="row mt0 footer">
9414 <div class="col-md-6" align="left"> 9414 <div class="col-md-6" align="left">
9415 - Generated on 2020-03-18 14:17:12 </div> 9415 + Generated on 2020-03-18 14:22:13 </div>
9416 <div class="col-md-6" align="right"> 9416 <div class="col-md-6" align="right">
9417 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a> 9417 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
9418 </div> 9418 </div>