From bec648912ca6d31df8ab003f3f047217aa60eb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=84=E5=B0=98?= <122383162@qq.com> Date: Sun, 23 Aug 2020 22:15:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/Coupon/IndexController.php | 4 ++-- app/Admin/Controllers/Log/IndexController.php | 7 ++----- app/Api/Controllers/UserController.php | 6 +++--- app/Http/Controllers/TestController.php | 11 ++++++----- app/Models/Log.php | 10 ++++++++++ 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/Admin/Controllers/Coupon/IndexController.php b/app/Admin/Controllers/Coupon/IndexController.php index 1e69a82..829af7e 100644 --- a/app/Admin/Controllers/Coupon/IndexController.php +++ b/app/Admin/Controllers/Coupon/IndexController.php @@ -47,7 +47,7 @@ class IndexController extends AdminController $filter->equal('thirdPartyGoodsId', '优惠政策')->select(ActivityRule::pluck('title', 'code')); }); $filter->column(1 / 2, function ($filter) { - $filter->like('redemptionCode', '平安券编号'); + $filter->like('redemptionCode', '卡券编号'); $filter->where(function ($query) { $query->whereHas('outlet', function ($query) { $query->whereHas('info', function ($query) { @@ -75,7 +75,7 @@ class IndexController extends AdminController return $this->outlet ? $this->outlet->nickname : $this->outletId; }); - $grid->column('redemptionCode', '平安券编号'); + $grid->column('redemptionCode', '卡券编号'); $grid->column('couponName', '优惠政策'); $grid->column('price', '核销金额'); $grid->column('资金通道结算')->display(function () { diff --git a/app/Admin/Controllers/Log/IndexController.php b/app/Admin/Controllers/Log/IndexController.php index 7432473..4e7f2d1 100644 --- a/app/Admin/Controllers/Log/IndexController.php +++ b/app/Admin/Controllers/Log/IndexController.php @@ -10,7 +10,7 @@ use Encore\Admin\Widgets\Table; class IndexController extends AdminController { - protected $title = 'api 日志22'; + protected $title = 'api接口日志'; /** * Notes: @@ -26,10 +26,7 @@ class IndexController extends AdminController $grid->disableActions(); $grid->filter(function ($filter) { - $filter->equal('type', '接口类型')->select([ - 'pingan' => '平安', - 'self' => '自己', - ]); + $filter->equal('type', '接口类型')->select(Log::TYPES); $filter->where(function ($query) { $query->where("out_source->data->profitOfferItemVersion", $this->input); }, '券类型')->select([ diff --git a/app/Api/Controllers/UserController.php b/app/Api/Controllers/UserController.php index 26e29d8..f318e98 100644 --- a/app/Api/Controllers/UserController.php +++ b/app/Api/Controllers/UserController.php @@ -85,7 +85,7 @@ class UserController extends Controller $res = $this->checkSign($request); $inputdata['jiemi'] = $res; - $log = $this->createLog($request->url(), 'POST', $inputdata, 'grant'); //添加日志 + $log = $this->createLog($request->url(), 'POST', $inputdata, 'query'); //添加日志 if (is_string($res)) { return $this->error($res, $log); @@ -121,7 +121,7 @@ class UserController extends Controller $inputdata = $request->all(); $res = $this->checkSign($request); $inputdata['jiemi'] = $res; - $log = $this->createLog($request->url(), 'POST', $inputdata, 'grant'); //添加日志 + $log = $this->createLog($request->url(), 'POST', $inputdata, 'destroy'); //添加日志 if (is_string($res)) { return $this->error($res, $log); @@ -156,7 +156,7 @@ class UserController extends Controller $res = $this->checkSign($request); $inputdata['jiemi'] = $res; //插入日志表 - $log = $this->createLog($request->url(), 'POST', $inputdata, 'self'); //添加日志 + $log = $this->createLog($request->url(), 'POST', $inputdata, 'freezecoupon'); //添加日志 if (!is_array($res)) { return $this->error($res, $log); diff --git a/app/Http/Controllers/TestController.php b/app/Http/Controllers/TestController.php index cef5fea..f868e75 100644 --- a/app/Http/Controllers/TestController.php +++ b/app/Http/Controllers/TestController.php @@ -15,6 +15,7 @@ class TestController { use ApiResponse; + public $baseUrl = 'http://pac.ysd-bs.com/api/V1/'; public function index(Request $request) { @@ -53,7 +54,7 @@ class TestController $data = $this->jiami($data); - $url = 'http://pac.ysd-bs.com/api/V1/user/grant'; + $url = $this->baseUrl.'user/grant'; $res = $this->http($data, $url); // if (isset($res['data'])) { @@ -79,7 +80,7 @@ class TestController $data = $this->jiami($request->all()); - $url = 'http://pac.ysd-bs.com/api/V1/user/grant'; + $url = $this->baseUrl.'user/grant'; $res = $this->http($data, $url); return $res; @@ -100,7 +101,7 @@ class TestController $data = $this->jiami($request->all()); - $url = 'http://pac.ysd-bs.com/api/V1/user/query'; + $url = $this->baseUrl.'user/query'; $res = $this->http($data, $url); return $res; @@ -124,7 +125,7 @@ class TestController $redemptionCode = $request->redemptionCode; $data = $this->jiami($request->all()); - $url = 'http://pac.ysd-bs.com/api/V1/user/destroy'; + $url = $this->baseUrl.'user/destroy'; $res = $this->http($data, $url); dump($this->getElapsedTime()); @@ -155,7 +156,7 @@ class TestController 'orderid' => $request->orderid, ]); - $url = 'http://pac.ysd-bs.com/api/V1/user/freezecoupon'; + $url = $this->baseUrl.'user/freezecoupon'; $res = $this->http($data, $url); return $res; diff --git a/app/Models/Log.php b/app/Models/Log.php index 52a631e..488e82f 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -18,6 +18,16 @@ class Log extends Model 'out_source' => 'array', ]; + const TYPE_FREEZECOUPON = 'freezecoupon'; + const TYPE_DESTROY = 'destroy'; + const TYPE_QUERY = 'query'; + const TYPE_GRANT = 'grant'; + const TYPES = [ + self::TYPE_FREEZECOUPON => '核销', + self::TYPE_DESTROY => '作废', + self::TYPE_QUERY => '查询', + self::TYPE_GRANT => '发券', + ]; public function __construct(array $attributes = []) { parent::__construct($attributes);