/** * 更新用户积分 * * @param int $uid * @param int $cType (1-8) * @param int $value */ public function editCredit($uid, $cType, $value, $isset = false) { Wind::import('WSRV:user.dm.WindidCreditDm'); $dm = new WindidCreditDm($uid); if ($isset) { $dm->setCredit($cType, $value); } else { $dm->addCredit($cType, $value); } return $this->_getUserDs()->updateCredit($dm); }
/** * 更新用户积分 * Enter description here ... * @param int $uid * @param int $cType (1-8) * @param int $value */ public function editCredit($uid, $cType, $value, $isset = false) { Wind::import('WINDID:service.user.dm.WindidCreditDm'); $dm = new WindidCreditDm($uid); if ($isset) { $dm->setCredit($cType, $value); } else { $dm->addCredit($cType, $value); } $result = $this->_getUserDs()->updateCredit($dm); if ($result instanceof WindidError) { return $result->getCode(); } if (!$result) { return 0; } $this->_getNotifyClient()->send('editCredit', $uid); return (int) $result; }
/** * 设置用户积分 * * @return void */ public function doEditCreditAction() { $uid = $this->getInput('uid', 'post'); if (!$uid) { $this->showError('WINDID:fail'); } $credits = $this->getInput("credit"); Wind::import('WSRV:user.dm.WindidCreditDm'); $dm = new WindidCreditDm($uid); foreach ($credits as $id => $value) { $dm->setCredit($id, $value); } $ds = Wekit::load('WSRV:user.WindidUser'); $result = $ds->updateCredit($dm); if ($result instanceof WindidError) { $this->showError($result->getCode()); } $srv = Wekit::load('WSRV:notify.srv.WindidNotifyService'); $srv->send('editCredit', array('uid' => $uid)); $this->showMessage('WINDID:success', 'windid/user/editCredit?uid=' . $uid); }
public function editDmCreditAction() { $uid = (int) $this->getInput('uid', 'post'); list($set, $add) = $this->getInput(array('set', 'add'), 'post'); Wind::import('WSRV:user.dm.WindidCreditDm'); $dm = new WindidCreditDm($uid); if ($set && is_array($set)) { foreach ($set as $key => $value) { $dm->setCredit($key, $value); } } if ($add && is_array($add)) { foreach ($add as $key => $value) { $dm->addCredit($key, $value); } } $result = $this->_getUserDs()->updateCredit($dm); if ($result instanceof WindidError) { $this->output($result->getCode()); } if ($result) { $this->_getNotifyService()->send('editCredit', array('uid' => $uid), $this->appid); } $this->output(WindidUtility::result($result)); }