[564] | 1 | <?php
|
---|
[439] | 2 |
|
---|
[564] | 3 | if (! defined ( 'BASEPATH' ))
|
---|
| 4 | exit ( 'No direct script access allowed' );
|
---|
| 5 | class User extends MX_Controller {
|
---|
[439] | 6 | const TOKENPW = 'violet';
|
---|
| 7 | public function __construct() {
|
---|
[564] | 8 | parent::__construct ();
|
---|
[439] | 9 | }
|
---|
[564] | 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 );
|
---|
[439] | 17 | }
|
---|
[564] | 18 | } else {
|
---|
| 19 | redirect ( '/frontend/home' );
|
---|
[439] | 20 | }
|
---|
| 21 | }
|
---|
[564] | 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 | );
|
---|
[439] | 39 | }
|
---|
| 40 | } |
---|