文件
mashangyoujiu/Application/Retail/Controller/MerInventoryPrintController.class.php

141 行
4.7 KiB
PHP
可执行文件

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<?php
namespace Retail\Controller;
use Common\Business\InventorySet;
use Common\Model\RetailMerchantConfigModel;
//[1.8.45]
/**
* 商户常规设置
* Class MerInventoryPrintController
* @package Retail\Controller
*/
class MerInventoryPrintController extends BaseController
{
public function index()
{
$this->display();
}
//基础数据
public function indexBasics()
{
$InventorySetClass = new InventorySet();
$info = $InventorySetClass->getInfo([
'user_type' => 3,
'merchant_id' => $this->merchant_id
]); //基础设置
$MerchantConfigModel = new RetailMerchantConfigModel();
$conf = $MerchantConfigModel->getFind(['merchant_id' => $this->merchant_id], 'is_check_show_invenum,set_batch_number');
$this->ajaxReturn([
'status' => 1,
'message' => '查询成功',
'data' => [
'print' => $info,
'is_check_show_invenum' => $conf['is_check_show_invenum'] == 1 ? '1' : '2',
'set_batch_number' => $conf['set_batch_number'] == 1 ? '1' : '2'
]
]);
}
/**
* 字体个数设置
*
*/
public function fontSet()
{
$merchant_id = session("merchant_userinfo")['id'];
$where = array(
'type' => 1,
'merchant_id' => $merchant_id
);
$info = D("InventoryPrint")->getFind($where);
$content['font_num'] = I("post.font_num");
$content['sku_num'] = I("post.sku_num");
if ($info) {
$res = D("InventoryPrint")->updateData($where, $content);
} else {
$content['merchant_id'] = $merchant_id;
$content['type'] = 1;
$res = D("InventoryPrint")->addData($content);
}
$this->ajaxReturn($res);
}
//采购修改售价的开关
public function modifyPrice()
{
$data = I('post.');
$data['merchant_id'] = $this->merchant_id;
$data['user_type'] = 3;
$InventoryClass = new InventorySet();
$result = $InventoryClass->modifyPriceState($data);
$this->ajaxReturn($result);
}
/**
* 盘点是否显示库存--商户
* @param status 1开启 2关闭
*/
public function takeMStockInventory()
{
$status = I('post.status');
if (!$status) {
$this->ajaxReturn(['status' => 0, 'msg' => '缺少必要参数']);
}
$RetailMerchantConfigModel = new RetailMerchantConfigModel();
$saveRes = $RetailMerchantConfigModel->updateOrder(['merchant_id' => $this->merchant_id], ['is_check_show_invenum' => $status]);
if ($saveRes) {
//操作日志记录
$source = 0; //请求来源: 0pc系统 1小助手
$type = 3; //平台:1合伙人端 2代理商端 3商户端 4门店端
$request_data = json_encode($_POST); //请求参数 json数据
if ($status == 1) {
$desc = '常规设置-盘点是否显示库存-开启'; //操作行为描述
} elseif ($status == 2) {
$desc = '常规设置-盘点是否显示库存-关闭'; //操作行为描述
}
action_log($source, $type, $request_data, $desc);
$result = ['status' => 1, 'msg' => '修改成功'];
} else {
$result = ['status' => 0, 'msg' => '修改失败'];
}
$this->ajaxReturn($result);
}
/**
* 采购设置商品批号功能--商户
* @param status 1开启 2关闭
*/
public function setBatchNumber()
{
$status = I('post.status');
if (!$status) {
$this->ajaxReturn(['status' => 0, 'msg' => '缺少必要参数']);
}
$RetailMerchantConfigModel = new RetailMerchantConfigModel();
$saveRes = $RetailMerchantConfigModel->updateOrder(['merchant_id' => $this->merchant_id], ['set_batch_number' => $status]);
if ($saveRes) {
//操作日志记录
$source = 0; //请求来源: 0pc系统 1小助手
$type = 3; //平台:1合伙人端 2代理商端 3商户端 4门店端
$request_data = json_encode($_POST); //请求参数 json数据
if ($status == 1) {
$desc = '常规设置-采购设置商品批号功能-开启'; //操作行为描述
} elseif ($status == 2) {
$desc = '常规设置-采购设置商品批号功能-关闭'; //操作行为描述
}
action_log($source, $type, $request_data, $desc);
$result = ['status' => 1, 'msg' => '修改成功'];
} else {
$result = ['status' => 0, 'msg' => '修改失败'];
}
$this->ajaxReturn($result);
}
}