From 3155b5e108e0775eda58ab7fceceaf28f9bc7be9 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Sat, 23 Sep 2023 14:21:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Auth.php | 25 +++++++++++++++++++++++++ route/api.php | 4 +++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 3a5d00df..ad92412a 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -275,6 +275,31 @@ class Auth extends BaseController return app('json')->success('退出登录'); } + public function doMargin() + { + $user = $this->request->userInfo(); + $merchant = Db::name('merchant')->where('uid', $user['uid'])->where('status', 1)->find(); + if (!$merchant) { + return app('json')->fail('用户店铺异常'); + } + $repository = app()->make(StoreOrderRepository::class); + $param = [ + "status" => 0, + "is_del" => 0, + "mer_id" => $merchant['mer_id'], + "pay_type" => 1, + "attach" => "meal", + "order_info" => '{"is_margin":1,"margin":"' . $merchant['margin'] . '"}', + "pay_price" => $merchant['margin'], + "order_sn" => "bzj" . date('YmdHis') . uniqid(), + "body" => $merchant['mer_name'] . ' - ' . $merchant['margin'], + ]; + $payType = 'weixinApp'; + $service = new PayService($payType, $param); + $payInfo = $service->pay(User::where(['uid'=>$user['uid']])->find()); + return app('json')->success($payInfo); + } + /** * @return mixed * @throws DataNotFoundException diff --git a/route/api.php b/route/api.php index 28e019cf..0b9d87b8 100644 --- a/route/api.php +++ b/route/api.php @@ -67,7 +67,9 @@ Route::group('api/', function () { //绑定推荐人 Route::post('user/spread', 'api.Auth/spread'); - + //用户缴纳保证金 + Route::post('user/margin', 'api.Auth/doMargin'); + //优惠券 Route::group('coupon', function () { Route::post('receive/:id', 'api.store.product.StoreCoupon/receiveCoupon');