|
@@ -9,9 +9,11 @@
|
|
|
namespace bonus;
|
|
|
|
|
|
require_once (BASE_ROOT_PATH . '/helper/model_helper.php');
|
|
|
+require_once (BASE_ROOT_PATH . '/helper/algorithm.php');
|
|
|
|
|
|
use \session_helper;
|
|
|
use \member_info;
|
|
|
+use \algorithm;
|
|
|
|
|
|
class manager
|
|
|
{
|
|
@@ -222,8 +224,14 @@ class manager
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function send($type_sn,$member_ids)
|
|
|
+ public function send($type_sn,$ids)
|
|
|
{
|
|
|
+ $member_ids = [];
|
|
|
+ foreach ($ids as $id) {
|
|
|
+ $member_ids[] = intval($id);
|
|
|
+ }
|
|
|
+ sort($member_ids);
|
|
|
+
|
|
|
$mod_bonus = Model('user_bonus');
|
|
|
|
|
|
$cond['user_id'] = array('in',$member_ids);
|
|
@@ -231,19 +239,20 @@ class manager
|
|
|
$items = $mod_bonus->getBonusList($cond);
|
|
|
unset($cond);
|
|
|
|
|
|
- $ret = array();
|
|
|
+ $ret = [];
|
|
|
foreach ($items as $item)
|
|
|
{
|
|
|
- $user_id = $item['user_id'];
|
|
|
- if(($pos = array_search($user_id,$member_ids)) != false) {
|
|
|
- unset($member_ids[$pos]);
|
|
|
+ $user_id = intval($item['user_id']);
|
|
|
+ if(algorithm::binary_search($user_id,$member_ids) != false)
|
|
|
+ {
|
|
|
+ $pos = algorithm::lower_bonud($member_ids,$user_id);
|
|
|
+ algorithm::array_erase($member_ids,$pos);
|
|
|
$ret[] = $item;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$cond['bonus_status'] = 0;
|
|
|
$cond['type_sn'] = $type_sn;
|
|
|
-
|
|
|
if(!empty($member_ids))
|
|
|
{
|
|
|
$count = count($member_ids);
|