Wxapp.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\common\model;
  13. use app\common\library\helper;
  14. use cores\BaseModel;
  15. use think\facade\Cache;
  16. use app\common\exception\BaseException;
  17. /**
  18. * 微信小程序模型 (当前类已废弃,请勿使用)
  19. * Class Wxapp
  20. * @package app\common\model
  21. */
  22. class Wxapp extends BaseModel
  23. {
  24. // 定义表名
  25. protected $name = 'wxapp';
  26. // 定义主键名
  27. protected $pk = 'id';
  28. /**
  29. * 获取微信小程序配置 (即将废弃, 用于兼容v2.0.4之前)
  30. * @param int|null $storeId
  31. * @return array
  32. */
  33. public static function getOldData(?int $storeId = null): array
  34. {
  35. empty($storeId) && $storeId = static::$storeId;
  36. $detail = static::get(['store_id' => $storeId]);
  37. if (empty($detail)) {
  38. return [];
  39. }
  40. return helper::pick($detail->toArray(), ['app_id', 'app_secret', 'mchid', 'apikey', 'cert_pem', 'key_pem']);
  41. }
  42. }