/** * 获取经纪人新推客户数 * * @param $brokerId * @return int|mixed */ public static function getBrokerLatestPushCountValue($brokerId) { $count = 0; /* @var Model_Mobile_CustomerLatestPushCount $todayCustomerPushedCount */ $todayCustomerPushedCount = Model_Mobile_CustomerLatestPushCount::data_access()->filter('brokerId', $brokerId)->filter('pushDate', date('Y-m-d'))->find_only(); if (!empty($todayCustomerPushedCount)) { $count = $todayCustomerPushedCount->count; } return $count; }
private function pushLastMsgNum($brokerId) { $thisPushLastMsgNum = Model_Mobile_CustomerLatestPushCount::data_access()->filter('brokerId', $brokerId)->filter('pushDate', date('Y-m-d', time()))->find_only(); if (!empty($thisPushLastMsgNum)) { $thisPushLastMsgNum->incrPushedCount(); } else { $insertData['brokerId'] = $brokerId; $insertData['pushDate'] = date('Y-m-d', time()); $insertData['count'] = 1; try { $MODEL = Model_Mobile_CustomerLatestPushCount::create($insertData); $MODEL::$enable_cache = false; $MODEL->save(); } catch (Exception $e) { Model_Mobile_BrokerUserRelation::data_access()->roll_back(); } } }