|
@@ -4,6 +4,8 @@ namespace app\admin\controller\shopro\user; |
|
@@ -4,6 +4,8 @@ namespace app\admin\controller\shopro\user; |
4
|
|
4
|
|
5
|
use app\common\controller\Backend;
|
5
|
use app\common\controller\Backend;
|
6
|
use app\admin\model\shopro\user\Oauth;
|
6
|
use app\admin\model\shopro\user\Oauth;
|
|
|
7
|
+use app\common\library\Auth;
|
|
|
8
|
+use think\Db;
|
7
|
|
9
|
|
8
|
|
10
|
|
9
|
/**
|
11
|
/**
|
|
@@ -315,4 +317,83 @@ class User extends Backend |
|
@@ -315,4 +317,83 @@ class User extends Backend |
315
|
$this->success('优惠券', null, $data);
|
317
|
$this->success('优惠券', null, $data);
|
316
|
}
|
318
|
}
|
317
|
}
|
319
|
}
|
|
|
320
|
+
|
|
|
321
|
+ /**
|
|
|
322
|
+ * 删除
|
|
|
323
|
+ */
|
|
|
324
|
+ public function del($ids = "")
|
|
|
325
|
+ {
|
|
|
326
|
+ if (!$this->request->isPost()) {
|
|
|
327
|
+ $this->error(__("Invalid parameters"));
|
|
|
328
|
+ }
|
|
|
329
|
+ $ids = $ids ? $ids : $this->request->post("ids");
|
|
|
330
|
+ $row = $this->model->get($ids);
|
|
|
331
|
+ $this->modelValidate = true;
|
|
|
332
|
+ if (!$row) {
|
|
|
333
|
+ $this->error(__('No Results were found'));
|
|
|
334
|
+ }
|
|
|
335
|
+ //开启事务
|
|
|
336
|
+ Db::startTrans();
|
|
|
337
|
+ try {
|
|
|
338
|
+ halt(1);
|
|
|
339
|
+ // 删除会员
|
|
|
340
|
+ Auth::instance()->delete($row['id']);
|
|
|
341
|
+ // 会员套餐订单
|
|
|
342
|
+ Db::name('package_order')->where('user_id',$row['id'])->delete();
|
|
|
343
|
+ // 拼团
|
|
|
344
|
+ Db::name('shopro_activity_groupon')->where('user_id',$row['id'])->delete();
|
|
|
345
|
+ // 拼团记录
|
|
|
346
|
+ Db::name('shopro_activity_groupon_log')->where('user_id',$row['id'])->delete();
|
|
|
347
|
+ // 购物车
|
|
|
348
|
+ Db::name('shopro_cart')->where('user_id',$row['id'])->delete();
|
|
|
349
|
+ // 反馈
|
|
|
350
|
+ Db::name('shopro_feedback')->where('user_id',$row['id'])->delete();
|
|
|
351
|
+ // 商品搜索历史
|
|
|
352
|
+ Db::name('shopro_goods_keywords')->where('user_id',$row['id'])->delete();
|
|
|
353
|
+ // 订单
|
|
|
354
|
+ $order_list = Db::name('shopro_order')->where('user_id',$row['id'])->field('id,order_sn')->select();
|
|
|
355
|
+ foreach ($order_list as $order){
|
|
|
356
|
+ // 订单操作记录
|
|
|
357
|
+ Db::name('shopro_order_action')->where('order_id',$order['id'])->delete();
|
|
|
358
|
+ // 售后单
|
|
|
359
|
+ Db::name('shopro_order_aftersale')->where('order_id',$order['id'])->delete();
|
|
|
360
|
+ // 售后单记录
|
|
|
361
|
+ Db::name('shopro_order_aftersale_log')->where('order_id',$order['id'])->delete();
|
|
|
362
|
+ // 快递包裹
|
|
|
363
|
+ Db::name('shopro_order_express')->where('order_id',$order['id'])->delete();
|
|
|
364
|
+ // 物流信息
|
|
|
365
|
+ Db::name('shopro_order_express_log')->where('order_id',$order['id'])->delete();
|
|
|
366
|
+ // 订单商品明细
|
|
|
367
|
+ Db::name('shopro_order_item')->where('order_id',$order['id'])->delete();
|
|
|
368
|
+ // 退款日志
|
|
|
369
|
+ Db::name('shopro_refund_log')->where('order_sn',$order['order_sn'])->delete();
|
|
|
370
|
+ // 删除订单
|
|
|
371
|
+ Db::name('shopro_order')->where('id',$order['id'])->delete();
|
|
|
372
|
+ }
|
|
|
373
|
+ // 用户地址
|
|
|
374
|
+ Db::name('shopro_user_address')->where('user_id',$row['id'])->delete();
|
|
|
375
|
+ // 用户优惠券
|
|
|
376
|
+ Db::name('shopro_user_coupons')->where('user_id',$row['id'])->delete();
|
|
|
377
|
+ // 用户收藏
|
|
|
378
|
+ Db::name('shopro_user_favorite')->where('user_id',$row['id'])->delete();
|
|
|
379
|
+ // 第三方授权
|
|
|
380
|
+ Db::name('shopro_user_oauth')->where('user_id',$row['id'])->delete();
|
|
|
381
|
+ // 用户浏览记录
|
|
|
382
|
+ Db::name('shopro_user_view')->where('user_id',$row['id'])->delete();
|
|
|
383
|
+ // 用户提现
|
|
|
384
|
+ Db::name('shopro_user_wallet_apply')->where('user_id',$row['id'])->delete();
|
|
|
385
|
+ // 钱包日志
|
|
|
386
|
+ Db::name('shopro_user_wallet_log')->where('user_id',$row['id'])->delete();
|
|
|
387
|
+ // 佣金提现
|
|
|
388
|
+ Db::name('user_commission_apply')->where('user_id',$row['id'])->delete();
|
|
|
389
|
+ // 佣金日志
|
|
|
390
|
+ Db::name('user_commission_log')->where('user_id',$row['id'])->delete();
|
|
|
391
|
+ Db::commit();
|
|
|
392
|
+ } catch (\Exception $e) {
|
|
|
393
|
+ Db::rollback();
|
|
|
394
|
+ $this->error($e->getMessage());
|
|
|
395
|
+ return false;
|
|
|
396
|
+ }
|
|
|
397
|
+ $this->success();
|
|
|
398
|
+ }
|
318
|
} |
399
|
} |