This commit is contained in:
wangjinlei
2021-07-26 14:26:35 +08:00
parent 55d2b78440
commit 68de3a8fd6
3 changed files with 74 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ namespace app\master\controller;
use think\Controller;
use think\Db;
use think\Cache;
/**
* @title 管理员接口
@@ -153,6 +154,40 @@ class Admin extends Controller
return json(['code'=>0,'msg'=>'success']);
}
/**
* @title 数据同步
* @description 数据同步
* @author wangjinlei
* @url /master/Admin/synchronization
* @method POST
*
*/
public function synchronization(){
$ptime = Cache::get('synchronization');
if($ptime){
jsonError('Synchronization minimum interval is 10 minute , last update time:'.$ptime);
}
Cache::set('synchronization',date('Y-m-d H:i:s'),10*60);
$url = "http://api.tmrjournals.cn/public/index.php/master/Admin/cn_synchronization";
$res = myPost($url);
return $res;
}
/**
* 触发cn同步方法
*/
public function cn_synchronization(){
$ptime = Cache::get('synchronization');
if($ptime){
return jsonError('Synchronization minimum interval is 10 minute , last update time:'.$ptime);
}
Cache::set('synchronization',date('Y-m-d H:i:s'),10*60);
exec('curl http://journalapi.tmrjournals.com/public/index.php/api/Main/pushImgFile');
exec("sh /etc/mysql/tongbu.sh");
return jsonSuccess([]);
}
/**
* @title 添加管理员
* @description 添加管理员

View File

@@ -1152,7 +1152,7 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
$xml .= '<person_name sequence="additional" contributor_role="author">' . PHP_EOL;
}
$xml .= '<given_name>' . $v['first_name'] . '</given_name>' . PHP_EOL;
$xml .= '<surname>' . $v['last_name'] . '</surname>' . PHP_EOL;
$xml .= '<surname>' . ($v['last_name']==''?$v['first_name']:$v['last_name']) . '</surname>' . PHP_EOL;
$xml .= '</person_name>' . PHP_EOL;
}
$xml .= '</contributors>' . PHP_EOL;
@@ -1255,7 +1255,7 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
$xml .= '<person_name sequence="additional" contributor_role="author">' . PHP_EOL;
}
$xml .= '<given_name>' . $v['first_name'] . '</given_name>' . PHP_EOL;
$xml .= '<surname>' . $v['last_name'] . '</surname>' . PHP_EOL;
$xml .= '<surname>' . ($v['last_name']==''?$v['first_name']:$v['last_name']) . '</surname>' . PHP_EOL;
$xml .= '</person_name>' . PHP_EOL;
}
$xml .= '</contributors>' . PHP_EOL;