Wechat.php 574 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\api\controller;
  3. use think\Controller;
  4. use app\common\util\WechatPublic as wcOper;
  5. class Wechat extends Base
  6. {
  7. public function __construct()
  8. {
  9. parent::__construct();
  10. }
  11. public function index()
  12. {
  13. $config = config('maccms.weixin');
  14. if($config['status'] ==0){
  15. echo 'closed';
  16. exit;
  17. }
  18. $wechatObj = new wcOper($config);
  19. if (isset($_GET['echostr'])) {
  20. $wechatObj->valid();
  21. }
  22. else {
  23. $wechatObj->responseMsg();
  24. }
  25. }
  26. }