Files
sbnews/server/app/api/controller/PointsOrderController.php
T
2026-06-11 12:15:29 +08:00

50 lines
1.4 KiB
PHP

<?php
namespace app\api\controller;
use app\api\logic\PointsOrderLogic;
use app\api\validate\PointsOrderValidate;
class PointsOrderController extends BaseApiController
{
public function products()
{
return $this->data(PointsOrderLogic::products());
}
public function preOrder()
{
$params = (new PointsOrderValidate())->post()->goCheck('preOrder');
$result = PointsOrderLogic::preOrder($params);
if (false === $result) {
return $this->fail(PointsOrderLogic::getError());
}
return $this->data($result);
}
public function createOrder()
{
$params = (new PointsOrderValidate())->post()->goCheck('createOrder', [
'user_id' => $this->userId,
'terminal' => $this->userInfo['terminal'],
]);
$result = PointsOrderLogic::createOrder($params);
if (false === $result) {
return $this->fail(PointsOrderLogic::getError());
}
return $this->data($result);
}
public function detail()
{
$params = (new PointsOrderValidate())->goCheck('detail', [
'user_id' => $this->userId,
]);
$result = PointsOrderLogic::detail($params);
if (false === $result) {
return $this->fail(PointsOrderLogic::getError());
}
return $this->data($result);
}
}