| | |
| | | continue; |
| | | } |
| | | //活动规则 |
| | | $rewardRule=json_encode($act['act_json']); |
| | | $rewardRule=json_decode($act['act_json']); |
| | | foreach($cusList as $cus) |
| | | {//循环参与活动的会员 |
| | | $yqCount=Db::query('select count(1) as count from t_user where invitation_id=? and invite_bind_time>=? and invite_bind_time<=?',[$cus['user_id'],$cus['create_time'],$actEndTime]); |
| | |
| | | } |
| | | //计算应得金额 |
| | | $price=0; |
| | | switch($rewardRule['act_type']) |
| | | switch($rewardRule->act_type) |
| | | { |
| | | case 'step_all'://阶梯完成后赠送 |
| | | $this->stepAllRule($rewardRule['rule'],$yqCount['count']); |
| | | $price=$this->stepAllRule($rewardRule->rule,$yqCount[0]['count']); |
| | | break; |
| | | default: |
| | | continue; |
| | | break; |
| | | break; |
| | | } |
| | | |
| | | if($price<=0) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | $tradeId=$act['id'].$cus['user_id']; |
| | | //插入聚推客的订单 |
| | |
| | | */ |
| | | public function stepAllRule($rule,$yqCount) |
| | | { |
| | | $currentStep=$rule->where('c_count','<=',$yqCount)->max('c_count'); |
| | | $maxReward=0; |
| | | foreach($rule as $r_item) |
| | | { |
| | | if($r_item->c_count>$yqCount) |
| | | { |
| | | continue; |
| | | } |
| | | if($maxReward<$r_item->reward) |
| | | { |
| | | $maxReward=$r_item->reward; |
| | | } |
| | | } |
| | | return $maxReward; |
| | | } |
| | | |
| | | } |