<?php
/**
 * @package merchant
 *
 * @author Qinii
 * @day 2020-07-18
 *
 * 
 */

namespace app\controller\merchant\store\order;

use app\common\repositories\merchant\order\OrderMerchantRepository;
use think\App;
use crmeb\basic\BaseController;

/**
 * 线下充值列表
 * Class OrderMerchant
 * @package app\controller\admin\system\merchant
 * @author php迷途小书童
 * @created 2021/2/3 13:38
 */
class OrderMerchant extends BaseController
{
    /**
     * @var OrderMerchantRepository
     */
    protected $repository;

    /**
     * @var int
     */
    protected $merId;

    /**
     * MerchantIntention constructor.
     * @param App $app
     * @param OrderMerchantRepository $repository
     */
    public function __construct(App $app, OrderMerchantRepository $repository)
    {
        parent::__construct($app);
        $this->repository = $repository;
            $this->merId = $this->request->merId();
    }

    /**
     * 线下充值列表
     * @return mixed
     * @author php迷途小书童
     * @created 2021/2/3 13:38
     */
    public function lst()
    {
        [$page, $limit] = $this->getPage();
        $where = $this->request->params(['keyword', 'date',"status"]);
        return app('json')->success($this->repository->getMerchantListAdmin($this->merId, $where, $page, $limit));
    }

    /**
     * 线下充值详情
     * @return mixed
     * @author php迷途小书童
     * @created 2021/2/3 13:37
     */
    public function detail($id){
        $detail = $this->repository->getOne($id);
        if (!$detail)
            return app('json')->fail('数据不存在');
        return app("json")->success("获取成功", $detail);
    }
}
