1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
---|
2 | /**
|
---|
3 | * Viettel Class
|
---|
4 | *
|
---|
5 | * @author dzungnv02
|
---|
6 | *
|
---|
7 | */
|
---|
8 |
|
---|
9 | class Viettel extends MX_Controller
|
---|
10 | {
|
---|
11 |
|
---|
12 | function __construct() {
|
---|
13 | parent::__construct ();
|
---|
14 | $this->nusoap_server = new soap_server ();
|
---|
15 | $this->nusoap_server->configureWSDL('messageReceiver', 'urn:messageReceiver');
|
---|
16 | $this->nusoap_server->soap_defencoding = 'UTF-8';
|
---|
17 | $this->nusoap_server->methodreturnisliteral=TRUE;
|
---|
18 |
|
---|
19 | $this->nusoap_server->wsdl->addComplexType(
|
---|
20 | 'messageReceiver',
|
---|
21 | 'simpleType',
|
---|
22 | 'struct',
|
---|
23 | '',
|
---|
24 | 'SOAP-ENC:Array',
|
---|
25 | array(
|
---|
26 | 'username'=>array('name'=>'username', 'type'=>'xsd:string'),
|
---|
27 | 'password'=>array('name'=>'password', 'type'=>'xsd:string'),
|
---|
28 | 'requestID'=>array('name'=>'requestID', 'type'=>'xsd:string'),
|
---|
29 | 'userID'=>array('name'=>'userID', 'type'=>'xsd:string'),
|
---|
30 | 'receiverID'=>array('name'=>'receiverID', 'type'=>'xsd:string'),
|
---|
31 | 'serviceID'=>array('name'=>'serviceID', 'type'=>'xsd:string'),
|
---|
32 | 'commandCode'=>array('name'=>'commandCode', 'type'=>'xsd:string'),
|
---|
33 | 'info'=>array('name'=>'info', 'type'=>'xsd:string'),
|
---|
34 | 'receiveTime'=>array('name'=>'receiveTime', 'type'=>'xsd:string')
|
---|
35 | )
|
---|
36 | );
|
---|
37 |
|
---|
38 | $this->nusoap_server->register ( 'MOReceiver',
|
---|
39 | array( 'username' => 'xsd:string',
|
---|
40 | 'password' => 'xsd:string',
|
---|
41 | 'requestID' => 'xsd:string',
|
---|
42 | 'userID' => 'xsd:string',
|
---|
43 | 'receiverID' => 'xsd:string',
|
---|
44 | 'serviceID' => 'xsd:string',
|
---|
45 | 'commandCode' => 'xsd:string',
|
---|
46 | 'info' => 'xsd:string',
|
---|
47 | 'receiveTime' => 'xsd:string')
|
---|
48 | , array ('return' => 'xsd:string'),false,false
|
---|
49 | ,'rpc'
|
---|
50 | );
|
---|
51 | }
|
---|
52 |
|
---|
53 | function index() {
|
---|
54 | if($this->uri->segment(3) == "wsdl") {
|
---|
55 | $_SERVER['QUERY_STRING'] = "wsdl";
|
---|
56 | } else {
|
---|
57 | $_SERVER['QUERY_STRING'] = "";
|
---|
58 | }
|
---|
59 | $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA:'';
|
---|
60 | $this->nusoap_server->service($HTTP_RAW_POST_DATA);
|
---|
61 | }
|
---|
62 |
|
---|
63 | public function mo()
|
---|
64 | {
|
---|
65 | function MOReceiver($username, $password, $requestID, $userID, $receiverID, $serviceID, $commandCode, $info,$receiveTime){
|
---|
66 | $msgType = '0'; //text message
|
---|
67 | $errCode = '1'; //#1:error; 1:Success;
|
---|
68 |
|
---|
69 | $CI =& get_instance();
|
---|
70 | $mo_username = $CI->config->item('mo_username');
|
---|
71 | $mo_password = $CI->config->item('mo_password');
|
---|
72 |
|
---|
73 | /* if (!isset($parameters['username'])) return '0|0|Username is required!';
|
---|
74 | if (!isset($parameters['password'])) return '0|0|Password is required!';
|
---|
75 | if ($parameters['username'] != $mo_username) return '0|0|Username is not corrected!'.var_export($parameters, true);
|
---|
76 | if ($parameters['password'] != $mo_password) return '0|0|Password is not corrected!';
|
---|
77 | if (!isset($parameters['userID'])) return '0|0|UserID is required!';
|
---|
78 | if (!isset($parameters['userID'])) return '0|0|UserID is required!';
|
---|
79 | if (!isset($parameters['serviceID'])) return '0|0|serviceID is required!';
|
---|
80 | if ($parameters['serviceID'] != '8062') return '0|0|serviceID is not corrected!'; */
|
---|
81 |
|
---|
82 | if (!$username) return '0|0|Username is required!';
|
---|
83 | if (!$password) return '0|0|Password is required!';
|
---|
84 | if ($username != $mo_username) return '0|0|Username is not corrected!';
|
---|
85 | if ($password != $mo_password) return '0|0|Password is not corrected!';
|
---|
86 | if (!$requestID) return '0|0|requestID is required!';
|
---|
87 | if (!$userID) return '0|0|UserID is required!';
|
---|
88 | if (!$serviceID) return '0|0|serviceID is required!';
|
---|
89 | if ($serviceID != '8062') return '0|0|serviceID is not corrected!';
|
---|
90 |
|
---|
91 | $sentNumber = $userID;
|
---|
92 | $username = !$receiverID ? $sentNumber : $receiverID;
|
---|
93 |
|
---|
94 | $CI->load->model('frontend/user_model', 'userModel');
|
---|
95 | $password = $CI->userModel->create_random_password();
|
---|
96 | $sms = "Chuc mung Qui vi da dang ky thanh cong tai khoan SBGOnline. Hay dang nhap vao http://soanbaigiang.smas.vn/ voi ten truy nhap ".$username.", mat khau ".$password." de su dung.";
|
---|
97 | //$msg = $CI->userModel->register ($sentNumber, $receiverID, $serviceID, $commandCode, $info, $receiveTime, $status);
|
---|
98 |
|
---|
99 | //return $status.'|'.$msgType.'|'.$msg;
|
---|
100 |
|
---|
101 | //for dummy data
|
---|
102 | return '1|0|'.$sms;
|
---|
103 | }
|
---|
104 |
|
---|
105 | $this->nusoap_server->service(file_get_contents("php://input"));
|
---|
106 | }
|
---|
107 | }
|
---|
108 |
|
---|
109 | /* End of file viettel.php */
|
---|
110 | /* Location: ./application/modules/service/controllers/viettel.php */ |
---|