function sendDetail() { if (IS_GET) { $map['mobile'] = I('mobile'); $user = D('Common/shop_address')->where($map)->find(); $map['uid'] = $user['id']; $orderLists = D('Order')->where($map)->order('id desc')->select(); foreach ($orderLists as $order) { $result['order_id'] = $order['id']; $result['order_number'] = $order['order_number']; $result['order_date'] = time_format($order['cTime']); // 如果尚未付款,显示付款状态;如果已经付款,显示订单跟踪状态 if ($order['pay_status'] != 1) { $result['order_status'] = getNamebyPayStatus($order['pay_status']); } else { $result['order_status'] = getNamebyOrderStatus($order['status_code']); } $result['status_code'] = $order['status_code']; $result['goods'] = json_decode($order['goods_datas'], true); $result['total_price'] = $order['total_price']; $address_info = D('Shop')->getInfo($order['address_id']); $result['fetch_address'] = $address_info['intro']; $result['fetch_contact'] = $address_info['mobile']; $result['id'] = $order['order_number']; $results[] = $result; } $this->assign('userInfo', $user); $this->assign('lists', $results); $this->display(); } }
public function Index() { // 获取数据 $map['id'] = I('id'); $info = M('Invites')->where($map)->order('id desc')->find(); $info[startdate] = time_format($info[startdate]); ///拆分经纬度 $lnglat = explode(',', $info['lnglat']); $info[lng] = $lnglat[0]; $info[lat] = $lnglat[1]; switch ($info[type]) { case 0: $info[type] = '会议'; break; case 1: $info[type] = '聚会'; break; default: $info[type] = '活动'; } if ($info['class'] == '0') { $this->assign('info', $info); $this->display('Invites_index'); } else { $this->assign('info', $info); $this->display('Invites_index2'); } }
function date_time_format($str) { global $k; list($datepart, $timepart) = explode(" ", $str); if ($datepart . " " . $timepart == $str) { $df = date_format($datepart); $tf = time_format($timepart); if ($GLOBALS["debug"]) { echo " _{$k}_ {$df} {$tf} _ "; } if ($df and $tf) { return "{$df} {$tf}"; } } else { if (preg_match('/^[0-9]+$/', $str)) { switch (strlen($str)) { case 14: return "YmdHis"; case 12: return "ymdHis"; } } } return false; }
/** * * 获取他人视频 ... */ public function getotherVideoList() { if (!$this->input['user_id']) { $this->errorOutput('请输入需要查看的用户id'); } //默认用户需要登陆 $cond = " where 1 and state=1 and `user_id`=" . $this->input['user_id']; //用户自定义分类 if (isset($this->input['cate_id'])) { $cond .= ' and cate_id=' . intval($this->input['cate_id']); } $offset = $this->input['offset'] ? $this->input['offset'] : 0; $count = $this->input['count'] ? intval($this->input['count']) : 20; $data_limit = $cond . ' order by id desc LIMIT ' . $offset . ' , ' . $count; $datas = $this->obj->show($this->tbname, $data_limit, $fields = '*'); $video_id = array(); foreach ($datas as $k => $v) { $v['stateName'] = $this->settings['state'][$v['state']]; $v['video_id'] && ($videoInfo = $this->get_video_moreinfo($v['video_id'])); $v['m3u8'] = $videoInfo[0]['videoaddr']['default']['m3u8']; $v['format_duration'] = time_format($videoInfo[0]['duration']); $this->addItem($v); } $this->output(); }
public function show() { //查询出已经选择的视频片段 $sql = "SELECT * FROM " . DB_PREFIX . "fast_vcr_tmp WHERE user_id = '" . $this->user['user_id'] . "' AND main_id = '" . intval($this->input['video_id']) . "' ORDER BY order_id ASC "; $q = $this->db->query($sql); while ($r = $this->db->fetch_array($q)) { $r['duration'] = time_format(intval($r['end_time']) - intval($r['start_time'])); $r['start_imgdata'] = ''; $r['end_imgdata'] = ''; $imgdata_path = FAST_EDIT_IMGDATA_PATH . $r['hash_id']; if (file_exists($imgdata_path . '_start.img')) { $r['start_imgdata'] = file_get_contents($imgdata_path . '_start.img'); } if (file_exists($imgdata_path . '_end.img')) { $r['end_imgdata'] = file_get_contents($imgdata_path . '_end.img'); } $data['videos'][] = $r; } //如果存在当前的视频,获取当前视频的信息 if ($this->input['video_id'] && !isset($data['videos'])) { $this->curl->setSubmitType('post'); $this->curl->setReturnFormat('json'); $this->curl->initPostData(); $this->curl->addRequestData('a', 'get_vod_info'); $this->curl->addRequestData('id', $this->input['video_id']); $cur_video = $this->curl->request('vod.php'); $data['videos'][] = $cur_video[0]; } $data['main_id'] = intval($this->input['video_id']); $data['date_time'] = date('Y-m-d', TIMENOW); $this->addItem($data); $this->output(); }
public function getList() { if (!extension_loaded('curl')) { $this->error('糗事百科插件需要开启PHP的CURL扩展'); } $lists = S('QiuBai_content'); if (!$lists) { $config = \Common\Controller\Addon::getConfig('QiuBai'); $content = \Org\Net\Http::fsockopenDownload('http://www.qiushibaike.com'); if ($content) { $regex = "/<div class=\"content\".*?>.*?--(.*?)--.*?<\\/div>/ism"; preg_match_all($regex, $content, $match); $lists = array_map(function ($a, $b) { return array('time' => time_format($a), 'content' => $b); }, $match[1], $match[0]); S('QiuBai_content', $lists, $config['cache_time']); } } if ($lists) { $this->success('成功', '', array('data' => $lists)); } else { $this->error('获取糗事百科列表失败'); } $this->assign('qiubai_list', $lists); }
public function setrunsize() { set_time_limit(0); $data['size'] = get_dir_size(SITE_PATH . '/Data/cache/') / 1000 . 'k'; $data['time'] = time(); F('runtimecachesize', $data); die("{$data['size']}" . " Time:" . time_format($data['time'])); }
function ticketTime() { if ($this->performance_id != 0) { return time_format($this->performance->time); } else { return time_format($this->season->start_time); } }
public function select_videos() { $offset = intval($this->input['start']) ? intval($this->input['start']) : 0; $count = intval($this->input['num']) ? intval($this->input['num']) : 40; $limit = " limit {$offset}, {$count}"; $condition = $this->get_condition(); $extend_cond = ' AND status = 2 '; $sql = "SELECT * FROM " . DB_PREFIX . "vodinfo WHERE 1 " . $condition . $extend_cond . " ORDER BY video_order_id DESC " . $limit; $q = $this->db->query($sql); $return = array(); while ($r = $this->db->fetch_array($q)) { $r['duration_format'] = time_format($r['duration']); $r['totalsize'] = hg_fetch_number_format($r['totalsize'], true); $img_arr = $r['img_info'] = unserialize($r['img_info']); $r['img'] = $img_arr['host'] . $img_arr['dir'] . '80x60/' . $img_arr['filepath'] . $img_arr['filename']; $return['video_info'][] = $r; } $current_page = intval($this->input['start']); $page_num = 40; /*每页显示的数目*/ $total_num = $this->count(); $last_page = intval($total_num / $page_num) * $page_num; /*第一页*/ $return['first_page'] = 0; /*下一页*/ if ($current_page == $last_page || $current_page + $page_num == $total_num) { $return['next_page'] = $current_page; } else { $return['next_page'] = $current_page + $page_num; } /*前一页*/ if ($current_page == 0) { $return['prev_page'] = 0; } else { $return['prev_page'] = $current_page - $page_num; } /*最后一页*/ if (intval($total_num % $page_num) == 0) { $return['last_page'] = $last_page - $page_num; } else { $return['last_page'] = $last_page; } /*当前页*/ $return['current_page'] = intval($current_page / $page_num) + 1; /*总页数*/ if (intval($total_num % $page_num) == 0) { $return['total_page'] = intval($total_num / $page_num); } else { $return['total_page'] = intval($total_num / $page_num) + 1; } /*总条数*/ $return['total_num'] = $total_num; $return['page_num'] = $page_num; $return['switch_mode'] = intval($this->input['g_switch_mode']); $this->addItem($return); $this->output(); }
/** * 添加用户兑换名额记录 * @param int $type_id * @param int $num * @return mixed * @author 郑钟良<*****@*****.**> */ public function buy($type_id = 0, $num = 0) { $invite_type = D('Ucenter/InviteType')->where(array('id' => $type_id))->find(); $user = query_user('nickname'); $data['content'] = "{$user} 在 " . time_format(time()) . L('_TIME_TO_BUY_') . $num . ' 个 ' . $invite_type['title'] . L('_INVITATION_'); $data['uid'] = is_login(); $data['invite_type'] = $type_id; $data['num'] = $num; $data['create_time'] = time(); $result = $this->add($data); return $result; }
function get_user_attend_count($gamesId, $uid = 0, $time = 0) { $map['sports_id'] = $gamesId; $map['token'] = get_token(); if ($uid != 0) { $map['follow_id'] = $uid; } if ($time != 0) { $map['cTime'] = array('egt', strtotime(time_format($time, 'Y-m-d'))); } $data = $this->where($map)->field('sum(count) totals')->select(); return intval($data[0]['totals']); }
public function detail() { if (!$this->input['row_id']) { $this->errorOutput(NOID); } //查询出顶级类别供下面没有分类的时候用 $sql = "SELECT * FROM " . DB_PREFIX . "vod_media_node WHERE fid = 0"; $q = $this->db->query($sql); $top_sorts = array(); while ($r = $this->db->fetch_array($q)) { $top_sorts[$r['id']] = $r; } $sql = "SELECT f.*,s.name AS sort_name,s.color FROM " . DB_PREFIX . "vodinfo as f left join " . DB_PREFIX . "vod_media_node as s on f.vod_sort_id = s.id WHERE f.id = '" . intval($this->input["row_id"]) . "'"; $arr = $this->db->query_first($sql); $return['subtitle'] = $arr['subtitle']; $return['comment'] = $arr['comment']; $return['keywords'] = $arr['keywords']; if ($arr['sort_name']) { $return['vod_sort_id'] = $arr['sort_name']; $return['vod_sort_color'] = $arr['color']; } else { $return['vod_sort_id'] = $top_sorts[$return['vod_leixing']]['name']; $return['vod_sort_color'] = $top_sorts[$return['vod_leixing']]['color']; } if ($return['starttime']) { $return['starttime'] = '(' . date('Y-m-d', $return['starttime']) . ')'; } else { $return['starttime'] = ''; } $return["title"] = $arr['title']; $return['status'] = $this->settings['video_upload_status'][0]; $return["create_time"] = date("Y-m-d H:i", TIMENOW); $return["row_id"] = intval($this->input["row_id"]); $return['addperson'] = $arr['addperson']; $return['bitrate'] = $arr['bitrate']; $return['duration'] = time_format($arr['duration']); $return['bitrate_color'] = $arr['bitrate_color']; $img_arr = $return['img_info'] = unserialize($arr['img_info']); $return['img'] = $img_arr['host'] . $img_arr['dir'] . '80x60/' . $img_arr['filepath'] . $img_arr['filename']; $rgb = $r['bitrate'] / 100; if ($rgb < 10) { $return['bitrate_color'] = $this->settings['bitrate_color'][$rgb]; } else { $return['bitrate_color'] = $this->settings['bitrate_color'][9]; } if ($this->input['pubinfo']) { $return['pubinfo'] = intval($this->input['pubinfo']); } $this->addItem($return); $this->output(); }
function format_post_info($post_info) { $formatted_post_info = array(); $formatted_post_info["guid"] = $post_info->guid; $formatted_post_info["post_title"] = $post_info->post_title; $formatted_post_info["post_author"] = get_userdata($post_info->post_author)->display_name; $formatted_post_info["mantime"] = time_format($post_info->mantime); $formatted_post_info["visits"] = number_format($post_info->visits); $formatted_post_info["pageviews"] = number_format($post_info->pageviews); $formatted_post_info["avg_time_on_page"] = time_format($post_info->avg_time_on_page); $formatted_post_info["entrance_rate"] = round($post_info->entrance_rate * 100, 2) . "%"; $formatted_post_info["exit_rate"] = round($post_info->exit_rate * 100, 2) . "%"; return $formatted_post_info; }
public function look_video() { if (!$this->input['collect_id']) { $this->errorOutput(NOID); } //取出集合信息 $sql = "SELECT vc.*,vs.name AS sort_name,ch.name as channel_name FROM " . DB_PREFIX . "vod_collect as vc LEFT JOIN " . DB_PREFIX . "vod_media_node as vs ON vc.vod_sort_id = vs.id LEFT JOIN " . DB_PREFIX . "channel as ch ON ch.id = vc.source WHERE vc.id = '" . intval($this->input['collect_id']) . "'"; $return['collect'] = $this->db->query_first($sql); $return['collect']['create_time'] = date('Y-m-d', $return['collect']['create_time']); $return['collect']['update_time'] = date('Y-m-d', $return['collect']['update_time']); //取出该集合里面的视频信息 $offset = $this->input['offset'] ? intval(urldecode($this->input['offset'])) : 0; $count = $this->input['count'] ? intval(urldecode($this->input['count'])) : 10; $limit = " limit {$offset}, {$count}"; //查询出顶级类别供下面没有分类的时候用 $sql = "SELECT * FROM " . DB_PREFIX . "vod_media_node WHERE fid = 0"; $q = $this->db->query($sql); $top_sorts = array(); while ($r = $this->db->fetch_array($q)) { $top_sorts[$r['id']] = $r; } $sql = "SELECT cv.id as cid,cv.order_id,vf.*,vs.name AS sort_name,vs.color AS vod_sort_color FROM " . DB_PREFIX . "vod_collect_video as cv LEFT JOIN " . DB_PREFIX . "vodinfo as vf \r\n\t\t ON cv.video_id = vf.id LEFT JOIN " . DB_PREFIX . "vod_media_node as vs ON vf.vod_sort_id = vs.id WHERE cv.collect_id = '" . urldecode($this->input['collect_id']) . "' ORDER BY cv.order_id DESC " . $limit; $q = $this->db->query($sql); while ($r = $this->db->fetch_array($q)) { if ($r['sort_name']) { $r['vod_sort_id'] = $r['sort_name']; } else { $r['vod_sort_id'] = $top_sorts[$r['vod_leixing']]['name']; $r['vod_sort_color'] = $top_sorts[$r['vod_leixing']]['color']; } $r['vod_leixing'] = $top_sorts[$r['vod_leixing']]['name']; $collects = unserialize($r['collects']); if ($collects) { $r['collects'] = $collects; } else { $r['collects'] = ''; } $r['img_info'] = unserialize($r['img_info']); $r['img'] = $r['img_info']['host'] . $r['img_info']['dir'] . '80x60/' . $r['img_info']['filepath'] . $r['img_info']['filename']; $r['duration'] = time_format($r['duration']); $r['status'] = $this->settings['video_upload_status'][$r['status']]; $r['source'] = $this->settings['video_channel'][$r['source']]; $r['create_time'] = date('Y-m-d h:i', $r['create_time']); $r['update_time'] = date('Y-m-d h:i', $r['update_time']); $return['collect_video'][] = $r; } $this->addItem($return); $this->output(); }
public function add_to_collect() { if (!$this->input['id']) { $this->errorOutput(NOID); } $sql = "SELECT * FROM " . DB_PREFIX . "vodinfo WHERE id in (" . urldecode($this->input['id']) . ")"; $q = $this->db->query($sql); while ($r = $this->db->fetch_array($q)) { $img_arr = unserialize($r['img_info']); $r['img'] = $img_arr['host'] . $img_arr['dir'] . '80x60/' . $img_arr['filepath'] . $img_arr['filename']; $r['duration'] = time_format($r['duration']); $return[] = $r; } $this->addItem($return); $this->output(); }
/** * @param 创建订单 * @return 加密后的站内订单编号 * @author lussen <*****@*****.**> */ public function creatPay() { $site_order = time_format(time(), 'YmdHis') . rand(100, 999); $data['uid'] = is_login(); $data['pay_money'] = I('post.money'); $data['pay_item'] = I('post.pay_item'); $data['site_order'] = $site_order; $data['isdone'] = 0; $data['create_time'] = time(); $result = $this->data($data)->add(); if ($result !== false) { return think_encrypt($site_order); } else { return false; } }
public function replyGiftNotice($uid, $name, $first = '', $orderId = '', $remark = '', $url = '', $templateId = '') { $first == '' && ($first = '您推荐的爱心分享已被领取'); $orderId == '' && ($orderId = time_format(time(), 'YmdHis')); $remark == '' && ($remark = '您的好友领取了您推荐的爱心分享,您的人气指数直接爆表!'); $param['data']['first']['value'] = $first; $param['data']['first']['color'] = "#E60B43"; $param['data']['keyword1']['value'] = $orderId; $param['data']['keyword1']['color'] = "#173177"; $param['data']['keyword2']['value'] = $name; $param['data']['keyword2']['color'] = "#E60B43"; $param['data']['remark']['value'] = $remark; $param['data']['remark']['color'] = "#173177"; $templateId == '' && ($templateId = 'VD0sCtsox8YHjFh12XzXRrS-k6-5GN3KMN8McPw0IiY'); return $this->_replyData($uid, $param, $templateId, $url); }
public function addComment() { if (!$this->isPost()) { $this->error('不给你看'); } $body = $this->_post('body'); $post_id = $this->_post('post_id'); $comment = array('post_id' => $post_id, 'body' => $body, 'time' => time(), 'user_id' => session('user_id')); //p($comment);die; if (M('comment')->add($comment)) { //消息发送处理 $user_id = M('post')->where(array('post_id' => $post_id))->getField('user_id'); //获帖子主人的ID if (isset($_POST['get_message_user_id']) && $_POST['get_message_user_id'] != $user_id && $_POST['get_message_user_id'] && $_POST['get_message_user_id'] != session('user_id')) { //点击了回复某人,并且不是层主 if ($user_id != $_SESSION['user_id'] && $_POST['get_message_user_id'] != session('user_id')) { send_message($user_id, $post_id, $body); } send_message($_POST['get_message_user_id'], $post_id, $body); } else { if ($user_id != $_SESSION['user_id'] && $_POST['get_message_user_id'] != session('user_id')) { send_message($user_id, $post_id, $body); } } //更新楼主帖子的更新时间 $post = M('post')->where(array('post_id' => $post_id))->find(); $parent_post_id = M('post')->where(array('post_id' => $post['parent_id']))->getField('post_id'); $update_time = array('post_id' => $parent_post_id, 'update_time' => time()); M('post')->save($update_time); $user = M('user')->where(array('user_id' => session('user_id')))->find(); $html = ''; $html .= "<div class='row'>\n <br><div class='col-xs-1'></div>\n <div class='col-xs-1 qianhui'>"; if ($user['face']) { $html .= "<a target='_blank' href='" . U('User/index', array('user_id' => $user['user_id'])) . "'>\n <img src='" . __ROOT__ . "/Uploads/face/" . $user['face'] . "' width='50px' height='50px' alt=''></a>"; } else { $html .= "<a target='_blank' href='" . U('User/index', array('user_id' => $user['user_id'])) . "'>\n \t<img src='" . __ROOT__ . "/Public/Index/images/no_face.jpg' width='50px' height='50px' alt=''>\n \t</a>"; } $time = time_format(time()); $html .= " </div>\n <div class='col-xs-10 qianhui'>\n <p>\n <a target='_blank' href='" . U('User/index', array('user_id' => $user['user_id'])) . "'>" . $user['username'] . "</a>:" . $body . "</p>\n <p class='text-muted text-right'>\n " . $time . " \n <span class='glyphicon glyphicon glyphicon-comment'></span>\n </p>\n </div>\n <hr>\n </div>"; echo $html; die; } else { echo 0; } }
function lists() { $isAjax = I('isAjax'); $isRadio = I('isRadio'); $model = $this->getModel('reserve'); $page = I('p', 1, 'intval'); // 默认显示第一页数据 // 解析列表规则 $list_data = $this->_list_grid($model); // 搜索条件 $map = $this->_search_map($model, $fields); $row = empty($model['list_row']) ? 20 : $model['list_row']; $order = 'id desc'; // 读取模型数据列表 $name = parse_name(get_table_name($model['id']), true); $data = M($name)->field(true)->where($map)->order($order)->page($page, $row)->select(); foreach ($data as &$vo) { if (!empty($vo['start_time']) && !empty($vo['end_time'])) { $vo['start_time'] = time_format($vo['start_time']) . ' 至 ' . time_format($vo['end_time']); } elseif (!empty($vo['start_time'])) { $vo['start_time'] = time_format($vo['start_time']) . ' 开始'; } elseif (!empty($vo['end_time'])) { $vo['start_time'] = '到 ' . time_format($vo['start_time']) . ' 结束'; } $vo['status_title'] = $vo['status'] == 0 ? '已禁用' : '已启用'; } /* 查询记录总数 */ $count = M($name)->where($map)->count(); $list_data['list_data'] = $data; // 分页 if ($count > $row) { $page = new \Think\Page($count, $row); $page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%'); $list_data['_page'] = $page->show(); } if ($isAjax) { $this->assign('isRadio', $isRadio); $this->assign($list_data); $this->display('ajax_lists_data'); } else { $this->assign($list_data); // dump($list_data); $this->display(); } }
function lzwg_activities_lists() { $this->assign('search_button', false); $this->assign('del_button', false); $this->assign('check_all', false); $model = $this->getModel('lzwg_activities'); $map['uid'] = $this->mid; session('common_condition', $map); $list_data = $this->_get_model_list($model, 0, 'id desc', true); // 判断该活动是否已经设置投票调查 $lzwgVote = M('lzwg_activities_vote')->field('id,lzwg_id')->select(); foreach ($lzwgVote as $v) { $lzwgVoteArr[$v['lzwg_id']] = $v['id']; } $dao = D('Draw'); foreach ($list_data['list_data'] as &$vo) { $vo = $dao->getInfo($vo['id']); $param['lzwg_id'] = $vo['id']; if ($lzwgVoteArr[$vo['id']]) { $param1['id'] = $lzwgVoteArr[$vo['id']]; $vote_url = addons_url('LzwgVote://LzwgActivitiesVote/edit', $param1); } else { $vote_url = addons_url('LzwgVote://LzwgActivitiesVote/add', $param); } $comment_url = addons_url('Comment://Comment/lists', $param); $award_url = addons_url('Draw://LotteryPrizeList/add', $param); $lucky_follow_url = addons_url('Draw://LuckyFollow/lzwg_lists', $param); $vo['activitie_time'] = time_format($vo['start_time'], 'Y/m/d') . '至' . time_format($vo['end_time'], 'Y/m/d'); $vo['comment_list'] = '<a href="' . $comment_url . '">评论列表</a>'; $vo['set_vote'] = '<a href="' . $vote_url . '">设置投票</a>'; $vo['set_award'] = '<a href="' . $award_url . '">奖品设置</a>'; $vo['get_prize_list'] = '<a href="' . $lucky_follow_url . '">中奖列表</a>'; } foreach ($list_data['list_grids'] as &$vo) { if ($vo['field'][0] == 'id') { $previewUrl = 'package?id=[id]&_controller=Sucai&_addons=Sucai&source=Lzwg&is_preview=1&target=_blank|预览'; $downloadUrl = 'package?id=[id]&_controller=Sucai&_addons=Sucai&source=Lzwg&is_download=1|素材下载'; $vo['href'] = $previewUrl . "," . $downloadUrl . ",lzwg_edit?id=[id]&model=" . $model['id'] . "|编辑,[DELETE]|删除"; } } $this->assign($list_data); // dump($list_data); $this->display(); }
public function show() { $return = array(); $offset = $this->_offset ? $this->_offset : 0; $count = $this->_count ? $this->_count : 15; $limit = " limit {$offset}, {$count}"; $sql = "SELECT v.*, vs.sort_name FROM " . DB_PREFIX . "vodinfo v LEFT JOIN " . DB_PREFIX . "vod_sort vs ON v.vod_sort_id = vs.id WHERE 1 " . $this->_getCondition($condition) . " ORDER BY v.video_order_id DESC, v.id DESC " . $limit; $q = $this->db->query($sql); $this->setXmlNode('vod', 'item'); while ($r = $this->db->fetch_array($q)) { $r['vod_sort_color'] = $this->settings['video_upload_type_attr'][intval($r['vod_leixing'])]['color']; $r['vod_leixing'] = $this->settings['video_upload_type'][$r['vod_leixing']]; if ($r['sort_name']) { $r['vod_sort_id'] = $r['sort_name']; } else { $r['vod_sort_id'] = $r['vod_leixing']; } $collects = unserialize($r['collects']); if (!$collects) { $r['collects'] = ""; } $r['img'] = SOURCE_THUMB_PATH . $r['img'] . "?" . TIMENOW; $rgb = $r['bitrate'] / 100; if ($rgb < 10) { $r['bitrate_color'] = $this->settings['bitrate_color'][$rgb]; } else { $r['bitrate_color'] = $this->settings['bitrate_color'][9]; } if ($r['starttime']) { $r['starttime'] = '(' . date('Y-m-d', $r['starttime']) . ')'; } else { $r['starttime'] = ''; } $r['start'] = $r['start'] + 1; $r['etime'] = intval($r['duration']) + intval($r['start']); $r['duration'] = time_format($r['duration']); $r['status'] = $this->settings['video_upload_status'][$r['status']]; $r['create_time'] = date('Y-m-d h:i', $r['create_time']); $r['update_time'] = date('Y-m-d h:i', $r['update_time']); $return[] = $r; } return $return; }
public function recharge($data) { $tran_stream = "CZ" . time_format(time(), 'YmdHis') . rand(1000, 9999); $data['tran_stream'] = $tran_stream; $data['type'] = 0; $data['do_tag'] = 8; // 线下充值 $data['state'] = 1; $data['create_time'] = time(); $data['update_time'] = time(); $this->add($data); $account = M('AccountUser')->where(array('uid' => $data['uid']))->find(); if (!$account) { D('AccountUser')->addAccount($data['uid']); } $use_able = $account['use_able'] + $data['amount']; M('AccountUser')->save(array('id' => $account['id'], 'balance' => $account['balance'] + $data['amount'], 'use_able' => $use_able, 'update_time' => time())); return $use_able; }
function pc_load_comments($link, $pc, $pur = 0) { $query = "SELECT cid , comments.subject , comments.created , comments.username , comments.nid FROM comments, nodes WHERE comments.nid = nodes.nid "; if ($pur == 0) { $query .= " AND access = 0 "; } elseif ($pur == 1) { $query .= " AND ( access = 0 OR access = 1 ) "; } elseif ($pur == 3) { $query .= " AND ( `access` = 0 OR `access` = 1 OR `access` = 2 OR `access` = 3 ) "; } $query .= " AND comments.uid = " . $pc["UID"] . " AND comment = 1 ORDER BY cid DESC LIMIT 0 , 10 ;"; $result = mysql_query($query, $link); $comments = array(); for ($i = 0; $i < mysql_num_rows($result); $i++) { $rows = mysql_fetch_array($result); $comments[] = array("USER" => $rows[username], "CID" => $rows[cid], "NID" => $rows[nid], "SUBJECT" => htmlspecialchars(stripslashes($rows[subject])), "TIME" => time_format($rows[created])); } mysql_free_result($result); return $comments; }
public function get_unselect_videos() { if (!$this->input['id']) { $this->errorOutput(NOID); } $start = explode(',', urldecode($this->input['start'])); $duration = explode(',', urldecode($this->input['duration'])); $sql = "SELECT * FROM " . DB_PREFIX . "vodinfo WHERE id = '" . intval($this->input['id']) . "'"; $arr = $this->db->query_first($sql); $img_arr = unserialize($arr['img_info']); $img_src = $img_arr['host'] . $img_arr['dir'] . '80x60/' . $img_arr['filepath'] . $img_arr['filename']; $ret = array(); for ($i = 0; $i < count($start); $i++) { $is_current = $i == count($start) - 1 ? 0 : 1; $row = array('id' => $arr['id'], 'start' => $start[$i], 'duration' => $duration[$i] - 40, 'title' => $arr['title'], 'max_duration' => $arr['duration'], 'img_src' => $img_src, 'vcr_num' => $i + 1, 'format_duration' => time_format($duration[$i]), 'is_current' => $is_current); $ret[] = $row; } $this->addItem($ret); $this->output(); }
public function agreement($pid, $uid) { $project = D('ProjectFundView')->where(array('p.id' => $id, 'p.status' => 9))->find(); $leader = M('ProjectLeader')->where(array('project_id' => $pid, 'lead_type' => 9))->find(); if ($leader) { $leader_name = M('UsersDetail')->where(array('id' => $leader['leader_id']))->find(); if (strstr($leader_name['name'], '公司') || strstr($leader_name['name'], '企业')) { $leaderinfo = $leader_name['name']; } else { $leaderinfo = $leader_name['name'] . '(' . $leader_name['card_id'] . ')'; } } if ($project['id'] == 151) { $rate = floor($invest['fund'] / 5000) * 0.05; } else { $rate = round($invest['fund'] / $project['final_valuation'] * 100, 4); } $data = array('姓名' => $user['name'], '身份证号' => $user['card_id'], '领投人' => $leaderinfo, '投资金额' => number_format($invest['fund'], 2), '投资占比' => $rate, '公司名称' => $project['company_name'], '大写金额' => cny($invest['fund']), '联系电话' => $user['phone'], '签约日期' => time_format(NOW_TIME, 'Y年m月d日')); if (!empty($project['agreement'])) { $detail = M('Agreement')->where(array('key' => $project['agreement']))->find(); } else { if ($project['id'] == 33 || $project['id'] == 48) { $detail = M('Agreement')->where(array('key' => 'weituochiguo'))->find(); } else { $detail = M('Agreement')->where(array('key' => 'judaodaichi'))->find(); } } $agreement = $detail['content']; foreach ($data as $key => $value) { $detail['content'] = str_replace("[{$key}]", $value, $detail['content']); } $agreementInvest = M('AgreementInvest')->where(array('pid' => $pid, 'uid' => $uid))->find(); if (!$agreementInvest) { $agreementInvest = array('content' => $detail['content'], 'agreement_id' => $detail['id'], 'pid' => $pid, 'uid' => $uid, 'create_time' => NOW_TIME, 'create_id' => $uid, 'update_time' => NOW_TIME, 'update_id' => $uid, 'status' => 1, 'client_ip' => get_client_ip(0)); M('AgreementInvest')->add($agreementInvest); } else { if ($agreementInvest['status'] == 0) { M('AgreementInvest')->save(array('id' => $agreementInvest['id'], 'content' => $detail['content'], 'update_time' => NOW_TIME, 'update_id' => $uid, 'status' => 1, 'client_ip' => get_client_ip(0))); } } }
public function getComment() { if (!IS_AJAX) { E('页面不存在!'); } $page = I('page', 1, 'intval'); $count = M('Message')->count(); $limit = 5; $total = ceil($count / $limit); $offset = $limit * ($page - 1) . ',' . $limit; //上一页 $prev = $page - 1 > 0 ? $page - 1 : 1; //下一页 $next = $page + 1 > $total ? $total : $page + 1; $comment = M('comment')->limit($offset)->order('addtime DESC')->select(); if ($comment) { $str = ''; foreach ($comment as $v) { $str .= '<dl class="comment_content">'; $str .= '<dt><a href="' . U('/' . $v['uid']) . '">'; $str .= '<img src="'; $str .= __ROOT__; if ($user['face']) { $str .= '/Uploads/Face/' . $user['face']; } else { $str .= '/Public/Images/phiz/aini.gif'; } $str .= '" alt="' . $user['username'] . '" width="30" height="30"/>'; $str .= '</a></dt><dd>'; $str .= '<a href="' . U('/' . $v['uid']) . '" class="comment_name">'; $str .= "hhahahh" . '</a> : ' . replace_content($v['content']); $str .= ' ( ' . time_format($v['addtime']) . ' )'; $str .= '</dd></dl>'; } $str .= "<div id='page'><a href='javascript:;' page='1' >首页</a>|<a href='javascript:;' page='{$prev}'>上一页</a>|<a href='javascript:;' page='{$next}'>下一页</a>|<a href='javascript:;' page='{$total}' >末页</a></div>"; echo $str; } else { echo 'false'; } }
/** * 创建表单 * @return boolean */ public function createExcharge() { $data = $this->create(); if ($data['way'] == 1) { //判断提现方式 1为银行卡提现 $data['account'] = I('post.account2'); //提现方式为银行卡,账号获取account2参数 } else { $data['account'] = I('post.account'); //提现方式为第三方支付,账号获取account参数 } $site_order = time_format(time(), 'YmdHis') . rand(100, 999); $data['uid'] = is_login(); $data['create_time'] = time(); $data['status'] = 0; $data['site_order'] = $site_order; $result = $this->data($data)->add(); if ($reuslt !== false) { return true; } else { return false; } }
function getRecommendBlogs($link, $pno = 1, $etemnum = 0) { global $pcconfig; if ($pno < 1) { $pno = 1; } $etemnum = intval($etemnum); if ($etemnum <= 0) { $etemnum = $pcconfig["NEWS"]; } $start = ($pno - 1) * $etemnum; $query = "SELECT recommend.uid , subject , body , htmltag , emote , hostname , created , recuser , nid , username , corpusname , description " . "FROM recommend , users " . "WHERE recommend.uid = users.uid " . "ORDER BY state DESC , rid DESC " . "LIMIT " . $start . " , " . $etemnum . " ;"; $result = mysql_query($query, $link); $num_rows = mysql_num_rows($result); $recommendBlogs = array(); $recommendBlogs["channel"] = array("siteaddr" => "http://" . $pcconfig["SITE"], "title" => $pcconfig["BBSNAME"] . "推荐Blog日志", "pcaddr" => "http://" . $pcconfig["SITE"], "desc" => $pcconfig["BBSNAME"] . "最新" . $etemnum . "个推荐日志", "email" => $pcconfig["BBSNAME"], "publisher" => $pcconfig["BBSNAME"], "creator" => $pcconfig["BBSNAME"], "rights" => $pcconfig["BBSNAME"], "date" => date("Y-m-d"), "updatePeriod" => "10分钟更新一次", "updateFrequency" => "最新的" . $etemnum . "个推荐日志", "updateBase" => date("Y-m-d H:i:s")); for ($i = 0; $i < $num_rows; $i++) { $rows = mysql_fetch_array($result); $body = "<br>\n" . "来自: " . $rows["corpusname"] . "<br>\n" . "作者: " . $rows["username"] . "<br>\n" . "发信站: " . $pcconfig["BBSNAME"] . "<br>\n" . "时间: " . time_format($rows["created"]) . "<br>\n" . "<hr size=1>\n" . html_format($rows["body"], TRUE, $rows["htmltag"]) . "<hr size=1>\n" . "(<a href=\"http://" . $pcconfig["SITE"] . "/pc/pccon.php?id=" . $rows[0] . "&nid=" . $rows["nid"] . "&s=all\">浏览全文</a>\n" . "<a href=\"http://" . $pcconfig["SITE"] . "/pc/pccom.php?act=pst&nid=" . $rows["nid"] . "\">发表评论</a>)<br>\n" . "<a href=\"http://" . $pcconfig["SITE"] . "/pc/rss.php?userid=" . $rows["username"] . "\"><img src=\"http://" . $pcconfig["SITE"] . "/pc/images/xml.gif\" border=\"0\" align=\"absmiddle\" alt=\"XML\">Blog地址:http://" . $pcconfig["SITE"] . "/pc/rss.php?userid=" . $rows["user"] . "</a>"; $recommendBlogs["useretems"][$i] = array("addr" => "http://" . $pcconfig["SITE"] . "/pc/pccon.php?id=" . $rows[0] . "&nid=" . $rows[nid], "subject" => htmlspecialchars($rows["subject"]), "desc" => $body, "tid" => 0, "nid" => $rows["nid"], "publisher" => $pcconfig["BBSNAME"], "creator" => $rows["username"], "pc" => $rows[0], "created" => time_format($rows["created"]), "rights" => $rows["username"] . ".bbs@" . $pcconfig["SITE"]); } mysql_free_result($result); return $recommendBlogs; }
public function get_vcr_data() { if (!$this->input['vcr_id']) { $this->errorOutput(NOID); } $sql = "SELECT mv.*,vf.vod_leixing,vf.original_id as oid,vf.duration as max_duration,vf.totalsize,vf.img_info FROM " . DB_PREFIX . "vod_mark_video as mv LEFT JOIN " . DB_PREFIX . "vodinfo as vf ON vf.id = mv.original_id WHERE mv.vodinfo_id = '" . intval($this->input['vcr_id']) . "' ORDER BY order_id ASC "; $q = $this->db->query($sql); $return = array(); while ($r = $this->db->fetch_array($q)) { if (intval($r['vod_leixing']) == 4 && $r['oid']) { $sql = "SELECT duration FROM " . DB_PREFIX . "vodinfo WHERE id = '" . $r['oid'] . "'"; $arr = $this->db->query_first($sql); $r['max_duration'] = $arr['duration']; } $img_arr = unserialize($r['img_info']); $r['img_src'] = $img_arr['host'] . $img_arr['dir'] . '80x60/' . $img_arr['filepath'] . $img_arr['filename']; $r['format_start_time'] = time_format($r['start_time']); $r['format_duration'] = time_format($r['duration']); $r['totalsize'] = hg_fetch_number_format($r['totalsize'], true); $return[] = $r; } $this->addItem($return); $this->output(); }
public function cash($data) { $account = M('AccountUser')->where(array('uid' => $data['uid']))->find(); $use_able = $account['use_able'] - $data['amount']; $count = $this->where(array('uid' => $data['uid'], 'operation_day' => time_format(NOW_TIME, 'Ymd')))->count(); if ($count) { $this->error = '您今天已经有一次提现记录了,一天只能申请一次提现。'; return false; } if ($use_able < 0) { $this->error = '您账号的可用余额小于提现金额。'; return false; } M('AccountUser')->save(array('id' => $account['id'], 'use_able' => $account['use_able'] - $data['amount'], 'update_time' => time())); $tran_stream = "TX" . time_format(time(), 'YmdHis') . rand(1000, 9999); $data['tran_stream'] = $tran_stream; $data['type'] = 3; $data['state'] = 0; $data['create_time'] = time(); $data['update_time'] = time(); $data['operation_day'] = time_format(NOW_TIME, 'Ymd'); $this->add($data); return true; }