public static function todayBidClickAndCost($ajkBrokerId, $date = '')
 {
     $date = empty($date) ? date('Y-m-d') : $date;
     $click = $cost = 0;
     $jpMemberId = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($ajkBrokerId);
     // 获取金铺brokerId
     $jpMemberId = $jpMemberId->id;
     if (!empty($jpMemberId)) {
         $re = Model_Log_JpCharge::data_access()->filter('member_id', $jpMemberId)->filter_by_op('create_time', '>=', $date . ' 00:00:00')->filter_by_op('create_time', '<=', $date . ' 23:59:59')->filter('spread_type', 2)->filter('charge_type', 0)->get_all();
         if (!empty($re)) {
             foreach ($re as $r) {
                 $click++;
                 $cost += round($r['real_cost'] / 100, 2);
             }
         }
     }
     return array('click' => $click, 'cost' => $cost);
 }
 public static function get7DaysHouseClick($propId)
 {
     if (empty($propId)) {
         return array();
     }
     $return = $clickInfo = array();
     $cache = APF_Cache_Factory::get_instance()->get_memcache();
     $time = time();
     for ($i = 0; $i < 7; $i++) {
         $date = date('Y-m-d', $time - $i * 86400);
         if ($i == 0) {
             $clicks = Model_Log_JpCharge::data_access()->filter('house_id', $propId)->filter_by_op('create_time', '>=', date('Y-m-d') . ' 00:00:00')->filter_by_op('create_time', '<=', date('Y-m-d') . ' 23:59:59')->filter('charge_type', 0)->get_all();
             $clickFormat = array(1 => array('num' => 0, 'cost' => 0), 2 => array('num' => 0, 'cost' => 0));
             if (!empty($clicks)) {
                 foreach ($clicks as $click) {
                     $clickFormat[$click['spread_type']]['num']++;
                     $clickFormat[$click['spread_type']]['cost'] += $click['real_cost'];
                 }
             }
         } else {
             $key = __CLASS__ . __FUNCTION__ . $propId . '_' . $date;
             $clickFormat = $cache->get($key);
             if ($clickFormat === false) {
                 $clicks = Model_Log_JpCharge::data_access()->filter('house_id', $propId)->filter_by_op('create_time', '>=', $date . ' 00:00:00')->filter_by_op('create_time', '<=', $date . ' 23:59:59')->filter('charge_type', 0)->get_all();
                 $clickFormat = array(1 => array('num' => 0, 'cost' => 0), 2 => array('num' => 0, 'cost' => 0));
                 if (!empty($clicks)) {
                     foreach ($clicks as $click) {
                         $clickFormat[$click['spread_type']]['num']++;
                         $clickFormat[$click['spread_type']]['cost'] += $click['real_cost'];
                     }
                 }
                 $cache->set($key, $clickFormat, 7200);
             }
         }
         $return[$date] = $clickFormat;
     }
     return $return;
 }