Beispiel #1
0
function get_tag_gxcms($tag)
{
    $table = !empty($tag['name']) ? trim($tag['name']) : 'video';
    $field = !empty($tag['field']) ? trim($tag['field']) : '*';
    $limit = !empty($tag['limit']) ? trim($tag['limit']) : '10';
    if ($table == 'self' && !$tag['order']) {
        $tag['order'] = 'orders desc';
    }
    $order = !empty($tag['order']) ? trim($tag['order']) : 'addtime desc';
    if ($table != 'link' && $table != 'self') {
        $where['status'] = array('eq', 1);
    }
    if ($tag['time']) {
        $where['addtime'] = array('gt', xtime($tag['time']));
    }
    if ($tag['hits']) {
        $hits = explode(',', trim($tag['hits']));
        if (count($hits) > 1) {
            $where['hits'] = array('between', $hits[0] . ',' . $hits[1]);
        } else {
            $where['hits'] = array('gt', $hits[0]);
        }
    }
    //根据索引规则放置CID前
    if ($tag['cid']) {
        $cids = explode(',', trim($tag['cid']));
        if ($table == 'self') {
            $where['cid'] = array('eq', $tag['cid']);
        } else {
            if (count($cids) > 1) {
                $where['cid'] = array('in', get_channel_remove($cids));
            } else {
                $where['cid'] = get_channel_sqlin($tag['cid']);
            }
        }
    }
    if ($tag['sid']) {
        $sid = $tag['sid'];
        $sidArr = explode(',', $sid);
        if (count($sidArr > 0)) {
            foreach ($sidArr as $v) {
                $where['_string'] = "FIND_IN_SET('{$v}',stype_mcid)";
            }
        } else {
            $where['_string'] = "FIND_IN_SET('{$sid}',stype_mcid)";
        }
    }
    if ($tag['ids']) {
        $where['id'] = array('in', trim($tag['ids']));
    }
    if ($tag['stars']) {
        $where['stars'] = array('in', trim($tag['stars']));
    }
    if ($tag['letter']) {
        $where['letter'] = array('eq', trim($tag['letter']));
    }
    if ($tag['keyword']) {
        $keyword = trim($tag['keyword']);
        $where['title'] = array('like', '%' . $keyword . '%');
    }
    if ($tag['serial'] && $table == 'video') {
        $serial = trim($tag['serial']);
        if ('all' == $serial) {
            $where['serial'] = array('neq', 0);
        } else {
            $where['serial'] = array('gt', $serial);
        }
    }
    if ($tag['up']) {
        $up = explode(',', trim($tag['up']));
        if (count($up) > 1) {
            $where['up'] = array('between', $up[0] . ',' . $up[1]);
        } else {
            $where['up'] = array('gt', $up[0]);
        }
    }
    if ($tag['down']) {
        $down = explode(',', trim($tag['down']));
        if (count($down) > 1) {
            $where['down'] = array('between', $down[0] . ',' . $down[1]);
        } else {
            $where['down'] = array('gt', $down[0]);
        }
    }
    if ($tag['score']) {
        $score = explode(',', trim($tag['score']));
        if (count($score) > 1) {
            $where['score'] = array('between', $score[0] . ',' . $score[1]);
        } else {
            $where['score'] = array('gt', $score[0]);
        }
    }
    if ($tag['scoreer']) {
        $scoreer = explode(',', trim($tag['scoreer']));
        if (count($scoreer) > 1) {
            $where['scoreer'] = array('between', $scoreer[0] . ',' . $scoreer[1]);
        } else {
            $where['scoreer'] = array('gt', $scoreer[0]);
        }
    }
    $rs = M($table);
    $list = $rs->field($field)->where($where)->order($order)->limit($limit)->select();
    //dump($rs->getLastSql());
    if ('special' == $table) {
        foreach ($list as $key => $val) {
            $list[$key]['readurl'] = get_read_url($table, $list[$key]['id'], $list[$key]['cid']);
            $list[$key]['logo'] = get_img_url($list[$key]['logo']);
            $list[$key]['banner'] = get_img_url_s($list[$key]['banner']);
        }
    } else {
        foreach ($list as $key => $val) {
            $list[$key]['showname'] = get_channel_name($list[$key]['cid']);
            $list[$key]['showurl'] = get_show_url($table, array('id' => $list[$key]['cid']), 1);
            $list[$key]['readurl'] = get_read_url($table, $list[$key]['id'], $list[$key]['cid'], $list[$key]['jumpurl']);
            $list[$key]['playerurl'] = get_play_url($list[$key]['id'], $list[$key]['cid'], 1);
            $list[$key]['picurlsmall'] = get_img_url_s($list[$key]['picurl'], $list[$key]['content']);
            $list[$key]['picurl'] = get_img_url($list[$key]['picurl'], $list[$key]['content']);
        }
    }
    if ($table == 'special') {
        var_dump($list);
    }
    return $list;
}
Beispiel #2
0
 public function infoday()
 {
     $this->checkhtml(C('url_html'), '文章内容');
     echo '<div class="htmllist" id="show" style="font-size:12px;">';
     $aday = intval($_REQUEST['aday']);
     $where['status'] = array('eq', 1);
     $where['addtime'] = array('gt', xtime($aday));
     $count = $this->InfoDB->where($where)->count('id');
     $listRows = C('url_create_num');
     $totalpages = ceil($count / $listRows);
     $nowpage = !empty($_GET['page']) ? $_GET['page'] : 1;
     $nowpage = intval($nowpage);
     $list = $this->InfoDB->where($where)->order('addtime desc')->limit($listRows)->page($nowpage)->select();
     if (empty($list)) {
         $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Show');
         $this->error('今日没有更新数据,暂不需要生成!');
     }
     foreach ($list as $key => $value) {
         $this->createinfo($value);
     }
     echo '</div><script>document.getElementById("show").style.display="none";</script>';
     if ($nowpage < $totalpages) {
         //是否生成完成
         $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Infoday/page/' . ($nowpage + 1) . '/aday/' . $aday);
         $this->success('第(' . $nowpage . ')页已经完成,正在准备下一个,请稍等!');
     } else {
         $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Infoshow/asid/0');
         $this->success('恭喜您!今日更新的新闻资讯已经生成完毕!正在准备生成新闻栏目页,请稍等!');
     }
 }
Beispiel #3
0
function get_color_date($type = 'Y-m-d H:i:s', $time, $color = 'red')
{
    if ($time > xtime(1)) {
        return '<font color="' . $color . '">' . date($type, $time) . '</font>';
    } else {
        return date($type, $time);
    }
}
Beispiel #4
0
 /**
  * 采集影片入库管理
  * @param $act
  */
 function Inflow($act)
 {
     if ($act == 'inflow') {
         if (empty($_POST['ids'])) {
             $this->error = '请选择需入库影片!';
             return false;
         }
         $ArrID = $_POST['ids'];
     } else {
         $where['status'] = array('neq', 0);
         if ($act == 'today') {
             $where['addtime'] = array('gt', xtime(1));
         }
         if ($act == 'allunused') {
             $where['status'] = 1;
         }
         if ($act == 'allinflow') {
             $where = '';
         }
         $All = $this->ContDB->field('id')->where($where)->select();
         foreach ($All as $k => $v) {
             $ArrID[$k] = $v['id'];
         }
     }
     foreach ($ArrID as $key => $val) {
         $Cont = $this->ContDB->field('nid,url,data')->where('id=' . $val)->find();
         $data = collect::string2array(stripslashes($Cont['data']));
         $result .= '[' . $data['cname'] . ']<strong>' . $data['title'] . '</strong>';
         if (!$this->CModel->videoImport($Cont['url'], $data, $Cont['nid'])) {
             $result .= $this->CModel->getError() . "\n\r";
             continue;
         } else {
             $UpCont = array('status' => 2);
             /*if($data['cid']==999){
             			unset($data['cid']);
             			$UpCont['data']=collect::array2string($data);
             		}*/
             $Update = $this->ContDB->where('id=' . $val)->save($UpCont);
             $result .= "入库成功!\n\r";
         }
     }
     $result = explode("\n\r", $result);
     return $result;
     //if(!empty($this->error)) return false;
     //return true;
 }