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 () {