Beispiel #1
0
 /**
  * 更新用户积分
  *
  * @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);
 }
Beispiel #2
0
 public function editDmCredit(WindidCreditDm $dm)
 {
     $params = array('uid' => $dm->uid, 'set' => array(), 'add' => array());
     $data = $dm->getData();
     $increase = $dm->getIncreaseData();
     if ($data) {
         foreach ($data as $key => $value) {
             $params['set'][substr($key, 6)] = $value;
         }
     }
     if ($increase) {
         foreach ($increase as $key => $value) {
             $params['add'][substr($key, 6)] = $value;
         }
     }
     return WindidApi::open('user/editDmCredit', array(), $params);
 }
Beispiel #3
0
 /**
  * 更新用户积分信息
  *
  * @param WindidUserDm $dm 用户资料
  * @return int|bool 返回用户注册uid|失败时返回false
  */
 public function updateCredit(WindidCreditDm $dm)
 {
     if (($check = $dm->beforeUpdate()) !== true) {
         return false;
     }
     return $this->_getDao(self::FETCH_DATA)->updateCredit($dm->uid, $dm->getData(), $dm->getIncreaseData());
 }
 /** 
  * 设置用户积分
  * 
  * @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);
 }
Beispiel #5
0
 /**
  * 更新用户积分
  * 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;
 }
Beispiel #6
0
 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));
 }