Commit b6ac6bd4 authored by hangjun83's avatar hangjun83

1、增加任务删除功能

parent bd5ccaa4
......@@ -115,6 +115,21 @@ class BhOrdersController extends Controller
}
}
public function delSorderRefundTask(Request $request)
{
$message = [
'taskId.required' => "任务id必传",
];
$this->validateRequest($request, $message);
try{
$task = $this->bhOrdersService->delSorderRefundTask($request);
return Response::success($task, '操作成功');
}catch(\Exception $exception){
return Response::fail($exception->getMessage(),500);
}
}
/**
* 获取订单退货任务列表
* @param Request $request
......
......@@ -7,6 +7,7 @@ use App\Repositories\Criteria\RequestCriteria;
use App\Repositories\Models\BhSorderRefund;
use App\Repositories\Eloquent\BaseRepository;
use Illuminate\Support\Facades\DB;
use Prettus\Validator\Contracts\ValidatorInterface;
/**
......@@ -63,4 +64,23 @@ class BhSorderRefundRepositoryEloquent extends BaseRepository implements BhSorde
return $this->create($task);
}
}
public function delRefundTask($params)
{
if(empty($params)){
throw new \LogicException('参数为空!',500);
}
DB::beginTransaction();
try{
$this->delete($params['task_id']);
DB::table('task_log')
->where('task_id',$params['task_id'])
->delete();
DB::commit();
}catch(\Exception $e){
DB::rollback();
}
}
}
......@@ -156,6 +156,19 @@ class BhOrdersService
return app(BhSorderRefundRepository::class)->addRefundTask($params);
}
public function delSorderRefundTask($request)
{
$params = $this->formatKeysfromArray($request->all(),'toUnderScore');
if(isset($params['task_id']) && !empty($params['task_id'])){
if(!app(BhSorderRefundRepository::class)->find($params['task_id'])){
throw new \LogicException('该任务不存在!',500);
}
}
return app(BhSorderRefundRepository::class)->delRefundTask($params);
}
/**
* 获取订单退货任务
* @param $request
......
......@@ -26,6 +26,7 @@ $api->version('v1', function($api) {
$api->get('/adminapi/tools/bh/getBhSorderRefundTask', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@getBhSorderRefundTaskToPage']);
$api->post('/adminapi/tools/bh/execBhSorderRefundTask', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@execBhSorderRefundTask']);
$api->get('/adminapi/tools/bh/getSorderRefundTaskLogs', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@getSorderRefundTaskLogsToPage']);
$api->post('/adminapi/tools/bh/delSorderRefundTask', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@delSorderRefundTask']);
$api->post('/adminapi/tools/bh/getSorderDetailByTaskId', ['permission' => 'tools.bh.order.search', 'uses'=>'BhOrdersController@getSorderDetailByTaskId']);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment