<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Tour_model extends CI_Model {

    function __construct() {
        parent::__construct();
        $this->HT = $this->load->database('HT', TRUE);
    }

    public $crm_coli_webcode;

    public function init() {
        $this->crm_coli_webcode = false;
    }

    public function get_list() {
        $sql = "
            

        ";

        if (!empty($this->crm_coli_webcode)) {
            $crm_coli_webcode='';
            foreach ($this->crm_coli_webcode as $item) {
                $crm_coli_webcode .= '\'' . $item . '\',';
            }
            $crm_coli_webcode .='0';
            $sql .= " AND coli.COLI_WebCode in ($crm_coli_webcode) ";
        }

        echo $sql;
        // $query = $this->HT->query($sql);
        //print_r($this->HT->queries);
        // return $query->result();
    }

    //线路类型,PPC,newsletters,QA,InquiryForm等
    public function get_sourcetype_list() {
        $sql = " 
            SELECT syc_sn,
                   syc2_codediscribe
            FROM V_System_Code
            WHERE LGC_LGC = 2
              AND SYC_Type = 32
              AND ltrim(isnull(SYC2_CodeDiscribe,''))<>''
              AND SYC_Delete=0
            ORDER BY SYC2_CodeDiscribe
                        ";
        $query = $this->HT->query($sql);
        return $query->result();
    }

    //网站列表
    public function get_website_list() {
        $sql = "
        select wci_code,wci_describe 
        from WebCodeInfo 
        where WCI_Describe not like '全民营销%'
                ";
        $query = $this->HT->query($sql);
        return $query->result();
    }

    //获取国籍列表
    public function get_country_list() {
        $sql = "  
            
            SELECT coi_sn,
                   coi_code,
                   coi2_country
            FROM V_Country_Info
            WHERE LGC_LGC = 2
              AND COI2_Country<>''
              AND COI_Code IS NOT NULL
            ORDER BY COI_Code ASC
                  ";
        $query = $this->HT->query($sql);
        return $query->result();
    }

}
