diff --git a/app/common/repositories/community/CommunityRepository.php b/app/common/repositories/community/CommunityRepository.php index 7363d8f3..a8f7707a 100644 --- a/app/common/repositories/community/CommunityRepository.php +++ b/app/common/repositories/community/CommunityRepository.php @@ -354,9 +354,13 @@ class CommunityRepository extends BaseRepository Db::transaction(function () use($id, $data) { $spuId = $data['spu_id']; - unset($data['spu_id']); + $productInfo = $data['product_info']; + unset($data['spu_id'], $data['product_info']); $community = $this->dao->update($id, $data); if ($spuId) $this->joinProduct($id, $spuId); + if ($productInfo && $data['is_type'] == self::COMMUNITY_TYPE_RESALE) { + $this->resale($id, $productInfo); + } event('community.update.before',compact('id','community')); }); } @@ -548,6 +552,12 @@ class CommunityRepository extends BaseRepository { $insert = []; foreach ($data as $value) { + if (isset($value['id'])) { + $resale = Resale::find($value['id']); + unset($value['purchase_record_id']); + $resale->update($value); + continue; + } $purchaseRecord = PurchaseRecord::find($value['purchase_record_id']); $exist = Resale::where('purchase_record_id', $purchaseRecord['id'])->find(); if ($exist) { diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index cbe6914c..06c81e23 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -804,10 +804,10 @@ class StoreOrderRepository extends BaseRepository //1: 未支付 2: 未发货 3: 待收货 4: 待评价 5: 交易完成 6: 已退款 7: 已删除 $all = $this->dao->search($where, $sysDel)->where($this->getOrderType(0))->count(); $statusAll = $all; - $unpaid = $this->dao->search($where, $sysDel)->where($this->getOrderType(1))->count(); + $unpaid = $this->dao->search($where, $sysDel)->where($this->getOrderType(1))->whereRaw("(StoreOrder.paid=0 and StoreOrder.status!=12) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->count(); $unshipped = $this->dao->search($where, $sysDel)->where($this->getOrderType(2))->count(); $untake = $this->dao->search($where, $sysDel)->where($this->getOrderType(3))->count(); - $unevaluate = $this->dao->search($where, $sysDel)->where($this->getOrderType(4))->count(); + $unevaluate = $this->dao->search($where, $sysDel)->where($this->getOrderType(4))->where('paid', 1)->where('pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY)->count(); $complete = $this->dao->search($where, $sysDel)->where($this->getOrderType(5))->count(); $refund = $this->dao->search($where, $sysDel)->where($this->getOrderType(6))->count(); $del = $this->dao->search($where, $sysDel)->where($this->getOrderType(7))->count(); diff --git a/app/controller/api/server/StoreOrder.php b/app/controller/api/server/StoreOrder.php index 921a7060..e2f52866 100644 --- a/app/controller/api/server/StoreOrder.php +++ b/app/controller/api/server/StoreOrder.php @@ -36,10 +36,10 @@ class StoreOrder extends BaseController public function orderStatistics($merId, StoreOrderRepository $repository) { - $product_type=$this->request->param('product_type',0); $order = $repository->OrderTitleNumber($merId, null,$product_type); $order['refund'] = app()->make(StoreRefundOrderRepository::class)->getWhereCount(['is_system_del' => 0, 'mer_id' => $merId]); + /** @var Common $common */ $common = app()->make(Common::class); $data = []; $data['today'] = $common->mainGroup('today', $merId);