修复:总平台商品购买后 未成功绑定提货点
This commit is contained in:
parent
d607d3066d
commit
7c3cb6158c
|
|
@ -60,23 +60,24 @@ class StoreOrderDao extends BaseDao
|
|||
* @day 2020/6/16
|
||||
*/
|
||||
public function search(array $where, $sysDel = 0){
|
||||
$query = StoreOrder::alias('StoreOrder')
|
||||
->leftJoin('Merchant','Merchant.mer_id = StoreOrder.mer_id')
|
||||
->where(function($query){
|
||||
$query->where('Merchant.is_del',0)->whereOr('StoreOrder.mer_id', 0);
|
||||
})
|
||||
->when(isset($where['is_trader']) && $where['is_trader'] !== '', function ($query) use ($where) {
|
||||
$query->where('is_trader', $where['is_trader']);
|
||||
});
|
||||
|
||||
// $query = StoreOrder::hasWhere('merchant', function ($query) use ($where) {
|
||||
// if (isset($where['is_trader']) && $where['is_trader'] !== '') {
|
||||
// $query->where('is_trader', $where['is_trader'])->whereOr('StoreOrder.mer_id', 0);
|
||||
// }
|
||||
// $query->where(function($hasQuery){
|
||||
// $hasQuery->where('is_del',0)->whereOr('StoreOrder.mer_id', 0);
|
||||
// $query = StoreOrder::alias('StoreOrder')
|
||||
// ->field('StoreOrder.*')
|
||||
// ->leftJoin('Merchant','Merchant.mer_id = StoreOrder.mer_id')
|
||||
// ->where(function($query){
|
||||
// $query->where('Merchant.is_del',0)->whereOr('StoreOrder.mer_id', 0);
|
||||
// })
|
||||
// ->when(isset($where['is_trader']) && $where['is_trader'] !== '', function ($query) use ($where) {
|
||||
// $query->where('is_trader', $where['is_trader']);
|
||||
// });
|
||||
// });
|
||||
|
||||
$query = StoreOrder::hasWhere('merchant', function ($query) use ($where) {
|
||||
if (isset($where['is_trader']) && $where['is_trader'] !== '') {
|
||||
$query->where('is_trader', $where['is_trader']);
|
||||
}
|
||||
$query->where(function($hasQuery){
|
||||
$hasQuery->where('Merchant.is_del',0)->whereOr('StoreOrder.mer_id', 0);
|
||||
});
|
||||
},'*','left');
|
||||
// 存在商户id是否 判断商户id类型,显示对应的订单 30,31,32,33,34
|
||||
if(isset($where['mer_id']) && $where['mer_id'] !== ''){
|
||||
$merchantType = app()->make(MerchantRepository::class)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use app\common\model\store\shipping\Express;
|
|||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\store\MerchantTakeRepository;
|
||||
use app\common\repositories\store\PointRepository;
|
||||
|
||||
class StoreOrder extends BaseModel
|
||||
{
|
||||
|
|
@ -88,9 +89,10 @@ class StoreOrder extends BaseModel
|
|||
return $this->hasOne(StoreService::class, 'service_id', 'verify_service_id');
|
||||
}
|
||||
|
||||
public function getTakeAttr()
|
||||
{
|
||||
return app()->make(MerchantTakeRepository::class)->get($this->mer_id);
|
||||
public function getTakeAttr(){
|
||||
$pointId = $this->point_id ?? 0;
|
||||
if((int)$pointId > 0) return app()->make(PointRepository::class)->getSearchModel(['id'=>$pointId])->findOrEmpty();
|
||||
else return app()->make(MerchantTakeRepository::class)->get($this->mer_id);
|
||||
}
|
||||
|
||||
public function searchDataAttr($query, $value)
|
||||
|
|
|
|||
|
|
@ -1028,7 +1028,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
|
|||
// 数据补齐 总平台商品订单可能存在部分数据不存在
|
||||
$merchantCart['commission_rate'] = $merchantCart['commission_rate'] ?? 0;
|
||||
|
||||
|
||||
$cost = 0;
|
||||
$total_extension_one = 0;
|
||||
$total_extension_two = 0;
|
||||
|
|
@ -1150,8 +1149,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
|
|||
'exchange_integral' => $merchantCart['order']['exchange_integral'] ?? 0,
|
||||
'wine_diff_money' => $merchantCart['order']['wine_diff_money'] ?? 0,
|
||||
'wine_diff_money_price' => $merchantCart['order']['wine_diff_money_price'] ?? 0,
|
||||
'point_id' => $merchantCart['take']['id'] ?? 0,
|
||||
];
|
||||
|
||||
|
||||
$allUseCoupon = array_merge($allUseCoupon,$merchantCart['order']['useCouponIds']);
|
||||
$orderList[] = $_order;
|
||||
$totalPostage = bcadd($totalPostage,$_order['total_postage'],2);
|
||||
|
|
|
|||
|
|
@ -687,18 +687,17 @@ class StoreOrderRepository extends BaseRepository
|
|||
$order =
|
||||
// $this->dao->search($where)
|
||||
$this->dao->getSearch([])
|
||||
->hasWhere('merchant',function($query) use ($where){
|
||||
$query->where('is_del',0);
|
||||
})
|
||||
// ->hasWhere('merchant',function($query) use ($where){
|
||||
// $query->where('is_del',0);
|
||||
// })
|
||||
->where('order_id',$id)
|
||||
->where('StoreOrder.is_del',0)
|
||||
->where('is_del',0)
|
||||
->with($with)
|
||||
->append(['refund_status','open_receipt'])
|
||||
->find();
|
||||
|
||||
if (!$order) {
|
||||
return null;
|
||||
}
|
||||
if (!$order) return null;
|
||||
|
||||
if ($order->activity_type == 2) {
|
||||
if ($order->presellOrder) {
|
||||
$order->presellOrder->append(['activeStatus']);
|
||||
|
|
@ -1841,7 +1840,10 @@ class StoreOrderRepository extends BaseRepository
|
|||
'receipt' => function ($query) {
|
||||
return $query->field('order_id,order_receipt_id');
|
||||
},
|
||||
])->page($page, $limit)->order('pay_time DESC')->append(['refund_status','open_receipt'])->select();
|
||||
])
|
||||
->page($page, $limit)->order('pay_time DESC')
|
||||
->append(['refund_status','open_receipt'])
|
||||
->select();
|
||||
|
||||
foreach ($list as $order) {
|
||||
if ($order->activity_type == 2) {
|
||||
|
|
|
|||
|
|
@ -192,14 +192,11 @@ class StoreOrder extends BaseController
|
|||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
public function detail($id){
|
||||
$order = $this->repository->getDetail((int)$id, $this->request->uid());
|
||||
if (!$order)
|
||||
return app('json')->fail('订单不存在');
|
||||
if ($order->order_type == 1) {
|
||||
$order->append(['take', 'refund_status']);
|
||||
}
|
||||
if (!$order) return app('json')->fail('订单不存在');
|
||||
if ($order->order_type == 1) $order->append(['take', 'refund_status']);
|
||||
|
||||
return app('json')->success($order->toArray());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue