getPage($params); $limit = $this->getLimit($params); return TaxOrder::getPageList($page, $limit, function($model) use ($params) { // 手续费未成功 $batch_nums = TaxOrder::find()->where([ 'mall_id' => $this->mall_id, 'sub_type' => 1, 'status' => 5, ])->select('batch_num'); // 但是用户打款成功 $model->with(['withdraw'])->where(['batch_num' => $batch_nums, 'status' => 1]); }); } /** * 重新提交 * * @param integer $id * @return boolean */ public function resub(int $id) { $order = TaxOrder::find()->where([ 'mall_id' => $this->mall_id, 'id' => $id, 'sub_type' => TaxOrder::SUB_TYPE_TAX ])->one(); if (empty($order)) { return $this->error('订单不存在'); } $type = (new TaxConfigService(['mall_id' => $this->mall_id]))->getType(); $service = new OrderService(['mall_id' => $this->mall_id]); // 自用版手续费打款 if ($type == TaxConfig::PERSONAL) { if ($service->transToTaxByOrder($order) === false) { return $this->error($service->getError()); } } // 服务商版手续费打款 if ($type == TaxConfig::SERVICE) { if ($service->bookTransToTaxByOrder($order) === false) { return $this->error($service->getError()); } } return true; } /** * 列表 * * @param array $params * @return array */ public function getOrderList(array $params = []) { $page = $this->getPage($params); $limit = $this->getLimit($params); return TaxOrder::getPageList($page, $limit, function($model) use ($params) { $model->andWhere(['mall_id' => $this->mall_id]) // ->andWhere(['status' => [-1, 1]]) ->andWhere(['sub_type' => 1]); }); } /** * 失败提交 * * @param integer $id * @return boolean */ public function toFail(int $id) { $order = TaxOrder::find()->where([ 'mall_id' => $this->mall_id, 'id' => $id // , 'status' => [1, -1] , 'sub_type' => 1 ])->one(); if (empty($order)) { return $this->error('订单不存在'); } if ($this->getConfigService()->isLYApiType()) { // 发送订单成功通知 if ($this->getLyService()->asyncTransferResultNotifyNo($order) === false) { return $this->error('支付时异步请求接口请求失败'); } } return true; } public function toSuccess(int $id) { $order = TaxOrder::find()->where(['id' => $id, 'sub_type' => 1])->one(); if ($this->getConfigService()->isLYApiType()) { // 发送订单成功通知 if ($this->getLyService()->asyncTransferResultNotifyOk($order) === false) { return $this->error('支付时异步请求接口请求失败'); } } return true; } /** * @param array $params * @return array */ public function getList(array $params = []) { return TaxOrder::getPageList(1, 20, function($model) use ($params) { $model->andWhere(['mall_id' => $this->mall_id]) ->andWhere(['status' => 1]) ->andWhere(['sub_type' => 2]); if (isset($params['keyword'])) { $model->andWhere([ 'or', ['like', 'order_sn', '%' . $params['keyword'] . '%'], ['like', 'batch_num', '%' . $params['keyword'] . '%'] ]); } }); } /** * @param integer $id * @return boolean */ public function subSuccess(int $id) { $order = TaxOrder::find()->where([ 'mall_id' => $this->mall_id, 'id' => $id, 'sub_type' => 2, 'status' => 1 ])->one(); if (empty($order)) return $this->error('订单不存在'); /** * @var OrderService */ $service = new OrderService(['mall_id' => $this->mall_id]); $service->setUserOrder($order->userLog); $service->setSignUser($order->userLog->withdraw2); $service->setFeeOrder($order); if ($service->orderSuccess($order) === false) return $this->error($service->getError()); $order->status = StatusEnum::STATUS_OUT_OK; $order->save(); return true; } /** * @param integer $id * @return boolean */ public function subFial(int $id) { $order = TaxOrder::find()->where([ 'mall_id' => $this->mall_id, 'id' => $id, 'sub_type' => 2, 'status' => 1 ])->one(); if (empty($order)) return $this->error('订单不存在'); return $this->error('未完善'); return true; } }