first commit
This commit is contained in:
122
app/api/controller/RobotController.php
Normal file
122
app/api/controller/RobotController.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\RobotLogic;
|
||||
use app\api\validate\{RobotValidate};
|
||||
use app\api\lists\lh\{LhRecordLists};
|
||||
|
||||
/**
|
||||
* 抢单控制器
|
||||
* Class RobotController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class RobotController extends BaseApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = RobotLogic::getIndexData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 量化
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function buy()
|
||||
{
|
||||
$params = (new RobotValidate())->post()->goCheck('buy', [
|
||||
'user_id' => $this->userId,
|
||||
]);
|
||||
$result = RobotLogic::buy($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(RobotLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 抢单记录
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function recordLists()
|
||||
{
|
||||
return $this->dataLists(new LhRecordLists());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 抢单
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function grab()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = RobotLogic::grab($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(RobotLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取进行中订单
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function grabIngRecord()
|
||||
{
|
||||
$result = RobotLogic::grabIngRecord([
|
||||
'user_id' => $this->userId
|
||||
]);
|
||||
if (false === $result) {
|
||||
return $this->fail(RobotLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 订单支付
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function grabPay()
|
||||
{
|
||||
$params = (new RobotValidate())->post()->goCheck('grabPay', [
|
||||
'user_id' => $this->userId,
|
||||
]);
|
||||
$result = RobotLogic::grabPay($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(RobotLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user