作者 lyh

变更数据

... ... @@ -50,7 +50,7 @@ class Project5CateController extends BaseController
if(empty($action)){
$this->response('未知请求',Code::SYSTEM_ERROR);
}
$url = $projectInfo['website'].'wp-admin/admin-ajax.php?action=get_products_category';
$url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action;
$data = http_get($url);
if($data && $data['status'] == 200){
$resultData = $data['data'];
... ... @@ -66,4 +66,33 @@ class Project5CateController extends BaseController
$this->response('success',Code::SUCCESS,$url);
}
/**
* @remark :新增分类
* @name :addProject5Cate
* @author :lyh
* @method :post
* @time :2025/11/8 10:25
*/
public function addProject5Cate()
{
$this->request->validate([
'post_id'=>'required',
'type'=>'required',
'name'=>'required',
'parent'=>'required',
],[
'post_id.required' => 'post_id不能为空',
'type.required' => '类型不能为空',
'name.required' => '名称不能为空',
'parent.required' => '上级ID不能为空',
]);
//获取域名
$ticketProjectMdoel = new TicketProject();
$projectInfo = $ticketProjectMdoel->read(['post_id' => $this->param['post_id']]);
if($projectInfo === false){
$this->response('当前项目不存在或数据未同步',Code::SYSTEM_ERROR);
}
$url = $projectInfo['website'].'wp-admin/admin-ajax.php?action=get_products_category';
$data = http_post($url);
}
}
... ...
... ... @@ -37,7 +37,7 @@ class Project5Cate extends Base
* @method :post
* @time :2025/11/8 10:22
*/
public function getCateType($type = '')
public function getCateTypeAction($type = '')
{
$data = [
1 => 'get_products_category',
... ... @@ -48,4 +48,16 @@ class Project5Cate extends Base
}
return '';
}
public function saveCateTypeAction($type = '')
{
$data = [
1 => 'add_products_category',
3 => 'add_news_category',
];
if(!empty($type)){
return $data[$type];
}
return '';
}
}
... ...