member_id = $member_id; $this->mod_member = Model('member'); $mem_info = $this->mod_member->getMemberInfoByID($member_id); $this->mem_info = new member_info($mem_info); } public function run() { if($this->check_present()) return; if($this->check_fcode()) return; } public function topup() { $mod_bonus = Model('user_bonus'); $total = $mod_bonus->getUsableSum($this->member_id) + $mod_bonus->getBindSum($this->member_id); if($total > 50) return false; $params = bonus\parameters::poor_user(); foreach ($params as $param) { $type = bonus_helper::create_type_input($param); $money = $type->getTotal_amount(); $rate = $type->bonus_rate(); $ret = bonus_helper::make_bonus($param,$param['rate_money']); if($ret != false) { $type_sn = $ret['type_sn']; bonus_helper::send($type_sn,[$this->member_id]); push_helper::poor_user_bonus($this->member_id,$money,$rate,$type_sn); } else { return false; } } } private function check_present() { if($this->mem_info->order_num() > 0) { return false; } if($this->mem_info->first_present() > 0) { return false; } $result = fcode\present_manager::instance()->fetch($this->mem_info->mobile(),null); if($result == false) return false; $fcode = $result['fcode']; $this->mod_member->editMember(['member_id' => $this->member_id],['first_present' => intval($fcode['fc_id'])]); push_helper::first_present($this->member_id,$fcode); return true; } private function check_fcode() { return false; } }