想通了出。做類似如下:
public function getPoints($customer_id = false) {
$customer = Mage::getModel('customer/customer')->load($customer_id);
$reward = Mage::getModel('enterprise_reward/reward')
->setCustomer($customer)
->setWebsiteId(Mage::app()->getWebsite()->getId())
->loadByCustomer();
$balance = $reward->getPointsBalance();
return $balance;
}
public function setPoints($customer_id = false, $points = false, $comment = 'Adjustment', $action = 0) {
$customer = Mage::getModel('customer/customer')->load($customer_id);
$reward = Mage::getModel('enterprise_reward/reward')
->setCustomer($customer)
->setWebsiteId(Mage::app()->getWebsite()->getId())
->loadByCustomer();
$reward->setPointsBalance($points)
->setAction($action) // Enterprise_Reward_Model_Reward::REWARD_ACTION_ADMIN
->setComment($comment)
->updateRewardPoints();
$history = Mage::getModel('enterprise_reward/reward_history')
->setReward($reward)->prepareFromReward()->save();
}