| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\extra\service\wechat;
- use app\extra\basic\Service;
- use EasyWeChat\MiniApp\Application;
- class RoutineService extends Service
- {
- protected $request;
- protected $utils;
- /**
- * 设置模型
- * @return string
- */
- public function __construct()
- {
- $miniapp = new Application($this->options());
- $this->request = $miniapp->getClient();
- $this->utils = $miniapp->getUtils();
- }
- protected function options()
- {
- return ['app_id'=>sConf('wechat.mini_appid'),'secret'=>sConf('wechat.mini_secret'),'token'=>'','aes_key'=>''];
- }
- /**
- * 列表
- * @param array $param
- */
- public function getUserInfo(string $code)
- {
- try {
- return $this->utils->codeToSession($code);
- } catch (\Throwable $throwable) {
- return error($throwable->getMessage());
- }
- }
- }
|