objRedpack = new Redpack(); $this->objRedpackLog = new RedpackLog(); $this->objBind = new UserBindInfo; parent::__construct('redpack', 'id', 'update_time_int'); } protected function addNewRows($newRows) { foreach ($newRows as $k => $row) { $row['create_time'] = $this->formatDateTime($row['create_time']); $row['quantity_total_int'] = Eos::toNumber($row['quantity_total']); $row['quantity_left_int'] = Eos::toNumber($row['quantity_left']); $row['sender_id'] = $this->objBind->getUserIdBy($row['sender']); $newRows[$k] = $row; } parent::addNewRows($newRows); foreach ($newRows as $row) { // 初始化红包奖励队列 $this->objRedpack->initReward($row, $this->objRedis); } } protected function updateRow($row, $priValue, $dbRow) { $row['create_time'] = $this->formatDateTime($row['create_time']); $row['quantity_total_int'] = Eos::toNumber($row['quantity_total']); $row['quantity_left_int'] = Eos::toNumber($row['quantity_left']); parent::updateRow($row, $priValue, $dbRow); // 红包结束计算最佳 if ($dbRow['status'] == 0 && $row['status'] > 0) { try { $this->objRedpackLog->updateBest($row['transfer_trx_id']); } catch (Exception $e) { alermErrorMsg($e->getMessage()); } } } }