Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 public function RegistUser($umobile, $password, $captcha)
 {
     $ret = array('ret' => 7, 'msg' => 'regist user failed!');
     $proxy = "http://182.92.97.3:13128";
     $api = 'https://webapi.sms.mob.com';
     //(例:https://webapi.sms.mob.com);
     $appkey = 'f40f0f41f1d1';
     //您的appkey
     $zone = '86';
     $apiurl = $api . '/sms/verify';
     $param = array('appkey' => $appkey, 'phone' => $umobile, 'zone' => $zone, 'code' => $captcha);
     $vrest = VerificationCode_proxy($apiurl, $proxy, $param);
     if (!$vrest) {
         $ret['ret'] = 1;
         $ret['msg'] = 'verify cathcha error!';
     } else {
         $user = new UserService();
         $capacity = 1 * 1024 * 1024 * 1024;
         $reg_ret = $user->RegistUser($umobile, $password, $capacity);
         $cb_ret = '';
         if ($reg_ret['status'] == 0) {
             $host = CEPH_HOST;
             $aws_key = session('user_key');
             $aws_secret_key = session('user_secret_key');
             $Buckets = array();
             $userTypes = self::_get_user_all_ftype();
             foreach ($userTypes as $type) {
                 $bucketname = self::_get_bucket_name_by_ftype($type);
                 //$cb_ret = $conn->createUserBucket($bucketname);
                 try {
                     $pythonpath = '/usr/bin/python';
                     $python_script = __DIR__ . '/lib/createUserBucket.py';
                     $param = '-a ' . session('user_key') . ' -s ' . session('user_secret_key') . ' -b ' . $bucketname;
                     $command = $pythonpath . ' ' . $python_script . ' ' . $param;
                     exec($command, $output, $ret_var);
                 } catch (\Exception $e) {
                     $reg_ret['status'] = 7;
                     $reg_ret['msg'] = 'create user bucket have a exeption!';
                     break;
                 }
                 $conn = new cephService($host, $aws_key, $aws_secret_key);
                 if (!$conn->queryBucketExist($bucketname)) {
                     $reg_ret['status'] = 2;
                     $reg_ret['msg'] = 'create user bucket failed!';
                     break;
                 }
             }
         }
         $ret = array('ret' => $reg_ret['status'], 'msg' => $reg_ret['msg']);
     }
     $ret_h = new \proto\RetHead($ret);
     return $ret_h;
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 public function RegistUser($umobile, $password, $captcha)
 {
     $ret = array('ret' => 7, 'msg' => 'regist user failed!');
     $proxy = "http://182.92.97.3:13128";
     $api = 'https://webapi.sms.mob.com';
     //(例:https://webapi.sms.mob.com);
     $appkey = 'f40f0f41f1d1';
     //您的appkey
     $zone = '86';
     $apiurl = $api . '/sms/verify';
     $param = array('appkey' => $appkey, 'phone' => $umobile, 'zone' => $zone, 'code' => $captcha);
     $vrest = VerificationCode_proxy($apiurl, $proxy, $param);
     if (!$vrest) {
         $ret['ret'] = 1;
         $ret['msg'] = 'verify cathcha error!';
     } else {
         $user = new UserService();
         $capacity = 1 * 1024 * 1024 * 1024;
         $reg_ret = $user->RegistUser($umobile, $password, $capacity);
         $cb_ret = '';
         if ($reg_ret['status'] == 0) {
             $host = CEPH_HOST;
             $aws_key = session('user_key');
             $aws_secret_key = session('user_secret_key');
             $Buckets = array();
             $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);
                 $vhost = CEPH_HOST . '/' . $bucketname;
                 $cb_ret = $conn->createUserBucket($bucketname, $vhost);
                 if ($cb_ret->isOK()) {
                     $reg_ret['status'] = 0;
                     $reg_ret['msg'] = '';
                 } else {
                     $reg_ret['status'] = 2;
                     $reg_ret['msg'] = 'create user bucket failed!';
                     break;
                 }
             }
         }
         $ret = array('ret' => $reg_ret['status'], 'msg' => $reg_ret['msg']);
     }
     $ret_h = new \proto\RetHead($ret);
     return $ret_h;
 }