/** * 用户注册 * @param $mobile * @param $password * @return bool|int -1:帐号已存在 */ public function register($mobile, $password, $code, $name, $gender, $provId, $cityId, $areaId, $grade, $school) { if ($this->isUserExists($mobile)) { return Common_Error::ERROR_USER_EXISTS; } $errno = $this->checkCode($mobile, $code); if (true !== $errno) { return $errno; } $time = time(); $salt = rand(10000, 999999); $password = md5(md5($password . $salt)); $data = array('stuff_name' => $name, 'gender' => $gender, 'mobile' => $mobile, 'salt' => $salt, 'password' => $password, 'prov_id' => $provId, 'city_id' => $cityId, 'area_id' => $areaId, 'grade' => $grade, 'school' => $school); $tblUser = new DB_Howdo_User(); $uid = $tblUser->insert($data); if ($uid) { return $uid; } return Common_Error::ERROR_USER_REG; }