Changeset 909 for pro-violet-viettel
- Timestamp:
- Apr 24, 2015 11:17:57 AM (10 years ago)
- Location:
- pro-violet-viettel/sourcecode/application/modules/services
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/services/controllers/sendmessage.php
r884 r909 2 2 /** 3 3 * Viettel Class 4 * 4 * 5 5 * @author dzungnv02 6 6 * 7 7 */ 8 8 9 class Sendmessage extends MX_Controller 9 class Sendmessage extends MX_Controller 10 10 { 11 11 private $_xmlHeader = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; 12 13 public function __construct() 12 13 public function __construct() 14 14 { 15 15 parent::__construct(); 16 16 } 17 18 public function index () 17 18 public function index () 19 19 { 20 20 error_reporting(E_ALL); … … 29 29 echo $this->Services_model->cardPaidProcess($aryParams); 30 30 } 31 31 32 32 public function testmo() { 33 33 $url = 'http://10.58.38.162/violetservice/soanbai/mo?wsdl'; … … 45 45 'receiveTime' => date('Ymd H:i:s') 46 46 ); 47 47 48 48 $client = new nusoap_client($url, false); 49 49 $client->useHTTPPersistentConnection(); 50 50 $xml = $this->load->view('mo', null, true); 51 51 52 52 $operator = 'MOReceiver'; 53 53 $operation = 'http://tempuri.org/MOReceiver'; … … 55 55 $client->soap_defencoding = 'UTF-8'; 56 56 $client->operation = $operation; 57 $result = $client->send($this->_xmlHeader.$xml, $operation); 57 $result = $client->send($this->_xmlHeader.$xml, $operation); 58 58 //$result = $client->call('MOReceiver', $aryParams ,$operator ,$operation); 59 59 60 60 echo $client->responseData; 61 61 62 62 /* $err = $client->getError(); 63 63 64 64 if ($err) { 65 65 echo '<p><b>Error: ' . $err . '</b></p>'; 66 66 } 67 68 echo "<br/>"; 69 echo "<h2>Request</h2>"; 70 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 71 echo "<h2>Response</h2>"; 72 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; */ 73 } 74 67 68 echo "<br/>"; 69 echo "<h2>Request</h2>"; 70 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 71 echo "<h2>Response</h2>"; 72 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; */ 73 } 74 75 75 public function send($msg, $receiverID) 76 76 { … … 80 80 $operator = 'InsertMT'; 81 81 $operation = 'http://tempuri.org/InsertMT'; 82 82 83 83 $aryMatch = array(); 84 84 if (preg_match('/^(0)([0-9]{9,10})$/', $receiverID, $aryMatch) == 1) { 85 85 $receiverID = '84'. $aryMatch[2]; 86 86 } 87 87 88 88 $aryParams = array( 89 89 'User' => $username, … … 98 98 'Info' => urldecode($msg).' - Host: '.$_SERVER['HTTP_HOST'].' - '. date('Y-m-d H:i:s')//'Test MT '. date('Y-m-d H:i:s'), 99 99 ); 100 100 101 101 $xml = $this->load->view('mt', $aryParams, true); 102 102 $client = new nusoap_client($url); … … 104 104 $client->soap_defencoding = 'UTF-8'; 105 105 $client->operation = $operation; 106 106 107 107 $result = $client->send($this->_xmlHeader.$xml, $operation); 108 108 $err = $client->getError(); 109 109 110 110 if ($err) { 111 111 echo '<p><b>Error: ' . $err . '</b></p>'; 112 112 } 113 113 114 114 var_dump($result); 115 115 116 116 echo "<br/>"; 117 117 echo "<h2>Request</h2>"; … … 119 119 echo "<h2>Response</h2>"; 120 120 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 121 122 } 123 124 public function topup () 121 122 } 123 124 public function topup () 125 125 { 126 126 $url = $this->config->item('topup_service_url'); 127 127 128 128 //echo file_get_contents($url); 129 129 //exit(); 130 130 131 131 $operation = 'http://tempuri.org/ITopupService/TopUp'; 132 132 133 133 $username = 'sbg'; 134 134 $password = 'sbg56ab77cdsgb'; 135 135 136 136 $aryParams = array( 137 137 'EWalletID' => 0, … … 144 144 $client->soap_defencoding = 'UTF-8'; 145 145 $client->operation = $operation; 146 146 147 147 $result = $client->send($this->_xmlHeader.$xml, $operation); 148 148 $err = $client->getError(); 149 149 150 150 if ($client->fault) { 151 151 echo "<h2>Fault loi:</h2><pre>"; … … 169 169 echo "<h2>Response</h2>"; 170 170 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 171 172 } 173 174 public function charging () 175 { 171 172 } 173 174 public function chargingws () 175 { 176 //$op = $this->input->get('op', TRUE); 177 //$op = trim($op) == '' ? 'Balance' : 'processCharging'; 176 178 $url = $this->config->item('charging_service_url'); 177 179 $content = file_get_contents ($url.'?op=Charge'); 180 header('Content-Type: text/html; charset=utf-8'); 181 echo $content; 182 } 183 184 public function getBalance() 185 { 186 //GetAmountBalance 187 $url = $this->config->item('charging_service_url'); 188 178 189 $username = $this->config->item('charging_username'); 179 190 $password = $this->config->item('charging_password'); 180 191 $operator = 'GetAmountBalance'; 192 $operation = 'http://tempuri.org/Balance'; 193 194 $aryParams = array( 195 'user' => $username, 196 'pass' => $password, 197 'MSISDN' => '01662860000', 198 ); 199 200 $xml = $this->load->view('chargingBalance', $aryParams, true); 201 $client = new nusoap_client($url.'?op=Balance'); 202 $client->useHTTPPersistentConnection(); 203 $client->soap_defencoding = 'UTF-8'; 204 $client->operation = $operation; 205 206 $result = $client->send($this->_xmlHeader.$xml, $operation); 207 $err = $client->getError(); 208 209 if ($err) { 210 echo '<p><b>Error: ' . $err . '</b></p>'; 211 } 212 213 var_dump($result); 214 215 echo "<br/>"; 216 echo "<h2>Request</h2>"; 217 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 218 echo "<h2>Response</h2>"; 219 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 220 } 221 222 public function charging () 223 { 224 $url = $this->config->item('charging_service_url'); 225 226 $username = $this->config->item('charging_username'); 227 $password = $this->config->item('charging_password'); 228 181 229 $operator = 'processCharging'; 182 $operation = 'http://tempuri.org/ processCharging';183 230 $operation = 'http://tempuri.org/Charge'; 231 184 232 $aryParams = array( 185 233 'user' => $username, … … 189 237 'Contents' => 'Namta-Active' 190 238 ); 191 239 192 240 $xml = $this->load->view('charging', $aryParams, true); 193 241 $client = new nusoap_client($url); … … 195 243 $client->soap_defencoding = 'UTF-8'; 196 244 $client->operation = $operation; 197 245 198 246 $result = $client->send($this->_xmlHeader.$xml, $operation); 199 247 $err = $client->getError(); 200 248 201 249 if ($err) { 202 250 echo '<p><b>Error: ' . $err . '</b></p>'; 203 251 } 204 252 205 253 var_dump($result); 206 207 echo "<br/>"; 208 echo "<h2>Request</h2>"; 209 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 210 echo "<h2>Response</h2>"; 211 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 212 } 213 254 255 echo "<br/>"; 256 echo "<h2>Request</h2>"; 257 echo "<pre>" . htmlspecialchars($client->request, ENT_QUOTES) . "</pre>"; 258 echo "<h2>Response</h2>"; 259 echo "<pre>" . htmlspecialchars($client->response, ENT_QUOTES) . "</pre>"; 260 } 261 214 262 public function getCollaborators () { 215 263 $client = new SoapClient($this->config->item('bccs_service_url'), array( 'trace' => true, … … 219 267 $password = $this->config->item('bccs_password'); 220 268 $wscode = 'getListShopAndStaftInfo'; 221 269 222 270 $input = new Input($username, $password, $wscode/* , 2, 1,5000 */); 223 271 $param = new Param(); 224 272 225 273 $params = array( 226 274 "Input" => $input, … … 228 276 "Param" => $param, 229 277 ); 230 278 231 279 var_dump($params); 232 280 … … 234 282 var_dump($response); 235 283 } 236 237 284 285 238 286 } 239 287 -
pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php
r906 r909 177 177 178 178 if (trim($arySmsReturn[1]) == trim(lang('_SBG_MO_USER_REGISTER_VIP_FAIL_NOT_ENOUGH_MSG'))) { 179 $maxCharging = 50000;180 179 $amount = $packageData ['p_price']; 181 $count = $amount > $maxCharging ? ceil($amount/ _SBG_CHARGING_MAX_VALUE) : 1; 182 $value = 0; 183 for ($i = 1; $i <= $count; $i++) { 184 $value = $amount > _SBG_CHARGING_MAX_VALUE ? _SBG_CHARGING_MAX_VALUE : $amount; 185 $amount -= $value; 186 $result = $this->chargeRootAccountProcess($sentNumber, $value, $sentNumber.' paid for SBG'); 187 } 180 $result = $this->chargeRootAccountProcess($sentNumber, $amount, $sentNumber.' paid for SBG'); 188 181 189 182 if ($result == _SBG_CHARGING_SUCCESS) { … … 243 236 } 244 237 else if ($result == _SBG_CHARGING_FAIL_MORETHAN_LIMIT) { 245 /*$aryPatterns = array ('/:sendid:/');238 $aryPatterns = array ('/:sendid:/'); 246 239 $smsReturn = preg_replace($aryPatterns, array($sentNumber), lang('_SBG_MO_CHARGING_FAIL_MORETHAN_LIMIT_MSG')); 247 $smsReturn = _SBG_MO_PROCCESS_ERR.'|'.$smsReturn; */ 248 249 250 251 240 $smsReturn = _SBG_MO_PROCCESS_ERR.'|'.$smsReturn; 252 241 }else if ($result == _SBG_CHARGING_FAIL_NOT_VIETTEL || $result == _SBG_CHARGING_NUMBER_NOT_EXISTED || $result == _SBG_CHARGING_NUMBER_NOT_AVAILABLE) { 253 242 $smsReturn = _SBG_MO_PROCCESS_ERR.'|'.lang('_SBG_MO_CHARGING_FAIL_NOT_VIETTEL_MSG'); … … 265 254 } 266 255 break; 267 256 268 257 case _SBG_MO_PASSWORD_COLLABORATOR_SERVICE: 269 258 $smsReturn = $this->objCollaboratorModel->getPassword($sentNumber); 270 259 break; 271 260 272 261 case _SBG_MO_UNSUBSCRIBE_SERVICE: 273 262 case _SBG_MO_SYNTAX_ERR: … … 339 328 $username = $this->config->item('charging_username'); 340 329 $password = $this->config->item('charging_password'); 341 $action = 'http://tempuri.org/ processCharging';330 $action = 'http://tempuri.org/Charge'; 342 331 343 332 $aryParams = array( … … 355 344 $client->operation = $action; 356 345 $result = $client->send($xml, $action); 346 347 error_log(date('Y-m-d H:i:s').' -- DATA: '. var_export($xml, TRUE).' -- CASE: '. $case . "\n", 3, '/srv/www/sbg/log/chargeresult.log'); 348 error_log(date('Y-m-d H:i:s').' -- DATA: '. var_export($result, TRUE).' -- CASE: '. $case . "\n", 3, '/srv/www/sbg/log/chargeresult.log'); 349 357 350 if ($client->fault) { 358 351 return _SBG_CHARGING_FAIL; -
pro-violet-viettel/sourcecode/application/modules/services/views/charging.php
r457 r909 1 1 <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 2 2 <soap:Body> 3 < processChargingxmlns="http://tempuri.org/">3 <Charge xmlns="http://tempuri.org/"> 4 4 <user><?php echo $user?></user> 5 5 <pass><?php echo $pass?></pass> … … 7 7 <Charging><?php echo $Charging?></Charging> 8 8 <Contents><?php echo $Contents?></Contents> 9 </ processCharging>9 </Charge> 10 10 </soap:Body> 11 11 </soap:Envelope>
Note: See TracChangeset
for help on using the changeset viewer.