Changeset 620
- Timestamp:
- Nov 24, 2014 4:27:40 PM (10 years ago)
- Location:
- pro-violet-viettel/sourcecode
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/helpers/lockfile_helper.php
r619 r620 3 3 if ( ! function_exists('createLockFile')) 4 4 { 5 function createLockFile ($lockFilePrefix, $maxReach, $timeToUnlock, $ colSep = '|', $lockFilePath = '')5 function createLockFile ($lockFilePrefix, $maxReach, $timeToUnlock, $lockFilePath = '', $checkLockOnly = 0, $colSep = '|') 6 6 { 7 7 $currentTimeStamp = time(); … … 24 24 $timeDiffMin = $lastTimeLock != '' ? dateDifference(date('Y-m-d H:i:s',$currentTimeStamp), date('Y-m-d H:i:s',$lastTimeLock), '%i') : 0; 25 25 26 if ($lockCount < $maxReach && $timeDiffMin < $timeToUnlock ) {26 if ($lockCount < $maxReach && $timeDiffMin < $timeToUnlock && $checkLockOnly == 0) { 27 27 $lockCount ++; 28 28 $isLocked = $lockCount < $maxReach ? 0:1; … … 37 37 $lockTime = ($isLocked == 1) ? $lastTimeLock : $currentTimeStamp; 38 38 $content = $lockCount . $colSep . $lockTime . $colSep . $isLocked; 39 if($ready == 1) { 39 40 if($ready == 1 && $checkLockOnly == 0) { 40 41 $fh = fopen ($filePath,'w'); 41 42 fwrite ($fh, $content); … … 43 44 } 44 45 45 return $ lockCount;46 return $isLocked; 46 47 } 47 48 } -
pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php
r599 r620 192 192 193 193 if ($checkSentNumber) { 194 $sms = "So Dien thoai " . $sentNumber . " da dang kytren he thong SBG Online. Tran trong.";194 $sms = "So dien thoai " . $sentNumber . " da dang ky tai khoan tren he thong SBG Online. Tran trong."; 195 195 $status = 0; 196 196 return $status . '|' . $sms; … … 234 234 break; 235 235 case 2: 236 $sms = "So Dien thoai " . $sentNumber . " da dang kytren he thong SBG Online. Tran trong";236 $sms = "So dien thoai " . $sentNumber . " da dang ky tai khoan tren he thong SBG Online. Tran trong"; 237 237 $status = 0; 238 238 break; … … 247 247 } 248 248 } else { 249 $sms = " Tai khoan".$username." chua dang ky tai khoan tren he thong SBG Online. Tran trong.";249 $sms = "So dien thoai ".$username." chua dang ky tai khoan tren he thong SBG Online. Tran trong."; 250 250 $status = 0; 251 251 } -
pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php
r608 r620 476 476 </div> 477 477 <div class="modal-body"> 478 <div id="no_success_charge_info" class="alert alert-block alert-success"><center> Mã thẻ hoặc Serial khÃŽng Äúng hoặc Äã ÄÆ°á»£c sá» dụng. Quà vá» vui lòng kiá»m tra lại!</center></div>478 <div id="no_success_charge_info" class="alert alert-block alert-success"><center></center></div> 479 479 <center><button id="package_register_finish_button" data-dismiss="modal" class="btn btn-primary" >Äóng</button></center> 480 480 </div> -
pro-violet-viettel/sourcecode/application/modules/services/controllers/recharge.php
r611 r620 6 6 { 7 7 parent::__construct(); 8 $this->load->model('frontend/user_model', 'objUserModel'); 9 $this->load->helper('lockfile'); 10 $this->load->model('services_model'); 8 11 } 9 12 … … 14 17 $cardSerial = $input['card_serial']; 15 18 $pinCard = $input['pin_card']; 16 $aryParams = array( 17 'EWalletID' => $this->config->item('EWalletID'), 18 'CardSerial' => $cardSerial, 19 'PinCard' => $pinCard, 20 ); 21 22 $this->load->model('services_model'); 23 $aryResult = array(); 24 $data = $this->services_model->cardPaidProcess($aryParams, $aryResult); 25 $this->load->model('frontend/user_model', 'objUserModel'); 26 $paidType = 2; 27 $amount = $aryResult['TransactionAmount']; 28 $paidTime = date('Y-m-d H:i:s'); 19 $isLocked = 0; 29 20 30 21 $user = $this->objUserModel->get_user_by_id($userID); 31 $user['acc_balanced'] = $user['acc_balanced'] + $amount; 32 $user['updated_time'] = date('Y-m-d H:i:s'); 33 if ($amount>0){ 34 $this->objUserModel->updateUser($userID, $user); 22 $lockFilePreFix = $user['cellphone']; 23 $lockFilePath = $this->config->item('topup_lock_path'); 24 $maxReach = $this->config->item('topup_lock_max_reach'); 25 $timeToUnlock = $this->config->item('topup_unlock_minute'); 26 27 $isLocked = createLockFile($lockFilePreFix, $maxReach, $timeToUnlock, $lockFilePath, 1); 28 $chargCard = _SBG_CARD_PAY_SUCCESS; 29 $result = array(); 30 $result['maxReach'] = $maxReach; 31 $result['timeToUnlock'] = $timeToUnlock; 32 $result['isLocked'] = $isLocked; 33 $result['tmp'] = $maxReach; 34 35 $lockedMsg = 'QuÜ vá» Äã nháºp sai thÃŽng tin thẻ cà o '. $maxReach .' lần liên tiếp.<br />Xin chá» '. $timeToUnlock .' phút sau Äá» thao tác lại!'; 36 $chargErrMsg = 'Mã thẻ hoặc Serial khÃŽng Äúng hoặc Äã ÄÆ°á»£c sá» dụng. Quà vá» vui lòng kiá»m tra lại!'; 37 $errMsg = ''; 38 39 if ($isLocked == 0) { 40 $aryParams = array( 41 'EWalletID' => $this->config->item('EWalletID'), 42 'CardSerial' => $cardSerial, 43 'PinCard' => $pinCard, 44 ); 45 46 $aryResult = array(); 47 $chargCard = $this->services_model->cardPaidProcess($aryParams, $aryResult); 48 49 $paidType = 2; 50 $amount = $aryResult['TransactionAmount']; 51 $paidTime = date('Y-m-d H:i:s'); 52 $user['acc_balanced'] = $user['acc_balanced'] + $amount; 53 $user['updated_time'] = date('Y-m-d H:i:s'); 54 if ($amount>0){ 55 $this->objUserModel->updateUser($userID, $user); 56 } 57 58 $result['success'] = $chargCard; 59 60 if ($chargCard == _SBG_CARD_PAY_SUCCESS){ 61 $result['username'] = $user['cellphone']; 62 $result['acc_balanced'] = $user['acc_balanced']; 63 $result['amount'] = $amount; 64 $this->objUserModel->insertPaidlog($user['cellphone'], $user['cellphone'], $paidType, $amount, $paidTime); 65 releaseLockFile($lockFilePreFix, $lockFilePath); 66 } 67 else { 68 $isLocked = createLockFile($lockFilePreFix, $maxReach, $timeToUnlock, $lockFilePath); 69 $errMsg = $isLocked == 1 ? $chargErrMsg .'<br />'.$lockedMsg : $chargErrMsg; 70 } 71 }else if ($isLocked == 1) { 72 $errMsg = $lockedMsg; 73 $result['success'] = _SBG_CARD_PAY_FAIL; 35 74 } 36 75 37 $result = array(); 38 if ($data == 1){ 39 $result['success'] = 1; 40 $result['username'] = $user['cellphone']; 41 $result['acc_balanced'] = $user['acc_balanced']; 42 $result['amount'] = $amount; 43 $this->objUserModel->insertPaidlog($user['cellphone'], $user['cellphone'], $paidType, $amount, $paidTime); 44 }else 45 { 46 $result['success'] = 0; 47 } 76 $result['errMsg'] = $errMsg; 48 77 echo json_encode($result); 49 78 } -
pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php
r616 r620 12 12 13 13 if ( ! defined('_SBG_MO_SYNTAX_ERR')) define('_SBG_MO_SYNTAX_ERR', -1); 14 if ( ! defined('_SBG_MO_SYNTAX_ERR_MSG')) define('_SBG_MO_SYNTAX_ERR_MSG', 'SBG Online khong co dich vu n Ãy, ban vui long kiem tra lai. Tran trong.');14 if ( ! defined('_SBG_MO_SYNTAX_ERR_MSG')) define('_SBG_MO_SYNTAX_ERR_MSG', 'SBG Online khong co dich vu nay, ban vui long kiem tra lai. Tran trong.'); 15 15 16 16 if ( ! defined('_SBG_CARD_PAY_FAIL')) define('_SBG_CARD_PAY_FAIL', -1); -
pro-violet-viettel/sourcecode/assets/css/custom.css
r563 r620 2 2 margin-right: 0; 3 3 } 4 5 li { 6 white-space: nowrap; 7 } 8 9 .nav-tabs>li { 10 margin-bottom: -2px 11 } 12 4 13 .modal { 5 14 overflow-y: auto; 6 15 } 7 16 .icon-a:before { 17 content: ""; 18 } 8 19 @media (max-width:993px) { 9 20 .site-info { … … 17 28 .login-container { 18 29 width:100% 19 }20 21 .main-container {22 margin-top: 64px;23 30 } 24 31 … … 263 270 left: 0 264 271 } 272 273 #not_success_charge .modal-dialog { 274 width:620px; 275 } -
pro-violet-viettel/sourcecode/assets/js/frontend/user.js
r617 r620 158 158 }else 159 159 { 160 /*var notSuccessMsg = 'Mã thẻ hoặc Serial khÃŽng Äúng hoặc Äã ÄÆ°á»£c sá» dụng. Quà vá» vui lòng kiá»m tra lại!'; 161 if (result.isLocked == 1) { 162 notSuccessMsg = 'QuÜ vá» Äã nháºp sai thÃŽng tin thẻ cà o ' + result.maxReach + ' lần liên tiếp.<br />Xin chá» ' + result.timeToUnlock + ' phút sau Äá» thao tác lại!'; 163 }*/ 164 165 $("#not_success_charge").find('div#no_success_charge_info > center').html (result.errMsg); 160 166 $("#not_success_charge").modal('show'); 161 167 } -
pro-violet-viettel/sourcecode/info.php
r460 r620 1 <script> 2 function addCommas(nStr) 3 { 4 nStr += ''; 5 x = nStr.split('.'); 6 x1 = x[0]; 7 x2 = x.length > 1 ? '.' + x[1] : ''; 8 var rgx = /(\d+)(\d{3})/; 9 while (rgx.test(x1)) { 10 x1 = x1.replace(rgx, '$1' + ',' + '$2'); 11 } 12 return x1 + x2; 13 } 14 15 console.log(addCommas(1000000000)); 16 </script> 1 17 <?php 2 echo md5('123456 '), "<br />";18 echo md5('123456a'), "<br />"; 3 19 echo md5('0988568786violet'); 4 20 phpinfo(); -
pro-violet-viettel/sourcecode/service.php
r473 r620 1 1 <?php 2 require_once('/srv/www/sbg/application/libraries/nusoap/nusoap.php');3 2 4 $nusoap_server = new soap_server(); 5 $nusoap_server->configureWSDL('messageReceiverWSDL','urn:messageReceiverWSDL'); 6 7 $nusoap_server->soap_defencoding = 'UTF-8'; 8 $nusoap_server->methodreturnisliteral=TRUE; 9 10 $nusoap_server->wsdl->schemaTargetNamespace = 'http://soapinterop.org/xsd/'; 11 $nusoap_server->wsdl->addComplexType( 12 'messageReceiver', 13 'simpleType', 14 'struct', 15 '', 16 'SOAP-ENC:Array', 17 array( 18 'username'=>array('name'=>'username', 'type'=>'xsd:string'), 19 'password'=>array('name'=>'password', 'type'=>'xsd:string'), 20 'requestID'=>array('name'=>'requestID', 'type'=>'xsd:string'), 21 'userID'=>array('name'=>'userID', 'type'=>'xsd:string'), 22 'receiverID'=>array('name'=>'receiverID', 'type'=>'xsd:string'), 23 'serviceID'=>array('name'=>'serviceID', 'type'=>'xsd:string'), 24 'commandCode'=>array('name'=>'commandCode', 'type'=>'xsd:string'), 25 'contentType'=>array('name'=>'contentType', 'type'=>'xsd:string'), 26 'info'=>array('name'=>'info', 'type'=>'xsd:string'), 27 'receiveTime'=>array('name'=>'receiveTime', 'type'=>'xsd:string') 28 ) 29 ); 30 31 $nusoap_server->register ( 'MOReceiver', 32 array( 'username' => 'xsd:string', 33 'password' => 'xsd:string', 34 'requestID' => 'xsd:string', 35 'userID' => 'xsd:string', 36 'receiverID' => 'xsd:string', 37 'serviceID' => 'xsd:string', 38 'commandCode' => 'xsd:string', 39 'contentType' => 'xsd:string', 40 'info' => 'xsd:string', 41 'receiveTime' => 'xsd:string') 42 , array ('return' => 'xsd:string'), 43 'urn:messageReceiverWSDL',"urn:messageReceiverWSDL#MOReceiver","rpc","encoded"); 44 45 function MOReceiver($username, $password, $requestID, $userID, $receiverID, $serviceID, $commandCode, $contentType ,$info, $receiveTime) 3 function createLockFile ($lockFilePrefix, $maxReach, $timeToUnlock, $colSep = '|') 46 4 { 5 $currentTimeStamp = time(); 6 $filePath = $lockFilePrefix.'_lock'; 7 $fileExisted = file_exists($filePath); 8 $content = ''; 9 $lastTimeLock = ''; 10 $lockCount = 0; 11 $isLocked = 0; 47 12 13 if ($fileExisted) { 14 $content = file_get_contents($filePath); 15 } 16 17 if ($content != '') { 18 list($lockCount, $lastTimeLock, $isLocked) = explode ($colSep, $content); 19 } 20 21 $timeDiffMin = $lastTimeLock != '' ? dateDifference(date('Y-m-d H:i:s',$currentTimeStamp), date('Y-m-d H:i:s',$lastTimeLock), '%i') : 0; 22 23 24 if ($lockCount < $maxReach && $timeDiffMin < $timeToUnlock) { 25 $lockCount ++; 26 $isLocked = $lockCount < $maxReach ? 0:1; 27 } 28 else if ($timeDiffMin > $timeToUnlock) { 29 $lockCount = 0; 30 $isLocked = 0; 31 } 32 33 $lockTime = ($isLocked == 1) ? $lastTimeLock : $currentTimeStamp; 34 $content = $lockCount . $colSep . $lockTime . $colSep . $isLocked; 35 $fh = fopen ($filePath,'w'); 36 fwrite ($fh, $content); 37 fclose ($fh); 38 39 return $timeDiffMin; 48 40 } 49 41 50 $nusoap_server->service(file_get_contents("php://input")); 42 function releaseLockFile ($lockFilePrefix) 43 { 44 $filePath = $lockFilePrefix.'_lock'; 45 $fileExisted = file_exists($filePath); 46 if ($fileExisted) { 47 unlink($filePath); 48 } 49 } 50 51 function dateDifference($date_1 , $date_2 , $differenceFormat = '%a' ) 52 { 53 $datetime1 = date_create($date_1); 54 $datetime2 = date_create($date_2); 55 $interval = date_diff($datetime1, $datetime2); 56 return $interval->format($differenceFormat); 57 } 58 59 $username = '0988568786'; 60 $maxReach = 3; 61 $timeToUnlock = 1; 62 echo createLockFile($username, $maxReach, $timeToUnlock); 63 releaseLockFile ($username); 64 65
Note: See TracChangeset
for help on using the changeset viewer.