| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Http\Controllers\Admin;
- use App\Services\Common\BalanceLogsService;
- /**
- * 财务明细管理-控制器(基于 balance_logs 表)
- * @author laravel开发员
- * @since 2020/11/11
- * Class AccountController
- * @package App\Http\Controllers
- */
- class AccountController extends Backend
- {
- /**
- * 获取商家对应的 member_id(用于数据隔离)
- * @return int|null
- */
- private function getMemberId()
- {
- if ($this->storeId > 0) {
- // 如果是商家登录,获取商家对应的 member_id
- $storeModel = new \App\Models\StoreModel();
- $storeInfo = $storeModel->find($this->storeId);
- return $storeInfo ? $storeInfo->user_id : null;
- }
- return null;
- }
- /**
- * 列表(基于 balance_logs 表)
- */
- public function index()
- {
- $service = new BalanceLogsService();
- $params = request()->all();
-
- // 获取商家对应的 member_id 用于数据隔离
- $memberId = $this->getMemberId();
-
- $result = $service->getList($params, $memberId);
-
- return [
- "msg" => $result['msg'] ?? '操作成功',
- "code" => $result['code'] ?? 0,
- "data" => $result['data'] ?? [],
- "count" => $result['count'] ?? 0,
- ];
- }
- /**
- * 获取详情(基于 balance_logs 表)
- */
- public function read()
- {
- $id = request()->input('id');
- if (empty($id)) {
- return showJson('参数错误', false);
- }
-
- $service = new BalanceLogsService();
- $result = $service->getInfo($id, $this->getMemberId());
-
- return showJson($result['msg'], $result['code'] == 0, $result['data'] ?? []);
- }
- // 财务明细只能查看,不能修改、添加、删除
- // 以下方法已禁用
-
- // /**
- // * 添加
- // */
- // public function add()
- // {
- // $result = $this->service->add();
- // return showJson($result['msg'], $result['code'] == 0);
- // }
- // /**
- // * 编辑
- // */
- // public function edit()
- // {
- // $result = $this->service->edit();
- // return showJson($result['msg'], $result['code'] == 0);
- // }
- // /**
- // * 设置状态
- // */
- // public function status()
- // {
- // $result = $this->service->status();
- // return showJson($result['msg'], $result['code'] == 0);
- // }
- // /**
- // * 删除
- // */
- // public function delete()
- // {
- // $result = $this->service->delete();
- // return showJson($result['msg'], $result['code'] == 0);
- // }
- }
|