|
...
|
...
|
@@ -26,12 +26,14 @@ class Project5CateController extends BaseController |
|
|
|
public function getProject5Cate(){
|
|
|
|
$this->request->validate([
|
|
|
|
'post_id'=>'required',
|
|
|
|
'type'=>'required',
|
|
|
|
],[
|
|
|
|
'post_id.required' => 'post_id不能为空',
|
|
|
|
'type.required' => '类型不能为空',
|
|
|
|
]);
|
|
|
|
//查询是否有值
|
|
|
|
$project5CateModel = new Project5Cate();
|
|
|
|
$cateInfo = $project5CateModel->read(['project_id' => $this->param['post_id'],'updated_at'=>['>', date('Y-m-d H:i:s', strtotime('-48 hours'))]]);
|
|
|
|
$cateInfo = $project5CateModel->read(['project_id' => $this->param['post_id'],'type'=>$this->param['type'],'updated_at'=>['>', date('Y-m-d H:i:s', strtotime('-48 hours'))]]);
|
|
|
|
if($cateInfo !== false){
|
|
|
|
$resultData = $cateInfo['text'];
|
|
|
|
$this->response('success', Code::SUCCESS, $resultData);
|
|
...
|
...
|
@@ -44,6 +46,10 @@ class Project5CateController extends BaseController |
|
|
|
}
|
|
|
|
//todo::目前写死
|
|
|
|
$projectInfo['website'] = 'https://devmark.globalso.com/';
|
|
|
|
$action = $project5CateModel->getCateType($this->param['type']);
|
|
|
|
if(empty($action)){
|
|
|
|
$this->response('未知请求',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
$url = $projectInfo['website'].'wp-admin/admin-ajax.php?action=get_products_category';
|
|
|
|
$data = http_get($url);
|
|
|
|
if($data && $data['status'] == 200){
|
|
...
|
...
|
@@ -52,10 +58,12 @@ class Project5CateController extends BaseController |
|
|
|
'project_id' => $projectInfo['post_id'],
|
|
|
|
'domain' => $projectInfo['website'],
|
|
|
|
'text'=>json_encode($data['data']),
|
|
|
|
'type' => $this->param['type'],
|
|
|
|
];
|
|
|
|
$project5CateModel->addReturnId($saveData);
|
|
|
|
$this->response('success', Code::SUCCESS,$resultData);
|
|
|
|
}
|
|
|
|
$this->response('success',Code::SUCCESS,$url);
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|