Files
journal/application/api/job/mysftp.php

22 lines
699 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace app\api\job;
use think\queue\Job;
use sftp\Sftp;
class mysftp {
public function push(Job $job, $data){
$job->delete();
//链接sftp服务器凭证走 dbpush 配置,历史值兜底)
$cred = config('dbpush.credentials.portico');
$config['host'] = isset($cred['host']) ? $cred['host'] : 'ftp.portico.org';
$config['port'] = isset($cred['port']) ? $cred['port'] : 22;
$config['username'] = isset($cred['user']) ? $cred['user'] : "TMR";
$config['password'] = isset($cred['pass']) ? $cred['pass'] : "h6EHD8";
$sftp_obj = new Sftp($config);
$sftp_obj->upftp($data['local'],$data['remote']);
}
}