303 行
8.7 KiB
PHP
可执行文件
303 行
8.7 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Retail\Controller;
|
|
|
|
use Retail\Business\LabelInventory;
|
|
use Think\Controller;
|
|
|
|
//[1.7.90]
|
|
|
|
/**
|
|
* 标签库
|
|
* Class LabelInventoryController[
|
|
* addMerchantLabelData 商户-添加标签
|
|
* addStoreLabelData 门店-添加标签
|
|
* getLabelInventoryList 获取标签列表
|
|
* delStoreLabelData 门店-删除标签
|
|
* delMerchantLabelData 商户-删除标签
|
|
* getGoodsList 获取门店/商城商品列表
|
|
* addStoreLinkGoods 门店-绑定商品与标签
|
|
* addMerchantLinkGoods 商户-绑定商品与标签
|
|
* getLabelBelongGoods 获取标签对应商品
|
|
* delLinkGoods 删除商品与标签的绑定关系
|
|
* ]
|
|
* @package Retail\Controller
|
|
*/
|
|
class LabelInventoryController extends BaseController
|
|
{
|
|
/**
|
|
* 商户添加标签
|
|
*/
|
|
public function addMerchantLabelData()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
$this->ajaxReturn($LabelInventory->addLabelData([
|
|
'name' => I('post.name'),
|
|
'industry_id' => I('post.industry_id'),
|
|
'operate_id' => $this->login_user['id'],
|
|
'operate_type' => 1,
|
|
'merchant_id' => $this->merchant_id,
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 门店添加标签
|
|
*/
|
|
public function addStoreLabelData()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
$this->ajaxReturn($LabelInventory->addLabelData([
|
|
'name' => I('post.name'),
|
|
'industry_id' => I('post.industry_id'),
|
|
'operate_id' => $this->login_user['id'],
|
|
'operate_type' => 2,
|
|
'merchant_id' => $this->merchant_id,
|
|
'store_id' => $this->store_id,
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 获取标签列表
|
|
* @param name 标签名
|
|
* @param operate_type 场景 1商户 2门店
|
|
* @param industry_id 行业id (选填 搜索用)
|
|
* @param start_time 开始时间(选填 搜索用)
|
|
* @param end_time 结束时间(选填 搜索用)
|
|
* @param page 页码
|
|
* @param limit 页长
|
|
*/
|
|
public function getLabelInventoryList()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$param = I('post.');
|
|
$param['merchant_id'] = $this->merchant_id;
|
|
$param['operate_id'] = $this->login_user['id'];
|
|
$param['store_id'] = $this->store_id;
|
|
|
|
$this->ajaxReturn($LabelInventory->getLabelInventoryList($param));
|
|
}
|
|
|
|
/**
|
|
* 获取标签列表-无商品数
|
|
*/
|
|
public function getLabelList()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
$param['merchant_id'] = $this->merchant_id;
|
|
$param['industry_id'] = I('post.industry_id');
|
|
$param['operate_id'] = $this->login_user['id'];
|
|
$param['store_id'] = $this->store_id;
|
|
|
|
$result = $LabelInventory->getLabelList($param);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
/**
|
|
* 门店删除标签
|
|
*/
|
|
public function delStoreLabelData()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->delLabelData([
|
|
'id' => I('post.id'),
|
|
'merchant_id' => $this->merchant_id,
|
|
'store_id' => $this->store_id,
|
|
'operate_type' => 2,
|
|
'operate_id' => $this->login_user['id'],
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 商户删除标签
|
|
* @param id 标签id
|
|
*/
|
|
public function delMerchantLabelData()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->delLabelData([
|
|
'id' => I('post.id'),
|
|
'merchant_id' => $this->merchant_id,
|
|
'operate_type' => 1,
|
|
'operate_id' => $this->login_user['id'],
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 获取门店/商城商品列表
|
|
* @param label_id 标签id
|
|
* @param operate_type 场景 1商户 2门店
|
|
* @param page 页码
|
|
* @param limit 页长
|
|
* @param search_type 搜索类型 1商品名称 2货号 3条码
|
|
* @param search_text 搜索内容
|
|
*/
|
|
public function getGoodsList()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
$param = I('post.');
|
|
$param['merchant_id'] = $this->merchant_id;
|
|
$param['store_id'] = $this->store_id;
|
|
$param['operate_id'] = $this->login_user['id'];
|
|
|
|
$this->ajaxReturn($LabelInventory->getGoodsList($param));
|
|
}
|
|
|
|
/**
|
|
* 门店-绑定商品与标签
|
|
* @param label_id 标签id
|
|
* @param ids 商品id
|
|
*/
|
|
public function addStoreLinkGoods()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->addLinkGoods([
|
|
'label_id' => I('post.label_id'),
|
|
'ids' => I('post.ids'),
|
|
'operate_id' => $this->login_user['id'],
|
|
'operate_type' => 2,
|
|
'merchant_id' => $this->merchant_id,
|
|
'store_id' => $this->store_id,
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 商户-绑定商品与标签
|
|
* @param label_id 标签id
|
|
* @param ids 商品id
|
|
*/
|
|
public function addMerchantLinkGoods()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->addLinkGoods([
|
|
'label_id' => I('post.label_id'),
|
|
'ids' => I('post.ids'),
|
|
'operate_id' => $this->login_user['id'],
|
|
'operate_type' => 1,
|
|
'merchant_id' => $this->merchant_id,
|
|
'store_id' => $this->store_id,
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 获取标签对应商品
|
|
* @param operate_type 场景 1门店 2商户
|
|
* @param label_id 标签id
|
|
* @param search_type 搜索类型 1商品名称 2货号 3条码
|
|
* @param search_text 搜索内容
|
|
*/
|
|
public function getLabelBelongGoods()
|
|
{
|
|
$param = I('post.');
|
|
$param['merchant_id'] = $this->merchant_id;
|
|
$param['operate_id'] = $this->login_user['id'];
|
|
$param['store_id'] = $this->store_id;
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->getLabelBelongGoods($param));
|
|
}
|
|
|
|
/**
|
|
* 商户-删除商品与标签的绑定关系
|
|
*/
|
|
public function delMerchantLinkGoods()
|
|
{
|
|
$param['ids'] = I('post.ids');
|
|
$param['operate_type'] = 1;
|
|
$param['operate_id'] = $this->login_user['id'];
|
|
$param['merchant_id'] = $this->merchant_id;
|
|
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->delLinkGoods($param));
|
|
}
|
|
|
|
/**
|
|
* 门店-删除商品与标签的绑定关系
|
|
*/
|
|
public function delStoreLinkGoods()
|
|
{
|
|
$param['ids'] = I('post.ids');
|
|
$param['operate_type'] = 2;
|
|
$param['operate_id'] = $this->login_user['id'];
|
|
$param['merchant_id'] = $this->merchant_id;
|
|
$param['store_id'] = $this->store_id;
|
|
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->delLinkGoods($param));
|
|
}
|
|
|
|
/**
|
|
* 获取商品绑定标签列表
|
|
* @param goods_id 商品id
|
|
* @param user_type 类型 1商户 2门店
|
|
*/
|
|
public function getGoodsLabel()
|
|
{
|
|
$param['goods_id'] = I('post.goods_id');
|
|
$param['user_type'] = I('post.user_type');
|
|
$param['merchant_id'] = $this->merchant_id;
|
|
$param['store_id'] = $this->store_id;
|
|
$param['operate_id'] = $this->login_user['id'];
|
|
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->getGoodsLabel($param));
|
|
}
|
|
|
|
/**
|
|
* 保存商品标签
|
|
* @param goods_id 商品id
|
|
* @param label_ids 标签数组
|
|
* @param user_type 类型 1商户 2门店
|
|
*/
|
|
public function addGoodsLabelLink()
|
|
{
|
|
$param = I('post.');
|
|
$param['merchant_id'] = $this->merchant_id;
|
|
$param['store_id'] = $this->store_id;
|
|
$param['operate_id'] = $this->login_user['id'];
|
|
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->addGoodsLabelLink($param));
|
|
}
|
|
|
|
/**
|
|
* 验证批量修改商品分类
|
|
*/
|
|
public function verifyGoodsChangeClass()
|
|
{
|
|
$LabelInventory = new LabelInventory();
|
|
|
|
$this->ajaxReturn($LabelInventory->verifyGoodsChangeClass([
|
|
'merchant_id' => $this->merchant_id,
|
|
'store_id' => $this->store_id,
|
|
'class_id' => I('post.class_id'),
|
|
'goods_ids' => I('post.goods_ids'),
|
|
'operate_type' => I('post.operate_type'),
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 商户管理标签页面
|
|
*/
|
|
public function mer_index()
|
|
{
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
* 门店管理标签页面
|
|
*/
|
|
public function store_index()
|
|
{
|
|
$this->display();
|
|
}
|
|
}
|