cscmsv4火车头免登陆接口-utf8
cscmsv4火车头免登陆接口-utf8\歌曲提示数据不完整 谁能解决的联系我QQ406084291
http://www.chshcms.com/
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Locoy extends CI_Controller {
function __construct(){
parent::__construct();
//免登入接口密码,默认为1234,请自行修改
$pass==$this->pass='337268759';
}
//分类列表
public function lists()
{
$sid=intval($this->input->get_post('sid',TRUE)); //版块类型,1为歌曲,2为文章,3为视频,4为歌手
if($sid==0) $sid=1;
echo "<select name='list'>";
if($sid==1){
$sqlstr="select id,name from ".CS_SqlPrefix."dance_list order by xid asc";
}elseif($sid==2){
$sqlstr="select id,name from ".CS_SqlPrefix."news_list order by xid asc";
}elseif($sid==3){
$sqlstr="select id,name from ".CS_SqlPrefix."vod_list order by xid asc";
}else{
$sqlstr="select id,name from ".CS_SqlPrefix."singer_list order by xid asc";
}
$result=$this->CsdjDB->db->query($sqlstr);
$recount=$result->num_rows();
if($recount>0){
foreach ($result->result() as $row) {
echo "<option value='".$row->id."'>".$row->name."</option>\n";
}
}
echo '</select>';
}
//入库
public function ruku()
{
//判断密码
$pass=$this->input->get_post('pass',TRUE);
if($this->pass!=$pass || $pass!=$this->pass){
die('密码错误');
}
//--------------------以下代码非专业人员不要修改----------------------
$sid=intval($this->input->get_post('sid',TRUE)); //版块类型,1为歌曲,2为文章,3为视频,4为歌手
if($sid==0) $sid=1;
//-------------------歌曲------------------------//
if($sid==1){
//必填字段
$music['name']=$this->input->get_post('name', TRUE, TRUE); //歌曲标题
$music['cid']=intval($this->input->get_post('cid')); //歌曲分类
$music['purl']=$this->input->get_post('purl', TRUE, TRUE); //试听地址
//选填字段
$music['tid']=intval($this->input->get_post('tid')); //歌曲专辑
$music['reco']=intval($this->input->get_post('reco')); //推荐星级
$music['hits']=intval($this->input->get_post('hits')); //总人气
$music['yhits']=intval($this->input->get_post('yhits')); //月人气
$music['zhits']=intval($this->input->get_post('zhits')); //周人气
$music['rhits']=intval($this->input->get_post('rhits')); //日人气
$music['dhits']=intval($this->input->get_post('dhits')); //被顶次数
$music['chits']=intval($this->input->get_post('chits')); //被踩次数
$music['shits']=intval($this->input->get_post('shits')); //收藏次数
$music['xhits']=intval($this->input->get_post('xhits')); //下载次数
$music['cion']=intval($this->input->get_post('cion')); //下载金币
$music['text']=remove_xss($this->input->get_post('text')); //文本歌词
$music['lrc']=$this->input->get_post('lrc', TRUE, TRUE); //LRC歌词
$music['pic']=$this->input->get_post('pic', TRUE, TRUE); //歌曲图片
$music['tags']=$this->input->get_post('tags', TRUE, TRUE); //TAGS标签
$music['zc']=$this->input->get_post('zc', TRUE, TRUE); //歌曲作词
$music['zq']=$this->input->get_post('zq', TRUE, TRUE); //歌曲作曲
$music['bq']=$this->input->get_post('bq', TRUE, TRUE); //歌曲编曲
$music['hy']=$this->input->get_post('hy', TRUE, TRUE); //歌曲混音
$music['durl']=$this->input->get_post('durl', TRUE, TRUE); //下载地址
$music['uid']=intval($this->input->get_post('uid', TRUE)); //会员ID
$music['dx']=$this->input->get_post('dx', TRUE, TRUE); //歌曲大小
$music['yz']=$this->input->get_post('yz', TRUE, TRUE); //歌曲音质
$music['sc']=$this->input->get_post('sc', TRUE, TRUE); //歌曲时长
$music['title']=$this->input->get_post('title',true,true); //SEO标题
$music['keywords']=$this->input->get_post('keywords',true,true); //SEO关键词
$music['description']=$this->input->get_post('description',true,true); //SEO描述
$music['addtime']=time();
// 采集规则请参照以下
//
//
// &name=[标签:歌曲标题]
// &cid=[标签:歌曲分类]
// &purl=[标签:试听地址]
// &tid=[标签:歌曲专辑]
// &reco=[标签:推荐星级]
// &hits=[标签:总人气]
// &yhits=[标签:月人气]
// &zhits=[标签:周人气]
// &rhits=[标签:日人气]
// &dhits=[标签:被顶次数]
// &chits=[标签:被踩次数]
// &shits=[标签:收藏次数]
// &xhits=[标签:下载次数]
// &cion=[标签:下载金币]
// &text=[标签:文本歌词]
// &lrc=[标签:LRC歌词]
// &pic=[标签:歌曲图片]
// &tags=[标签:TAGS标签]
// &durl=[标签:下载地址]
// &uid=[标签:会员ID]
$singer=$this->input->get_post('singer', TRUE, TRUE);
//判断歌手是否存在
if(!empty($singer)){
$row=$this->CsdjDB->get_row('singer','id',$singer,'name');
if($row){
$music['singerid']=$row->id;
}
}
if($music['cid']==0 || empty($music['name']) || empty($music['purl'])){
echo "数据不完整";
}else{
$row=$this->db->query("select id from ".CS_SqlPrefix."dance where name='".$music['name']."'")->row();
if($row){
echo "数据已存在,跳过";
}else{
$did=$this->CsdjDB->get_insert('dance',$music);
if($did>0){
echo "增加信息成功";
}else{
echo "增加信息失败";
}
}
}
//-------------------文章------------------------//
}elseif($sid==2){
$news['cion']=intval($this->input->get_post('cion'));
$news['pic']=$this->input->get_post('pic', TRUE, TRUE);
$news['tags']=$this->input->get_post('tags', TRUE, TRUE);
$news['info']=$this->input->get_post('info', TRUE, TRUE);
$news['uid']=intval($this->input->get_post('uid'));
$news['title']=$this->input->get_post('title',true,true);
$news['keywords']=$this->input->get_post('keywords',true,true);
$news['description']=$this->input->get_post('description',true,true);
$news['addtime']=time();
//必填字段
$news['name']=$this->input->get_post('name', TRUE, TRUE);
$news['cid']=intval($this->input->get_post('cid'));
$news['content']=remove_xss($this->input->get_post('content'));
//截取概述
$news['info'] = sub_str(str_checkhtml($news['content']),120);
//检测必须字段
if($news['cid']==0 || empty($news['name']) || empty($news['content'])){
echo "数据不完整";
}else{
$row=$this->db->query("select id from ".CS_SqlPrefix."news where name='".$news['name']."'")->row();
if($row){
echo "数据已存在,跳过";
}else{
$did=$this->CsdjDB->get_insert('news',$news);
if($did>0){
echo "增加信息成功";
}else{
echo "增加信息失败";
}
}
}
//-------------------视频------------------------//
}elseif($sid==3){
$vod['cion']=intval($this->input->get_post('cion'));
$vod['dcion']=intval($this->input->get_post('dcion'));
$vod['text']=remove_xss($this->input->get_post('text'));
$vod['pic']=$this->input->get_post('pic', TRUE, TRUE);
$vod['tags']=$this->input->get_post('tags', TRUE, TRUE);
$vod['daoyan']=$this->input->get_post('daoyan', TRUE, TRUE);
$vod['zhuyan']=$this->input->get_post('zhuyan', TRUE, TRUE);
$vod['yuyan']=$this->input->get_post('yuyan', TRUE, TRUE);
$vod['diqu']=$this->input->get_post('diqu', TRUE, TRUE);
$vod['year']=$this->input->get_post('year', TRUE, TRUE);
$vod['info']=$this->input->get_post('info', TRUE, TRUE);
$vod['uid']=intval($this->input->get_post('uid'));
$vod['title']=$this->input->get_post('title',true,true);
$vod['keywords']=$this->input->get_post('keywords',true,true);
$vod['description']=$this->input->get_post('description',true,true);
$vod['addtime']=time();
//必填字段
$vod['name']=$this->input->get_post('name', TRUE, TRUE);//视频名称
$vod['cid']=intval($this->input->get_post('cid'));//视频分类ID
$play=$this->input->get_post('play', TRUE);//播放来源
$purl=$this->input->get_post('purl', TRUE);//播放地址
$down=$this->input->get_post('down', TRUE, TRUE);//下载来源
$durl=$this->input->get_post('durl', TRUE, TRUE);//下载地址
//播放地址组合
if(!empty($purl) && !empty($play)){
$purl = explode("\n",str_replace("\r","",$purl));
$playurl='';
for($j=0;$j<count($purl);$j++){
$playurl.=(strpos($purl[$j],'$') !== FALSE) ? '第'.($j+1).'集$'.$purl.'$'.$play : $purl[$j];
$playurl.="\n";
}
$playurl.="\n=cscms=";
$vod['purl']=str_replace("\n=cscms=","",$playurl);
}
if(!empty($durl) && !empty($down)){
$durl = explode("\n",str_replace("\r","",$durl));
$downurl='';
for($j=0;$j<count($durl);$j++){
$downurl.=(strpos($durl[$j],'$') !== FALSE) ? '第'.($j+1).'集$'.$durl.'$'.$down : $durl[$j];
$downurl.="\n";
}
$downurl.="\n=cscms=";
$vod['durl']=str_replace("\n=cscms=","",$downurl);
}
$singer=$this->input->get_post('singer', TRUE, TRUE);
//判断歌手是否存在
if(!empty($singer)){
$row=$this->CsdjDB->get_row('singer','id',$singer,'name');
if($row){
$vod['singerid']=$row->id;
}
}
//检测必须字段
if($vod['cid']==0 || empty($vod['name'])){
echo "数据不完整";
}else{
$row=$this->db->query("select id,purl,durl from ".CS_SqlPrefix."vod where name='".$vod['name']."'")->row();
if($row){
$s=0;
if(strpos($row->purl,'$'.$play) === FALSE){
$vod2['purl']=$row->purl.'#cscms#'.$vod['purl'];
echo "数据存在,新增一组播放";
$s++;
}
if(strpos($row->durl,'$'.$down) === FALSE){
$vod2['durl']=$row->durl.'#cscms#'.$vod['durl'];
echo "数据存在,新增一组下载";
$s++;
}
if($s>0){
$this->CsdjDB->get_update('vod',$row->id,$vod2);
}else{
echo "数据已存在,跳过";
}
}else{
$did=$this->CsdjDB->get_insert('vod',$vod);
if($did>0){
echo "增加信息成功";
}else{
echo "增加信息失败";
}
}
}
//-------------------歌手------------------------//
}elseif($sid==4){
$singer['name']=$this->input->get_post('pic',true,true);
$singer['tags']=$this->input->get_post('tags',true,true);
$singer['pic']=$this->input->get_post('pic',true,true);
$singer['color']=$this->input->get_post('color',true,true);
$singer['bname']=$this->input->get_post('bname',true,true);
$singer['cid']=intval($this->input->get_post('cid'));
$singer['nichen']=$this->input->get_post('nichen',true,true);
$singer['sex']=$this->input->get_post('sex',true,true);
$singer['nat']=$this->input->get_post('nat',true,true);
$singer['yuyan']=$this->input->get_post('yuyan',true,true);
$singer['city']=$this->input->get_post('city',true,true);
$singer['sr']=$this->input->get_post('sr',true,true);
$singer['xingzuo']=$this->input->get_post('xingzuo',true,true);
$singer['height']=$this->input->get_post('height',true,true);
$singer['weight']=$this->input->get_post('weight',true,true);
$singer['content']=remove_xss($this->input->get_post('content'));
$singer['title']=$this->input->get_post('title',true,true);
$singer['keywords']=$this->input->get_post('keywords',true,true);
$singer['description']=$this->input->get_post('description',true,true);
//开始处理数据
if(empty($singer['name']) || $singer['cid']==0){
echo "数据不完整";
}else{
//判断数据是否相同
$row=$this->db->query("select id from ".CS_SqlPrefix."singer where name='".$singer['name']."'")->row();
if($row){
$this->CsdjDB->get_update('singer',$row->id,$singer);
echo "数据存在,资料修改成功";
}else{
$did=$this->CsdjDB->get_insert('singer',$singer);
if($did>0){
echo "增加信息成功";
}else{
echo "增加信息失败";
}
}
}
}
}
}
不完整就把所有字段都填上发布试试
页:
[1]