find('subject_id=:subject_id',array(':subject_id'=>$subjectId)); if($model){ return $model->style_type; }else{ $time = time(); $model = new self(); $model->subject_id = $subjectId; $model->style_type = 0; $model->update_time = $time; $model->create_time = $time; $model->save(); return 0; } } }