WechatConfig.php 735 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\common\model;
  3. class WechatConfig extends Base
  4. {
  5. /**
  6. * 获取微信号配置
  7. * @param $key
  8. * @return array|false
  9. * @throws \think\db\exception\DataNotFoundException
  10. * @throws \think\db\exception\DbException
  11. * @throws \think\db\exception\ModelNotFoundException
  12. */
  13. public static function getEasyWechatConfig($key)
  14. {
  15. $where = [];
  16. $where[] = ["id|app_id|app_code", "=", $key];
  17. $wechatConfig = self::where($where)->find();
  18. if (!$wechatConfig) {
  19. return false;
  20. }
  21. $config = [
  22. 'app_id' => $wechatConfig->app_id,
  23. 'secret' => $wechatConfig->secret,
  24. ];
  25. return $config;
  26. }
  27. }