123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <?php
- namespace App\Admin\Controllers;
- use App\Services\ShopInfoService;
- use Illuminate\Http\Request;
- use Slowlyo\OwlAdmin\Controllers\AdminController;
- /**
- * 店铺
- *
- * @property ShopInfoService $service
- */
- class ShopInfoController extends AdminController
- {
- protected string $serviceName = ShopInfoService::class;
- public function list()
- {
- $crud = $this->baseCRUD()
- ->filterTogglable(false)
- ->headerToolbar([
- $this->createButton('dialog'),
- ...$this->baseHeaderToolBar(),
- ])
- ->columns([
- amis()->TableColumn('id', 'ID')->sortable(),
- amis()->TableColumn('auth_record_id', '店铺认证记录编号'),
- amis()->TableColumn('salesperson_id', '业务员编号'),
- amis()->TableColumn('state', '状态'),
- amis()->TableColumn('created_at', admin_trans('admin.created_at'))->type('datetime')->sortable(),
- amis()->TableColumn('updated_at', admin_trans('admin.updated_at'))->type('datetime')->sortable(),
- $this->rowActions('dialog'),
- ]);
- return $this->baseList($crud);
- }
- public function form($isEdit = false)
- {
- return $this->baseForm()->body([
- amis()->TextControl('auth_record_id', '店铺认证记录编号'),
- amis()->TextControl('salesperson_id', '业务员编号'),
- amis()->TextControl('state', '状态'),
- ]);
- }
- public function detail()
- {
- return $this->baseDetail()->body([
- amis()->TextControl('id', 'ID')->static(),
- amis()->TextControl('auth_record_id', '店铺认证记录编号')->static(),
- amis()->TextControl('salesperson_id', '业务员编号')->static(),
- amis()->TextControl('state', '状态')->static(),
- amis()->TextControl('created_at', admin_trans('admin.created_at'))->static(),
- amis()->TextControl('updated_at', admin_trans('admin.updated_at'))->static(),
- ]);
- }
- /**
- * [店铺管理]审核店铺
- *
- * @description 审核店铺认证申请
- *
- * @header x-xsrf-token required CSRF令牌 Example: your_csrf_token
- *
- * @bodyParam shop_id integer required 店铺ID Example: 1
- * @bodyParam action string required 审核操作(approve:通过,reject:拒绝) Example: approve
- * @bodyParam reason string required 审核意见 Example: 资料齐全,符合要求
- *
- * @response {
- * "code": 200,
- * "message": "审核成功",
- * "data": null
- * }
- */
- public function review(Request $request)
- {
- $validated = $request->validate([
- 'shop_id' => 'required|integer|exists:shop_info,id',
- 'action' => 'required|string|in:approve,reject',
- 'reason' => 'required|string|max:255',
- ]);
- return $this->service->reviewShop($validated);
- }
- /**
- * [店铺管理]拉黑店铺
- *
- * @description 将店铺加入黑名单
- *
- * @header x-xsrf-token required CSRF令牌 Example: your_csrf_token
- *
- * @bodyParam shop_id integer required 店铺ID Example: 1
- * @bodyParam reason string required 拉黑原因 Example: 违规经营
- *
- * @response {
- * "code": 200,
- * "message": "拉黑成功",
- * "data": null
- * }
- */
- public function blockShop(Request $request)
- {
- $validated = $request->validate([
- 'shop_id' => 'required|integer|exists:shop_infos,id',
- 'reason' => 'required|string|max:255',
- ]);
- return $this->service->blockShop($validated);
- }
- /**
- * [店铺管理]审核记录
- *
- * @description 获取店铺审核记录列表
- *
- * @queryParam shop_id integer required 店铺ID Example: 1
- * @queryParam page int 页码 Example: 1
- * @queryParam perPage int 每页数量 Example: 20
- *
- * @response {
- * "code": 200,
- * "message": "success",
- * "data": {
- * "current_page": 1,
- * "data": [{
- * "id": 1,
- * "shop_id": 1,
- * "state": "ENABLE",
- * "audit_remark": "资料齐全,符合要求",
- * "audit_time": "2024-03-20 10:00:00",
- * "auditor": 1,
- * "created_at": "2024-03-20 10:00:00"
- * }],
- * "total": 10
- * }
- * }
- */
- public function reviewRecords(Request $request)
- {
- $validated = $request->validate([
- 'shop_id' => 'required|integer|exists:shop_infos,id',
- 'page' => 'nullable|integer|min:1',
- 'perPage' => 'nullable|integer|min:1',
- ]);
- return $this->service->getShopReviewRecords($validated);
- }
- /**
- * [店铺管理]冻结店铺余额
- *
- * @description 冻结店铺钱包余额
- *
- * @header x-xsrf-token required CSRF令牌 Example: your_csrf_token
- *
- * @bodyParam shop_id integer required 店铺ID Example: 1
- * @bodyParam amount numeric required 冻结金额 Example: 100.00
- * @bodyParam reason string required 冻结原因 Example: 涉嫌违规操作
- *
- * @response {
- * "code": 200,
- * "message": "冻结成功",
- * "data": null
- * }
- */
- public function freezeBalance(Request $request)
- {
- $validated = $request->validate([
- 'shop_id' => 'required|integer|exists:shop_infos,id',
- 'amount' => 'required|numeric|min:0.01',
- 'reason' => 'required|string|max:255',
- ]);
- return $this->service->freezeShopBalance($validated);
- }
- }
|