Changeset 579 for pro-violet-viettel/sourcecode/application/modules
- Timestamp:
- Nov 20, 2014 11:00:32 AM (10 years ago)
- Location:
- pro-violet-viettel/sourcecode/application/modules
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php
r459 r579 59 59 $us = $this->user_model->get_list_users($data); 60 60 $users = array(); 61 foreach($us as $u): 61 62 foreach($us as $u) { 62 63 $id = $u['us_id']; 63 64 $username = $this->get_username($id); 64 65 $u['username'] = $username; 65 66 array_push($users, $u); 66 endforeach;67 } 67 68 68 69 $data['users'] = $users; -
pro-violet-viettel/sourcecode/application/modules/admin/models/cardlog_model.php
r426 r579 26 26 $order = "ORDER BY " . $data['sorting_field'] . " " . $sort; 27 27 } 28 return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array(); 28 $query = $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." "); 29 return $query->result_array(); 29 30 } 30 31 … … 37 38 $sql.=" WHERE (sender LIKE '%".$data['keyword']."%'"; 38 39 } 39 return $this->db->query($sql)->row_array()['total']; 40 $query = $this->db->query($sql); 41 $row = $query->row_array(); 42 return $row['total']; 40 43 } 41 44 } -
pro-violet-viettel/sourcecode/application/modules/admin/models/smslog_model.php
r426 r579 26 26 $order = "ORDER BY " . $data['sorting_field'] . " " . $sort; 27 27 } 28 return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array(); 28 29 $query = $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." "); 30 31 return $query->result_array(); 29 32 } 30 33 … … 37 40 $sql.=" WHERE (sender LIKE '%".$data['keyword']."%' OR mobody LIKE '%".$data['keyword']."%' OR mtbody LIKE '%".$data['keyword']."%') "; 38 41 } 39 return $this->db->query($sql)->row_array()['total']; 42 43 $query = $this->db->query($sql); 44 $row = $query->row_array(); 45 return $row['total']; 40 46 } 41 47 } -
pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php
r459 r579 1 1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 2 2 3 class User_model extends MY_Model3 class User_model extends CI_Model 4 4 { 5 5 … … 62 62 $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') "; 63 63 } 64 return $this->db->query($sql)->row_array()['total']; 64 65 $query = $this->db->query($sql); 66 $row = $query->row_array(); 67 68 return $row['total']; 65 69 } 66 70 -
pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php
r574 r579 71 71 } 72 72 73 public function register($username, $collaborator, &$ status= '') {73 public function register($username, $collaborator, &$collaboratorMsg = '') { 74 74 $user = array (); 75 75 $password = $this->create_random_password (); … … 80 80 $token = md5 ( $username . self::TOKENPW ); 81 81 $phone = $username; 82 $status = 0; 82 83 83 84 if (! is_null ( $collaborator ) || $collaborator != '') { 84 85 if (! $this->isExistcollaborator ( $collaborator )) { 85 86 $sms = "Khong tim thay cong tac vien nao co so dien thoai [" . $collaborator . "] tren soanbaigiang.smas.vn"; 86 $ status = 0;87 $collaboratorMsg = $status . '|'.$sms; 87 88 return $status . '|' . $sms; 88 89 } … … 101 102 { 102 103 $sms = "Tam thoi Qui vi khong the dang ky duoc. Xin thu lai sau. Cam on!"; 103 $ status = 0;104 $collaboratorMsg = $status . '|'.$sms; 104 105 return $status . '|' . $sms; 105 106 } … … 120 121 $sms = "Chuc mung Qui vi da dang ky thanh cong tai khoan Soan Bai giang Online. Hay dang nhap vao soanbaigiang.smas.vn voi ten truy nhap " . $username . ", mat khau " . $password . " de su dung."; 121 122 $status = 1; 123 $collaboratorMsg = $status . '|'. 'Ban da dang ky thanh cong dich vu Soan bai giang Online cho '.$username; 122 124 break; 123 125 case 2 : … … 125 127 $sms = "So dien thoai cua Qui vi da duoc dang ky"; 126 128 $status = 0; 129 $collaboratorMsg = $status . '|'. 'So dien thoai '.$username.' da duoc dang ky'; 127 130 break; 128 131 default : 129 132 $status = 0; 130 133 $sms = $errMsg; 134 $collaboratorMsg = $status . '|'. $sms; 131 135 break; 132 136 } … … 258 262 259 263 $result = $this->get_user_by_cellphone ( $username ); 264 260 265 if ($result) { 261 266 $us_id = $result ['us_id']; … … 368 373 $user ['updated_time'] = date ( 'Y-m-d H:i:s' ); 369 374 $this->updateUser ( $us_id, $user ); 370 $sms = "Qui vi da nap thanh cong " . $amount . " VN Ävao tai khoan " . $username . " tren soanbaigiang.smas.vn";375 $sms = "Qui vi da nap thanh cong " . $amount . " VND vao tai khoan " . $username . " tren soanbaigiang.smas.vn"; 371 376 $status = 1; 372 377 } else { -
pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php
r535 r579 55 55 $CI->load->model('Services_model'); 56 56 $CI->load->model('frontend/User_model', 'objUserModel'); 57 $result = $CI->Services_model->processMORequest($userID, strtoupper($info));57 $result = $CI->Services_model->processMORequest($userID, $info); 58 58 $CI->objUserModel->insertSmslog($receiverID, $serviceID, $commandCode, $info, $receiveTime); 59 59 -
pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php
r575 r579 39 39 _SBG_MO_PHONENUM_CHANGE => array('pattern' => '/^(SBG[[:blank:]])(DDT)([[:blank:]][0-9]{10,11})([[:blank:]][a-zA-Z0-9]{4,16})$/'), 40 40 _SBG_MO_PASSWORD_RECOVERY => array('pattern' => '/^(SBG[[:blank:]])(MK)$/'), 41 _SBG_MO_PASSWORD_CHANGE => array('pattern' => '/^(SBG[[:blank:]])(MK)([[:blank:]][a-zA-Z0-9 ]{4,16})$/'),41 _SBG_MO_PASSWORD_CHANGE => array('pattern' => '/^(SBG[[:blank:]])(MK)([[:blank:]][a-zA-Z0-9~!@#$%^&*]{4,16})$/'), 42 42 _SBG_MO_VIP_REGISTER => array('pattern' => '/^(SBG[[:blank:]])(VIP)([[:blank:]][0-9]{1,2})$/'), 43 43 _SBG_MO_PAY_TO_ACCOUNT => array('pattern' => '/^(SBG[[:blank:]])(NAP)([[:blank:]][0-9]{3,})$/'), … … 50 50 } 51 51 52 private function messageAnalys ($message) 53 { 54 $aryMatched = array(); 52 public function messageAnalys ($message) 53 { 54 $aryMatched = array(); 55 $aryContent = array(); 55 56 $result = false; 56 foreach ($this->_arySmsMO as $key => $pattern) 57 58 foreach ($this->_arySmsMO as $key => $pattern) 57 59 { 58 $result = preg_match ($pattern['pattern'], $message, $aryMatched);60 $result = preg_match_all ($pattern['pattern'], strtoupper($message), $aryMatched); 59 61 if ((bool)$result) break; 60 62 } 61 63 64 if (count ($aryMatched) > 0) { 65 foreach ($aryMatched as $k => $val) { 66 if ($k == 0) continue; 67 $aryContent[] = trim($val[0]); 68 } 69 } 70 62 71 $key = (bool)$result ? $key:_SBG_MO_SYNTAX_ERR; 63 $aryResult = (bool)$result ? array('case' => $key, 'content' => $aryMatched):array('case' => $key); 72 if ($key == _SBG_MO_PASSWORD_CHANGE || $key == _SBG_MO_PHONENUM_CHANGE) { 73 $index = $key == _SBG_MO_PASSWORD_CHANGE ? 2 : 3; 74 $upcasePass = $aryContent[$index]; 75 $password = substr($message, -strlen($upcasePass)); 76 $aryContent[$index] = $password; 77 } 78 79 $aryResult = (bool)$result ? array('case' => $key, 'content' => $aryContent):array('case' => $key); 64 80 return $aryResult; 65 81 } … … 75 91 $case = $aryMOAnalys['case']; 76 92 $aryContents = isset($aryMOAnalys['content']) ? $aryMOAnalys['content']: null; 77 if ($aryContents != null){ 78 unset($aryContents[0]); 79 $aryTmp = array(); 80 foreach ($aryContents as $key => $val) 81 { 82 $aryTmp[] = trim($val); 83 } 84 $aryContents = $aryTmp; 85 } 86 93 $debugMsg .= var_export($aryMOAnalys); 87 94 $this->load->model('frontend/user_model', 'objUserModel'); 88 95 $debugMsg .= $case; … … 93 100 $userName = isset($aryContents[2]) ? $this->formatPhoneNumber($aryContents[2]) : $sentNumber; 94 101 $collaborator = isset($aryContents[2]) ? $sentNumber:null; 95 $sms = $this->objUserModel->register($userName, $collaborator); 102 $collaboratorMsg = ''; 103 $sms = $this->objUserModel->register($userName, $collaborator, $collaboratorMsg); 96 104 if ($case == _SBG_MO_REGISTER_FOR) { 97 $smsReturn = '1|Ban da dang ky thanh cong dich vu Soan bai giang Online cho '. $userName;105 $smsReturn = $collaboratorMsg; 98 106 $arySMS = explode ('|', $sms); 99 $sendMT = $this->sendMT($userName, $arySMS[1]); 107 if ((int)$arySMS[0] == 1 ) 108 $sendMT = $this->sendMT($this->formatPhoneNumber($userName, -1), $arySMS[1]); 100 109 } 101 110 else { … … 131 140 $smsReturn = $this->objUserModel->rechargeAccount($userName, $amount); 132 141 if (_SBG_MO_PAY_TO_ACCOUNT_FOR) { 133 $smsMT = $smsReturn .' tu thue bao '. $sentNumber; 134 $sendMT = $this->sendMT($userName, $smsMT); 142 $arySmsReturn = explode ('|', $smsReturn); 143 $smsMT = $arySmsReturn[1] .' tu thue bao '. $sentNumber; 144 $sendMT = $this->sendMT($this->formatPhoneNumber($userName, -1), $smsMT); 135 145 } 136 146 } … … 147 157 } 148 158 149 return $smsReturn ;159 return $smsReturn.'|'.$case; 150 160 } 151 161 … … 272 282 } 273 283 274 public function formatPhoneNumber ($phoneNumber ) {284 public function formatPhoneNumber ($phoneNumber, $direction = 1) { 275 285 $aryMatch = array(); 276 if (preg_match('/^(84)([0-9]{9,10})$/', $phoneNumber, $aryMatch) == 1 ) {286 if (preg_match('/^(84)([0-9]{9,10})$/', $phoneNumber, $aryMatch) == 1 && $direction == 1) { 277 287 $result = '0'. $aryMatch[2]; 278 288 } 279 else if (preg_match('/^(0)([0-9]{9,10})$/', $phoneNumber) ) {289 else if (preg_match('/^(0)([0-9]{9,10})$/', $phoneNumber) == 1 && $direction == 1) { 280 290 $result = $phoneNumber; 281 291 } 292 else if (preg_match('/^(84)([0-9]{9,10})$/', $phoneNumber) == 1 && $direction == -1) { 293 $result = $phoneNumber; 294 } 295 else if (preg_match('/^(0)([0-9]{9,10})$/', $phoneNumber, $aryMatch) == 1 && $direction == -1) { 296 $result = '84'. $aryMatch[2]; 297 } 282 298 283 299 return $result;
Note: See TracChangeset
for help on using the changeset viewer.