| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- namespace app\controller\admin\system\merchant;
- use app\common\repositories\system\merchant\MerchantRepository;
- use app\common\repositories\system\serve\ServeOrderRepository;
- use app\common\repositories\user\UserBillRepository;
- use crmeb\basic\BaseController;
- use think\App;
- /**
- * 商户保证金
- */
- class MerchantMargin extends BaseController
- {
- /**
- * MerchantMargin constructor.
- * @param App $app
- */
- public function __construct(App $app)
- {
- parent::__construct($app);
- }
- /**
- * 列表
- * @param ServeOrderRepository $orderRepository
- * @return \think\response\Json
- * @author Qinii
- * @day 1/26/22
- */
- public function lst(MerchantRepository $orderRepository)
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['date', 'keyword', 'is_trader', 'category_id', 'type_id']);
- $where['margin'] = 10;
- $data = $orderRepository->getPaidToMarginLst($where, $page, $limit);
- return app('json')->success($data);
- }
- /**
- * 获取商户保证金记录
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- * @day 2023/4/25
- */
- public function getMarginLst($id)
- {
- [$page, $limit] = $this->getPage();
- $where = [
- 'mer_id' => $id,
- 'category' => 'mer_margin'
- ];
- $data = app()->make(UserBillRepository::class)->getLst($where, $page, $limit);
- return app('json')->success($data);
- }
- /**
- * 扣除保证金
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- * @day 2023/4/25
- */
- public function setMarginForm($id)
- {
- $data = app()->make(MerchantRepository::class)->setMarginForm($id);
- return app('json')->success(formToData($data));
- }
- /**
- * 扣除保证金
- * @return \think\response\Json
- * @author Qinii
- * @day 2023/4/25
- */
- public function setMargin()
- {
- $data = $this->request->params(['mer_id', 'number', ['type', 'mer_margin'], 'mark']);
- $data['title'] = '保证金扣除';
- if ($data['number'] < 0)
- return app('json')->fail('扣除金额不能小于0');
- app()->make(MerchantRepository::class)->setMargin($data);
- return app('json')->success('扣除保证金成功');
- }
- /**
- * 线下补缴表单
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- */
- public function localMarginForm($id)
- {
- $data = app()->make(MerchantRepository::class)->localMarginForm($id);
- return app('json')->success(formToData($data));
- }
- /**
- * 线下补缴
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- */
- public function localMarginSet($id)
- {
- $data = $this->request->params(['number', 'mark', 'status']);
- app()->make(MerchantRepository::class)->localMarginSet($id, $data);
- return app('json')->success('操作成功');
- }
- }
|