コード例 #1
0
ファイル: EClassApi.php プロジェクト: hqd276/bigs
    static function get_sms_config($delcache = false)
    {
        if (!CGlobal::$sms_configs || $delcache) {
            if (EBArrCache::is_not_cached('sms_config', 0, '', $delcache)) {
                if (!$delcache) {
                    $tmp_arr = array();

                    $re = DB::query('SELECT * FROM sms_config ORDER BY service_code, up_number', __LINE__ . __FILE__);

                    if ($re) {
                        while ($value = mysql_fetch_assoc($re)) {
                            if (!isset($tmp_arr[$value['service_code']][$value['up_number']])) {
                                if ($value['up_number']) {
                                    $tmp_arr[$value['service_code']][$value['up_number']] = $value['up_number'];
                                }
                            }
                        }
                    }

                    if ($tmp_arr) {
                        foreach ($tmp_arr as $s_code => $s_array) {
                            $min = min($s_array);
                            $max = max($s_array);
                            if (!isset(CGlobal::$sms_configs[$s_code])) {
                                CGlobal::$sms_configs[$s_code] = '';
                            }
                            if ($min == $max) {
                                CGlobal::$sms_configs[$s_code] = $min;
                            } else {
                                CGlobal::$sms_configs[$s_code] = "$min đến $max";
                            }
                        }
                    }

                    EBArrCache::set(CGlobal::$sms_configs);
                }
            } else {
                CGlobal::$sms_configs = EBArrCache::$arr_cache;
                EBArrCache::$arr_cache = array();
            }
        }
    }