/** * 订单日志 */ public function actionLogs() { $order_id = $_POST['order_id']; $log_list = OrderLog::model()->findAll('rel_id = :order_id', array(':order_id' => $order_id)); foreach ($log_list as $v) { $item['op_name'] = $v->op_name; $item['alttime'] = $v->alttime; $item['bill_type'] = $v->bill_type; $item['behavior'] = Params::BehaviorStatus($v->behavior); $item['result'] = $v->result === 'SUCCESS' ? '成功' : '失败'; $log_text = unserialize($v->log_text); $item['txt_key'] = $log_text[0]['txt_key']; $item_list[] = $item; } echo $this->renderPartial('_order_logs', array('item_list' => $item_list), true); }
/** * 订单详情 */ public function actionOrder() { $userId = $this->user_id; if (empty($userId)) { $this->redirect('/user/login'); } $orderSn = addslashes(trim($_REQUEST['ordersn'])); try { $oInfo = Order::model()->getUserOrderInfoBySn($userId, $orderSn); if (empty($oInfo) || !$oInfo['id']) { $this->redirect('/?from=no_order'); } $orderProduct = OrderProduct::model()->getOrderProductByOrderId($oInfo['id']); $status = Order::model()->getOrderStatusForUserPage($oInfo); $logs = OrderLog::model()->findAllByAttributes(array('order_id' => $oInfo['id'])); } catch (exception $e) { $this->redirect('/?from=order_error'); } $viewData = array(); $viewData['info'] = $oInfo; $viewData['status'] = $status; $viewData['logs'] = $logs; $viewData['orderProduct'] = $orderProduct; $this->render('/user/order', $viewData); }
public function showOp($log_id) { $logOp = OrderLog::model()->findByPk($log_id); $users = Users::model()->findByPk($logOp->user_id); $op = $users->username . ' ' . $logOp->op_name . " order " . $logOp->order_id; return $op; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = OrderLog::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * 订单【关闭】 */ public function actionCloseOrder() { $res = array('statusCode' => 200, 'message' => '关闭成功!'); try { $oInfo = Order::model()->findByPk($_REQUEST['id']); if (empty($oInfo)) { throw new exception('订单不存在!'); } elseif (!in_array($oInfo['order_status'], array(6))) { throw new exception('订单状态错误!'); } $oInfo->order_status = 7; $oInfo->update_time = time(); $flag = $oInfo->save(); if (empty($flag)) { throw new exception('订单关闭失败!', 500); } $logData = array(); $logData['order_id'] = $oInfo->id; $logData['type'] = 'AdminClosed'; $logData['msg'] = '您的订单已经超过退换货时间,已关闭该交易!'; OrderLog::model()->addOrderLog($logData); } catch (exception $e) { $res['statusCode'] = 300; $res['message'] = '关闭失败!【' . $e->getMessage() . '】'; } $res['callbackType'] = 'reloadTab'; $res['forwardUrl'] = '/manage/order/index'; $this->ajaxDwzReturn($res); }