Sha256: 5a3840ab3772c8b145a288c75b6c6ca1d2abe9f251de87d34fe0abaac1b00546
Contents?: true
Size: 852 Bytes
Versions: 13
Compression:
Stored size: 852 Bytes
Contents
#coding: utf-8 =begin Service模块提供的json数据格式封装 =end class ResultPacker #自定义打包 def self.pack(response_hash={}) {:status=>'ok',:msg=>'', :data=>nil}.merge!(response_hash) end #封装数据 def self.data(data_hash={}, msg='通信正常!') {:status=>'ok',:msg=>msg, :data=>data_hash} end #前台验证错误 def self.improve(ok_data = nil, hint_hash={}, msg='部分逻辑错误!') {:status=>'imperfect',:msg=>msg, :data=>ok_data, :errors=>hint_hash} end #前台验证错误 def self.help(hint_hash={}, msg='数据逻辑有误,请查看错误明细!') {:status=>'illegal',:msg=>msg, :errors=>hint_hash} end #异常错误 def self.error(msg='通信异常,请查看出错信息!', error_hash={}) {:status=>'error',:msg=>msg, :errors=>error_hash} end end
Version data entries
13 entries across 13 versions & 1 rubygems