예제 #1
0
 /**
  * 发送动作页面,一般是ajax提交的数据
  */
 public function sendAction()
 {
     $act = $this->getInput('act', 'post');
     $uid = $this->getInput('uid', 'post');
     if (!$act) {
         $this->showError('请选择动作');
     }
     if (!$uid) {
         $this->showError('请选择用户');
     }
     !is_array($uid) && ($uid = array($uid));
     Wind::import('EXT:dongta.service.dm.App_Dongta_Dm');
     $service = Wekit::load('EXT:dongta.service.App_Dongta');
     $users = Wekit::load('user.PwUser')->fetchUserByUid($uid);
     $actMap = (include Wind::getRealPath('EXT:dongta.conf.dongta.php', true));
     $title = '<a href="' . WindUrlHelper::createUrl('space/index/run', array('uid' => $this->loginUser->uid)) . '">' . $this->loginUser->username . '</a> ' . str_replace('{Ta}', '你', $actMap[$act][1]);
     $content = $title . ' <br>[来自应用 <a href="' . WindUrlHelper::createUrl('app/dongta/index/run') . '">动他一下</a>]';
     foreach ($users as $key => $value) {
         $dm = new App_Dongta_Dm();
         $dm->setAct($act)->setTouid($value['uid'])->setCreatedUser($this->loginUser->uid, $this->loginUser->username)->setCreatedTime(Pw::getTime());
         $service->add($dm);
         Wekit::load('message.srv.PwNoticeService')->sendNotice($value['uid'], 'app', 0, array('title' => $title, 'content' => $content));
     }
     $this->showMessage('operate.success');
 }
예제 #2
0
 /**
  * update record
  *
  * @param App_Dongta_Dm $dm
  * @return multitype:|Ambigous <boolean, number, rowCount>
  */
 public function update(App_Dongta_Dm $dm)
 {
     if (true !== ($r = $dm->beforeUpdate())) {
         return $r;
     }
     return $this->_loadDao()->update($dm->getId(), $dm->getData());
 }