1
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\common\service\WordpressSiteService;
|
||||
use support\Request;
|
||||
|
||||
class WordpressSiteController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new WordpressSiteService();
|
||||
}
|
||||
|
||||
//推送,在wp站点上创建产品
|
||||
public function createProduct(Request $request){
|
||||
try {
|
||||
$domain = $request->get('domain');
|
||||
$id = $request->get('id');
|
||||
$res = $this->service->createProduct($domain,$id);
|
||||
return $this->success($res, '推送成功');
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage().'-'.$e->getLine().'-'.$e->getFile());
|
||||
}
|
||||
}
|
||||
|
||||
public function uploadImageToWp(Request $request){
|
||||
try {
|
||||
$domain = $request->get('domain');
|
||||
$res = $this->service->uploadImageToWp($domain);
|
||||
return $this->success($res, '推送成功');
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
// protected function indexFormat($data)
|
||||
// {
|
||||
// if (isset($data['created_at']))
|
||||
// $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
// if (isset($data['updated_at']))
|
||||
// $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
// return $data;
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user