wanghousheng 8 months ago
parent 8acaecff9a
commit 702634b7fb
  1. 13
      app/common/model/RecoveryOrder.php
  2. 14
      app/common/model/server/Order.php
  3. 17
      app/store/controller/Recovery.php
  4. 17
      app/store/controller/Server.php

@ -8,11 +8,16 @@ use app\api\model\store\Shop;
use app\common\enum\RecoveryStatusEnum;
use app\common\enum\RecoveryTypeEnum;
use cores\BaseModel;
use think\model\concern\SoftDelete;
use think\model\relation\HasMany;
use think\model\relation\HasOne;
class RecoveryOrder extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $defaultSoftDelete = 0;
// 定义表名
protected $name = 'server_recovery_order';
@ -82,4 +87,12 @@ class RecoveryOrder extends BaseModel
{
return $this->hasOne(ServerRecovery::class, 'recovery_id', 'recovery_id');
}
public function remove($orderId): bool
{
if (static::destroy($orderId)) {
return true;
}
return false;
}
}

@ -7,12 +7,18 @@ use app\common\enum\payment\Method;
use app\common\enum\ServerEnum;
use app\common\model\UploadFile;
use cores\BaseModel;
use think\model\concern\SoftDelete;
use think\model\relation\BelongsTo;
use think\model\relation\HasOne;
use think\Paginator;
class Order extends BaseModel
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $defaultSoftDelete = 0;
// 定义表名
protected $name = 'server_order';
@ -118,4 +124,12 @@ class Order extends BaseModel
{
return static::get($where, $with);
}
public function remove($orderId): bool
{
if (static::destroy($orderId)) {
return true;
}
return false;
}
}

@ -246,6 +246,23 @@ class Recovery extends Controller
return $this->renderSuccess(['detail' => $data]);
}
/**
* @notes:删除订单
* @return Json
* @author: wanghousheng
*/
public function orderDel(): Json
{
$orderId = intval($this->request->post('order_id'));
if (!$orderId) {
return $this->renderError('非法请求');
}
if ((new RecoveryOrder())->remove($orderId)) {
return $this->renderSuccess('操作成功');
}
return $this->renderError('操作失败');
}
/**
* @notes:订单验收
* @return Json

@ -284,6 +284,23 @@ class Server extends Controller
return $this->renderError('取消失败');
}
/**
* @notes:删除订单
* @return Json
* @author: wanghousheng
*/
public function delOrder(): Json
{
$orderId = intval($this->request->post('order_id'));
if (!$orderId) {
return $this->renderError('非法请求');
}
if ((new \app\common\model\server\Order())->remove($orderId)) {
return $this->renderSuccess('操作成功');
}
return $this->renderError('操作失败');
}
/**
* @notes:派单
* @return Json

Loading…
Cancel
Save