164 lines
4.0 KiB
PHP
164 lines
4.0 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\merchant\controller;
|
|
|
|
use app\channel\service\CardGroupService;
|
|
use app\channel\service\CardService;
|
|
use app\channel\service\ProductBaseService;
|
|
use app\merchant\model\MerchantMappingProduct as MerchantMappingProductModel;
|
|
use app\merchant\service\CardService as Log;
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
use think\admin\Controller;
|
|
use app\merchant\service\MerchantLogService;
|
|
use app\merchant\service\MerchantService;
|
|
use app\channel\service\ProductService;
|
|
use app\merchant\service\OrderService;
|
|
use app\merchant\service\PercentService;
|
|
|
|
use app\gateway\controller\api\Bee;
|
|
use think\admin\helper\QueryHelper;
|
|
use think\App;
|
|
|
|
/**
|
|
* 商户关联映射产品
|
|
* Class MerchantRelation
|
|
* @package app\merchant\controller
|
|
*/
|
|
class MerchantMappingProduct extends Controller
|
|
{
|
|
/**
|
|
* cell
|
|
*
|
|
* @var array
|
|
*/
|
|
|
|
|
|
/**
|
|
* 绑定数据表
|
|
* @var string
|
|
*/
|
|
public $table = 'merchant_mapping_product';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 产品映射列表
|
|
* @auth true
|
|
* @menu true
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function index()
|
|
{
|
|
MerchantMappingProductModel::mQuery()->layTable(function () {
|
|
$this->title = '商户映射产品管理';
|
|
$this->mid = input('mid');
|
|
}, static function (QueryHelper $query) {
|
|
$query->dateBetween('create_at')->equal('mid')->like('mapping_id,product_key,cash,proid,status')->order('sort asc, status desc, id desc');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 列表数据处理
|
|
* @param array $data
|
|
* @throws \Exception
|
|
*/
|
|
protected function _index_page_filter(array &$data)
|
|
{
|
|
$this->mid = input('mid');
|
|
// $region = new Ip2Region();
|
|
// foreach ($data as &$vo) try {
|
|
// $vo['geoisp'] = $region->simple($vo['geoip']);
|
|
// } catch (\Exception $exception) {
|
|
// $vo['geoip'] = $exception->getMessage();
|
|
// }
|
|
}
|
|
|
|
/**
|
|
* 修改权限状态
|
|
* @auth true
|
|
*/
|
|
public function state()
|
|
{
|
|
MerchantMappingProductModel::mSave($this->_vali([
|
|
'status.in:0,1' => '状态值范围异常!',
|
|
'status.require' => '状态值不能为空!',
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 添加产品映射
|
|
* @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');
|
|
}
|
|
|
|
|
|
/**
|
|
* 删除产品
|
|
* @auth true
|
|
* @throws \think\db\exception\DbException
|
|
*/
|
|
public function remove()
|
|
{
|
|
$this->_applyFormToken();
|
|
$this->_delete($this->table);
|
|
}
|
|
|
|
/**
|
|
* 表单数据处理
|
|
* @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');
|
|
|
|
// $this->service_info = ProductBaseService::instance()->getServiceAll();
|
|
// foreach ( $this->service_info as $k => $v) {
|
|
//
|
|
//
|
|
// }
|
|
// $this->key = $this->service_info['key'];
|
|
//// $this->key_id = $this->service_info['key'];
|
|
//
|
|
//// $this->service_id = input('service_id');
|
|
// if ($this->request->isPost()) {
|
|
// if (empty($data['name'])) $this->error('产品名称不能为空!');
|
|
// }
|
|
}
|
|
|
|
protected function _form_result($id, $data)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
}
|