多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# KtUser # ## 1. 修改任教科目 http://ketang.test/index.php?r=ktUser/setTeacherSubjects&subjects=1%2C2 ``` GET r: ktUser/setTeacherSubjects subjects: 1,2 ``` 代码: ``` /* * 设置教师任教科目 * @param $id * @param $subjects * @author chenxch 16/9/12 */ public function actionSetTeacherSubjects($subjects){ if(Yii::app()->request->isAjaxRequest){ $id = Yii::app()->user->id; $ret=array("result"=>0,"id"=>$id); $user = UserService::factory()->getUser($id); if($user->fdCardID){ Value::model()->deleteAllByAttributes(array('fdCardID'=>$user->fdCardID,'fdItemID'=>WK::TEACHER_SUBJECT)); $subjectNames = ''; $subjects = explode(',',$subjects); if($subjects){ foreach($subjects as $i=>$subject){ $subject && V2UserService::factory()->setTeacherSubject($id,$subject); $subject && $subjectNames .= ($i==0 ? Yii::app()->params['SUBJECT_ARR'][$subject] : ','.Yii::app()->params['SUBJECT_ARR'][$subject]); } } $ret["result"]=1; $ret['names']=$subjectNames; echo json_encode($ret); } } } ``` 表 wkads.tbValue