source: pro-violet-viettel/sourcecode/application/modules/frontend/models/servicepackage_model.php @ 744

Last change on this file since 744 was 662, checked in by quyenla, 10 years ago

trial

File size: 1.6 KB
Line 
1<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
3class Servicepackage_model extends MY_Model
4{
5       
6        protected $table_name = 'tblservicepackage';
7        protected $id_name = 'p_id';
8        const TOKENPW = 'violet';
9       
10        function __construct()
11        {
12        parent::__construct();
13                $this->vservices->setApiUrl($this->config->item('api_url'));
14                $this->vservices->setConnection($this->curl);
15    }
16       
17    function getAllPackages()
18    {
19        $this->db->query('UNLOCK TABLES');
20        $sql="SELECT * FROM ".$this->table_name." WHERE p_period > 0";
21        return $this->db->query($sql)->result_array();
22    }
23    function getTrialPackage()
24    {
25        $this->db->query('UNLOCK TABLES');
26        $sql="SELECT * FROM ".$this->table_name." WHERE p_period < 0 LIMIT 1";
27        return $this->db->query($sql)->row_array();
28    }
29    function getPackage($p_id)
30    {
31        $this->db->query('UNLOCK TABLES');
32        $sql="SELECT * FROM ".$this->table_name." WHERE ".$this->id_name."=".$p_id;
33        return $this->db->query($sql)->row_array();
34    }
35   
36    function getPackagePriceByCode ($p_code)
37    {
38        $this->db->query('UNLOCK TABLES');
39        $sql='SELECT p_price FROM '. $this->table_name .' WHERE p_code = ?';
40        $query =  $this->db->query($sql , array($p_code));
41        $row = $query->row_array();
42        return $row['p_price'];
43    }
44   
45    function getPackageByCode ($p_code)
46    {
47        $this->db->query('UNLOCK TABLES');
48        $sql='SELECT * FROM '. $this->table_name .' WHERE p_code = ?';
49        $query =  $this->db->query($sql , array($p_code));
50        $row = $query->row_array();
51        return $row;
52    }
53       
54}
Note: See TracBrowser for help on using the repository browser.