Store.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 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\store\controller;
  13. use think\response\Json;
  14. use app\store\model\Store as StoreModel;
  15. /**
  16. * 商家中心控制器
  17. * Class Store
  18. * @package app\store\controller
  19. */
  20. class Store extends Controller
  21. {
  22. /**
  23. * 获取当前登录的商城信息
  24. * @return Json
  25. */
  26. public function info(): Json
  27. {
  28. // 商城详情
  29. $model = StoreModel::detail($this->storeId);
  30. return $this->renderSuccess(['storeInfo' => $model]);
  31. }
  32. /**
  33. * 更新商城信息
  34. * @return Json
  35. */
  36. public function update(): Json
  37. {
  38. // 商城详情
  39. $model = StoreModel::detail($this->storeId);
  40. // 更新记录
  41. if (!$model->edit($this->postForm())) {
  42. return $this->renderError($model->getError() ?: '更新失败');
  43. }
  44. return $this->renderSuccess('更新成功');
  45. }
  46. }