分享页提交回复未关注公众号会跳到二维码界面
This commit is contained in:
parent
ea85c0c608
commit
8ab003d5ee
|
@ -54,6 +54,27 @@ module Mobile
|
||||||
|
|
||||||
authenticate!
|
authenticate!
|
||||||
|
|
||||||
|
subscribe = 0 #默认未关注
|
||||||
|
|
||||||
|
#-------------------获取用户是否关注此公众号-----------------------------
|
||||||
|
access_token = session[:access_token]
|
||||||
|
refresh_token = session[:refresh_token]
|
||||||
|
|
||||||
|
if access_token.present? && refresh_token.present?
|
||||||
|
refreshinfo = Wechat.api.web_refresh_access_token(refresh_token)
|
||||||
|
|
||||||
|
access_token = refreshinfo["access_token"]
|
||||||
|
refresh_token = refreshinfo["refresh_token"]
|
||||||
|
session[:access_token] = access_token
|
||||||
|
session[:refresh_token] = refresh_token
|
||||||
|
|
||||||
|
#获取用户信息
|
||||||
|
user_info = Wechat.api.web_user_info(access_token,openid)
|
||||||
|
Rails.logger.info "user_info!!!!!!!!!"
|
||||||
|
Rails.logger.info user_info
|
||||||
|
subscribe = user_info["subscribe"]
|
||||||
|
end
|
||||||
|
|
||||||
status = 0
|
status = 0
|
||||||
tip = 0 #0班级1项目
|
tip = 0 #0班级1项目
|
||||||
type = params[:type]
|
type = params[:type]
|
||||||
|
@ -207,6 +228,7 @@ module Mobile
|
||||||
present :result, result
|
present :result, result
|
||||||
present :status, status
|
present :status, status
|
||||||
present :tip, tip
|
present :tip, tip
|
||||||
|
present :subscribe,subscribe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -70,6 +70,7 @@ module Mobile
|
||||||
raise user.errors.full_messages.first if user.new_record?
|
raise user.errors.full_messages.first if user.new_record?
|
||||||
|
|
||||||
if uw && !user.real?
|
if uw && !user.real?
|
||||||
|
user.update_attributes(:lastname=>uw.user[:lastname])
|
||||||
uw.migrate_user(user)
|
uw.migrate_user(user)
|
||||||
else
|
else
|
||||||
UserWechat.create!(
|
UserWechat.create!(
|
||||||
|
|
|
@ -139,5 +139,9 @@ module Wechat
|
||||||
get 'userinfo', params: { access_token: web_access_token, openid: openid, lang: lang }, base: OAUTH2_USERINFO
|
get 'userinfo', params: { access_token: web_access_token, openid: openid, lang: lang }, base: OAUTH2_USERINFO
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def web_user_info(web_access_token, openid, lang = 'zh_CN')
|
||||||
|
get 'user/info', params: { access_token: web_access_token, openid: openid, lang: lang }, base: API_BASE
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -142,7 +142,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
|
||||||
|
|
||||||
data.disabled = false;
|
data.disabled = false;
|
||||||
if(typeof cb === 'function'){
|
if(typeof cb === 'function'){
|
||||||
cb();
|
cb(response.data.subscribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
//保证内外回复数一致
|
//保证内外回复数一致
|
||||||
|
@ -301,9 +301,16 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
|
||||||
loadData(args.id,0,0);
|
loadData(args.id,0,0);
|
||||||
args.scope.addReply = function(data){
|
args.scope.addReply = function(data){
|
||||||
console.log(data.comment);
|
console.log(data.comment);
|
||||||
addCommonReply(args.id, args.replyType, data,args, function(){
|
addCommonReply(args.id, args.replyType, data,args, function(subscribe){
|
||||||
args.scope.formData = {comment: ''};
|
args.scope.formData = {comment: ''};
|
||||||
loadData(args.id,0,0);
|
if(subscribe == 0){
|
||||||
|
$location.path("/login_tip");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
loadData(args.id,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
if(typeof args.replyCallback === 'function'){
|
if(typeof args.replyCallback === 'function'){
|
||||||
args.replyCallback();
|
args.replyCallback();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue