20201112
This commit is contained in:
@@ -19,11 +19,6 @@ class Admin extends Controller
|
||||
$this->admin_obj = Db::name('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 测试demo接口
|
||||
* @description 接口说明
|
||||
@@ -158,19 +153,22 @@ class Admin extends Controller
|
||||
* @title 数据同步
|
||||
* @description 数据同步
|
||||
* @author wangjinlei
|
||||
* @url /master/Admin/synchronization
|
||||
* @url /master/Admin/admin_synchronization
|
||||
* @method POST
|
||||
*
|
||||
*/
|
||||
public function synchronization(){
|
||||
public function admin_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;
|
||||
$res = $this->object_to_array(json_decode(myPost($url)));
|
||||
if($res['code']==1){
|
||||
return jsonError($res['msg']);
|
||||
}else{
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -251,5 +249,15 @@ class Admin extends Controller
|
||||
return json(['code'=>0,'msg'=>'success']);
|
||||
}
|
||||
|
||||
public function object_to_array($obj){
|
||||
$_arr=is_object($obj)?get_object_vars($obj):$obj;
|
||||
$arr = null;
|
||||
foreach($_arr as $key=>$val){
|
||||
$val=(is_array($val))||is_object($val)?$this->object_to_array($val):$val;
|
||||
$arr[$key]=$val;
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user