问题说明:商品订单取消后未处理虚拟币问题
解决问题方法:
修改文件:application\wap\model\store\StoreOrder
修改方法:removeOrder()
public static function removeOrder($uni, $uid)
{
public static function removeOrder($uni, $uid)
{
$order = self::getUserOrderDetail($uid, $uni);
if (!$order) return self::setErrorInfo('订单不存在!');
$order = self::tidyOrder($order);
$res = true;
$res3 = 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']);
if($order['use_gold'] > 0) {
$gold_name = SystemConfigService::get('gold_name');
$gold_num = User::where('uid',$uid)->value('gold_num');
$res3 = User::bcInc($uid, 'gold_num', $order['use_gold'], 'uid');
UserBill::income($gold_name . '返还', $uid, 'gold_num', 'return', $order['use_gold'], $order['id'], $gold_num, '订单取消返还' . floatval($order['use_gold']) .$gold_name);
}
}
$res1 = self::edit(['is_del' => 1], $order['id'], 'id');
$res2 = StoreOrderStatus::status($order['id'], 'remove_order', '删除订单');
$res = $res && $res1 && $res2 && $res3;
self::checkTrans($res);
if ($res)
return true;
else
return self::setErrorInfo('订单删除失败!');
}