From fac8b1f0018b67452dcd06db2e5fae358648dcaa Mon Sep 17 00:00:00 2001 From: xuanchen120 <122383162@qq.com> Date: Tue, 1 Mar 2022 16:30:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Api/Controllers/PetroController.php | 129 ------------------------ app/Api/routes.php | 5 - 2 files changed, 134 deletions(-) delete mode 100644 app/Api/Controllers/PetroController.php diff --git a/app/Api/Controllers/PetroController.php b/app/Api/Controllers/PetroController.php deleted file mode 100644 index e533b41..0000000 --- a/app/Api/Controllers/PetroController.php +++ /dev/null @@ -1,129 +0,0 @@ -all(); - $res = $this->checkSign($request); - - //获取解密后数据 - $inputdata['jiemi'] = $res; - $this->log = $this->createLog($request->url(), 'POST', $inputdata, 'grant'); //添加日志 - - if (is_string($res)) { - return $this->error($res, $this->log); - } - - $validator = \Validator::make($res, [ - 'activityId' => 'required', - 'outletId' => 'required', - 'mobile' => 'required', - ], [ - 'activityId.required' => '缺少活动编码', - 'outletId.required' => '缺少网点id', - 'mobile.required' => '缺少手机号', - ]); - - if ($validator->fails()) { - return $this->error($validator->errors()->first(), $this->log); - } - - $grant = [ - 'requestCode' => $res['activityId'], - 'tradeId' => $res['tradeId'], - 'ticketSum' => 1, - 'amount' => $res['amount'], - 'random' => Str::random(6), - ]; - - $res = Petro::Grant()->setParams($grant)->start(); - return $this->success($res, $this->log); - } catch (\Exception $exception) { - return $this->error($exception->getMessage(), $this->log); - } - } - - public function query(Request $request) - { - try { - $inputdata = $request->all(); - $res = $this->checkSign($request); - - //获取解密后数据 - $inputdata['jiemi'] = $res; - $this->log = $this->createLog($request->url(), 'POST', $inputdata, 'query'); //添加日志 - - if (is_string($res)) { - return $this->error($res, $this->log); - } - - $validator = \Validator::make($res, [ - 'couponNo' => 'required', - ], [ - 'couponNo.required' => '缺少券码', - ]); - - if ($validator->fails()) { - return $this->error($validator->errors()->first(), $this->log); - } - - $res = Petro::Detail()->setParams([ - 'couponNo' => $res['couponNo'], - 'random' => Str::random(6), - ])->start(); - - return $this->success($res, $this->log); - } catch (\Exception $exception) { - return $this->error($exception->getMessage(), $this->log); - } - } - - public function destroy(Request $request) - { - try { - $inputdata = $request->all(); - $res = $this->checkSign($request); - - //获取解密后数据 - $inputdata['jiemi'] = $res; - $this->log = $this->createLog($request->url(), 'POST', $inputdata, 'query'); //添加日志 - - if (is_string($res)) { - return $this->error($res, $this->log); - } - - $validator = \Validator::make($res, [ - 'couponNo' => 'required', - ], [ - 'couponNo.required' => '缺少券码', - ]); - - if ($validator->fails()) { - return $this->error($validator->errors()->first(), $this->log); - } - - $res = Petro::Invalid()->setParams([ - 'cxcouponNo' => $res['couponNo'], - 'random' => Str::random(6), - ])->start(); - - return $this->success($res, $this->log); - } catch (\Exception $exception) { - return $this->error($exception->getMessage(), $this->log); - } - } - - -} diff --git a/app/Api/routes.php b/app/Api/routes.php index 6b27305..5c13f94 100644 --- a/app/Api/routes.php +++ b/app/Api/routes.php @@ -19,9 +19,4 @@ Route::group(['prefix' => 'V1'], function () { Route::post('ticket/grant180', 'WoController@grant180'); //发券 Route::post('ticket/cancel', 'WoController@cancel'); //退业务 Route::post('ticket/query', 'WoController@query'); //退业务 - - //中石油 - Route::post('petro/grant', 'PetroController@grant'); //发券 - Route::post('petro/query', 'PetroController@query'); //查询 - Route::post('petro/destroy', 'PetroController@destroy'); //作废 });