| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | <?phpnamespace 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,            'log' => [                'default' => 'dev', // 默认使用的 channel,生产环境可以改为下面的 prod                'channels' => [                    // 测试环境                    'dev' => [                        'driver' => 'daily',                        'path' => runtime_path().'/tmp/easywechat.log',                        'level' => 'debug',                    ],                    // 生产环境                    'prod' => [                        'driver' => 'daily',                        'path' =>runtime_path(). '/tmp/easywechat.log',                        'level' => 'info',                    ],                ],            ],        ];        return $config;    }}
 |