Exemplo n.º 1
0
 public function show()
 {
     if (!$this->user['user_id']) {
         return false;
     }
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $condition = $this->get_condition();
     $orderby = '  ORDER BY o.id DESC ';
     $limit = ' LIMIT ' . $offset . ' , ' . $count;
     $sql = "SELECT o.*,p.title,p.youhui_price,p.start_time,p.end_time,p.amount,m.host,m.dir,m.filepath,m.filename,p.channel_id,p.live_start_time,p.live_end_time FROM " . DB_PREFIX . "order o \n\t\t\t\t\tLEFT JOIN " . DB_PREFIX . "product p \n\t\t\t\tON o.product_id = p.id \n\t\t\t\t\tLEFT JOIN " . DB_PREFIX . "materials m \n\t\t\t\tON p.indexpic_id = m.id WHERE 1 " . $condition . $orderby . $limit;
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         if ($r['end_time'] >= TIMENOW) {
             $r['cheap_status'] = '进行中';
             if ($r['channel_id'] && $r['live_start_time'] <= TIMENOW && $r['live_end_time'] >= TIMENOW) {
                 $r['cheap_status'] = '直播中';
             }
         } else {
             $r['cheap_status'] = '已过期';
         }
         if ($r['amount'] <= 0) {
             $r['cheap_status'] = '已售完';
             $r['cheap_state'] = 2;
         }
         $r['create_time'] = hg_tran_time($r['create_time']);
         if ($r['host'] && $r['dir'] && $r['filepath'] && $r['filename']) {
             $r['indexpic'] = array('host' => $r['host'], 'dir' => $r['dir'], 'filepath' => $r['filepath'], 'filename' => $r['filename']);
         } else {
             $r['indexpic'] = array();
         }
         $this->addItem($r);
     }
     $this->output();
 }
Exemplo n.º 2
0
 function create()
 {
     $avatar = $this->attachlib->get_avatar($this->user['user_id']);
     $content = $this->input['thread'];
     $topic_id = $this->input['tid'];
     $pcd = intval($this->input['pcd']);
     $aid = urldecode($this->input['aid']);
     if ($aid) {
         $aid_array = array_filter(explode(',', $aid));
         $aid = $this->attachlib->tmp2att($aid_array);
     }
     if ($pcd) {
         $c = new content();
         $article = $c->get_published_content_byid($pcd);
         if ($article) {
             $extend_arc = array('title' => $article['title'], 'brief' => $article['brief'], 'href' => $article['content_url'], 'bundle_id' => $article['bundle_id'], 'module_id' => $article['module_id']);
             $article = is_array($article['indexpic']) ? array('host' => $article['indexpic']['host'], 'dir' => $article['indexpic']['dir'], 'filepath' => $article['indexpic']['filepath'], 'filename' => $article['indexpic']['filename']) : array();
             $aid .= ',' . $this->attachlib->attach($article, 'publish', 'attach', $extend_arc);
         }
     }
     if (!$topic_id) {
         $this->errorOutput("请选择一个话题");
     }
     $short_link = $this->attachlib->outlink(urldecode($this->input['outlink']));
     if ($short_link) {
         $aid .= ',' . $short_link;
     }
     $location = array('lat' => $this->input['lat'], 'lon' => $this->input['lon'], 'address' => urldecode($this->input['address']), 'gpsx' => $this->input['gpsx'], 'gpsy' => $this->input['gpsy']);
     if ($location['lat'] && $location['lon']) {
         $loc = FromBaiduToGpsXY($location['lon'], $location['lat']);
         $location['gpsx'] = $loc['x'];
         $location['gpsy'] = $loc['y'];
     } elseif ($location['gpsx'] && $location['gpsy']) {
         $loc = FromGpsToBaiduXY($location['gpsx'], $location['gpsy']);
         $location['lon'] = $loc['x'];
         $location['lat'] = $loc['y'];
     }
     if ($map = $this->attachlib->map($location)) {
         $aid .= ',' . $map;
     }
     if (!$content && !$aid) {
         $this->errorOutput("内容不能为空");
     }
     $aid = $aid ? trim($aid, ',') : '';
     $data = array('tid' => $topic_id, 'content' => $content, 'aid' => $aid, 'client' => $this->input['client'] ? $this->input['client'] : $this->user['user_name'], 'status' => 0, 'create_time' => TIMENOW, 'user_id' => $this->user['user_id'], 'avatar' => $avatar ? addslashes(serialize($avatar)) : '', 'user_name' => $this->user['user_name'], 'pcd' => $pcd, 'ip' => hg_getip());
     $sql = 'INSERT INTO ' . DB_PREFIX . 'thread SET ';
     foreach ($data as $key => $val) {
         $sql .= "`{$key}` = \"{$val}\",";
     }
     $sql = trim($sql, ',');
     $this->db->query($sql);
     $data['id'] = $this->db->insert_id();
     $data['format_create_time'] = hg_tran_time($data['create_time']);
     $data['materail'] = $this->attachlib->get_attach_by_aid($aid);
     $this->attachlib->delete_attach(urldecode($this->input['aid']));
     $this->addItem($data);
     $this->output();
 }
Exemplo n.º 3
0
 public function show()
 {
     $limit = '';
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 10;
     if ($offset || $count) {
         $limit = " limit {$offset},{$count}";
     }
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'topic WHERE 1 ' . $this->get_conditions() . ' ORDER BY order_id DESC, id DESC' . $limit;
     $query = $this->db->query($sql);
     while ($row = $this->db->fetch_array($query)) {
         $row['format_create_time'] = hg_tran_time($row['create_time']);
         $row['indexpic'] = ($tmp = unserialize($row['indexpic'])) ? $tmp : array();
         $row['latest'] = ($tmp = json_decode($row['latest'], 1)) ? $tmp : array();
         $row['avatar'] = ($tmp = unserialize($row['avatar'])) ? $tmp : array();
         $this->addItem($row);
     }
     $this->output();
 }
Exemplo n.º 4
0
 public function show()
 {
     $condition = '';
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 10;
     $limit = " LIMIT " . $offset . " , " . $count;
     $sql = "SELECT member_id,medalid,dateline FROM " . DB_PREFIX . "medallog";
     $sql .= " WHERE type<'2'" . $condition;
     $sql .= " ORDER BY dateline DESC" . $limit;
     $q = $this->db->query($sql);
     $return = array();
     $medal_id = array();
     $member_id = array();
     while ($row = $this->db->fetch_array($q)) {
         if ($row['dateline']) {
             $row['dateline'] = hg_tran_time($row['dateline']);
         }
         $return[] = $row;
         $medal_id[] = $row['medalid'];
         $member_id[] = $row['member_id'];
     }
     $medal_info = $this->Members->get_medal(@array_unique($medal_id), 'id,name');
     $member_id = @array_unique($member_id);
     if ($member_id && is_array($member_id)) {
         $member_info = $this->Members->get_member_info('AND member_id IN (' . implode(',', $member_id) . ')', 'm.member_id,m.member_name,m.avatar', '', 'member_id', true);
     }
     if (!empty($return) && is_array($return)) {
         foreach ($return as $v) {
             $v['member_name'] = $member_info[$v['member_id']]['member_name'];
             $v['avatar'] = $member_info[$v['member_id']]['avatar'];
             $v['medal_name'] = $medal_info[$v['medalid']]['name'];
             $v['title'] = $v['member_name'] . ',在' . $v['dateline'] . '获得 ' . $v['medal_name'] . ' 勋章';
             $this->addItem($v);
         }
     }
     $this->output();
 }
Exemplo n.º 5
0
 public function show()
 {
     $limit = '';
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     if ($offset || $count) {
         $limit = " limit {$offset},{$count}";
     }
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'thread WHERE 1 ' . $this->get_conditions() . ' ORDER BY create_time desc ' . $limit;
     $query = $this->db->query($sql);
     while ($row = $this->db->fetch_array($query)) {
         $row['format_create_time'] = hg_tran_time($row['create_time']);
         $row['format_update_time'] = hg_tran_time($row['update_time']);
         $row['avatar'] = ($tmp = unserialize($row['avatar'])) ? $tmp : array();
         //$this->addItem($row);
         $thread[] = $row;
         $aid[] = $row['aid'];
     }
     if ($aid) {
         $aid = array_filter(array_unique(explode(',', implode($aid, ','))));
         if ($aid) {
             $material = $this->attachlib->get_attach_by_aid(implode(',', $aid), true);
         }
     }
     if ($thread) {
         foreach ($thread as $key => $val) {
             $aid_array = $val['aid'] ? explode(',', $val['aid']) : array();
             $val['materail'] = array();
             if ($aid_array) {
                 $aid_array = array_flip($aid_array);
                 $val['materail'] = array_values(array_intersect_key($material, $aid_array));
             }
             $this->addItem($val);
         }
     }
     $this->output();
 }
Exemplo n.º 6
0
 function news_refer_material($condition = '', $orderby = ' t.create_time DESC ', $limit)
 {
     $sql = "SELECT t.*,s.id as sid,s.name as sort_name,s.brief,s.create_time as tuji_time,t.path  FROM " . DB_PREFIX . 'tuji as t LEFT JOIN ' . DB_PREFIX . 'tuji_node as s ON t.tuji_sort_id=s.id WHERE 1 ' . $condition . $orderby . $limit;
     //图集信息
     $tuji_info = array();
     $tuji_ids = array();
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $r['create_time'] = date('Y-m-d h:i:s', $r['create_time']);
         $r['update_time'] = date('Y-m-d h:i:s', $r['update_time']);
         $r['tuji_time'] = date('Y-m-d h:i:s', $r['tuji_time']);
         $r['time'] = hg_tran_time($r['update_time']);
         $r['status_display'] = $r['status'];
         $r['status'] = $this->settings['image_upload_status'][$r['status']];
         $r['img'] = unserialize($r['cover_url']);
         $r['brief'] = $r['comment'];
         $r['app_bundle'] = APP_UNIQUEID;
         $r['module_bundle'] = MOD_UNIQUEID;
         unset($r['cover_url']);
         $tuji_info[$r['id']] = $r;
     }
     return $tuji_info;
 }
Exemplo n.º 7
0
 public function news_refer_material()
 {
     $condition = '';
     if (!empty($this->input['user'])) {
         $user = trim($this->input['user']);
         $condition .= " and user_name='" . $user . "'";
     }
     if (!empty($this->input['sort_id'])) {
         $sort_id = intval($this->input['sort_id']);
         $condition .= " and node_id = " . $sort_id;
     }
     //判断是否传入搜索关键次,如果传入则将搜索得数距全部范围
     if (!empty($this->input['key'])) {
         $key = trim($this->input['key']);
         $condition .= " and title like '%" . $key . "%'";
     }
     $condition .= ' and status = 1 and (end_time >' . TIMENOW . ' or end_time = 0 )';
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 10;
     $data_limit = " LIMIT " . $offset . ", " . $count;
     if (!empty($key)) {
         $data_limit = '';
     }
     $vote_question = $this->mVote->news_refer_show($condition, $data_limit, '');
     if (is_array($vote_question) && count($vote_question) > 0) {
         foreach ($vote_question as $v) {
             $v['img'] = array('host' => $v['pictures_info']['host'], 'dir' => $v['pictures_info']['dir'], 'filepath' => $v['pictures_info']['filepath'], 'filename' => $v['pictures_info']['filename']);
             unset($v['pictures_info']);
             $v['create_time'] = date('Y-m-d H:i:s', $v['create_time']);
             $v['start_time'] = date('Y-m-d H:i:s', $v['start_time']);
             $v['time'] = hg_tran_time($v['update_time']);
             $v['update_time'] = date('Y-m-d H:i:s', $v['update_time']);
             $v['filepath'] = $v['pictures_info']['filepath'] . $v['pictures_info']['filename'];
             $v['app_bundle'] = APP_UNIQUEID;
             $v['module_bundle'] = MOD_UNIQUEID;
             $this->addItem($v);
         }
     }
     $this->output();
 }
Exemplo n.º 8
0
 public function show_quick_select()
 {
     $condition = '';
     if (!empty($this->input['user'])) {
         $user = urldecode($this->input['user']);
         $condition .= " and v.admin_name='" . $user . "'";
     }
     if (!empty($this->input['key'])) {
         $key = urldecode($this->input['user']);
         $condition .= " and v.title like '%" . $key . "%'";
     }
     $condition .= ' and v.state=1 and v.end_time > ' . TIMENOW;
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 10;
     $data_limit = " LIMIT " . $offset . " , " . $count;
     if (!empty($key)) {
         $data_limit = '';
     }
     $vote = $this->obj->show($condition, $data_limit);
     $this->setXmlNode('vote', 'info');
     if (!empty($vote)) {
         foreach ($vote as $v) {
             $v['create_time'] = date('Y-m-d H:i:s', $v['create_time']);
             $v['start_time'] = date('Y-m-d H:i:s', $v['start_time']);
             $v['end_time'] = date('Y-m-d H:i:s', $v['end_time']);
             $v['describes'] = substr($v['describes'], 0, 200);
             $v['question_total'] = count($v['questions']);
             $v['time'] = hg_tran_time($v['create_time']);
             $v['filepath'] = $v['logo_info']['filepath'] . $v['logo_info']['filename'];
             $v['app_bundle'] = APP_UNIQUEID;
             $v['module_bundle'] = MOD_UNIQUEID;
             $this->addItem($v);
         }
     }
     $this->output();
 }
Exemplo n.º 9
0
 public function news_refer_material()
 {
     $condition = '';
     if (!empty($this->input['user'])) {
         $user = $this->input['user'];
         $condition .= " and v.user_id='" . $this->user['user_id'] . "' AND v.vod_leixing != 2";
     }
     if (!empty($this->input['key'])) {
         $key = $this->input['key'];
         $condition .= " and v.title like '%" . $key . "%'";
     }
     if (!empty($this->input['sort_id'])) {
         $sort_id = intval($this->input['sort_id']);
         if ($sort_id < 5) {
             $condition .= " AND v.vod_leixing = " . $sort_id;
         } else {
             $condition .= " and v.vod_sort_id = " . $sort_id;
         }
     }
     $condition .= ' and status = 2 and img_info != ""';
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 10;
     $limit = " limit {$offset}, {$count}";
     if (!empty($key)) {
         $limit = '';
     }
     $sql = "SELECT v.*, vs.name AS sort_name FROM " . DB_PREFIX . "vodinfo v LEFT JOIN " . DB_PREFIX . "vod_media_node vs ON v.vod_sort_id = vs.id WHERE 1" . $condition . " ORDER BY v.video_order_id DESC, v.id DESC " . $limit;
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $r['create_time'] = date('Y-m-d H:i', $r['create_time']);
         $r['update_time'] = date('Y-m-d H:i', $r['update_time']);
         $r['time'] = hg_tran_time($r['update_time']);
         $r['app_bundle'] = APP_UNIQUEID;
         $r['module_bundle'] = MOD_UNIQUEID;
         $r['img'] = unserialize($r['img_info']);
         $this->addItem($r);
     }
     $this->output();
 }