Share.php 838 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace addons\shopro\controller;
  3. use think\Db;
  4. use app\admin\model\shopro\Share as ShareModel;
  5. class Share extends Common
  6. {
  7. protected $noNeedLogin = [];
  8. protected $noNeedRight = ['*'];
  9. public function add()
  10. {
  11. $params = $this->request->only(['shareId', 'spm', 'page', 'query', 'from', 'platform']);
  12. $user = auth_user();
  13. $shareInfo = ShareModel::log($user, $params);
  14. $this->success("");
  15. }
  16. /**
  17. * 查看分享记录
  18. */
  19. public function index()
  20. {
  21. $user = auth_user();
  22. $logs = ShareModel::with(['user' => function ($query) {
  23. return $query->field(['id', 'nickname', 'avatar']);
  24. }])->where('share_id', $user->id)->paginate($this->request->param('list_rows', 8));
  25. $this->success('获取成功', $logs);
  26. }
  27. }