DictCoin.php 469 B

123456789101112131415161718192021
  1. <?php
  2. namespace app\models\system;
  3. use crmeb\traits\ModelTrait;
  4. use crmeb\basic\BaseModel;
  5. use think\facade\Cache;
  6. class DictCoin extends BaseModel {
  7. use ModelTrait;
  8. public static function getIcon($symbol) {
  9. $icon = Cache::get('icon_' . $symbol);
  10. if ($icon) {
  11. return $icon;
  12. }
  13. $icon = self::where('symbol', $symbol)->value('icon');
  14. Cache::set('icon_' . $symbol, $icon, 86400);
  15. return $icon;
  16. }
  17. }