修改返回为json

This commit is contained in:
guange 2016-04-02 07:56:12 +08:00
parent 1926f0ba53
commit ff93e9f79b
1 changed files with 4 additions and 4 deletions

View File

@ -177,9 +177,9 @@ class WechatsController < ActionController::Base
raise "非法操作, code不存在" unless params[:code]
openid = get_openid_from_code(params[:code])
raise "无法获取到openid" unless openid
render :text => {status:0, openid: openid}.to_json
render :json => {status:0, openid: openid}
rescue Exception=>e
render :text => {status: -1, msg: e.message}.to_json
render :json => {status: -1, msg: e.message}
end
end
@ -200,9 +200,9 @@ class WechatsController < ActionController::Base
openid: openid,
user: user
)
render :text => {status:0, msg: "绑定成功"}.to_json
render :json => {status:0, msg: "绑定成功"}
rescue Exception=>e
render :text => {status: -1, msg: e.message}.to_json
render :json => {status: -1, msg: e.message}
end
end