当前位置: 首页>>代码示例>>PHP>>正文


PHP api::get_date方法代码示例

本文整理汇总了PHP中api::get_date方法的典型用法代码示例。如果您正苦于以下问题:PHP api::get_date方法的具体用法?PHP api::get_date怎么用?PHP api::get_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在api的用法示例。


在下文中一共展示了api::get_date方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * 获取群列表
  */
 public function index()
 {
     if ($this->get_method() != 'GET') {
         $this->send_response(405, NULL, '请求的方法不存在');
     } else {
         $data = $this->get_data();
         $type = (int) $this->input->get('type', 0);
         $result = $this->model->getUserAllGroup($this->user_id, $type);
         $showTabList = Tab_Model::instance()->getList($this->user_id, 1);
         $gidList = array();
         foreach ($showTabList as $key => $value) {
             if ($value['id'] != Kohana::config('uap.xiaomo_qun')) {
                 $gidList[$value['id']] = $key;
             }
         }
         $groupList = array();
         $privateType = Kohana::config('group.type.private');
         foreach ($result as $value) {
             $sort = (int) $gidList[$value['gid']];
             $groupInfo = array();
             $groupInfo['is_hide'] = 0;
             if (array_key_exists($value['gid'], $gidList)) {
                 $groupInfo['is_hide'] = 0;
             }
             $groupInfo['id'] = floatval($value['gid']);
             $groupInfo['name'] = $value['gname'];
             $groupInfo['notice'] = $value['notice'];
             $groupInfo['introduction'] = $value['introduction'];
             $groupInfo['privacy'] = intval($value['privacy']);
             $groupInfo['created_at'] = api::get_date($value['create_time']);
             $groupInfo['modified_at'] = api::get_date($value['modify_time']);
             $creator = array();
             $creator['id'] = floatval($value['creator_id']);
             $creator['name'] = sns::getrealname($value['creator_id']);
             $creator['avatar'] = sns::getavatar($value['creator_id']);
             $groupInfo['creator'] = $creator;
             $groupInfo['master'] = $creator;
             $managerIdList = $this->model->getManagerId($groupInfo['id']);
             $managerList = array();
             foreach ($managerIdList as $val) {
                 $manager = array();
                 $manager['id'] = floatval($val['uid']);
                 $manager['name'] = sns::getrealname($manager['id']);
                 $manager['avatar'] = sns::getavatar($manager['id']);
                 $managerList[] = $manager;
                 unset($manager);
             }
             $groupInfo['manager'] = $managerList;
             $groupInfo['member_count'] = (int) $this->model->getGroupMemberNum($value['gid']);
             $groupList[$sort] = $groupInfo;
             unset($groupInfo);
             unset($creator);
         }
         ksort($groupList);
         foreach ($groupList as $group) {
             $return_list[] = $group;
         }
         $this->send_response(200, $return_list);
     }
 }
开发者ID:momoim,项目名称:momo-api,代码行数:63,代码来源:group.php

示例2: _fill_activity_list

 /**
  * 填充活动列表信息
  * @param array $aidList 活动ID列表
  * @param int $start 开始位置
  * @param int $pos 获取数量
  * return array
  */
 private function _fill_activity_list($aidList, $start, $pos)
 {
     $activityList = array();
     $activityType = array_flip(Kohana::config('activity.type'));
     $activityTypeName = Kohana::config('activity.typeName');
     $nowTime = time();
     $friendModel = new Friend_Model();
     $groupModel = new Group_Model();
     $index = 0;
     foreach ($aidList as $value) {
         $aid = $value['aid'];
         $gidArray = $this->model->getActivityGroupId($aid);
         $activityInfo = $this->model->getActivityInfo($aid);
         if ($activityInfo['creator_id'] != $this->user_id && !$activityInfo['is_allow_invite']) {
             $permit = false;
             foreach ($gidArray as $val) {
                 if ($val['gid'] == -1) {
                     $isFriend = $friendModel->check_isfriend($this->user_id, $activityInfo['creator_id']);
                     if ($isFriend) {
                         $permit = true;
                         break;
                     }
                     continue;
                 }
                 $grade = $groupModel->getMemberGrade($val['gid'], $this->user_id);
                 if ($grade > 0) {
                     $permit = true;
                     break;
                 }
             }
             if (!$permit) {
                 continue;
             }
         }
         if ($pos == 0 || $index >= $start && $index < $start + $pos) {
             $activity = array();
             $activity['id'] = floatval($activityInfo['aid']);
             $user = array();
             $user['id'] = floatval($activityInfo['creator_id']);
             $user['name'] = sns::getrealname($activityInfo['creator_id']);
             $user['avatar'] = sns::getavatar($activityInfo['creator_id']);
             $activity['user'] = $user;
             $activity['title'] = $activityInfo['title'];
             $activity['start_at'] = api::get_date($activityInfo['start_time']);
             $activity['end_at'] = api::get_date($activityInfo['end_time']);
             $activity['spot'] = $activityInfo['spot'];
             //$activity['content'] = $activityInfo['content'];
             $type = $activityType[$activityInfo['type']];
             $activity['type'] = $activityTypeName[$type];
             if ($activityInfo['end_time'] < $nowTime) {
                 $status = Kohana::config('activity.status.end.id');
             } else {
                 if ($activityInfo['start_time'] > $nowTime) {
                     $status = Kohana::config('activity.status.enroll.id');
                 } else {
                     $status = Kohana::config('activity.status.working.id');
                 }
             }
             $activity['status'] = $status;
             $activity['apply_type'] = $this->model->getActivityApplyType($activity['id'], $this->user_id);
             $activity['is_hide'] = -1;
             $result = $this->model->getActivityOrganizer($activity['id']);
             $organizer = array();
             unset($user);
             foreach ($result as $val) {
                 $user = array();
                 $user['id'] = floatval($val['uid']);
                 $userInfo = sns::getuser($val['uid']);
                 $user['name'] = $userInfo['realname'];
                 $user['avatar'] = sns::getavatar($val['uid']);
                 $user['mobile'] = $userInfo['mobile'];
                 $organizer[] = $user;
                 unset($userInfo);
                 unset($user);
             }
             $activity['organizer'] = $organizer;
             $activityList[] = $activity;
             unset($activityInfo);
             unset($activity);
             unset($user);
         }
         $index++;
     }
     return array('data' => $activityList, 'count' => $index);
 }
开发者ID:momoim,项目名称:momo-api,代码行数:92,代码来源:activity.php

示例3: lists

 /**
  * 获取系统消息列表,提供给j2me使用
  */
 public function lists()
 {
     if ($this->get_method() != 'GET') {
         $this->send_response(405, NULL, '请求的方法不存在');
     }
     $pagesize = $this->input->get('pagesize', 5);
     $start = $this->input->get('start', 0);
     $new = $this->input->get('new', 0);
     $res = $this->model->getNewNoticeNum($this->user_id);
     if ($res) {
         $noticeNum = (int) $res;
     } else {
         $noticeNum = 0;
     }
     $i = 0;
     $str = $autoUpId = array();
     $body = '';
     $preurl = url::base();
     //@todo msgid 属性等整合完毕拿掉
     $result = $this->model->getNewNoticeList($this->user_id, $start, $pagesize, null, $new);
     if ($result) {
         $config = Kohana::config_load('noticetpl');
         //加载模板配置文件
         foreach ($result as $val) {
             //查找模板
             foreach ($config as $tval) {
                 $tplid = !empty($val['status']) ? $val['tplid'] . '0' . $val['status'] : $val['tplid'];
                 if ($tval['id'] == $tplid) {
                     $tpl = $tval;
                     break;
                 }
             }
             if ($tplid == 10) {
                 continue;
             }
             $title = $this->model->parsedata($val['title'], $tpl['title'], $preurl);
             $body = '';
             if ($val['body']) {
                 $body = json_decode($val['body'], true);
             }
             $group_obj = json_decode($val['title']);
             $gid = isset($group_obj->group[0]->id) ? $group_obj->group[0]->id : '';
             $gname = isset($group_obj->group[0]->name) ? $group_obj->group[0]->name : '';
             $item['id'] = $val['id'];
             $item['created_at'] = api::get_date($val['addtime']);
             $item['sender']['id'] = $val['authorid'];
             $item['sender']['name'] = $val['author'];
             $item['sender']['avatar'] = sns::getavatar($val['authorid']);
             $item['need_handle'] = in_array($tplid, Kohana::config('uap.message_handle')) ? 1 : 0;
             $item['type']['id'] = $tplid;
             $item['type']['name'] = '';
             $item['is_handle'] = in_array($tplid, array(1, 5, 7, 9, 12, 16)) ? 1 : 0;
             $item['text'] = str_replace('[action_info]', '[action_invite]', $title);
             if ($val['tplid'] == 6 || preg_match('/^5/is', $val['tplid'])) {
                 $apply = $this->groupModel->getUserApplyGroup($gid, $val['authorid']);
                 $item['explain'] = $apply['reason'] ? $apply['reason'] : '';
             } else {
                 $item['explain'] = isset($body['explain']) ? str::unhtmlspecialchars($body['explain']) : '';
             }
             $item['is_new'] = $val['isnew'];
             if ($this->has_message_type($val['tplid'])) {
                 if ($this->message_type != null) {
                     $opt[$this->message_type] = $this->message_opt($val['title'], $val['id'], $body, true);
                 }
             } else {
                 $opt = new stdClass();
             }
             $item['opt'] = $opt;
             $str[] = $item;
             unset($opt);
         }
     }
     unset($config, $result);
     //更新己读
     if (!empty($autoUpId)) {
         $this->model->putSetNoticeOld($this->user_id, $autoUpId);
     }
     $remainNum = $this->model->getNewNoticeNum($this->user_id);
     //获取新通知条数
     if ($remainNum) {
         $remainNum = (int) $remainNum;
     } else {
         $remainNum = 0;
     }
     if (!empty($str)) {
         $data['count'] = $noticeNum;
         $data['new_count'] = $remainNum;
         $data['unhandle_count'] = $remainNum;
         $data['message'] = $str;
     } else {
         $data['count'] = 0;
         $data['new_count'] = 0;
         $data['unhandle_count'] = 0;
         $data['message'] = array();
     }
     $this->send_response(200, $data);
 }
开发者ID:momoim,项目名称:momo-api,代码行数:100,代码来源:message.php


注:本文中的api::get_date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。