From 003d76c504b3fcb4ed0bdb4c34469c1d812073b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E6=A1=83?= <1098598843@qq.com> Date: Sat, 25 Feb 2023 11:02:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E8=B4=AD=E6=96=B0=E5=A2=9E=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/store/order/StoreCartDg.php | 29 +++++++++++++++++++ route/api.php | 1 + 2 files changed, 30 insertions(+) diff --git a/app/controller/api/store/order/StoreCartDg.php b/app/controller/api/store/order/StoreCartDg.php index e5c4738e..514442a3 100644 --- a/app/controller/api/store/order/StoreCartDg.php +++ b/app/controller/api/store/order/StoreCartDg.php @@ -265,6 +265,9 @@ class StoreCartDg extends BaseController $goods = Db::table('eb_store_cart')->alias('a')->join('eb_store_product b','a.product_id = b.product_id')->field("sum(b.price*a.cart_num) as total_price")->where($www3)->find(); return $goods['total_price']; }) + ->withAttr('create_time',function ($value,$data){ + return date('Y-m-d H:i:s',$data['create_time']); + }) ->order('id desc') ->select(); if($list){ @@ -274,6 +277,32 @@ class StoreCartDg extends BaseController } } + /** + * @param $id + * @return mixed + * @throws \think\db\exception\DbException + * @author Qinii + * 删除保存的未付款代购 + */ + public function del() + { + $id = $this->request->param('id'); + if(empty($id)){ + return app('json')->fail('参数错误'); + } + $where['id'] = $id; + $where['uid'] = $this->request->uid(); + $res = Db::table('eb_store_cart_dg_nopay') + ->where($where) + ->delete(); + + if($res){ + return app('json')->success('删除成功'); + }else{ + return app('json')->fail('删除失败'); + } + } + /** * @return mixed diff --git a/route/api.php b/route/api.php index 6af442eb..8ecd2d5b 100644 --- a/route/api.php +++ b/route/api.php @@ -221,6 +221,7 @@ Route::group('api/', function () { Route::post('/edit', 'StoreCartDg/edit'); Route::post('/save', 'StoreCartDg/save'); Route::post('/get_list', 'StoreCartDg/get_list'); + Route::post('/del', 'StoreCartDg/del'); })->prefix('api.store.order.'); Route::group('store/product', function () {