<?php namespace app\common\model; class WechatConfig extends Base { /** * 获取微信号配置 * @param $key * @return array|false * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function getEasyWechatConfig($key) { $where = []; $where[] = ["app_id|app_code", "=", $key]; $wechatConfig = self::where($where)->find(); if (!$wechatConfig) { return false; } $config = [ 'app_id' => $wechatConfig->app_id, 'secret' => $wechatConfig->secret, 'sign_key'=>$wechatConfig->sign_key, ]; return $config; } }