| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?php
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- namespace app\controller\merchant\system\financial;
- use app\common\repositories\system\financial\FinancialRepository;
- use app\common\repositories\system\merchant\MerchantRepository;
- use app\validate\merchant\MerchantFinancialAccountValidate;
- use crmeb\basic\BaseController;
- use think\App;
- class Financial extends BaseController
- {
- /**
- * @var FinancialRepository
- */
- protected $repository;
- /**
- * Merchant constructor.
- * @param App $app
- * @param FinancialRepository $repository
- */
- public function __construct(App $app, FinancialRepository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- /**
- * TODO 转账信息Form
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- * @day 3/18/21
- */
- public function accountForm()
- {
- return app('json')->success(formToData($this->repository->financialAccountForm($this->request->merId())));
- }
- /**
- * TODO 转账信息保存
- * @param MerchantFinancialAccountValidate $accountValidate
- * @return \think\response\Json
- * @author Qinii
- * @day 3/18/21
- */
- public function accountSave(MerchantFinancialAccountValidate $accountValidate)
- {
- $data = $this->request->params(['account','financial_type','name','bank','bank_code','wechat','wechat_code','alipay','alipay_code']); //idcard
- $accountValidate->check($data);
- $this->repository->saveAccount($this->request->merId(),$data);
- return app('json')->success('保存成功');
- }
- /**
- * TODO 申请转账form
- * @return \think\response\Json
- * @author Qinii
- * @day 3/19/21
- */
- public function createForm()
- {
- return app('json')->success(formToData($this->repository->applyForm($this->request->merId())));
- }
- /**
- * TODO 申请转账保存
- * @return \think\response\Json
- * @author Qinii
- * @day 3/19/21
- */
- public function createSave()
- {
- $data = $this->request->param(['extract_money','financial_type','mark']);
- $data['mer_admin_id'] = $this->request->adminId();
- $this->repository->saveApply($this->request->merId(),$data);
- return app('json')->success('保存成功');
- }
- /**
- * TODO 列表
- * @author Qinii
- * @day 3/19/21
- */
- public function lst()
- {
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['date','status','financial_type','financial_status','keyword']);
- $where['keywords_'] = $where['keyword'];
- unset($where['keyword']);
- $where['mer_id'] = $this->request->merId();
- $data = $this->repository->getAdminList($where,$page,$limit);
- return app('json')->success($data);
- }
- /**
- * TODO 取消申请
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- * @day 3/19/21
- */
- public function delete($id)
- {
- $this->repository->cancel($this->request->merId(),$id,['is_del' => 1]);
- return app('json')->success('取消申请');
- }
- /**
- * TODO
- * @param $id
- * @return \think\response\Json
- * @author Qinii
- * @day 3/19/21
- */
- public function detail($id)
- {
- $data = $this->repository->detail($id,$this->request->merId());
- if(!$data) return app('json')->fail('数据不存在');
- return app('json')->success($data);
- }
- public function markForm($id)
- {
- return app('json')->success(formToData($this->repository->markForm($id)));
- }
- public function mark($id)
- {
- $ret = $this->repository->getWhere([$this->repository->getPk() => $id,'mer_id' => $this->request->merId()]);
- if(!$ret) return app('json')->fail('数据不存在');
- $data = $this->request->params(['mark']);
- $this->repository->update($id,$data);
- return app('json')->success('备注成功');
- }
- }
|