Ejemplo n.º 1
0
 private function getRewardMemberIds($accountId, $memberId, $birthdayRule)
 {
     if (!empty($memberId)) {
         $memberIds = $this->getMembers($accountId, $birthdayRule->triggerTime, $memberId);
     } else {
         $memberIds = $this->getMembers($accountId, $birthdayRule->triggerTime);
     }
     $thisYear = TimeUtil::thisYear();
     if ($birthdayRule->rewardType == ScoreRule::REWARD_SCORE_TYPE) {
         $scoreHistoryMemberIds = ScoreHistory::getAllMemberIdByRuleName(ScoreRule::NAME_BIRTHDAY, $memberIds, $accountId, $thisYear);
         $memberIds = array_diff($memberIds, $scoreHistoryMemberIds);
         //check this rule whether reward in coupon
         $couponLogMemberIds = CouponLog::getAllMemberIdByRuleName(ScoreRule::NAME_BIRTHDAY, $memberIds, $accountId);
         $memberIds = array_diff($memberIds, $couponLogMemberIds);
     } else {
         if ($birthdayRule->rewardType == ScoreRule::REWARD_COUPON_TYPE) {
             $couponLogMemberIds = CouponLog::getAllMemberIdByRuleName(ScoreRule::NAME_BIRTHDAY, $memberIds, $accountId, $thisYear);
             $memberIds = array_diff($memberIds, $couponLogMemberIds);
             //check this rule whethe reward in score
             $scoreHistoryMemberIds = ScoreHistory::getAllMemberIdByRuleName(ScoreRule::NAME_BIRTHDAY, $memberIds, $accountId, $thisYear);
             $memberIds = array_diff($memberIds, $scoreHistoryMemberIds);
         }
     }
     return $memberIds;
 }