OutServices.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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\api\controller\providers;
  13. use app\api\controller\Controller;
  14. use app\store\model\Shops;
  15. /**
  16. * 对外提供的接口服务
  17. * Class OutServices
  18. * @package app\api\controller\balance
  19. */
  20. class OutServices extends Controller
  21. {
  22. /**
  23. * 余额账单明细列表
  24. * @return array
  25. * @throws \app\common\exception\BaseException
  26. * @throws \think\db\exception\DbException
  27. */
  28. public function add()
  29. {
  30. $model = new Shops();
  31. $data = $model->add($this->postData(),true);
  32. if ($data) {
  33. return $this->renderSuccess($data,'添加成功');
  34. }
  35. return $this->renderError($model->getError());
  36. }
  37. /**
  38. * 编辑门店
  39. * @return array|\think\response\Json
  40. */
  41. public function edit(){
  42. $model = new Shops();
  43. if ($model->edit($this->postData())) {
  44. return $this->renderSuccess('编辑成功');
  45. }
  46. return $this->renderError($model->getError() ?: '编辑失败');
  47. }
  48. }