ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
### 通过顾客身份判断是否会员来计算最优活动积分倍率 **位置:** Wpos\Controller\IndexController.class.php **参数:** * 通过顾客身份判断是否会员来计算最优活动积分倍率 * @param $customer int 顾客会员身份 * @return array **调用:** * $result = $this->calculate_active_integral($customer); **完整代码:** ~~~ /** * 计算最优活动积分倍率 * Lanson 2017-09-06 * @param $customer int 顾客会员身份 * @return array */ public function calculate_active_integral($customer) { $rate = 0; // 1.调用营销活动公共方法 $event_result = $this->check_public_active($customer); if (empty($event_result)) { if (empty($customer)) { return array('success' => false, 'rate' => 0); } else { return array('success' => false, 'rate' => 1); } } // 2.积分倍率最优判定 foreach ($event_result as $key => $value) { if (empty($value['rate'])) { unset($event_result[$key]); continue; } if ($value['rate'] > $rate) { $rate = $value['rate']; } } if (empty($event_result)) { if (empty($customer)) { return array('success' => false, 'rate' => 0); } else { return array('success' => false, 'rate' => 1); } } else { if (empty($customer)) { return array('success' => false, 'rate' => 0); } else { return array('success' => true,'rate' => $rate); } } } ~~~