|
|
@@ -15,6 +15,7 @@ use app\workerapi\lists\ServiceWorkSparePartLists;
|
|
|
use app\workerapi\lists\SparePartLists;
|
|
|
use app\workerapi\validate\ServiceWorkValidate;
|
|
|
use app\workerapi\validate\GoodsFeeStandardsValidate;
|
|
|
+use Exception;
|
|
|
|
|
|
/**
|
|
|
* 工单系统
|
|
|
@@ -95,17 +96,21 @@ class WorksController extends BaseApiController
|
|
|
*/
|
|
|
public function detail()
|
|
|
{
|
|
|
- $params = (new ServiceWorkValidate())->goCheck('detail',[
|
|
|
- 'user_id' => $this->userId,
|
|
|
- ]);
|
|
|
- if(empty($params['id']) && empty($params['work_sn'])){
|
|
|
- $this->fail('参数错误');
|
|
|
+ try {
|
|
|
+ $params = (new ServiceWorkValidate())->goCheck('detail',[
|
|
|
+ 'user_id' => $this->userId,
|
|
|
+ ]);
|
|
|
+ if(empty($params['id']) && empty($params['work_sn'])){
|
|
|
+ $this->fail('参数错误');
|
|
|
+ }
|
|
|
+ $result = ServiceWorkLogic::detail($params);
|
|
|
+ if (false === $result) {
|
|
|
+ return $this->fail(ServiceWorkLogic::getError());
|
|
|
+ }
|
|
|
+ return $this->data($result);
|
|
|
+ } catch (Exception $e) {
|
|
|
+ return $this->fail($e->getMessage());
|
|
|
}
|
|
|
- $result = ServiceWorkLogic::detail($params);
|
|
|
- if (false === $result) {
|
|
|
- return $this->fail(ServiceWorkLogic::getError());
|
|
|
- }
|
|
|
- return $this->data($result);
|
|
|
}
|
|
|
|
|
|
/**
|