- Timestamp:
- Nov 4, 2014 6:48:37 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php
r397 r408 10 10 { 11 11 parent::__construct(); 12 $this->vservices->setApiUrl($this->config->item('api_url')); 13 $this->vservices->setConnection($this->curl); 12 14 } 13 15 … … 26 28 $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') "; 27 29 } 30 if ($data['status'] == 1){ 31 $sql.=" WHERE expire_date > NOW()"; 32 } 33 if ($data['status'] == 2){ 34 $sql.=" WHERE expire_date < NOW()"; 35 } 28 36 $order = ""; 29 37 if ($data['sorting_order'] != "sorting") { 30 $sort = "DESC"; 31 if ($data['sorting_order'] == "sorting_asc") 32 $sort = "ASC"; 33 $order = "ORDER BY " . $data['sorting_field'] . " " . $sort; 38 if($data['sorting_field'] != "status"){ 39 $sort = "DESC"; 40 if ($data['sorting_order'] == "sorting_asc") 41 $sort = "ASC"; 42 $order = "ORDER BY " . $data['sorting_field'] . " " . $sort; 43 } 34 44 } 35 45 return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array(); … … 39 49 { 40 50 $sql="SELECT COUNT(".$this->id_name.") AS total FROM ".$this->table_name; 51 52 if ($data['status'] == 1){ 53 $sql.=" WHERE expire_date > NOW()"; 54 } 55 if ($data['status'] == 2){ 56 $sql.=" WHERE expire_date < NOW()"; 57 } 58 41 59 if (isset($data['keyword'])) 42 60 { 43 $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') "; 61 if (strlen($data['keyword'])>0) 62 $sql.=" WHERE (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%') "; 44 63 } 45 64 return $this->db->query($sql)->row_array()['total']; 46 65 } 66 67 function get_user_info($src, $us_id, $token) 68 { 69 $data = $this->vservices->actionExecute('getinfo', array('src' => $src, 'us_id' => $us_id, 'token'=>$token), 'user'); 70 return $data; 71 } 47 72 }
Note: See TracChangeset
for help on using the changeset viewer.