Example #1
0
 /**
  * 列出用户拥有的邀请码
  */
 private function listCode()
 {
     $perpage = 6;
     list($type, $page) = $this->getInput(array('type', 'page'), 'get');
     $vo = new PwInviteCodeSo();
     $vo->setCreatedUid($this->loginUser->uid)->setIfused(0)->setExpireTime(Pw::getTime() - $this->regist['invite.expired'] * 86400);
     //未过期
     $count = $this->_getDs()->countSearchCode($vo);
     $list = array();
     if ($count) {
         $totalPage = ceil($count / $perpage);
         $page = intval($page);
         $page = $page < 1 ? 1 : ($page > $totalPage ? $totalPage : $page);
         list($start, $limit) = Pw::page2limit($page, $perpage);
         /* @var $service PwInviteCodeService */
         $service = Wekit::load('invite.srv.PwInviteCodeService');
         $list = $service->searchInvitecodeList($vo, $limit, $start);
     }
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($list, 'list');
     $this->setOutput($page, 'page');
     $this->setOutput($type, 'type');
 }
Example #2
0
 /**
  * 根据条件统计邀请码总数
  *
  * @param PwInviteCodeSo $condition
  * @return int
  */
 public function countSearchCode(PwInviteCodeSo $condition)
 {
     return $this->_getDao()->countSearchCode($condition->getData());
 }