mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-13 17:25:39 +08:00
68 lines
2.3 KiB
PHP
68 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* Copyright 2026 ShopeX (https://www.shopex.cn)
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
|
|
class ome_order_remain_gift {
|
|
|
|
/*
|
|
* 获取订单编辑的商品类型配置列表
|
|
* @return array conf
|
|
*/
|
|
public function diff_money($obj){
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* 余单撤销处理
|
|
*/
|
|
public function remain_cancel($obj){
|
|
if ($obj){
|
|
$sql = "UPDATE `sdb_ome_order_items` SET `nums`=`sendnum` WHERE `obj_id`='".$obj['obj_id']."' AND `sendnum`<`nums` AND `sendnum` <> '0' ";
|
|
kernel::database()->exec($sql);
|
|
$sql = "UPDATE `sdb_ome_order_items` SET `delete`='true' WHERE `obj_id`='".$obj['obj_id']."' AND `sendnum`<`nums` AND `sendnum` = '0' ";
|
|
kernel::database()->exec($sql);
|
|
|
|
//更新order_objects订单对象表上的quantity购买数量
|
|
if($obj['quantity'] && $obj['order_items'])
|
|
{
|
|
$num = 0;
|
|
$delete = false;
|
|
foreach ($obj['order_items'] as $item)
|
|
{
|
|
if ($item['sendnum'] == 0)
|
|
{
|
|
$num = $obj['quantity'];
|
|
$delete = true;
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
$num = $obj['quantity'] / $item['quantity'] * $item['sendnum'];
|
|
}
|
|
}
|
|
|
|
if(!$delete)
|
|
{
|
|
$sql = "UPDATE `sdb_ome_order_objects` SET `quantity`=". intval($num) ." WHERE `obj_id`='". $obj['obj_id'] ."'";
|
|
kernel::database()->exec($sql);
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
} |