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

/**
 * 首页功能类 
 *
 * @package         zsb
 * @subpackage      Models
 * @category        Models
 * 
 */
class welcome_test_model extends MY_Model{
    
    public function __construct() {
        parent::__construct();
   }
   
   /**
    * 查询经纪人收藏的应用管理
    * get_app_custom
    * @param int $uid
    * @return array
    */
   public function get_app_custom($uid){
        
        $key = $this->config_cityflag . '_get_app_custom_' . $uid;
        $cache = $this->mc->get($key);

        if($cache['isok'] == 1)
        {
            $return_data = $cache['data'];
        }
        else
        {
            //查询字段
            $this->dbback->select('app_custom');
            //查询条件
            $this->dbback->where("uid = '".$uid."'");
            //查询
            $arr_data = $this->dbback->get('broker_sub')->row_array();
            $return_data = isset($arr_data['app_custom']) ? $arr_data['app_custom'] : '';

            $this->mc->set($key, array('isok'=>1, 'data'=>$return_data), 86400);
        }

        return $return_data;
   }
   
   /**
    * 修改经纪人应用管理
    * udpate_app_custom
    * @param array $app_arr 应用数组
    * @param int $uid 用户id
    */
   public function update_app_custom($uid,$active_app_s){

       $key = $this->config_cityflag . '_get_app_custom_' . $uid;

       $data = array('uid' => $uid, 'app_custom' => $active_app_s);
       $this->db->replace('broker_sub',$data);

       $this->mc->delete($key);
   }
   
   /**
   * 获取经纪人诚信logo
   * @param int $uid 用户id
   * @return int
   */
   public function get_honesty_status($uid)
   {
       $key = $this->config_cityflag.'_get_honesty_status_'.$uid;
       $cache = $this->mc->get($key);

       if($cache['isok'] == 1)
       {
           $data = $cache['data'];
       }
       else
       {
           $list = $this->dbback->select('honesty_status')->get_where('broker',array('uid'=>$uid))->row_array();
           $data = $list['honesty_status'];
           $this->mc->set($key, array('isok'=>1, 'data'=>$data), 600);
       }

       return $data;
   }
   
   
    
}




