更新查询
This commit is contained in:
parent
cff6927976
commit
f09ef6dc64
@ -116,15 +116,18 @@ class StoreCartDao extends BaseDao
|
|||||||
->append(['bc_extension_one', 'bc_extension_two']);
|
->append(['bc_extension_one', 'bc_extension_two']);
|
||||||
},
|
},
|
||||||
'merchant' => function (Relation $query) use ($uid) {
|
'merchant' => function (Relation $query) use ($uid) {
|
||||||
$query->field('mer_id,mer_name,mer_state,mer_avatar,delivery_way,commission_rate,category_id,credit_buy,settle_cycle,interest_rate')->with(['coupon' => function ($query) use ($uid) {
|
$query->field('mer_id,mer_name,mer_state,mer_avatar,delivery_way,commission_rate,category_id')
|
||||||
$query->where('uid', $uid);
|
->with([
|
||||||
},
|
'coupon' => function ($query) use ($uid) {
|
||||||
'config' => function ($query) {
|
$query->where('uid', $uid);
|
||||||
$query->whereIn('config_key', ['mer_integral_status', 'mer_integral_rate', 'mer_store_stock', 'mer_take_status', 'mer_take_name', 'mer_take_phone', 'mer_take_address', 'mer_take_location', 'mer_take_day', 'mer_take_time']);
|
},
|
||||||
},
|
'config' => function ($query) {
|
||||||
'merchantCategory'
|
$query->whereIn('config_key', ['mer_integral_status', 'mer_integral_rate', 'mer_store_stock', 'mer_take_status', 'mer_take_name', 'mer_take_phone', 'mer_take_address', 'mer_take_location', 'mer_take_day', 'mer_take_time']);
|
||||||
]);
|
},
|
||||||
}])->whereIn('cart_id', $ids)->order('product_type DESC,cart_id DESC')->select();
|
'merchantCategory'
|
||||||
|
]);
|
||||||
|
}])
|
||||||
|
->whereIn('cart_id', $ids)->order('product_type DESC,cart_id DESC')->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,8 @@ class StoreCartRepository extends BaseRepository
|
|||||||
if ($item['merchant']){
|
if ($item['merchant']){
|
||||||
$merchantData = $item['merchant']->append(['openReceipt'])->toArray();
|
$merchantData = $item['merchant']->append(['openReceipt'])->toArray();
|
||||||
} else {
|
} else {
|
||||||
$merchantData = ['mer_id' => 0];
|
throw new ValidateException('商户不存在');
|
||||||
|
// $merchantData = ['mer_id' => 0];
|
||||||
}
|
}
|
||||||
unset($item['merchant']);
|
unset($item['merchant']);
|
||||||
$coupon_make = app()->make(StoreCouponRepository::class);
|
$coupon_make = app()->make(StoreCouponRepository::class);
|
||||||
|
@ -777,9 +777,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
'mer_integral_status' => 0,
|
'mer_integral_status' => 0,
|
||||||
];
|
];
|
||||||
$allow_no_address = $allow_no_address && $merchantCart['order']['isTake'];
|
$allow_no_address = $allow_no_address && $merchantCart['order']['isTake'];
|
||||||
// foreach ($merchantCart['config'] as $config) {
|
foreach ($merchantCart['config'] as $config) {
|
||||||
// $merchantCart['take'][$config['config_key']] = $config['value'];
|
$merchantCart['take'][$config['config_key']] = $config['value'];
|
||||||
// }
|
}
|
||||||
$merIntegralConfig = $merchantCart['take'];
|
$merIntegralConfig = $merchantCart['take'];
|
||||||
unset($merchantCart['config']);
|
unset($merchantCart['config']);
|
||||||
$merIntegralConfig['mer_integral_rate'] = min(1, $merIntegralConfig['mer_integral_rate'] > 0 ? bcdiv($merIntegralConfig['mer_integral_rate'], 100, 4) : $merIntegralConfig['mer_integral_rate']);
|
$merIntegralConfig['mer_integral_rate'] = min(1, $merIntegralConfig['mer_integral_rate'] > 0 ? bcdiv($merIntegralConfig['mer_integral_rate'], 100, 4) : $merIntegralConfig['mer_integral_rate']);
|
||||||
|
@ -142,20 +142,26 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
throw new ValidateException('未开启余额支付');
|
throw new ValidateException('未开启余额支付');
|
||||||
if ($user['now_money'] < $groupOrder['pay_price'])
|
if ($user['now_money'] < $groupOrder['pay_price'])
|
||||||
throw new ValidateException('余额不足,请更换支付方式');
|
throw new ValidateException('余额不足,请更换支付方式');
|
||||||
Db::transaction(function () use ($user, $groupOrder) {
|
Db::startTrans();
|
||||||
$user->now_money = bcsub($user->now_money, $groupOrder['pay_price'], 2);
|
try{
|
||||||
$user->save();
|
$user->now_money = bcsub($user->now_money, $groupOrder['pay_price'], 2);
|
||||||
$userBillRepository = app()->make(UserBillRepository::class);
|
$user->save();
|
||||||
$userBillRepository->decBill($user['uid'], 'now_money', 'pay_product', [
|
$userBillRepository = app()->make(UserBillRepository::class);
|
||||||
'link_id' => $groupOrder['group_order_id'],
|
$userBillRepository->decBill($user['uid'], 'now_money', 'pay_product', [
|
||||||
'status' => 1,
|
'link_id' => $groupOrder['group_order_id'],
|
||||||
'title' => '购买商品',
|
'status' => 1,
|
||||||
'number' => $groupOrder['pay_price'],
|
'title' => '购买商品',
|
||||||
'mark' => '余额支付支付' . floatval($groupOrder['pay_price']) . '元购买商品',
|
'number' => $groupOrder['pay_price'],
|
||||||
'balance' => $user->now_money
|
'mark' => '余额支付支付' . floatval($groupOrder['pay_price']) . '元购买商品',
|
||||||
]);
|
'balance' => $user->now_money
|
||||||
$this->paySuccess($groupOrder);
|
]);
|
||||||
});
|
$this->paySuccess($groupOrder);
|
||||||
|
Db::commit();
|
||||||
|
}catch (Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new ValidateException('余额支付失败');
|
||||||
|
}
|
||||||
|
|
||||||
return app('json')->status('success', '余额支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
return app('json')->status('success', '余额支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,10 +556,13 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
// 更新调货价格
|
// 更新调货价格
|
||||||
} else if ($cart['product_type'] == '98') {
|
} else if ($cart['product_type'] == '98') {
|
||||||
if ($cart['source_id'] > 0) {
|
if ($cart['source_id'] > 0) {
|
||||||
$price = Db::name('resale')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->where('status', 0)->value('price');
|
$resale_find = Db::name('resale')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->find();
|
||||||
if ($price) {
|
if ($resale_find &&$resale_find['status']==0) {
|
||||||
return $price;
|
return $resale_find['price'];
|
||||||
} else {
|
}else if($resale_find['status']==1){
|
||||||
|
throw new ValidateException('商品已转售');
|
||||||
|
}
|
||||||
|
else {
|
||||||
throw new ValidateException('转售商品数据异常');
|
throw new ValidateException('转售商品数据异常');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -945,7 +954,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$param['StoreOrder.paid'] = 1;
|
$param['StoreOrder.paid'] = 1;
|
||||||
break; // 已支付
|
break; // 已支付
|
||||||
case 20:
|
case 20:
|
||||||
$param['StoreOrder.status'] = 2;
|
$param['StoreOrder.status'] =['in','2,3'];
|
||||||
break; // 已收货的商品才可以继续导入
|
break; // 已收货的商品才可以继续导入
|
||||||
default:
|
default:
|
||||||
unset($param['StoreOrder.is_del']);
|
unset($param['StoreOrder.is_del']);
|
||||||
@ -1757,7 +1766,8 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
if ($status == 1) {
|
if ($status == 1) {
|
||||||
$query = $this->dao->search($where)->where($this->getOrderType($status))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('StoreOrder.is_del', 0);
|
$query = $this->dao->search($where)->where($this->getOrderType($status))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('StoreOrder.is_del', 0);
|
||||||
} else {
|
} else {
|
||||||
$query = $this->dao->search($where)->where($this->getOrderType($status))->where('StoreOrder.is_del', 0);
|
$arr=$this->getOrderType($status);
|
||||||
|
$query = $this->dao->search($where)->where($arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
|
@ -230,6 +230,7 @@ class ProductReplyRepository extends BaseRepository
|
|||||||
|
|
||||||
public function reply(array $data)
|
public function reply(array $data)
|
||||||
{
|
{
|
||||||
|
halt(1);
|
||||||
$storeOrderProductRepository = app()->make(StoreOrderProductRepository::class);
|
$storeOrderProductRepository = app()->make(StoreOrderProductRepository::class);
|
||||||
$orderProduct = $storeOrderProductRepository->userOrderProduct($data['order_product_id'], $data['uid']);
|
$orderProduct = $storeOrderProductRepository->userOrderProduct($data['order_product_id'], $data['uid']);
|
||||||
if (!$orderProduct || !$orderProduct->orderInfo)
|
if (!$orderProduct || !$orderProduct->orderInfo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user