source: pro-violet-viettel/www/deploy/20150304/application/modules/ajax/controllers/user.php @ 780

Last change on this file since 780 was 780, checked in by dungnv, 10 years ago
File size: 1.2 KB
Line 
1<?php
2
3if (! defined ( 'BASEPATH' ))
4        exit ( 'No direct script access allowed' );
5class User extends MX_Controller {
6        const TOKENPW = 'violet';
7        public function __construct() {
8                parent::__construct ();
9        }
10        public function login($return_type = 'xml') {
11                $user_info = $this->session->userdata ( 'userInfo' );
12                if ($user_info) {
13                        $user = $user_info ['user'];
14                        $data ['content'] = $this->get_data ( $user );
15                        if ($return_type == "xml") {
16                                $this->load->view ( 'user', $data );
17                        }
18                } else {
19                        redirect ( '/frontend/home' );
20                }
21        }
22        private function get_data($user) {
23                $this->load->model ( 'us_model' );
24                $aryParams = array ();
25                parse_str ( $user, $aryParams );
26                $us = $this->us_model->search_by_id ( $aryParams ['id'] );
27                return array (
28                                "userId" => $aryParams ['id'],
29                                "userLevel" => 1,
30                                "userPhone" => $aryParams ['phone'],
31                                "userMoney" => $us ['acc_balanced'],
32                                "appUserName" => $aryParams ['fullname'],
33                                "appAddress" => $aryParams ['school'],
34                                "licType" => "SBG",
35                                "licCustomer" => $aryParams ['username'],
36                                "licCreate" => $us ['created_time'],
37                                "licExpire" => $us ['expire_date']
38                );
39        }
40}
Note: See TracBrowser for help on using the repository browser.