作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !3194
... ... @@ -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,43 @@ 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);
}
$project5CateModel = new Project5Cate();
$projectInfo['website'] = 'https://devmark.globalso.com/';
$action = $project5CateModel->saveCateTypeAction($this->param['type']);
$url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action;
if(empty($action)){
$this->response('未知请求',Code::SYSTEM_ERROR);
}
$data = http_post($url,json_encode(['name'=>$this->param['name'],'parent'=>$this->param['parent']],true));
if($data && $data['status'] == 200){
$this->response('success', );
}
$this->response('请求失败',Code::SYSTEM_ERROR);
}
}
... ...
... ... @@ -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 '';
}
}
... ...