Files
anmo/server/app/coachapi/controller/OrderController.php
2025-08-19 14:16:51 +08:00

147 lines
3.6 KiB
PHP
Executable File

<?php
namespace app\coachapi\controller;
use app\coachapi\lists\IncomeLists;
use app\coachapi\logic\OrderLogic;
use app\coachapi\validate\OrderValidate;
use app\common\logic\PayNotifyLogic;
/**
* 订单控制器类
* Class OrderController
* @package app\coachapi\controller
*/
class OrderController extends BaseCoachController
{
public array $notNeedLogin = ['test'];
/**
* @notes 订单列表
* @return \think\response\Json
* @author cjhao
* @date 2024/9/16 21:14
*/
public function lists()
{
return $this->dataLists();
}
/**
* @notes 订单详情
* @return \think\response\Json
* @author cjhao
* @date 2024/9/20 02:18
*/
public function detail()
{
$id = $this->request->get('id');
$result = (new OrderLogic())->detail($id);
return $this->success('', $result);
}
/**
* @notes 接单操作
* @return \think\response\Json
* @author cjhao
* @date 2024/9/13 17:23
*/
public function take()
{
$params = (new OrderValidate())->post()->goCheck('',['coach_id'=>$this->coachId]);
$result = (new OrderLogic())->take($params);
if (true === $result) {
return $this->success('接单成功', ['msg'=>'接单成功'], 1, 0);
}
return $this->success(OrderLogic::getError(), ['msg'=>OrderLogic::getError()], 1, 0);
}
/**
* @notes 出发操作
* @return \think\response\Json
* @author cjhao
* @date 2024/9/13 17:24
*/
public function depart()
{
$params = (new OrderValidate())->post()->goCheck('',['coach_id'=>$this->coachId]);
$result = (new OrderLogic())->depart($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 达到操作
* @return \think\response\Json
* @author cjhao
* @date 2024/9/13 17:24
*/
public function arrive()
{
$params = (new OrderValidate())->post()->goCheck('',['coach_id'=>$this->coachId]);
$result = (new OrderLogic())->arrive($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 0);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 服务开始
* @return \think\response\Json
* @author cjhao
* @date 2024/9/14 14:47
*/
public function startServer()
{
$params = (new OrderValidate())->post()->goCheck('',['coach_id'=>$this->coachId]);
$result = (new OrderLogic())->startServer($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 服务完成
* @return \think\response\Json
* @author cjhao
* @date 2024/9/14 14:53
*/
public function finishServer()
{
$params = (new OrderValidate())->post()->goCheck('',['coach_id'=>$this->coachId]);
$result = (new OrderLogic())->finishServer($params);
if (true === $result) {
return $this->success('操作成功', [], 1, 0);
}
return $this->fail(OrderLogic::getError());
}
/**
* @notes 收入列表
* @return \think\response\Json
* @author cjhao
* @date 2024/11/5 18:11
*/
public function incomeLists()
{
return $this->dataLists((new IncomeLists()));
}
public function test()
{
// PayNotifyLogic::handle('deposit', 202411290022494214, []);
}
}