tablePrefix ='tab_'; /* 执行构造方法 */ parent::__construct($name, $tablePrefix, $connection); } public function sw_add($add_data=array()){ $data = array( 'account' => $add_data['account'], 'password' => $add_data['password'], 'sw_name' => $add_data['sw_name'], 'phone' => $add_data['phone'], 'qq' => $add_data['qq'], 'inferiors' => $add_data['inferiors'], 'status' => $add_data['status'], 'create_time' => NOW_TIME, // 'admin_id'=>0, ); /* 添加用户 */ $result = $this->create($data); if($result){ $uid = $this->add(); return $uid ? $uid : 0; //0-未知错误,大于0-注册成功 } else { return $this->getError(); //错误详情见自动验证注释 } } /** * 创建时间不写则取当前时间 * @return int 时间戳 * @author huajie */ protected function getCreateTime(){ $create_time = I('post.create_time'); return $create_time?strtotime($create_time):NOW_TIME; } }