use think\Db;
public static function removeOrder($uni, $uid) {
$order = self::getUserOrderDetail($uid, $uni);
if (!$order) return self::setErrorInfo('订单不存在!');
$order = self::tidyOrder($order);
$res = true;
self::beginTrans();
if ($order['type'] == 2 && ($order['refund_status'] == 2 || !$order['paid'])) {
$cart_id = Db::name('store_order_cart_info')->where('oid', $order['id'])->value('cart_id');
if (!$cart_id) return self::setErrorInfo('订单数据有误!');
$cart = StoreCart::where('id', $cart_id)->field('product_id,cart_num')->find();
if (!$cart) return self::setErrorInfo('订单购物车数据有误!');
$res = StoreProduct::where('id', $cart['product_id'])->setInc('stock', $cart['cart_num']);
}
$res1 = self::edit(['is_del' => 1], $order['id'], 'id');
$res2 = StoreOrderStatus::status($order['id'], 'remove_order', '删除订单');
$res = $res && $res1 && $res2;
self::checkTrans($res);
if ($res)
return true;
else
return self::setErrorInfo('订单删除失败!');
}
知识付费v2.1.4版本可直接下载下面文件包覆盖
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}