Пример #1
0
 public function show()
 {
     $sql = "SELECT app_uniqueid, trade_number, out_trade_number, total_fee FROM " . DB_PREFIX . "orders\n            WHERE order_type = 'THIRD_PARTY' AND trade_status = 'HAS_PAY' AND out_trade_notify IN(0,1)\n            ORDER BY out_trade_notify_time ASC LIMIT 1";
     $order = $this->db->query_first($sql);
     //通知第三方订单
     $sql = "SELECT * FROM " . DB_PREFIX . "app_access WHERE app_uniqueid = '" . $order['app_uniqueid'] . "'";
     $app = $this->db->query_first($sql);
     if (!empty($app)) {
         $curl = new curl($app['host'], $app['dir']);
         $curl->setSubmitType('post');
         $curl->setReturnFormat('json');
         $curl->initPostData();
         $curl->addRequestData('a', $app['order_detail_func']);
         $curl->addRequestData('trade_number', $order['out_trade_number']);
         $curl->addRequestData('total_fee', $order['total_fee']);
         $ret = $curl->request($app['request_file']);
         if ($ret['success'] == 1) {
             $status = $ret['data']['status'];
             if ($status == 0) {
                 $curl->initPostData();
                 $curl->addRequestData('a', $app['pay_func']);
                 $curl->addRequestData('trade_number', $order['out_trade_number']);
                 $curl->addRequestData('total_fee', $order['total_fee']);
                 $ret = $curl->request($app['request_file']);
             }
             $this->db->update_data(array('out_trade_notify' => $status, 'out_trade_notify_time' => TIMENOW), 'orders', " trade_number = '" . $order['trade_number'] . "'");
         } else {
             $this->db->update_data(array('out_trade_notify' => 0, 'out_trade_notify_time' => TIMENOW), 'orders', " trade_number = '" . $order['trade_number'] . "'");
         }
     }
     var_dump($ret);
     var_dump($order);
 }
Пример #2
0
 public function get_transcode_progress()
 {
     $id = urldecode($this->input['id']);
     if (!$id) {
         $this->errorOutput("未知的视频");
     }
     include_once ROOT_PATH . 'lib/class/curl.class.php';
     $mediaserver = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
     $ret = array();
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'attach where attach_id IN(' . $id . ')';
     $query = $this->db->query($sql);
     while ($row = $this->db->fetch_array($query)) {
         $mediaserver->initPostData();
         $mediaserver->addRequestData('id', $row['attach_id']);
         $mediaserver->addRequestData('host', $row['host']);
         $mediaserver->addRequestData('port', $row['port']);
         $mediaserver->addRequestData('a', 'get_transcode_status');
         $ret[$row['video']] = $mediaserver->request('video_transcode.php');
     }
     $output = array();
     foreach (explode(',', $id) as $val) {
         if (!$ret[$id]) {
             $output[$id] = '100';
         } else {
             $output[$id] = $ret[$id]['return'] == 'success' ? $ret[$id]['transcode_percent'] : "0";
         }
     }
     $this->addItem($output);
     $this->output();
 }
Пример #3
0
 public function __getConfig()
 {
     //获取mediaserver的里面视频类型的配置
     if ($this->settings['App_mediaserver']) {
         $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
         $curl->setReturnFormat('json');
         $curl->initPostData();
         $curl->addRequestData('a', '__getConfig');
         $m_config = $curl->request('index.php');
     }
     if ($m_config && is_array($m_config)) {
         $video_type = $m_config[0]['video_type']['allow_type'];
     } else {
         $video_type = $this->default_type;
     }
     $video_type_arr = explode(',', $video_type);
     $flash_video_type = '';
     foreach ($video_type_arr as $k => $v) {
         $flash_video_type .= '*' . $v . ';';
     }
     $video_types = str_replace('.', '', $video_type);
     $this->settings['flash_video_type'] = $flash_video_type;
     $this->settings['video_type'] = $video_types;
     parent::__getConfig();
 }
Пример #4
0
 public function video2ftp()
 {
     if (!USE_FTP_UPLOAD) {
         return;
     }
     if (!$this->settings['App_mediaserver']) {
         $this->errorOutput('请先安装转码服务器!');
     }
     $c = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . '/admin/');
     $c->initPostData();
     $c->addRequestData('video_id', implode(',', array_keys($this->vdata)));
     $c->addRequestData('a', 'upload');
     foreach ($this->settings['ftp'] as $key => $value) {
         $c->addRequestData($key, $value);
     }
     $re = $c->request('ftp_upload.php');
     if (!$re || $re == 'null') {
         $this->errorOutput('无效的视频!');
     }
     if ($re['ErrorCode'] || $re['ErrorText']) {
         $this->errorOutput('Mediaserver:' . $re['ErrorText']);
     }
     foreach ($re as $key => $val) {
         if ($val['id']) {
             $this->vdata[$val['id']]['ftp_path'] = $val['dir'] . '/';
         }
         /*
         else
         {
         	$this->vdata[$val['id']]['ftp_path'] = $this->vdata[$val['id']]['video_path'];
         }
         */
     }
 }
Пример #5
0
    }
    public function __destruct()
    {
        parent::__destruct();
    }
    /**
	 * 转换word文档
	 */
    public function convert()
    {
        $app_id = isset($this->input['custom_appid']) ? trim($this->input['custom_appid']) : '';
        $app_key = isset($this->input['custom_appkey']) ? trim($this->input['custom_appkey']) : '';
        if (empty($app_id) || empty($app_key)) {
            $this->errorOutput(PARAM_WRONG);
        }
        //先验证是否有权限
        $auth = new Auth();
        $auth_info = $auth->getAccessToken($app_id, $app_key);
        if (!$auth_info) {
            $this->errorOutput(NO_AUTH);
        }
        //处理上传的word文档
        $gGlobalConfig['officeconvert'] = array('host' => '10.0.1.59:8080', 'dir' => 'officeConverter/');
        $curl = new curl($gGlobalConfig['officeconvert']['host'], $gGlobalConfig['officeconvert']['dir']);
        $curl->setSubmitType('post');
        $curl->setReturnFormat('str');
        $curl->initPostData();
        $curl->addFile($_FILES);
        $curl->addRequestData('custom_appid', $app_id);
        $curl->addRequestData('custom_appkey', $app_key);
Пример #6
0
 public function setting()
 {
     $data = array('id' => intval($this->user['id']), 'password' => trim($this->input['password']), 'password_again' => trim($this->input['password_again']), 'old_password' => trim($this->input['old_password']));
     if ($data['password'] && $data['password'] != $data['password_again']) {
         $this->ReportError('两次输入的密码不一样');
     }
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('a', 'update_password');
     foreach ($data as $key => $val) {
         $curl->addRequestData($key, $val);
     }
     if ($_FILES['Filedata']) {
         $curl->addFile($_FILES);
     }
     $return = $curl->request('member.php');
     if ($return && $return[0]) {
         if ($return[0]['error'] == -1) {
             $this->ReportError('原始密码错误');
         }
     }
     $this->redirect('更新成功');
 }
Пример #7
0
 protected function verifyToken()
 {
     $gAuthServerConfig = $this->settings['App_auth'];
     if (!$gAuthServerConfig) {
         $this->user = array('user_id' => $this->input['user_id'], 'user_name' => $this->input['user_name'], 'group_type' => 1, 'appid' => $this->input['appid'], 'display_name' => $this->input['user_name'], 'visit_client' => 0);
         return;
     }
     if (!class_exists('curl')) {
         include_once ROOT_PATH . 'lib/class/curl.class.php';
     }
     $curl = new curl($gAuthServerConfig['host'], $gAuthServerConfig['dir']);
     $curl->initPostData();
     $postdata = array('appid' => $this->input['appid'], 'appkey' => $this->input['appkey'], 'access_token' => $this->input['access_token'], 'mod_uniqueid' => MOD_UNIQUEID, 'app_uniqueid' => APP_UNIQUEID, 'a' => 'get_user_info');
     foreach ($postdata as $k => $v) {
         $curl->addRequestData($k, $v);
     }
     $ret = $curl->request('get_access_token.php');
     //判定终端是否需要登录授权
     if ($ret['ErrorCode']) {
         $this->errorOutput($ret['ErrorCode']);
     }
     $this->user = $ret[0];
     if ($this->input['m2o_ckey'] == CUSTOM_APPKEY) {
         $this->user['group_type'] = 1;
     }
 }
Пример #8
0
 }
 public function __destruct()
 {
     parent::__destruct();
 }
 public function convert()
 {
     global $gGlobalConfig;
     include_once ROOT_PATH . 'lib/class/curl.class.php';
     if ($gGlobalConfig['App_officeconvert']) {
         $curl = new curl($gGlobalConfig['App_officeconvert']['host'], $gGlobalConfig['App_officeconvert']['dir']);
     }
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('custom_appid', CUSTOM_APPID);
     $curl->addRequestData('custom_appkey', CUSTOM_APPKEY);
     $curl->addFile($_FILES);
     $result = $curl->request('convert.php');
     //var_dump($result);exit;
     $path = 'cache/word/zip_' . uniqid() . '/';
     $zipDir = ROOT_PATH . $path;
     $return = array();
     if (hg_mkdir($zipDir) && is_writeable($zipDir)) {
         $zipFile = $zipDir . 'word.zip';
         file_put_contents($zipFile, $result);
         $unzipDir = $zipDir . 'unzip/';
         if (hg_mkdir($unzipDir) && is_writeable($unzipDir)) {
             $unzipCmd = ' unzip ' . $zipFile . ' -d ' . realpath($unzipDir);
             exec($unzipCmd);
             $rmZip = ' rm -f ' . $zipFile;
             exec($rmZip);
Пример #9
0
 /**
  * 发送消息到用户最后一次登录的设备
  * Enter description here ...
  */
 public function send_notify()
 {
     $member_id = intval($this->input['member_id']);
     $message = trim($this->input['message']);
     $content_id = intval($this->input['content_id']);
     $module = trim($this->input['module']);
     if (!$member_id) {
         $this->errorOutput('NO_MEMBER');
     }
     if (!$message) {
         $this->errorOutput('NO_MESSAGE');
     }
     $field = 'member_id, last_login_device';
     $condition = ' AND member_id=' . $member_id;
     $info = $this->mMember->get_member_info($condition, $field, $leftjoin);
     if (!$info) {
         $this->errorOutput('NO_MEMBER');
     }
     $last_login_device = $info[0]['last_login_device'];
     if (!$last_login_device) {
         $this->errorOutput('NO_DEVICE_LOGIN');
     }
     if ($this->settings['App_push_platform']) {
     } else {
         $device_len = strlen($last_login_device);
         if ($device_len > 60) {
             if ($this->settings['App_mobile']) {
                 $curl = new curl($this->settings['App_mobile']['host'], $this->settings['App_mobile']['dir']);
                 $curl->initPostData();
                 $curl->addRequestData('device_token', $last_login_device);
                 $curl->addRequestData('message', $message);
                 $curl->addRequestData('module', $module);
                 $curl->addRequestData('content_id', $content_id);
                 $ret = $curl->request('send_notify.php');
                 if ($ret) {
                     $this->addItem_withkey('result', 1);
                 } else {
                     $this->addItem_withkey('result', 0);
                 }
             }
         } else {
             if ($device_len > 20) {
                 $curl = new curl($this->settings['App_members']['host'], $this->settings['App_members']['dir']);
                 $curl->initPostData();
                 $curl->addRequestData('device_token', $last_login_device);
                 $curl->addRequestData('message', $message);
                 $curl->addRequestData('module', $module);
                 $curl->addRequestData('content_id', $content_id);
                 $ret = $curl->request('jpush.php');
                 if ($ret['result']) {
                     $this->addItem_withkey('result', 1);
                 } else {
                     $this->addItem_withkey('result', 0);
                 }
             }
         }
     }
     $this->output();
 }
Пример #10
0
 public function run()
 {
     /**************************************查询出数据库里面正在转码的视频******************************************/
     $sql = "SELECT * FROM " . DB_PREFIX . "vodinfo WHERE status = 0  AND vod_leixing != 4 ";
     $q = $this->db->query($sql);
     $videos = array();
     while ($r = $this->db->fetch_array($q)) {
         $videos[] = $r['id'];
     }
     if (!$videos) {
         $this->errorOutput(NO_VIDEO_IS_TRANSCODING);
     }
     /**************************************查询出当前正在开启的服务器********************************************/
     $sql = " SELECT * FROM " . DB_PREFIX . "transcode_center WHERE is_open = 1 ";
     $q = $this->db->query($sql);
     $servers = array();
     while ($r = $this->db->fetch_array($q)) {
         $servers[] = $r;
     }
     if (!$servers) {
         $this->errorOutput(NO_TRANSERVER_CAN_USE);
     }
     /**************************************查询出所有正在使用的转码服务器中正在转码的视频*****************************/
     $ids = array();
     //存储正在转码中视频id
     foreach ($servers as $k => $v) {
         $trans = new transcode(array('host' => $v['trans_host'], 'port' => $v['trans_port']));
         $task = json_decode($trans->get_transcode_status(), 1);
         if ($task['return'] == 'success' && $task['running']) {
             if ($task['waiting']) {
                 $task['running'] = array_merge($task['running'], $task['waiting']);
             }
             foreach ($task['running'] as $_k => $_v) {
                 if (!in_array($_v['id'], $ids)) {
                     $ids[] = $_v['id'];
                 }
             }
         }
     }
     /***************算出页面中正在转码的视频与实际服务器中转码视频以及等待的视频的差集,算出来视频id就是遗漏的视频**************/
     $diffIds = array_diff($videos, $ids);
     if (!$diffIds) {
         $this->errorOutput(NO_VIDEO_LEAVE_OUT);
     }
     //将找出遗漏的视频提交重新转码
     $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
     $curl->setSubmitType('get');
     foreach ($diffIds as $k => $v) {
         $curl->initPostData();
         $curl->addRequestData('id', $v);
         $curl->addRequestData('force_recodec', 1);
         $curl->request('retranscode.php');
     }
     $this->addItem('遗漏的视频:' . implode(',', $diffIds) . '已经提交重新转码');
     $this->output();
 }
Пример #11
0
 public function column_node()
 {
     $curl = new curl($this->settings['App_publishcontent']['host'], $this->settings['App_publishcontent']['dir'] . 'admin/');
     $curl->initPostData();
     $curl->addRequestData('a', 'get_all_columns');
     $return = $curl->request('column.php');
     if (is_array($return) && !$return['ErrorCode']) {
         exit(json_encode($return));
     }
     exit($return);
 }
Пример #12
0
 public function get_water_config()
 {
     global $gGlobalConfig;
     $curl = new curl($gGlobalConfig['App_material']['host'], $gGlobalConfig['App_material']['dir']);
     $curl->setSubmitType('get');
     $curl->initPostData();
     $curl->addRequestData('a', 'get_water_config');
     $ret = $curl->request('water.php');
     $this->addItem($ret[0]);
     $this->output();
 }
Пример #13
0
 public function run()
 {
     if (!$this->input['stime']) {
         $stime = TIMENOW - 24 * 3600;
     } else {
         $stime = strtotime($this->input['stime']);
     }
     if (!$this->input['etime']) {
         $etime = TIMENOW;
     } else {
         $etime = strtotime($this->input['etime']);
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "vodinfo WHERE 1 AND create_time >= '" . $stime . "' AND create_time <= '" . $etime . "' AND status NOT IN (0,4,5) AND vod_leixing != 4";
     $q = $this->db->query($sql);
     $video_path = array();
     $videos = array();
     while ($r = $this->db->fetch_array($q)) {
         $video_tmp = explode('.', $r['video_filename']);
         $video_path[$r['id']] = $r['video_base_path'] . $r['video_path'] . $video_tmp[0];
         $videos[$r['id']] = $r;
     }
     if (!$video_path) {
         $this->errorOutput('此时间段不存在视频');
     }
     $no_ismv = array();
     foreach ($video_path as $k => $v) {
         if (!file_exists($v . '.ismv') || !file_exists($v . '.ism')) {
             $no_ismv[] = $k;
         }
     }
     if (!$no_ismv) {
         $this->errorOutput('此时间段的视频都存在ismv与ism文件');
     }
     //检测视频有没有转码中的,主要为了防止强制转码的任务
     foreach ($no_ismv as $k => $v) {
         if (checkStatusFromAllServers($v)) {
             unset($no_ismv[$k]);
         }
     }
     $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
     $curl->setSubmitType('get');
     foreach ($no_ismv as $k => $v) {
         $curl->initPostData();
         $curl->addRequestData('id', $v);
         $curl->addRequestData('force_recodec', 1);
         if (in_array($videos[$v]['status'], array(2, 3))) {
             $curl->addRequestData('audit_auto', $videos[$v]['status']);
         }
         $curl->request('retranscode.php');
     }
     $ids = implode(',', $no_ismv);
     $this->addItem('没有ismv的视频有:' . $ids . ',已经提交重新转码');
     $this->output();
 }
Пример #14
0
 public function select_videos()
 {
     $curl = new curl($this->settings['App_livmedia']['host'], $this->settings['App_livmedia']['dir']);
     $curl->setSubmitType('get');
     $curl->initPostData();
     foreach ($this->input as $k => $v) {
         $curl->addRequestData($k, $v);
     }
     $return = $curl->request('vod_get_many_videos.php');
     $this->addItem($return[0]);
     $this->output();
 }
Пример #15
0
 public function auth()
 {
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
     $curl->mAutoInput = false;
     $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'applications ORDER BY id desc';
     $q = $this->db->query($sql);
     while ($row = $this->db->fetch_array($q)) {
         echo $row['name'] . '<br />';
         $row['dir'] = str_replace($row['admin_dir'], '', $row['dir']);
         $curl->initPostData();
         foreach ($row as $k => $v) {
             $curl->addRequestData($k, $v);
         }
         $curl->addRequestData('bundle', $row['softvar']);
         $ret = $curl->request('admin/apps.php');
     }
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'modules ORDER BY id desc';
     $q = $this->db->query($sql);
     $app_main_module = array();
     while ($row = $this->db->fetch_array($q)) {
         echo $row['name'] . '<br />';
         $row['dir'] = str_replace($row['admin_dir'], '', $row['dir']);
         $row['main_module'] = 0;
         if ($row['app_uniqueid'] == $row['mod_uniqueid']) {
             $row['main_module'] = 1;
         }
         if ($row['menu_pos'] == -1) {
             $row['main_module'] = 2;
         }
         $modules[$row['id']] = $row;
         if ($row['main_module']) {
             //纪录各个应用主模块 menu_pos优先
             if ($modules[$app_main_module[$row['app_uniqueid']]]['main_module'] <= $row['main_module']) {
                 $app_main_module[$row['app_uniqueid']] = $row['id'];
             }
         }
     }
     if ($modules) {
         foreach ($modules as $mid => $row) {
             if ($row['main_module'] && in_array($row['id'], $app_main_module)) {
                 $row['main_module'] = 1;
             } else {
                 $row['main_module'] = 0;
             }
             $curl->initPostData();
             foreach ($row as $k => $v) {
                 $curl->addRequestData($k, $v);
             }
             $ret = $curl->request('admin/modules.php');
         }
     }
 }
Пример #16
0
 private function checklogin($username, $password)
 {
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('a', 'show');
     $curl->addRequestData('username', $username);
     $curl->addRequestData('password', $password);
     $ret = $curl->request('get_access_token.php');
     return $ret[0];
 }
Пример #17
0
 public function get_video($vid = 0)
 {
     global $gGlobalConfig;
     include_once ROOT_PATH . 'lib/class/curl.class.php';
     $livmedia = new curl($gGlobalConfig['App_livmedia']['host'], $gGlobalConfig['App_livmedia']['dir'] . 'admin/');
     $livmedia->initPostData();
     $livmedia->addRequestData('id', $vid);
     $livmedia->addRequestData('a', 'detail');
     $vodinfo = $livmedia->request('vod.php');
     $vodinfo = $vodinfo[0];
     return is_array($vodinfo) && !empty($vodinfo) ? $vodinfo : array();
 }
Пример #18
0
 public function callBack()
 {
     $record = json_decode(html_entity_decode($this->input['data']), 1);
     $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
     $curl->setSubmitType('post');
     $curl->initPostData();
     $data = array('id' => $record['id'], 'is_time_shift' => $record['time_shift'] ? 1 : 0, 'title' => $record['title'] ? $record['title'] : '精彩节目', 'filepath' => $record['file_path'], 'source' => $record['source'], 'is_mark' => $record['is_allow'], 'vod_sort_id' => $record['vod_sort_id'], 'audit_auto' => $record['audit_auto'], 'column_id' => $record['column_id'], 'channel_id' => $record['channel_id'], 'vod_leixing' => 3, 'start' => '0', 'end' => $record['duration'] * 1000, 'starttime' => $record['start_time'], 'create_time' => -1, 'force_recodec' => $record['force_codec'], 'appid' => $record['appid'], 'appkey' => $record['appkey'], 'comment' => $record['comment'], 'user_id' => $record['user_id'], 'user_name' => $record['user_name']);
     foreach ($data as $k => $v) {
         $curl->addRequestData($k, $v);
     }
     include_once ROOT_PATH . 'lib/class/program_record.class.php';
     $obj_record = new programRecord();
     $tmp_ret = array();
     switch ($record['exit_status']) {
         case 0:
             //出错
             $data = array('text' => '录制失败', 'state' => 2, 'content_id' => $record['id'], 'conid' => $record['id']);
             $tmp_ret = $obj_record->updateLogs($data);
             if ($tmp_ret) {
                 $obj_record->update_record_state($record['id']);
             }
             break;
         case 1:
             //成功
             $data = array('text' => '录制成功', 'state' => 1, 'content_id' => $record['id'], 'conid' => $record['id']);
             $tmp_ret = $obj_record->updateLogs($data);
             if ($tmp_ret) {
                 $obj_record->update_record_state($record['id']);
             }
             break;
         case 2:
             //停止录制
             /*
             			$data = array(
             				'text' => '停止录制',
             				'state' => 2,
             				'content_id' => $record['id'],
             				'conid' => $record['id'],
             			);
             			$obj_live->updateLogs($data);
             			$obj_live->update_record_state($record['id']);
             */
             $this->addItem(array());
             $this->output();
             break;
         default:
             break;
     }
     $ret = $curl->request('create.php');
     $this->addItem($ret);
     $this->output();
 }
Пример #19
0
 function config()
 {
     $curl = new curl('localhost', 'livsns/api/auth/');
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('a', 'settings');
     $ret = $curl->request('configuare.php');
     $user_configs = array('base' => $ret['base'], 'define' => $ret['define']);
     $curl = new curl('10.0.1.40', 'livworkbench/api/');
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
     $curl->addRequestData('app', 'auth');
     $curl->addRequestData('version', '1.0.0');
     $curl->addRequestData('pre_release', '1');
     $new_configs = $curl->request('config.php');
     if ($new_configs) {
         $doset = array();
         foreach ($new_configs as $k => $v) {
             if (is_array($v)) {
                 foreach ($v as $kk => $vv) {
                     if (!$user_configs[$k][$kk]) {
                         $doset[$k][$kk] = $vv;
                     }
                 }
             }
         }
     }
     if ($doset) {
         $curl = new curl('localhost', 'livsns/api/auth/');
         $curl->setSubmitType('post');
         $curl->setReturnFormat('json');
         $curl->initPostData();
         $curl->addRequestData('a', 'doset');
         foreach ($doset as $k => $v) {
             foreach ($v as $kk => $vv) {
                 if (is_array($vv)) {
                     foreach ($vv as $kkk => $vvv) {
                         $curl->addRequestData($k . "[{$kk}][{$kkk}]", $vvv);
                     }
                 } else {
                     $curl->addRequestData($k . "[{$kk}]", $vv);
                 }
             }
         }
         $ret = $curl->request('configuare.php');
     }
     print_r($doset);
     print_r($curl);
 }
Пример #20
0
 private function access_token_expired($access_token)
 {
     //获取需要修改的配置
     require_once ROOT_PATH . 'lib/class/curl.class.php';
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('a', 'access_token_expired');
     $curl->addRequestData('access_token', $access_token);
     $ret = $curl->request('get_app_info.php');
     return $ret[0];
 }
Пример #21
0
 public function get_tem_sort()
 {
     $fid = $this->input['fid'];
     unset($this->input['appid'], $this->input['appkey']);
     $host = $this->settings['App_publishsys']['host'];
     $dir = $this->settings['App_publishsys']['dir'] . 'admin/';
     $curl = new curl($host, $dir);
     $curl->setSubmitType('post');
     $curl->initPostData();
     $curl->addRequestData('a', 'get_tem_sort');
     $curl->addRequestData('fid', fid);
     $tem_sort_info = $curl->request('template.php');
     echo json_encode($tem_sort_info);
 }
Пример #22
0
 private function add2log($content, $operation = 'login')
 {
     $curl = new curl($this->settings['App_logs']['host'], $this->settings['App_logs']['dir'] . 'admin/');
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('a', 'create');
     $curl->addRequestData('bundle_id', 'm2o');
     $curl->addRequestData('moudle_id', 'm2o');
     $curl->addRequestData('operation', $operation);
     $curl->addRequestData('title', $content);
     $ret = $curl->request('logs_update.php');
     return $ret;
 }
Пример #23
0
 public function upload()
 {
     if ($_FILES['videofile']) {
         $this->errorOutput('没有视频文件');
     }
     if (!($server = $this->select_server())) {
         $this->errorOutput('服务器已经满,不能上传视频,请稍等片刻');
     }
     $curl = new curl($server['host'], $server['dir']);
     $curl->setSubmitType('post');
     $curl->initPostData();
     $curl->addFile($_FILES);
     $info = $curl->request('create.php');
 }
Пример #24
0
 private function request_create_physics($id, $svodid, $vodid, $start, $duration)
 {
     $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
     $curl->setSubmitType('get');
     $curl->initPostData();
     $curl->addRequestData('id', $id);
     $curl->addRequestData('vodid', $vodid);
     foreach ($svodid as $k => $v) {
         $curl->addRequestData('start[' . $k . ']', $start[$k]);
         $curl->addRequestData('duration[' . $k . ']', $duration[$k]);
         $curl->addRequestData('svodid[' . $k . ']', $svodid[$k]);
     }
     $arr = $curl->request('save_section.php');
     return $arr;
 }
Пример #25
0
 public function get_first_frame($video_id)
 {
     $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
     $curl->setSubmitType('get');
     $curl->initPostData();
     $curl->addRequestData('id', $video_id);
     $curl->addRequestData('count', 2);
     $curl->addRequestData('stime', 0);
     $ret = $curl->request('snap.php');
     if ($ret && $ret[0] && $ret[0][1] && !strstr($ret[0][1], '_fail')) {
         return $ret[0][1];
     } else {
         return false;
     }
 }
Пример #26
0
 function delete()
 {
     $id = urldecode($this->input['id']);
     if (empty($id)) {
         $this->errorOutput("请选择需要删除的图集");
     }
     global $gGlobalConfig;
     $curl = new curl($gGlobalConfig['App_tuji']['host'], $gGlobalConfig['App_tuji']['dir'] . 'admin/');
     $curl->setSubmitType('get');
     $curl->initPostData();
     $curl->addRequestData('a', 'delete');
     $curl->addRequestData('id', $id);
     $ret = $curl->request('tuji_update.php');
     $this->addItem('sucess');
     $this->output();
 }
Пример #27
0
 public function detail()
 {
     if (!$this->input['id']) {
         $this->errorOutput(NOID);
     }
     $ret = $this->mode->show_detail($this->input['id']);
     if (!$ret['title']) {
         $this->errorOutput(NODATA);
     }
     /***从会员接口取会员相关信息和拓展信息****/
     if ($this->user['user_id'] && $this->settings['App_members']) {
         $curl = new curl($this->settings['App_members']['host'], $this->settings['App_members']['dir'] . 'admin/');
         $curl->setSubmitType('post');
         $curl->setReturnFormat('json');
         $curl->initPostData();
         $curl->addRequestData('id', $this->user['user_id']);
         $curl->addRequestData('a', 'detail');
         $info = $curl->request('member.php');
         $info = $info[0];
         if ($info && is_array($info)) {
             $data = array('mobile' => $info['mobile'], 'avatar' => $info['avatar'], 'mobile' => $info['mobile'], 'email' => $info['email']);
             if ($info['extension'] && is_array($info['extension'])) {
                 foreach ($info['extension'] as $k => $v) {
                     $data[$v['field']] = $v['value'];
                 }
             }
         }
     }
     /***从会员接口取会员相关信息和拓展信息****/
     //会员信息对应到相关字段上去
     if ($data && $ret['forms'] && is_array($ret['forms'])) {
         foreach ($ret['forms'] as $key => $val) {
             if (!$val['default_value'] && $val['member_field'] && !$val['member_field_addr']) {
                 $ret['forms'][$key]['default_value'] = $data[$val['member_field']];
             } else {
                 if (!$val['default_value'] && $val['member_field_addr'] && is_array($val['element'])) {
                     foreach ($val['element'] as $ks => $ele) {
                         $ret['forms'][$key]['element'][$ks]['default_value'] = $data[$val['member_field_addr'][$ele['id']]];
                     }
                 }
             }
         }
     }
     $this->addItem($ret);
     $this->output();
 }
Пример #28
0
 public function create_publish_table()
 {
     $planret = array();
     if ($this->settings['App_livmedia']) {
         include_once ROOT_PATH . 'lib/class/curl.class.php';
         $curl = new curl($this->settings['App_livmedia']['host'], $this->settings['App_livmedia']['dir']);
         $curl->setSubmitType('post');
         $curl->setReturnFormat('json');
         $curl->initPostData();
         $curl->addRequestData('a', 'settings');
         $ret = $curl->request('configuare.php');
         $planret[1] = $ret['define']['PUBLISH_SET_ID'];
     }
     $this->addItem_withkey('message', 'success');
     $this->addItem_withkey('ret', $planret);
     $this->output();
 }
Пример #29
0
 public function publish()
 {
     $id = $this->input['id'];
     $sign = $this->input['sign'];
     if ($id) {
         $sign = $id;
     }
     $host = $this->settings['App_publishsys']['host'];
     $dir = $this->settings['App_publishsys']['dir'] . 'admin/';
     $curl = new curl($host, $dir);
     $curl->setSubmitType('post');
     $curl->initPostData();
     $curl->addRequestData('a', 'export_datasource');
     $curl->addRequestData('sign', $sign);
     $mode_info = $curl->request('data_source.php');
     $this->redirect('发布成功');
 }
Пример #30
0
 private function addmonitorlog($mark, $title, $content = '', $type = 0)
 {
     if (!$this->settings['App_servermonitor']) {
         return;
     }
     include_once ROOT_PATH . 'lib/class/curl.class.php';
     $curl = new curl($this->settings['App_servermonitor']['host'], $this->settings['App_servermonitor']['dir'] . 'admin/');
     $curl->setReturnFormat('json');
     $curl->setSubmitType('post');
     $curl->initPostData();
     $curl->addRequestData('a', 'create');
     $curl->addRequestData('mark', $mark);
     $curl->addRequestData('title', $title);
     $curl->addRequestData('type', $type);
     $curl->addRequestData('content', $content);
     $curl->request('logs_update.php');
 }