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

783 行
28 KiB
PHP
可执行文件

<?php
/**
* 收银端-商品满赠
* @author nianyi
* @create_time 2020年05月22日
*/
namespace Retail\Controller;
use Common\Model\ImageGalleryModel;
use Common\Model\RetailGoodsModel;
use Common\Model\SkuGoodsViewModel;
use Common\Model\RetailGoodsGiftsModel;
use Common\Model\RetailGoodsGiftsActivityModel;
use Think\Controller;
//[1.8.53]
class GoodsGiftsController extends BaseController
{
public function index()
{
$this->display();
}
// 获取可选选择商品--赠品
public function adminCanChooseBySku()
{
$user = session("ls_userinfo");
$store_id = session("storeid");
$merchant_id = $user['merchantid'];
$content = I("post.");
$page = $content['page'] ? $content['page'] : 1;
$limit = $content['pageSize'] ? $content['pageSize'] : 10;
$goods_number = $content['keyword'];
if (!empty($goods_number)) {
$where['goods_name'] = array('like', "%" . $goods_number . "%");
}
$where['merchant_id'] = $merchant_id;
$where['store_id'] = $store_id;
$where['status'] = 0;
$where['serial_number_state'] = ['neq',1];
$fields = [
'id as sale_goods_id',
'goods_id',
'goods_name',
'sku_id',
'sku_name',
'goods_num',
'cost_price',
];
$RetailGoodsModel = new RetailGoodsModel();
$RetailSkuGoods = new SkuGoodsViewModel();
$RetailGoodsGiftsModel = new RetailGoodsGiftsModel();
$ImageGalleryModel = new ImageGalleryModel();
$goodsList = D('SSaleMGoods')->getSelect($where, $page, $limit, $fields, "goods_num asc");
if ($goodsList) {
$count = D('SSaleMGoods')->getCount($where);
foreach ($goodsList as $key => &$val) {
$val['index'] = $key + 1;
$val['goods_num'] = round($val['goods_num'], 3);
$val['cost_price'] = round($val['cost_price'], 2);
$val['sku_num'] = round($val['sku_num'], 3);
if ($val['attribute_state'] == 2) {
$val['specifications'] = $val['sku_name'];
$val['goods_number'] = $val['sku_goods_number'];
$val['goods_code'] = $val['sku_code'];
}
// 零售价格处理
$val['retail_price'] = $RetailGoodsGiftsModel->getRetailPriceBySku($val['goods_id'], $val['sku_id']);
// 商品图片处理
$goods_img_id = $RetailGoodsModel->getFind(['id' => $val['goods_id']], 'goods_img_id');
$val['goods_img_id'] = $goods_img_id['goods_img_id'];
if ($goods_img_id) {
$val['goods_img'] = $ImageGalleryModel->getImagePath($val['goods_img_id']);
} else {
$val['goods_img'] = '';
}
$val['choose_status'] = 0; // 前端需要
}
} else {
$goodsList = array();
$count = 0;
}
$res['status'] = 1;
$res['msg'] = '';
$res['total'] = $count;
$res['data'] = $goodsList;
$this->ajaxReturn($res);
}
// 获取促销赠送主商品
public function goodsGiftsActivityMain()
{
$param = array(
'store_id' => $this->store_id,
'identity' => I('session.identity'), //寄售类型
'page' => I('post.page') ? I('post.page') : 1, //页
'limit' => I('post.pageSize') ? I('post.pageSize') : 10, //每页数量
'need_img' => true, //是否需要图片
'need_goods_num' => true, //是否需要库存
'need_count' => true, //是否需要总数量
'attribute_state' => I('post.attribute_state'), //规格 1无规格 2规格
'keyword' => I('post.keyword'), //搜索关键词
'keyword_type' => I('post.keyword_type'), //关键词搜索类型 1货号 2条码 3名称
'order_type' => I('post.order_type'), //排序规则
'condition_name' => I('post.condition_name'), //排序规则关键词
'pricing_method' => I('post.pricing_method'),
'online_state' => I('post.online_state'),
'recovery_type' => I('post.recovery_type'), //2回收站
'advance_sale_status' => I('post.advance_sale_status'),
// 按照商品类别搜索
'person1' => I('post.person1'),
'person2' => I('post.person2'),
'person3' => I('post.person3'),
);
$SkuGoodsViewModel = new SkuGoodsViewModel();
$ret = $SkuGoodsViewModel->getGoodsListActivity($param);
$this->ajaxReturn($ret);
}
// 获取商品规格
//获取商品规格信息--活动用,精简信息
public function getGoodsSkuAttrActivity()
{
$user = session('ls_userinfo');
$id = I('post.id');
if (empty($user) || empty($id)) {
$res['status'] = 0;
$res['msg'] = "登录超时";
$this->ajaxReturn($res);
}
$RetailGoodsGiftsModel = new RetailGoodsGiftsModel();
$skuList = M('retail_sku_goods')->field('id, sku_id_list, retail_price, goods_img, goods_id')->where(array('goods_id' => $id, 'state' => 0))->select();
if (!empty($skuList)) {
foreach ($skuList as &$value) {
$id = explode(',', $value['sku_id_list']);
foreach ($id as &$v) {
$v = intval($v);
$value['name'][] = M('retail_sku_list')->where(array('id' => $v))->getField('name');
$value['retail_price'] = $RetailGoodsGiftsModel->getRetailPriceBySku($value['goods_id'], $v);
}
$value['id'] = $id;
$value['sku_checked'] = false;
unset($value['sku_id_list']);
}
}
$data['list'] = $skuList;
$this->ajaxReturn(array('data' => $data));
}
/* ******************************** 后台收银员赠送START ******************************** */
// 后台赠品列表
public function getGoodsGiftBack()
{
$page = I('post.page') ? I('post.page') : 1;
$pageSize = I('post.pageSize') ? I('post.pageSize') : 10;
$start_time = I('post.start_time'); // 开始时间
$end_time = I('post.end_time'); // 结束时间
$status = I('post.status'); // 状态:0=关闭,1=开启
$search = I('post.search'); // 搜索条件
if ($status) {
$where['rgg.status'] = $status;
}
if ($status === 0 || $status === '0') {
$where['rgg.status'] = $status;
}
if ($search) {
$where['rg.goods_name|rg.goods_number|rg.goods_code'] = ['like', "%{$search}%"];
}
if ($start_time && $end_time) {
$where['rgg.created_at'] = ['between', [$start_time, $end_time]];
}
$store_id = $this->store_id;
$where['rgg.store_id'] = $store_id;
$where['rgg.is_del'] = 1;
$where['rg.status'] = ['in','0,1'];
$field = [
'rg.goods_img_id',
'rssg.goods_name',
'rssg.specifications',
'rssg.goods_num',
'rssg.sku_num',
'rssg.sku_name',
'rgg.id as gifts_id',
'rgg.remain_inventory',
'rgg.status',
'rgg.created_at',
'rgg.sku_id',
'rgg.goods_id',
];
$RetailGoodsGiftsModel = new RetailGoodsGiftsModel();
$ImageGalleryModel = new ImageGalleryModel();
$result = $RetailGoodsGiftsModel->getGoodsGiftsList($where, $field, $page, $pageSize, 'id desc');
if ($result['list']) {
foreach ($result['list'] as &$value) {
if ($value['sku_id']) {
$value['retail_price'] = $RetailGoodsGiftsModel->getRetailPriceBySku($value['goods_id'], $value['sku_id']);
}
$value['goods_img'] = $ImageGalleryModel->getImagePath($value['goods_img_id']);
$value['checked'] = false;
unset($value['goods_img_id']);
}
$res['status'] = 1;
$res['msg'] = '数据获取成功!';
$res['data'] = $result;
} else {
$res['status'] = 0;
$res['msg'] = '暂无更多商品信息!';
}
$this->ajaxReturn($res);
}
// 后台选择赠品
// [{"sale_goods_id":4496,"goods_id":1,"sku_id":1,"remain_inventory":100}]
public function chooseGoodsJoinGifts()
{
$gifts_json = I('post.gifts_json'); // 选择的赠品
if (empty($gifts_json)) {
$result['status'] = 0;
$result['msg'] = '缺少商品信息';
$this->ajaxReturn($result);
}
try {
$giftsList = json_decode($gifts_json, true);
} catch (Exception $e) {
echo $e->getMessage();
exit;
}
if (!is_array($giftsList)) {
$result['status'] = 0;
$result['msg'] = '商品信息有误';
$this->ajaxReturn($result);
}
$store_id = $this->store_id;
if (!$store_id) {
$result['status'] = 0;
$result['msg'] = '重要信息缺失!';
$this->ajaxReturn($result);
}
// 赠品表记录
$RetailGoodsGiftsModel = new RetailGoodsGiftsModel();
$num = 0;
foreach ($giftsList as &$value) {
if ($value['remain_inventory'] < 0) {
$res['status'] = 0;
$res['msg'] = '请填写正确的赠品数量!';
$this->ajaxReturn($res);
}
if (empty($value['remain_inventory'])) {
$value['remain_inventory'] = 0;
}
// 检验赠品库存
$saleGoodsNum = $this->getGoodsSaleNum($value['sale_goods_id']);
if ($value['remain_inventory'] > $saleGoodsNum) {
$res['status'] = 0;
$res['msg'] = '商品库存不足!';
$this->ajaxReturn($res);
}
// 检验赠品是否已经存在
$is_gifts = $RetailGoodsGiftsModel->getOrderFind(['sale_goods_id' => $value['sale_goods_id'], 'is_del' => 1, 'store_id' => $store_id]);
if ($is_gifts) {
$res['status'] = 0;
$res['msg'] = '赠品已存在,请勿重复添加!';
$this->ajaxReturn($res);
}
$value['created_at'] = date('Y-m-d H:i:s', time());
$value['store_id'] = $store_id;
$gifts_id = $RetailGoodsGiftsModel->addOrder($value);
if ($gifts_id) {
//商品库存减少
A('Api/Inventory')->Inventory(2, $value['remain_inventory'], $value['goods_id'], $value['sku_id']);
$num++;
}
}
if ($num == count($giftsList)) {
$result['status'] = 1;
$result['msg'] = '赠品记录入库成功!';
} else {
$result['status'] = 0;
$result['msg'] = '赠品记录入库失败!';
}
$this->ajaxReturn($result);
}
// 更改赠品属性 状态:0=关闭,1=开启
public function updateGiftsStatus()
{
$id = I('post.gifts_id');
if (!$id) {
$res['status'] = 0;
$res['msg'] = '必要参数缺失!';
$this->ajaxReturn($res);
}
$where['id'] = $id;
$field = [
'status',
'remain_inventory'
];
$RetailGoodsGiftsModel = new RetailGoodsGiftsModel();
$evaluate_info = $RetailGoodsGiftsModel->getOrderFind($where, $field);
if (!$evaluate_info) {
$res['status'] = 0;
$res['msg'] = '赠品数据有误!';
$this->ajaxReturn($res);
}
if ($evaluate_info['status'] == 1) {
$result = $RetailGoodsGiftsModel->updateOrder(['id' => $id], ['status' => 0, 'updated_at' => date('Y-m-d H:i:s', time())]);
} else {
// 判断库存
if ($evaluate_info['remain_inventory'] < 1) {
$res['status'] = 0;
$res['msg'] = '赠品库存不足,无法开启!';
$this->ajaxReturn($res);
}
$result = $RetailGoodsGiftsModel->updateOrder(['id' => $id], ['status' => 1, 'updated_at' => date('Y-m-d H:i:s', time())]);
}
if ($result) {
$res['status'] = 1;
$res['msg'] = '操作成功';
} else {
$res['status'] = 0;
$res['msg'] = '操作失败,请稍后!';
}
$this->ajaxReturn($res);
}
// 更改赠品库存
public function updateGiftsInventory()
{
$id = I('post.gifts_id');
$type = I('post.type');
$remain_inventory = I('post.remain_inventory');
if (!$id) {
$res['status'] = 0;
$res['msg'] = '必要参数缺失!';
$this->ajaxReturn($res);
}
if (!$remain_inventory) {
$res['status'] = 0;
$res['msg'] = '必要参数缺失!';
$this->ajaxReturn($res);
}
$where['id'] = $id;
$RetailGoodsGiftsModel = new RetailGoodsGiftsModel();
$giftsInfo = $RetailGoodsGiftsModel->getOrderFind($where);
if (!$giftsInfo) {
$res['status'] = 0;
$res['msg'] = '赠品数据有误!';
$this->ajaxReturn($res);
}
// 库存验证
$saleGoodsNum = $this->getGoodsSaleNum($giftsInfo['sale_goods_id']);
if ($remain_inventory > $saleGoodsNum) {
$res['status'] = 0;
$res['msg'] = '商品库存不足!';
$this->ajaxReturn($res);
}
if ($type == 1) {
$fact = $giftsInfo['remain_inventory'] + $remain_inventory;
} else {
$fact = $giftsInfo['remain_inventory'] - $remain_inventory;
}
$update = [
'remain_inventory' => $fact,
'updated_at' => date('Y-m-d H:i:s', time())
];
$result = $RetailGoodsGiftsModel->updateOrder(['id' => $id], $update);
if ($result) {
if ($remain_inventory > 0) {
if ($type == 1) {
//增品库存增加商品库存减少
A('Api/Inventory')->Inventory(2, $remain_inventory, $giftsInfo['goods_id'], $giftsInfo['sku_id']);
} else {
// 增品库存减少商品库存增加
A('Api/Inventory')->Inventory(1, $remain_inventory, $giftsInfo['goods_id'], $giftsInfo['sku_id']);
}
}
$res['status'] = 1;
$res['msg'] = '数据更新成功';
} else {
$res['status'] = 0;
$res['msg'] = '操作失败,请稍后!';
}
$this->ajaxReturn($res);
}
// 后台删除赠品
public function deleteGiftsRecord()
{
$id = I('post.gifts_id');
if (!$id) {
$res['status'] = 0;
$res['msg'] = '必要参数缺失!';
$this->ajaxReturn($res);
}
$where['id'] = $id;
$RetailGoodsGiftsModel = new RetailGoodsGiftsModel();
$evaluate_info = $RetailGoodsGiftsModel->getOrderFind($where);
if (!$evaluate_info) {
$res['status'] = 0;
$res['msg'] = '赠品数据有误!';
$this->ajaxReturn($res);
}
$result = $RetailGoodsGiftsModel->updateOrder(['id' => $id], ['is_del' => 0, 'deleted_at' => date('Y-m-d H:i:s', time())]);
if ($result) {
if ($evaluate_info['remain_inventory'] > 0) {
A('Api/Inventory')->Inventory(1, $evaluate_info['remain_inventory'], $evaluate_info['goods_id'], $evaluate_info['sku_id']);
}
$res['status'] = 1;
$res['msg'] = '删除成功';
} else {
$res['status'] = 0;
$res['msg'] = '操作失败,请稍后!';
}
$this->ajaxReturn($res);
}
/* ******************************** 后台促销赠送START ******************************** */
/**
* 促销赠送活动列表
* */
public function getGoodsGiftActivityBack()
{
$page = I('post.page') ? I('post.page') : 1;
$pageSize = I('post.pageSize') ? I('post.pageSize') : 10;
$goods_name = I('post.goods_name'); //
$start_time = I('post.start_time'); // 开始时间
$end_time = I('post.end_time'); // 结束时间
$sales_start_time = I('post.sales_start_time'); // 促销开始时间
$sales_end_time = I('post.sales_end_time'); // 促销结束时间
$status = I('post.status'); // 状态:0=关闭,1=开启
if ($status) {
$where['rgga.status'] = $status;
}
if ($goods_name) {
$where['rgga.goods_name'] = ['like', "%{$goods_name}%"];
}
if ($start_time && $end_time) {
$start_time = strtotime($start_time);
$end_time = strtotime($end_time);
$where['rgga.created_at'] = ['between', [$start_time, $end_time]];
}
if ($sales_start_time && $sales_end_time) {
$sales_start_time = strtotime($sales_start_time);
$sales_end_time = strtotime($sales_end_time);
$map['_complex'] = array(
array(
'rgga.start_time' => array('elt', $sales_start_time),
'rgga.end_time' => array('egt', $sales_end_time),
),
array(
'_complex' => array(
array(
'_string' => "rgga.start_time >={$sales_start_time} AND rgga.start_time <={$sales_end_time}",
),
array(
'_string' => "rgga.end_time >={$sales_start_time} AND rgga.end_time <={$sales_end_time}",
),
'_logic' => 'or'
),
),
array(
'rgga.start_time' => array('egt', $sales_start_time),
'rgga.end_time' => array('elt', $sales_end_time),
),
'_logic' => 'or'
);
}
$store_id = $this->store_id;
$where['rgga.store_id'] = $store_id;
$where['rgga.is_del'] = 1;
$field = [
'rgga.id as activity_id',
'rgga.goods_json',
'rgga.sku_info',
'rgga.created_at',
'rgga.start_time',
'rgga.end_time',
'rgga.status',
];
$RetailGoodsGiftsActivityModel = new RetailGoodsGiftsActivityModel();
$result = $RetailGoodsGiftsActivityModel->getGoodsGiftsActivityList($where, $field, $page, $pageSize, 'id desc');
if ($result['list']) {
foreach ($result['list'] as &$value) {
$goodsList = json_decode($value['goods_json'], true);
$value['goods_name'] = $goodsList[0]['goods_name'];
$skuList = json_decode($value['sku_info'], true);
if ($skuList[0]['id']) {
$sku = [];
foreach ($skuList as &$v) {
$sku[] = $v['name'][0];
}
$value['sku_name'] = implode(',', $sku);
}
unset($value['goods_json']);
unset($value['sku_info']);
unset($goodsList);
}
$res['status'] = 1;
$res['msg'] = '数据获取成功!';
$res['data'] = $result;
} else {
$res['status'] = 0;
$res['msg'] = '暂无更多商品信息!';
}
$this->ajaxReturn($res);
}
/**
* 促销赠送活动发布
* goods_json [{"goods_id":1,"sku_id":1}]
* gifts_json [{"id":1,"gifts_num":1}]
**/
public function releaseGoodsGiftsActivity()
{
$data['goods_json'] = I('post.goods_json'); // 主商品信息
$data['goods_gifts_json'] = I('post.gifts_json'); // 赠品信息
$data['goods_num_min'] = I('post.goods_num_min'); // 赠品门槛
$data['time_limit'] = I('post.time_limit'); // 时间限制 1=有限制
$data['start_time'] = I('post.start_time') ? I('post.start_time') : null; // 开始时间
$data['end_time'] = I('post.end_time') ? I('post.end_time') : null; // 结束时间
$data['online_promotion'] = I('post.online_promotion'); // 线上促销
$data['online_buy_limit'] = I('post.online_buy_limit'); // 线上购买限制
$data['offline_promotion'] = I('post.offline_promotion'); // 线下促销
$data['offline_buy_limit'] = I('post.offline_buy_limit'); // 线上购买限制
$store_id = $this->store_id;
$data['store_id'] = $store_id;
$goodsList = $this->goodsJsonVerify($data['goods_json']);
$giftsList = $this->goodsJsonVerify($data['goods_gifts_json']);
// 商品数据处理
$data['goods_id'] = $goodsList[0]['id'];
$sku = [];
foreach ($goodsList[0]['specifications'] as &$value) {
$sku[] = $value['id'][0];
unset($value['goods_id']);
unset($value['sku_checked']);
}
$data['sku_ids'] = implode(',', $sku);
if ($goodsList[0]['specifications'][0]['id']) {
$data['sku_info'] = json_encode($goodsList[0]['specifications']);
}
if ($data['time_limit'] == 1) {
if (empty($data['start_time']) || empty($data['end_time'])) {
$result['status'] = 0;
$result['msg'] = '活动时间错误!';
$this->ajaxReturn($result);
}
}
// 赠品数据判断
foreach ($giftsList as &$value) {
}
// 主商品是否已经参加活动
$where['goods_id'] = $data['goods_id'];
$where['is_del'] = 1;
$where['store_id'] = $store_id;
$RetailGoodsGiftsActivityModel = new RetailGoodsGiftsActivityModel();
$activity_info = $RetailGoodsGiftsActivityModel->getOrderFind($where);
if ($activity_info) {
$res['status'] = 0;
$res['msg'] = '该商品已有促销活动,请勿重新添加!';
$this->ajaxReturn($res);
}
$data['created_at'] = date('Y-m-d H:i:s', time());
$activity_id = $RetailGoodsGiftsActivityModel->addOrder($data);
if ($activity_id) {
$result['status'] = 1;
$result['msg'] = '满赠促销活动添加成功!';
} else {
$result['status'] = 0;
$result['msg'] = '满赠促销活动添加失败!';
}
$this->ajaxReturn($result);
}
// 促销赠送活动详情
public function goodsGiftsActivityDetails()
{
$id = I('post.activity_id');
if (!$id) {
$res['status'] = 0;
$res['msg'] = '必要参数缺失!';
$this->ajaxReturn($res);
}
$where['id'] = $id;
$field = [
'id as activity_id',
'goods_json',
'sku_info',
'goods_gifts_json',
'created_at',
'start_time',
'end_time',
'status',
'goods_num_min',
'online_promotion',
'online_buy_limit',
'offline_promotion',
'offline_buy_limit',
];
$RetailGoodsGiftsActivityModel = new RetailGoodsGiftsActivityModel();
// $activity_info = $RetailGoodsGiftsActivityModel->goodsGiftsActivityDetails($where, $field);
$activity_info = $RetailGoodsGiftsActivityModel->getFind($where, $field);
if ($activity_info) {
if ($activity_info['goods_json']) {
$activity_info['goods_info'] = json_decode($activity_info['goods_json'], true);
unset($activity_info['goods_json']);
unset($activity_info['goods_info'][0]['specifications']);
}
$activity_info['sku_info'] = json_decode($activity_info['sku_info'], true);
$activity_info['goods_gifts_info'] = json_decode($activity_info['goods_gifts_json'], true);
unset($activity_info['goods_gifts_json']);
$res['status'] = 1;
$res['msg'] = '操作成功';
$res['data'] = $activity_info;
} else {
$res['status'] = 0;
$res['msg'] = '操作失败,请稍后!';
}
$this->ajaxReturn($res);
}
// 促销活动状态修改
public function updateGiftsActivityStatus()
{
$id = I('post.activity_id');
if (!$id) {
$res['status'] = 0;
$res['msg'] = '必要参数缺失!';
$this->ajaxReturn($res);
}
$where['id'] = $id;
$RetailGoodsGiftsActivityModel = new RetailGoodsGiftsActivityModel();
$evaluate_info = $RetailGoodsGiftsActivityModel->getOrderFind($where);
if (!$evaluate_info) {
$res['status'] = 0;
$res['msg'] = '赠品数据有误!';
$this->ajaxReturn($res);
}
if ($evaluate_info['status'] == 1) {
$result = $RetailGoodsGiftsActivityModel->updateOrder(['id' => $id], ['status' => 0, 'updated_at' => date('Y-m-d H:i:s', time())]);
} else {
$result = $RetailGoodsGiftsActivityModel->updateOrder(['id' => $id], ['status' => 1, 'updated_at' => date('Y-m-d H:i:s', time())]);
}
if ($result) {
$res['status'] = 1;
$res['msg'] = '操作成功';
} else {
$res['status'] = 0;
$res['msg'] = '操作失败,请稍后!';
}
$this->ajaxReturn($res);
}
// 删除促销活动
public function deleteGiftsActivityRecord()
{
$id = I('post.activity_id');
if (!$id) {
$res['status'] = 0;
$res['msg'] = '必要参数缺失!';
$this->ajaxReturn($res);
}
$where['id'] = $id;
$RetailGoodsGiftsActivityModel = new RetailGoodsGiftsActivityModel();
$evaluate_info = $RetailGoodsGiftsActivityModel->getOrderFind($where);
if (!$evaluate_info) {
$res['status'] = 0;
$res['msg'] = '赠品数据有误!';
$this->ajaxReturn($res);
}
$result = $RetailGoodsGiftsActivityModel->updateOrder(['id' => $id], ['is_del' => 0, 'deleted_at' => date('Y-m-d H:i:s', time())]);
if ($result) {
$res['status'] = 1;
$res['msg'] = '删除成功';
} else {
$res['status'] = 0;
$res['msg'] = '操作失败,请稍后!';
}
$this->ajaxReturn($res);
}
/* ******************************** 后台促销赠送START ******************************** */
// 商品数据验证
private function goodsJsonVerify($data_json)
{
if (empty($data_json)) {
$result['status'] = 0;
$result['msg'] = '缺少商品信息';
$this->ajaxReturn($result);
}
try {
$dataList = json_decode($data_json, true);
} catch (Exception $e) {
echo $e->getMessage();
exit;
}
if (!is_array($dataList)) {
$result['status'] = 0;
$result['msg'] = '商品信息有误';
$this->ajaxReturn($result);
}
return $dataList;
}
// 获取商品库存
private function getGoodsSaleNum($sale_goods_id)
{
$goods_num = D('SSaleMGoods')->getFind(['id' => $sale_goods_id], 'goods_num');
if ($goods_num) {
return $goods_num['goods_num'];
} else {
return 0;
}
}
}