'阿里云', 'wechat_config' => '微信', 'system_config' => '系统设置', 'put_config' => '投放设置', 'fetch_config' => '清运设置', 'cash_config' => '提现设置', 'assistant_setting' => '协管员提现设置', ]; public const Field_textarea = 0,Filed_richText = 1,Field_Json = 2, Field_Switch = 3,Field_Time = 4,Field_File = 5, Field_Checkbox = 6,Field_Json_Array = 7; private static $_fieldType = [ self::Field_textarea => '纯文本', self::Filed_richText => '富文本', self::Field_Json => 'JSON', self::Field_Switch => '开关', self::Field_Time => '时间', self::Field_File => '文件', self::Field_Checkbox => '选择框', self::Field_Json_Array => '数组JSON', ]; protected static function getType() { return self::$_fieldType; } /** * @return array|string */ public static function get(string $group, string $key = '', string $default = '') { $query = self::where('group', $group); if ($key) { $res = $query->where('key', $key)->first(['value'])->value ?? $default; return $res; } $res = $query->get(['key', 'value']); $arr = []; foreach ($res as $index => $item) { $arr[$item['key']] = $item['value']; } return $arr; } /** * @return int */ public static function set(string $group, string $key, string $value) { return self::where([['group', $group], ['key', $key]])->update(['value' => $value]); } }