public function ClassChange() { if (IS_POST) { $data = array('id' => I('id'), 'classname' => I('name'), 'headmaster' => I('headmaster'), 'attendandate_id' => I('attendandate')); // 判断是否存在空字段 if (CheckFieldNotNull($data) == false) { echo GetResult(false, '有字段为空'); return; } // 入库 $id = D('Class')->ChangeClass($data); if ($id > 0) { echo GetResult(); } else { echo GetResult(false, '操作失败,数据未修改或系统繁忙'); } } }
public function CreateActivity($title, $content, $classid, $aid, $options = array()) { $data = array('activitytitle' => $title, 'activitycontent' => $content, 'user_id' => session('id'), 'class_id' => $classid, 'checkidetifier' => C('ACTIVITY_CHECK_DEFAULT')); trace($data); if (CheckFieldNotNull($data) == false) { return GetResult(false, '存在未填字段'); } $data = array_merge($data, $options); if ($aid == -1) { $id = $this->add($data); } else { $this->where('id=%d', $aid)->save($data); $id = $aid; } if ($id > 0) { return GetResult(true, '操作成功', array('id' => $id)); } else { return GetResult(false); } }