[]]); } /** * 我的订单页面 * @return \think\response\View */ public function order(string $orderType = 'received') { $userId = Session::get('user_id'); if (empty($userId)) { return view('passport/logIn'); } return view('order'); } /** * 订单详情 * @param $orderId * @return \think\response\View * @throws \cores\exception\BaseException * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function orderDetails($orderId) { $userId = Session::get('user_id'); if (empty($userId)) { return view('passport/logIn'); } $model = OrderModel::getUserOrderDetail($orderId); $orderAddress = OrderAddress::get(['order_id' => $orderId]); return view('orderDetails', ['order' => $model, 'orderAddress' => $orderAddress]); } /** * 我的积分页面 * @return \think\response\View */ public function myScores() { $userId = Session::get('user_id'); if (empty($userId)) { return view('passport/logIn'); } $model = new PointsLogModel; $list = $model->getList(); $user = \app\index\service\User::getCurrentLoginUser(); return view('integral', ['user' => $user]); } /** * 我的积分列表 * @return \think\response\Json * @throws \app\common\exception\BaseException * @throws \think\db\exception\DbException */ public function pointsLogs() { $model = new PointsLogModel; $list = $model->getList(); return $this->renderSuccess(compact('list')); } /** * 分享商品 * @return \think\response\Json */ public function shareUser() { $userId = Session::get('user_id'); if (empty($userId)) { return $this->renderJson(config('status.not_logged'), 'Log in please!'); } $goodsId = $this->request->param('goodsId'); if (empty($goodsId)) { return $this->renderError('Invalid goods'); } $mailbox = $this->request->param('mailbox'); if (empty($mailbox)) { return $this->renderError('Invalid mailbox'); } $encryptUserId = encrypt(strval($userId)); $url = url('/index/index/productDetail?goodsId=' . $goodsId . '&key=' . $encryptUserId); //todo 发邮件 $MailCaptchaService = new MailCaptchaService; if ($MailCaptchaService->sendText($mailbox,'From Your Friend',$url)) { return $this->renderSuccess('Sent Successful!Please check your new mails.'); } return $this->renderSuccess([]); } }