/** * * 获取定义字段数量,带键值输出 ... * @param unknown_type $id 可 直接为id 例如:1;也可以用 array('id'=>1);形式自定义参数 */ public function getMFcountAssoc($id) { $count = array(); $membersql = new membersql(); $membersql->setSelectField('mfcount'); $count = $membersql->detail($id, 'member_myset'); return $count; }
function show() { $membersql = new membersql(); $member_medal = new medal(); $medalnews = array(); $sql = 'SELECT * FROM ' . DB_PREFIX . 'medallog WHERE status=1 AND expiration>0 AND expiration<' . TIMENOW; $query = $this->db->query($sql); while ($row = $this->db->fetch_array($query)) { $medalnews[] = $row; } foreach ($medalnews as $medalnew) { $membersql->update('medallog', array('status' => 0), array('id' => $medalnew['id'])); $membersql->delete('member_medal', array('member_id' => $medalnew['member_id'], 'medalid' => $medalnew['medalid'])); $member_medal->update_used_num(array($medalnew['medalid']), '-'); } $ret = "更新了已经过期会员勋章"; $this->addItem($ret); $this->output(); }
public static function getMemberIdToSpreadCode($memberIds) { $idsArr = array('fuid' => $memberIds); $membersql = new membersql(); $membersql->setTable('spread_record'); $membersql->where($idsArr); $membersql->setSelectField('fuid,spreadcode'); $membersql->setType(4); $membersql->setKey('fuid'); $membersql->setOtherKey('spreadcode'); $row = $membersql->show(); return $row; }
private function getMemberIdForMI(array $params) { $membersql = new membersql(); $membersql->setTable('member'); $membersql->where($params); $membersql->setSelectField('member_id,identifier'); $membersql->setKey('member_id'); $membersql->setOtherKey('identifier'); return $membersql; }
/** * * 补充新浪绑定,QQ绑定等第三方绑定信息为正常M2O账号 ... * 目的是为了解决 新浪、QQ等第三方平台首次直接登陆系统后,资料信息不完善问题 */ public function supplementaryBindInfo() { try { $identifierUserSystem = new identifierUserSystem(); $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier(); //多用户系统 $member_name = $this->input['member_name']; $nick_name = $this->input['nick_name']; if (empty($member_name)) { $this->errorOutput(NO_MEMBER_NAME); } //如果是m2o注册类型屏蔽字检测 if ($this->settings['App_banword']) { include ROOT_PATH . 'lib/class/banword.class.php'; $banword = new banword(); $member_name_banword = $banword->exists($member_name); if ($member_name_banword && is_array($member_name_banword)) { $this->errorOutput(MEMBER_NAME_INVALID); } } switch ($this->mMember->verify_member_name($member_name, $user_id, $identifier)) { case -1: $this->errorOutput(MEMBER_NAME_ILLEGAL); break; case -2: $this->errorOutput(PROHIBITED_WORDS); break; case -3: $this->errorOutput(UC_MEMBER_NAME_REGISTER); break; case -4: $this->errorOutput(MEMBER_NAME_EXCEEDS_MAX); break; case -5: $this->errorOutput(USERNAME_BELOW_MINIMUM); break; case -6: $this->errorOutput(MEMBER_NAME_ERROR); break; case -7: $this->errorOutput(MEMBER_NAME_REGISTER); break; default: break; } $mobile_verifycode = trim($this->input['mobile_verifycode']); $email_verifycode = trim($this->input['email_verifycode']); $email = $this->input['email']; if (empty($email)) { $this->errorOutput(NO_EMAIL); } $reg_mail = $this->Members->check_reg_mail($email, 0, $identifier); if ($reg_mail == -4) { $this->errorOutput(EMAIL_FORMAT_ERROR); } elseif ($reg_mail == -5) { $this->errorOutput(EMAIL_NO_REGISTER); } elseif ($reg_mail == -6) { $this->errorOutput(EMAIL_HAS_BINDED); } if ($email && isset($this->input['email_verifycode'])) { if ($this->memberverifycode->get_verifycode_info($email, $email_verifycode, 1, $action = 1)) { //验证成功之后删除 $this->memberverifycode->verifycode_delete($member_name, $email_verifycode, 1, $action = 1); } else { $this->errorOutput(VERIFY_FAILED); } $this->isemailverify = 1; } $mobile = $this->input['mobile']; //简单验证手机号格式 if ($mobile && !hg_verify_mobile($mobile)) { $this->errorOutput(MOBILE_NUMBER_FORMAT_ERROR); } else { if ($mobile && (isset($this->input['mobile_verifycode']) || defined('NO_VERIFY_MOBILEBIND') && NO_VERIFY_MOBILEBIND)) { $check_bind = new check_Bind(); if ($check_bind->checkmembernamereg($mobile, $identifier)) { $this->errorOutput(MOBILE_REG_BIND); } } } if ($mobile && isset($this->input['mobile_verifycode'])) { //验证码 $verifycode = $this->mSmsServer->get_verifycode_info($mobile, $mobile_verifycode); if (empty($verifycode)) { $this->errorOutput(VERIFY_FAILED); } //删除验证码 $this->mSmsServer->mobile_verifycode_delete($mobile, $mobile_verifycode); if (TIMENOW > $verifycode['create_time'] + VERIFYCODE_EXPIRED_TIME) { $this->errorOutput(VERIFY_EXPIRED); } $this->ismobileverify = 1; } $password = $this->input['password']; $user_id = $this->user['user_id']; if (!$user_id) { $this->errorOutput(NO_MEMBER_ID); } $cond = ' AND member_id = ' . $user_id; $memberInfo = $this->Members->get_member_info($cond); if (!$memberInfo) { $this->errorOutput(NO_MEMBER); } if ($memberInfo['type'] == 'm2o' || $memberInfo['type'] == 'uc') { $this->errorOutput(UPDATEM2O); } $updateMemberInfo['member_id'] = $user_id; $updateMemberInfo['type'] = 'm2o'; $updateMemberInfo['type_name'] = 'M2O'; $updateMemberInfo['member_name'] = $member_name; if (empty($password)) { $this->errorOutput(NO_PASSWORD); } $salt = hg_generate_salt(); $updateMemberInfo['salt'] = $salt; $md5_password = md5(md5($password) . $salt); $updateMemberInfo['password'] = $md5_password; $email && ($updateMemberInfo['email'] = $email); $mobile && ($updateMemberInfo['mobile'] = $mobile); $this->mMember->update($updateMemberInfo); $membersql = new membersql(); $this->mMember->bind_update(array('is_primary' => 0), $membersql->where(array('member_id' => $memberInfo['member_id'], 'type' => $memberInfo['type']))); $platform_id = $user_id; $inuc = 0; if (!$identifier && $this->settings['ucenter']['open']) { $register_data = array('member_name' => $member_name, 'password' => $password, 'email' => $email); $registerInfo = $this->mMember->uc_register($register_data); if ($registerInfo['member_id'] > 0) { $inuc = $platform_id = $registerInfo['member_id']; } } //M2O绑定关系 $bind_data = array('member_id' => $user_id, 'platform_id' => $platform_id, 'nick_name' => $nick_name, 'type' => 'm2o', 'type_name' => 'M2O', 'bind_time' => TIMENOW, 'bind_ip' => hg_getip(), 'inuc' => $inuc, 'is_primary' => 1, 'identifier' => $identifier, 'reg_device_token' => 'www', 'reg_udid' => $udid); $ret_bind = $this->mMember->bind_create($bind_data); //如果注册时填写邮箱则可以同时入绑定表 if ($email) { if ($this->isemailverify || defined('NO_VERIFY_EMAILBIND') && NO_VERIFY_EMAILBIND) { $_bind_data = $bind_data; $_bind_data['platform_id'] = $email; $_bind_data['is_primary'] = 0; $_bind_data['type'] = 'email'; $_bind_data['type_name'] = '邮箱'; $_ret_bind = $this->mMember->bind_create($_bind_data); if (empty($_ret_bind)) { $this->errorOutput(BIND_DATA_ADD_FAILED); } unset($_bind_data, $_ret_bind); } } if ($mobile) { if ($this->ismobileverify || defined('NO_VERIFY_MOBILEBIND') && NO_VERIFY_MOBILEBIND) { $_bind_data = $bind_data; $_bind_data['platform_id'] = $mobile; $_bind_data['is_primary'] = 0; $_bind_data['type'] = 'shouji'; $_bind_data['type_name'] = '手机'; $_ret_bind = $this->mMember->bind_create($_bind_data); if (empty($_ret_bind)) { $this->errorOutput(BIND_DATA_ADD_FAILED); } unset($_bind_data, $_ret_bind); } } if ($inuc) { $_updateBind = array('inuc' => $inuc); $this->mMember->bind_update($_updateBind, ' WHERE member_id = ' . $user_id); } $this->addItem($bind_data); $this->output(); } catch (Exception $e) { $this->errorOutput($e->getMessage(), $e->getCode()); } }