Auth.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\wechat\api\controller;
  11. use addon\wechat\model\Material as MaterialModel;
  12. use addon\wechat\model\Wechat as WechatModel;
  13. use app\Controller;
  14. use think\facade\Log;
  15. class Auth extends Controller
  16. {
  17. public $wechat;
  18. public $config;
  19. public function __construct()
  20. {
  21. parent::__construct();
  22. $site_id = request()->siteid();
  23. $this->wechat = new WechatModel($site_id);
  24. }
  25. /**
  26. * ************************************************************************微信公众号消息相关方法 开始******************************************************
  27. */
  28. /**
  29. * 关联公众号微信unserialize
  30. */
  31. public function relateWeixin()
  32. {
  33. Log::write('微信公众号消息');
  34. $this->wechat->app = $this->wechat->app();
  35. $this->wechat->relateWeixin();
  36. }
  37. /**
  38. * ************************************************************************微信公众号消息相关方法 结束******************************************************
  39. */
  40. /**
  41. * 关联公众号微信unserialize
  42. */
  43. public function wechatArticle()
  44. {
  45. $id = input('id', '');
  46. $index = input('i', 0);
  47. $material_model = new MaterialModel();
  48. $info = $material_model->getMaterialInfo(['id' => $id]);
  49. if (!empty($info['data']['value']) && json_decode($info['data']['value'], true)) {
  50. $info['data']['value'] = json_decode($info['data']['value'], true);
  51. }
  52. $this->assign('info', $info['data']);
  53. $this->assign('index', $index);
  54. $replace = [
  55. 'WECHAT_CSS' => __ROOT__ . '/addon/wechat/admin/view/public/css',
  56. 'WECHAT_JS' => __ROOT__ . '/addon/wechat/admin/view/public/js',
  57. 'WECHAT_IMG' => __ROOT__ . '/addon/wechat/admin/view/public/img',
  58. ];
  59. return $this->fetch('wechat/article', [], $replace);
  60. }
  61. }