UserCancelServices.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. $userServices->update(['spread_uid' => $uid], ['spread_uid' => 0, 'spread_time' => 0]);
  31. $wechatUserServices->update(['uid' => $uid], ['is_del' => 1]);
  32. }
  33. /**
  34. * 获取注销列表
  35. * @param $where
  36. * @return array
  37. */
  38. public function getCancelList($where)
  39. {
  40. [$page, $limit] = $this->getPageValue();
  41. $list = $this->dao->getList($where, $page, $limit);
  42. foreach ($list as &$item) {
  43. $item['add_time'] = date('Y-m-d H:i:s', $item['add_time']);
  44. $item['up_time'] = $item['up_time'] != 0 ? date('Y-m-d H:i:s', $item['add_time']) : '';
  45. $item['status'] = $this->status[$item['status']];
  46. }
  47. $count = $this->dao->count($where);
  48. return compact('list', 'count');
  49. }
  50. /**
  51. * 备注
  52. * @param $id
  53. * @param $mark
  54. * @return mixed
  55. */
  56. public function serMark($id, $mark)
  57. {
  58. return $this->dao->update($id, ['remark' => $mark]);
  59. }
  60. }