Store.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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\store\controller;
  13. use app\store\model\Store as StoreModel;
  14. /**
  15. * 商家中心控制器
  16. * Class Store
  17. * @package app\store\controller
  18. */
  19. class Store extends Controller
  20. {
  21. /**
  22. * 获取当前登录的商城信息
  23. * @return array
  24. */
  25. public function info()
  26. {
  27. // 商城详情
  28. $model = StoreModel::detail($this->getStoreId());
  29. return $this->renderSuccess(['storeInfo' => $model]);
  30. }
  31. /**
  32. * 更新商城信息
  33. * @return array
  34. */
  35. public function update()
  36. {
  37. // 商城详情
  38. $model = StoreModel::detail($this->getStoreId());
  39. // 更新记录
  40. if (!$model->edit($this->postForm())) {
  41. return $this->renderError($model->getError() ?: '更新失败');
  42. }
  43. return $this->renderSuccess('更新成功');
  44. }
  45. }