User.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\admin\model\store;
  13. use app\common\exception\BaseException;
  14. use app\common\model\store\User as StoreUserModel;
  15. /**
  16. * 商家用户模型
  17. * Class StoreUser
  18. * @package app\admin\model
  19. */
  20. class User extends StoreUserModel
  21. {
  22. /**
  23. * 商家用户登录
  24. * @param int $storeId
  25. * @throws BaseException
  26. * @throws \think\Exception
  27. */
  28. public function login(int $storeId)
  29. {
  30. // 获取该商户管理员用户信息
  31. $userInfo = $this->getSuperStoreUser($storeId);
  32. if (empty($userInfo)) {
  33. throwError('超级管理员用户信息不存在');
  34. }
  35. }
  36. /**
  37. * 获取该商户管理员用户信息
  38. * @param int $storeId
  39. * @return static|null
  40. */
  41. private function getSuperStoreUser(int $storeId)
  42. {
  43. return static::detail(['store_id' => $storeId, 'is_super' => 1], ['wxapp']);
  44. }
  45. /**
  46. * 删除小程序下的商家用户
  47. * @param $storeId
  48. * @return false|int
  49. */
  50. public static function setDelete(int $storeId)
  51. {
  52. static::update(['is_delete' => '1'], ['store_id' => $storeId]);
  53. return true;
  54. }
  55. }