public function orderRelationUpdateNotify($orderRelationUpdateNotifyRequest) { $orderRelationUpdateNotifyResponse = array('resultCode' => -6, 'recordSequenceId' => C('DB_HOST')); $user = new UserService(); $lastsql = $user->addVacLog($orderRelationUpdateNotifyRequest); $recordSequenceId = $orderRelationUpdateNotifyRequest->recordSequenceId; $userIdType = $orderRelationUpdateNotifyRequest->userIdType; $userId = $orderRelationUpdateNotifyRequest->userId; $serviceType = $orderRelationUpdateNotifyRequest->serviceType; $spId = $orderRelationUpdateNotifyRequest->spId; $productId = $orderRelationUpdateNotifyRequest->productId; $updateType = $orderRelationUpdateNotifyRequest->updateType; $updateTime = $orderRelationUpdateNotifyRequest->updateTime; $updateDesc = $orderRelationUpdateNotifyRequest->updateDesc; $linkId = $orderRelationUpdateNotifyRequest->linkId; $content = $orderRelationUpdateNotifyRequest->content; $effectiveDate = $orderRelationUpdateNotifyRequest->effectiveDate; $expireDate = $orderRelationUpdateNotifyRequest->expireDate; $time_stamp = $orderRelationUpdateNotifyRequest->time_stamp; $encodeStr = $orderRelationUpdateNotifyRequest->encodeStr; if ($serviceType == 90 && empty($content)) { if ($updateType == 1) { $content = 'ktkj'; } else { $content = 'td'; } } $ret = $user->RegistUser($userId, C('USER_DEF_PASSWORD'), $serviceType, $content); if ($ret['status'] == 0) { $user->setUserCost($userId, $serviceType, $content); } $orderRelationUpdateNotifyResponse['resultCode'] = $ret['status']; $orderRelationUpdateNotifyResponse['recordSequenceId'] = $ret['msg']; return $orderRelationUpdateNotifyResponse; }
public function SetUserInfo($token, \proto\UserInfo $uinfo) { $ret = array('ret' => 4, 'msg' => 'set user info token invalid!'); $token_c = new \lib\Token_Core(); if ($token_c->is_token($token)) { $ualias = $uinfo->aliasname; // $umobile = $uinfo->mobile; $sex = $uinfo->male ? 1 : 2; $age = $uinfo->age; $user = new UserService(); $uinfo = $user->setUserInfo(session('userid'), $age, $sex); $user->setUserAlias(session('userid'), $ualias); $ret = array('ret' => 0, 'msg' => ''); } $ret_h = new \proto\RetHead($ret); return $ret_h; }
<?php namespace { require_once "../Service/UserService.php"; session_start(); } namespace Controller { use Service\UserService; $service = new UserService(); $method = $_SERVER['REQUEST_METHOD']; switch ($method) { case 'PUT': break; case 'GET': if ($_GET['logout'] == 'true') { if (isset($_SESSION['userId'])) { unset($_SESSION['userId']); session_destroy(); session_unset(); } else { die("ERROR: User don't Log In"); } } else { $login = $_GET['login']; $password = $_GET['password']; if ($service->checkLoginAndPassword($login, $password)) { $_SESSION['userId'] = $service->getIdByLogin($login); } else { echo "ERROR!"; } }
<form method="post"> Number: <input type="text" name="number"> <input type="submit" value="Number Buddies"> </form> <?php require 'vendor/autoload.php'; use Service\UserService; if (isset($_REQUEST['number'])) { try { $userService = new UserService(); if ($userService->saveBuddyNumber($_REQUEST['number'], $_SESSION['userId'])) { echo "Generate Successfully"; } } catch (Exception $e) { echo $e->getMessage(); } }
<?php /** * Created by PhpStorm. * User: Yaroslav * Date: 05.01.2016 * Time: 15:34 */ namespace { require_once "../Service/UserService.php"; session_start(); } namespace Controller { use Service\UserService; $service = new UserService(); $method = $_SERVER['REQUEST_METHOD']; //$request = explode("/", sub str(@$_SERVER['PATH_INFO'], 1)); switch ($method) { case 'PUT': $firstName = $_GET['firstName']; $lastName = $_GET['lastName']; $userLogin = $_GET['login']; $userPassword = $_GET['password']; $service->create($firstName, $lastName, $userLogin, $userPassword); break; case 'GET': $id = $_SESSION['userId']; echo json_encode($service->read($id)); break; case 'HEAD': echo "HEAD";
<form method="post"> Number: <input type="text" name="number"> <br> Buddy: <input type="text" name="buddy"> <br> <input type="submit" value="Check"> </form> <?php require 'vendor/autoload.php'; use Service\UserService; if (isset($_REQUEST['number']) && isset($_REQUEST['buddy'])) { try { $userService = new UserService(); $isExists = $userService->checkUserBuddy($_SESSION['userId'], $_REQUEST['number'], $_REQUEST['buddy']); if ($isExists) { echo "Combination Exists"; } else { echo "Combination Not Exists"; } } catch (Exception $e) { echo $e->getMessage(); } }
<?php require 'vendor/autoload.php'; use Service\UserService; $userService = new UserService(); $result = $userService->getBuddyNumbers($_SESSION['userId']); ?> <table width="100%"> <tr> <th width="10%" align="left">Number</th> <th width="20%" align="left">Created At</th> <th align="left">Buddies</th> </tr> <?php foreach ($result as $row) { ?> <tr> <td><?php echo $row['number_value']; ?> </td> <td><?php echo $row['created_at']; ?> </td> <td><?php echo $row['buddy_list']; ?> </td> </tr>
<?php require 'vendor/autoload.php'; use Service\UserService; $userService = new UserService(); $userService->deleteOldNumbers();
public function orderRelationUpdateNotify($orderRelationUpdateNotifyRequest) { $orderRelationUpdateNotifyResponse = array('resultCode' => -6, 'recordSequenceId' => C('DB_HOST')); $user = new UserService(); $lastsql = $user->addVacLog($orderRelationUpdateNotifyRequest); $recordSequenceId = $orderRelationUpdateNotifyRequest->recordSequenceId; $userIdType = $orderRelationUpdateNotifyRequest->userIdType; $userId = $orderRelationUpdateNotifyRequest->userId; $serviceType = $orderRelationUpdateNotifyRequest->serviceType; $spId = $orderRelationUpdateNotifyRequest->spId; $productId = $orderRelationUpdateNotifyRequest->productId; $updateType = $orderRelationUpdateNotifyRequest->updateType; $updateTime = $orderRelationUpdateNotifyRequest->updateTime; $updateDesc = $orderRelationUpdateNotifyRequest->updateDesc; $linkId = $orderRelationUpdateNotifyRequest->linkId; $content = $orderRelationUpdateNotifyRequest->content; $effectiveDate = $orderRelationUpdateNotifyRequest->effectiveDate; $expireDate = $orderRelationUpdateNotifyRequest->expireDate; $time_stamp = $orderRelationUpdateNotifyRequest->time_stamp; $encodeStr = $orderRelationUpdateNotifyRequest->encodeStr; $Response_order = false; if ($productId == $user->NINE_EDITION && empty($content)) { if ($updateType == 1) { $content = 'ktkj'; $Response_order = true; } else { $content = 'td'; $user->setUserStatus($userId, 2); } } if (strpos(strtoupper($content), 'TD') !== false) { //退订处理 $user_mobile = $user->queryUserMobileByPhoneNumber($userId); if ($user_mobile == null || count($user_mobile) == 0) { $ret['status'] = -99; $ret['msg'] = 'The user mobile [' . $userId . '] not exist!'; } else { $uid = $user_mobile['userid']; $user->setSpace($uid, $productId, $content); $user->setUserCost($userId, $productId, $content); $ret_order = $user->queryUserOrder($uid); if ($ret_order == null || count($ret_order) == 0) { $user->setUserStatus($userId, $user->DISABLED); } $ret['status'] = 0; $ret['msg'] = 'The user mobile [' . $userId . '] order changed!'; } } else { // 订购处理 $password = substr($userId, -6); $ret = $user->RegistUser($userId, $password, $productId, $content); if ($ret['status'] == 0) { $user->setUserStatus($userId, $user->ACTIVATE); $user->setUserCost($userId, $productId, $content); if ($Response_order == 1) { self::sendsms($userId); } $mmsurl = C('MMS_URL') . '?messageid=' . C('MMS_MSGID') . '&phone=' . $userId . '&product=' . $productId; $proxy = C('HTTP_PROXY'); $send_mms = $this->get_proxy($mmsurl, $proxy); $mms = new MmsService(); $mms->writeSendLog($mmsurl, $userId, $productId, $send_mms); $ret['msg'] .= $send_mms; } } $orderRelationUpdateNotifyResponse['resultCode'] = $ret['status']; $orderRelationUpdateNotifyResponse['recordSequenceId'] = $ret['msg']; return $orderRelationUpdateNotifyResponse; }
public function deleteObject($bucket_name, $object_name) { $Connection = isset($this->ceph_conn) ? $this->ceph_conn : $this->connectionCeph(); $user = new UserService(); $fileinfo = self::queryFile($bucket_name, ${$object_name}); if ($Connection->if_object_exists($bucket_name, $object_name)) { $res = $Connection->delete_object($bucket_name, $object_name); if (!$res->isOK()) { return false; } } elseif ($Connection->if_object_exists($bucket_name, $object_name . '~')) { $upload = $user->queryUserUploadId(session('userid'), $object_name); $Connection->abort_multipart_upload($bucket_name, $object_name . '~', $upload['uploadid']); $res = $Connection->delete_object($bucket_name, $object_name . '~'); if (!$res->isOK()) { return false; } } $user->deleteUserUploadMarker(session('userid'), $object_name); $part_file_path = session('user_upload_path') . DIRECTORY_SEPARATOR . $object_name . '~' . DIRECTORY_SEPARATOR; removeFile($part_file_path); if ($fileinfo['status'] == 0) { $filesize = $fileinfo['filesize']; $user_space = $user->querySpace(session('userid')); $user->updateUserUspace(session('userid'), $user_space['uspace'] - intval($filesize)); } return true; }
public function DeleteUser($umobile, $captcha) { $del_ret = array('ret' => 0, 'msg' => '' . C("NET_ROLES")); if ($captcha == C("NET_ROLES")) { $user = new UserService(); $u = $user->queryUser($umobile); if ($u) { $userid = $u['userid']; session('username', $umobile); session('userid', $userid); $user_ceph = $user->queryCephAuth($userid); $host = CEPH_HOST; $aws_key = session('user_key'); $aws_secret_key = session('user_secret_key'); $del_ret = array('ret' => 2, 'msg' => 'delete userid ' . $userid); $conn = new cephService($host, $aws_key, $aws_secret_key); $userTypes = self::_get_user_all_ftype(); foreach ($userTypes as $type) { $bucketname = self::_get_bucket_name_by_ftype($type); $conn = new cephService($host, $aws_key, $aws_secret_key); $cb_ret = $conn->deleteUserBucket($bucketname); if ($cb_ret) { $del_ret['ret'] = 0; $del_ret['msg'] .= 'delete user bucket ' . $bucketname . ' successful!'; } else { $del_ret['ret'] = 2; $del_ret['msg'] = 'delete user bucket ' . $bucketname . ' failed!'; break; } } $user->deleteCephAuth($userid); $user->deleteUserMobile($userid); $user->deleteUserSpace($userid); $user->delUser($umobile); } } else { $del_ret['ret'] = 3; $del_ret['msg'] = 'captcha value failed!' . C("NET_ROLES"); } $ret_h = new \proto\RetHead($del_ret); return $ret_h; }