UserCancelServices.php 1.7 KB

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