Toutiao.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Bear
  5. * Date: 2020/2/4
  6. * Time: 下午12:14
  7. */
  8. namespace app\admin\controller\wechat;
  9. use app\common\controller\Backend;
  10. use app\common\library\Redis;
  11. use app\common\service\DesService;
  12. use app\main\constants\CacheConstants;
  13. use \think\Config;
  14. class Toutiao extends Backend
  15. {
  16. public function index()
  17. {
  18. $token = DesService::instance()->encode($this->auth->id);
  19. $token = urlencode($token);
  20. if (!Config::get('site.tturl')) {
  21. $url = Config::get('site.url_root');
  22. } else {
  23. $url = Config::get('site.tturl');
  24. }
  25. $url = Config::get('site.scheme') . '://' . $url . "/index/guidewxsubscribe/index?token=$token";
  26. $new = Redis::instance()->get(CacheConstants::getGuideWxNewCount($this->auth->id));
  27. $pay = Redis::instance()->get(CacheConstants::getGuideWxPayCount($this->auth->id));
  28. $this->assign('new', $new > 0 ? $new : 0);
  29. $this->assign('pay', $pay > 0 ? $pay : 0);
  30. $this->assign('url', $url);
  31. return $this->view->fetch();
  32. }
  33. }