function NodeData($nid) { //获取某 nid数据 $NodeData = $this->DB->where('id=' . $nid)->find(); foreach ($NodeData as $key => $val) { $NodeData[$key] = stripslashes($val); //反转义字符 } if (isset($NodeData['fields'])) { $NodeData['fields'] = collect::string2array($NodeData['fields']); } //字符串转换为数组 return $NodeData; }
/** * 采集影片入库管理 * @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; }