UserCancelServices.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\services\user;
  3. use app\dao\user\UserCancelDao;
  4. use app\services\BaseServices;
  5. use app\services\kefu\service\StoreServiceServices;
  6. use app\services\wechat\WechatUserServices;
  7. use crmeb\services\CacheService;
  8. class UserCancelServices extends BaseServices
  9. {
  10. protected $status = ['待审核', '已通过', '已拒绝'];
  11. /**
  12. * UserExtractServices constructor.
  13. * @param UserCancelDao $dao
  14. */
  15. public function __construct(UserCancelDao $dao)
  16. {
  17. $this->dao = $dao;
  18. }
  19. /**
  20. * 提交用户注销
  21. * @param $userInfo
  22. * @return mixed
  23. */
  24. public function SetUserCancel($uid)
  25. {
  26. /** @var UserServices $userServices */
  27. $userServices = app()->make(UserServices::class);
  28. /** @var WechatUserServices $wechatUserServices */
  29. $wechatUserServices = app()->make(WechatUserServices::class);
  30. /** @var StoreServiceServices $ServiceServices */
  31. $ServiceServices = app()->make(StoreServiceServices::class);
  32. $userServices->update($uid, ['is_del' => 1]);
  33. $userServices->update(['spread_uid' => $uid], ['spread_uid' => 0, 'spread_time' => 0]);
  34. $wechatUserServices->update(['uid' => $uid], ['is_del' => 1]);
  35. $ServiceServices->delete(['uid' => $uid]);
  36. return true;
  37. }
  38. /**
  39. * 获取注销列表
  40. * @param $where
  41. * @return array
  42. */
  43. public function getCancelList($where)
  44. {
  45. [$page, $limit] = $this->getPageValue();
  46. $list = $this->dao->getList($where, $page, $limit);
  47. foreach ($list as &$item) {
  48. $item['add_time'] = date('Y-m-d H:i:s', $item['add_time']);
  49. $item['up_time'] = $item['up_time'] != 0 ? date('Y-m-d H:i:s', $item['add_time']) : '';
  50. $item['status'] = $this->status[$item['status']];
  51. }
  52. $count = $this->dao->count($where);
  53. return compact('list', 'count');
  54. }
  55. /**
  56. * 备注
  57. * @param $id
  58. * @param $mark
  59. * @return mixed
  60. */
  61. public function serMark($id, $mark)
  62. {
  63. return $this->dao->update($id, ['remark' => $mark]);
  64. }
  65. }