140 lines
3.8 KiB
PHP
140 lines
3.8 KiB
PHP
<?php
|
||
|
||
// +----------------------------------------------------------------------
|
||
// | ThinkAdmin
|
||
// +----------------------------------------------------------------------
|
||
// | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||
// +----------------------------------------------------------------------
|
||
// | 官方网站: https://thinkadmin.top
|
||
// +----------------------------------------------------------------------
|
||
// | 开源协议 ( https://mit-license.org )
|
||
// +----------------------------------------------------------------------
|
||
// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
||
// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\merchant\controller;
|
||
|
||
use think\admin\Controller;
|
||
use app\merchant\service\MerchantLogService;
|
||
use app\merchant\service\MerchantService;
|
||
use app\merchant\service\OrderService;
|
||
/**
|
||
* 商户通道管理
|
||
* Class Merchant
|
||
* @package app\merchant\controller
|
||
*/
|
||
class Project extends Controller
|
||
{
|
||
|
||
/**
|
||
* 绑定数据表
|
||
* @var string
|
||
*/
|
||
public $table = 'MerchantProject';
|
||
|
||
/**
|
||
* 商户列表
|
||
* @auth true
|
||
* @menu true
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function index()
|
||
{
|
||
$this->title = '商户通道列表';
|
||
$this->mid = input('mid');
|
||
$query = $this->_query($this->table);
|
||
$query->equal('mid,status')->dateBetween('create_at');
|
||
$query->like('name');
|
||
// 列表排序并显示
|
||
$query->order('status desc,id desc')->page();
|
||
}
|
||
|
||
/**
|
||
* 添加商户
|
||
* @auth true
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function add()
|
||
{
|
||
$this->_applyFormToken();
|
||
$this->_form($this->table, 'form');
|
||
}
|
||
|
||
/**
|
||
* 编辑商户
|
||
* @auth true
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function edit()
|
||
{
|
||
$this->_applyFormToken();
|
||
$this->_form($this->table, 'form');
|
||
}
|
||
|
||
/**
|
||
* 列表数据处理
|
||
* @param array $data
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
protected function _index_page_filter(array &$data)
|
||
{
|
||
foreach ($data as &$vo) {
|
||
$merchant = $this->app->db->name('merchant_list')->where(['id' => $vo['mid']])->find();
|
||
$vo['merchant'] = $merchant;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 表单数据处理
|
||
* @param array $data
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
protected function _form_filter(&$data)
|
||
{
|
||
$this->mid = input('mid');
|
||
}
|
||
|
||
protected function _form_result($id, $data)
|
||
{
|
||
|
||
}
|
||
|
||
/**
|
||
* 修改商户状态
|
||
* @auth true
|
||
* @throws \think\db\exception\DbException
|
||
*/
|
||
public function state()
|
||
{
|
||
$this->_applyFormToken();
|
||
$this->_save($this->table, $this->_vali([
|
||
'status.in:0,1' => '状态值范围异常!',
|
||
'status.require' => '状态值不能为空!',
|
||
]));
|
||
}
|
||
|
||
/**
|
||
* 删除商户
|
||
* @auth true
|
||
* @throws \think\db\exception\DbException
|
||
*/
|
||
public function remove()
|
||
{
|
||
$this->_applyFormToken();
|
||
$this->_delete($this->table);
|
||
}
|
||
|
||
|
||
}
|