1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\index\controller;
- use app\api\model\Article as ArticleModel;
- use app\api\model\Goods as GoodsModel;
- use think\facade\Session;
- use think\helper\Str;
- use think\response\Redirect;
- /**
- * 默认控制器
- * Class User
- * @package app\api\controller
- */
- class User extends Controller
- {
- /**
- * 个人中心
- * @return \think\response\View
- */
- public function personal()
- {
- $userId = Session::get('user_id');
- if (empty($userId)) {
- return view('passport/logIn');
- }
- $goodsModel = new GoodsModel();
- //$goods['content'] = html_entity_decode($goods['content']);
- return view('personal', ['goods' => []]);
- }
- /**
- * 分享商品
- * @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');
- }
- $encryptUserId = encrypt($userId);
- $url = url('/index/index/productDetail?goodsId=' . $goodsId . '&key=' . $encryptUserId);
- //todo 发邮件
- return $this->renderSuccess([]);
- }
- }
|