添加跨域

添加服务后台添加
This commit is contained in:
2025-12-23 10:38:20 +08:00
parent 3f6112d6f1
commit 3482382734
3 changed files with 8 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ class Moments extends AdminBase
public function lists() public function lists()
{ {
$list = MomentsServer::getMoments(); $list = MomentsServer::getMoments();
var_dump($list); $this->assign('list', $list);
return $this->fetch(); return $this->fetch();
} }
} }

View File

@@ -10,8 +10,12 @@ class MomentsServer
public static function getMoments() public static function getMoments()
{ {
$data = MomentsModel::with([ $data = MomentsModel::with([
'getStaff'=>function ($query) {}, 'getStaff'=>function ($query) {
'getOrder'=>function ($query) {} $query->field('id,name');
},
'getOrder'=>function ($query) {
$query->field('id,order_sn');
}
]) ])
->order('id desc') ->order('id desc')
->select(); ->select();

View File

@@ -28,7 +28,7 @@ use think\Response;
header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS"); header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type, Authorization"); header("Access-Control-Allow-Headers: Content-Type, Authorization, version");
class ApiBase extends Controller class ApiBase extends Controller
{ {