Common.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\controller\service;
  3. use app\common\repositories\system\merchant\MerchantRepository;
  4. use crmeb\basic\BaseController;
  5. class Common extends BaseController
  6. {
  7. /**
  8. * 获取商家信息
  9. * @return \think\response\Json
  10. * @author wuhaotian
  11. * @email 442384644@qq.com
  12. * @date 2024/7/8
  13. */
  14. public function info()
  15. {
  16. $merId = $this->request->merId();
  17. if ($merId) {
  18. $merchant = app()->make(MerchantRepository::class)->get($merId);
  19. $data = [
  20. 'mer_id' => $merchant['mer_id'],
  21. 'avatar' => $merchant['mer_avatar'],
  22. 'name' => $merchant['mer_name'],
  23. ];
  24. } else {
  25. $config = systemConfig(['site_logo', 'site_name','login_logo']);
  26. $data = [
  27. 'mer_id' => 0,
  28. 'avatar' => $config['site_logo'],
  29. 'name' => $config['site_name'],
  30. ];
  31. }
  32. return app('json')->success($data);
  33. }
  34. /**
  35. * 获取管理员信息
  36. * @return \think\response\Json
  37. * @author wuhaotian
  38. * @email 442384644@qq.com
  39. * @date 2024/7/8
  40. */
  41. public function user()
  42. {
  43. $admin = $this->request->adminInfo();
  44. return app('json')->success($admin->hidden(['pwd', 'merchant'])->toArray());
  45. }
  46. /**
  47. * 获取站点配置
  48. * @return \think\response\Json
  49. * @author wuhaotian
  50. * @email 442384644@qq.com
  51. * @date 2024/7/8
  52. */
  53. public function config()
  54. {
  55. return app('json')->success(systemConfig(['site_name', 'site_logo', 'beian_sn']));
  56. }
  57. }