I have made a function based on the CMS of the original platform in the url link in the sub-custom menu, and then put the function link in the menu, and click the menu to enter the page. However, at the beginning, you can smoothly access the system and click a few times to upload photos asynchronously, but the error openid: {wechat_id} is displayed. However, the system won't be able to enter the page. the error openid: {wechat_id} is displayed on a blank page, and no token is displayed on the windows developer tool, later, I did not know how to jump to the mobile phone homepage. Ask the experts for help.
Reply to discussion (solution)
You can write your own code when these error messages are prompted. you need to send the corresponding code.
You can write your own code when these error messages are prompted. you need to send the corresponding code.
_ Appid = C ("appid"); $ this-> _ secret = C ("secret"); $ this-> time = 0; $ this-> token = $ this-> _ get ("token"); if (ALI_FUWU_GROUP & (date ("Y") = 2015 )) {$ fuwuuserlist = M ("fuwuuser")-> where (array ("token" => $ this-> token)-> select (); foreach ($ fuwuuserlist as $ fuwuvo) {$ fuwuuserinfo = M ("userinfo")-> where (array ("token" => $ this-> token, "wecha_id" => $ fuwuvo ["wecha_id"])-> find (); if ($ fuwuuserinfo = "") {if ($ Fuwuvo ["gender"] = "M") {$ fuwuvo ["gender"] = 1 ;} else if ($ fuwuvo ["gender"] = "F") {$ fuwuvo ["gender"] = 2 ;} else {$ fuwuvo ["gender"] = 0 ;}$ add_userinfo_hb = array ("token" =>$ this-> token, "wecha_id" => $ fuwuvo ["wecha_id"], "issub" => 1, "portrait" => $ fuwuvo ["avatar"], "truename" => $ fuwuvo ["real_name"], "nickname" => $ fuwuvo ["real_name"], "wechaname" => $ fuwuvo ["real_name"], "sex" => $ fuwuvo ["g Ender "]); $ add_userinfo_hb = array_map (" nulltoblank ", $ add_userinfo_hb); $ id_userinfo = M (" userinfo ")-> add ($ add_userinfo_hb );} else {if ($ fuwuuserinfo ["portrait"] = "") | ($ fuwuuserinfo ["wechaname"] = "")) {if ($ fuwuvo ["gender"] = "M") {$ fuwuvo ["gender"] = 1 ;} else if ($ fuwuvo ["gender"] = "F") {$ fuwuvo ["gender"] = 2 ;} else {$ fuwuvo ["gender"] = 0 ;}$ save_userinfo_hb = array ("token" =>$ this-> token, "Wecha_id" => $ fuwuvo ["wecha_id"], "issub" => 1, "portrait" => $ fuwuvo ["avatar"], "truename" => $ fuwuvo ["real_name"], "nickname" => $ fuwuvo ["real_name"], "wechaname" => $ fuwuvo ["real_name"], "sex" => $ fuwuvo ["gender"]); $ save_userinfo_hb = array_map ("nulltoblank", $ save_userinfo_hb); $ up_userinfo = M ("userinfo ") -> where (array ("token" => $ this-> token, "wecha_id" => $ fuwuvo ["wecha_id"])-> save ($ save_u Serinfo_hb) ;}}}if (strlen ($ this-> token) {$ _ SESSION ["wap_token"] = $ this-> token;} if (! $ This-> token) {$ this-> token = $ _ SESSION ["wap_token"];} if (! Empty ($ _ SESSION ["wap_token"]) {$ this-> token = $ _ SESSION ["wap_token"];} if (! $ This-> token &&! Strpos (MODULE_NAME, "Drp") === false) {$ id = $ this-> _ get ("id"); if ($ id) {$ did = M ("Distributor_store")-> where (array ("id" => $ id)-> getField ("did "); $ this-> token = M ("Distributor")-> where (array ("id" => $ did)-> getField ("token ");}} $ this-> assign ("token", $ this-> token); if (! $ This-> token) {exit ("no token");} if ($ this-> token &&! Preg_match ("/^ [0-9a-zA-Z] {3, 42 }$/", $ this-> token) {exit ("error token ");} $ this-> wxuser = S ("wxuser _". $ this-> token); if (! $ This-> wxuser | 1) {$ this-> wxuser = D ("Wxuser")-> where (array ("token" => $ this-> token )) -> find (); S ("wxuser _". $ this-> token, $ this-> wxuser) ;}$ this-> owxuser =$ this-> wxuser; $ this-> assign ("wxuser ", $ this-> wxuser); $ this-> _ checkVipTime ($ this-> wxuser); $ fake = 0; if ($ this-> wxuser ["winxintype"]! = 3) & $ this-> _ appid & $ this-> _ secret) {if ($ this-> wxuser ["oauth"] = 1) {if (! $ This-> isAgent) {$ this-> wxuser ["appid"] = trim ($ this-> _ appid ); $ this-> wxuser ["appsecret"] = trim ($ this-> _ secret );} else {$ this-> wxuser ["appid"] = $ this-> thisAgent ["appid"]; $ this-> wxuser ["appsecret"] = $ this-> thisAgent ["appsecret"] ;}}$ fake = 1 ;}$ toAuth = 0; if (C ("server_topdomain") = "paiyi.net.cn") & (C ("site_url ")! =" http://weixintest.paiyi.net.cn ") {$ ToAuth = 1;} else {$ toAuth = $ this-> wxuser [" oauth "];} if (C (" server_topdomain ") = "pigcms.cn") & ($ this-> wxuser ["winxintype"]! = 3) {$ this-> wxuser ["appid"] = $ this-> _ appid; $ this-> wxuser ["appsecret"] = $ this-> _ secret; $ this-> wxuser ["oauth"] = 0; $ this-> wxuser ["is_domain"] = 1; $ fake = 1; }$ wexintype = $ this-> wxuser ["winxintype"]; $ session_openid_name = "token_openid _". $ this-> token; $ session_fakeopenid_name = "token_fakeopenid _". $ this-> token; $ session_reopenid_name = "token_reopenid _". $ this-> token; $ session_oauthed_name =" Ken_oauthed _". $ this-> token; $ getUserInfoModules = getUserInfoModule: index (); $ getUserinfo = 0; if (isset ($ _ GET ["rget"]) | intval ($ _ GET ["ali"]) {$ _ SESSION ["otherSource"] = 1; $ toAuth = 0; $ this-> wxuser ["oauthinfo"] = 0;} if (isset ($ _ SESSION ["otherSource"]) {$ toAuth = 0 ;} if ($ this-> wxuser ["oauthinfo"] &! $ _ SESSION [$ session_oauthed_name]) {if ($ _ SESSION [$ session_openid_name]) {$ fansInfo = M ("Userinfo ") -> where (array ("token" => $ this-> token, "wecha_id" => $ _ SESSION [$ session_openid_name])-> find (); if ($ toAuth) {if (! $ FansInfo |! $ FansInfo ["wechaname"] |! $ FansInfo ["portrait"]) {unset ($ _ SESSION [$ session_openid_name]); $ getUserinfo = 1 ;}}} else {if (isset ($ _ SESSION [$ session_reopenid_name]) & $ _ SESSION [$ session_reopenid_name]) {$ fansInfo = M ("Userinfo ") -> where (array ("token" => $ this-> token, "wecha_id" => $ _ SESSION [$ session_reopenid_name])-> find (); if (! $ FansInfo |! $ FansInfo ["wechaname"] |! $ FansInfo ["portrait"]) {unset ($ _ SESSION [$ session_openid_name]); unset ($ _ SESSION [$ session_reopenid_name]); $ getUserinfo = 1 ;}} else {$ getUserinfo = 1 ;}}$ this-> isFuwu = 0; $ this-> isWechat = 0; $ userAgent = strtolower ($ _ SERVER ["HTTP_USER_AGENT"]); if (strpos ($ userAgent, "alipayclient") {$ this-> isFuwu = 1 ;} else if (strpos ($ userAgent, "micromessenger") {$ this-> isWechat = 1;} if (! M ("Weixin_account")-> where (array ("type" => 1)-> find () {M ("Wxuser ") -> where ("1")-> save (array ("type" => 0);} $ this-> cookieToSession (); if ($ _ GET ["wecha_id"] & ($ _ GET ["wecha_id"]! = $ _ SESSION [$ session_openid_name]) & (3! = $ Wexintype) {unset ($ _ SESSION [$ session_openid_name]); unset ($ _ SESSION [$ session_oauthed_name]); cookie ("oau2 _". $ this-> token, NULL);} if ($ this-> isFuwu) {if ($ _ GET ["wecha_id"]! = "") {$ This-> wecha_id = $ _ GET ["wecha_id"];} else {$ this-> wecha_id = session ("wecha_id ");} session ("wecha_id", $ this-> wecha_id); $ thisfuwuuser = M ("fuwuuser")-> where (array ("token" => $ this-> token, "wecha_id" => $ this-> wecha_id)-> find (); $ isFuwuoauth = session ("isFuwuoauth ");} if ($ this-> isFuwu & ($ isFuwuoauth! = "Yes") {$ fw_wecha_id = FuwuOAuth: index ($ this-> token); if ($ fw_wecha_id! = "No") {$ this-> wecha_id = $ fw_wecha_id; session ("wecha_id", $ this-> wecha_id); session ("isFuwuoauth", "yes ");} else if ($ this-> wecha_id = "") {$ this-> error ("the service window does not have permission to retrieve fan information
Please confirm activation in the service window developer "); exit () ;}$ _ SESSION [$ session_openid_name] = $ this-> wecha_id; $ _ SESSION [$ session_oauthed_name] = 1;} $ users = M ("Users ") -> where (array ("id" => $ this-> wxuser ["uid"])-> find (); if ("payReturn" = ACTION_NAME) & (0 <$ users ["is_syn"]) {$ _ SESSION [$ session_openid_name] =$ _ GET ["wecha_id"];}
If (empty ($ _ SESSION [$ session_openid_name]) & (0 <$ users ["is_syn"]) {$ _ SESSION ["auth_callback _". $ this-> token] = array ("url" => getSelfUrl (array ("wecha_id"), "token" => $ this-> token ); $ url = $ users ["source_domain"]. A ("Home/Auth")-> getCallbackUrl ($ users ["is_syn"], "auth "). "token = ". $ this-> token. "& source = pigcms"; header ("Location :". $ url); exit ();} if (2 = $ users ["is_syn"]) {$ url = $ users ["s Ource_domain "]. A ("Home/Auth")-> getCallbackUrl ($ users ["is_syn"], "follow "). "wecha_id = ". $ _ SESSION [$ session_openid_name]; $ this-> _ auth = json_decode (HttpClient: getInstance ()-> get ($ url )); if (1 = $ this-> _ auth-> code) {M ("Userinfo")-> where (array ("token" => $ this-> token, "wecha_id" = >$ _ SESSION [$ session_openid_name])-> setField ("issub", 1);} else {M ("Home ") -> where (array ("token" => $ this-> token)-> se TField ("gzhurl", $ this-> _ auth-> follow-> url ); $ this-> wxuser ["qr"] = $ this-> _ auth-> follow-> qrcode; $ this-> wxuser ["wxname"] = $ this-> _ auth-> follow-> wechat;} if (! Isset ($ _ SESSION [$ session_openid_name]) |! $ _ SESSION [$ session_openid_name]) {if ($ this-> isFuwu) {} else {$ apiOauth = new apiOauth (); if ((! $ _ GET ["wecha_id"] | (urldecode ($ _ GET ["wecha_id"]) = "{wechat_id }")) & ($ _ GET ["wecha_id"]! = "No") & $ this-> wxuser ["appid"] & ($ this-> wxuser ["type"] = 0) & ($ this-> wxuser ["appsecret"]! = "") | ($ This-> wxuser ["type"] = 1) & ($ toAuth = 1 )) {$ token_info = $ apiOauth-> webOauth ($ this-> wxuser, "", $ fansInfo);} if (! Empty ($ token_info) {$ this-> wecha_id = $ token_info ["openid"]; if (3 = $ wexintype) {$ fake = 0 ;} if ($ fake) {if (isset ($ _ SESSION [$ session_fakeopenid_name]) {$ datainfo ["issub"] = 1; $ this-> wecha_id = $ _ SESSION [$ session_fakeopenid_name]; $ userinfoModel = M ("Userinfo "); $ userinfoData = $ userinfoModel-> where (array ("token" => $ this-> token, "wecha_id" = >$ _ SESSION [$ session_fakeopenid_name]) -> find (); if ($ user InfoData) {$ fakeUserinfoData = $ userinfoModel-> where (array ("token" => $ this-> token, "wecha_id" => $ token_info ["openid"], "fakeopenid" => $ token_info ["openid"])-> find (); if ($ fakeUserinfoData) {if ($ userinfoModel-> where (array ("id" => $ fakeUserinfoData ["id"])-> save ($ this-> _ mergeUserinfo ($ userinfoData, $ fakeUserinfoData) {$ userinfoModel-> where (array ("id" => $ userinfoData ["id"])-> delete () ;}} else {$ UserinfoModel-> where (array ("id" => $ userinfoData ["id"])-> setField ("fakeopenid ", $ token_info ["openid"]) ;}} else {$ fakeUserinfoData =$ userinfoModel-> where (array ("token" =>$ this-> token, "wecha_id" => $ token_info ["openid"], "fakeopenid" => $ token_info ["openid"])-> find (); if ($ fakeUserinfoData) {$ userinfoModel-> where (array ("id" => $ fakeUserinfoData ["id"])-> setField ("wecha_id", $ _ SESSION [$ session_fa Keopenid_name]); }}$ this-> wecha_id = $ _ SESSION [$ session_fakeopenid_name];} else {$ fansInfo = M ("Userinfo ") -> where (array ("token" => $ this-> token, "fakeopenid" => $ token_info ["openid"])-> find (); if ($ fansInfo) {$ this-> wecha_id = $ fansInfo ["wecha_id"] ;}} if ($ this-> wxuser ["oauthinfo"] & (MODULE_NAME! = "Index") {$ jsonui = $ apiOauth-> get_fans_info ($ token_info ["access_token"], $ token_info ["openid"]); if (isset ($ jsonui ["openid"]) & $ jsonui ["openid"]) {if ($ fansInfo) {$ exist = $ fansInfo ["id"]; $ issub = $ fansInfo ["issub"];} else {$ existInfo = M ("Userinfo")-> where (array ("token" => $ this-> token, "wecha_id" => $ this-> wecha_id)-> find (); $ issub = $ existInfo ["issub"]; $ exist = $ existInfo ["id"];} $ datainfo ["w Echaname "] = str_replace (array (" '"," \ "), array (" "), $ jsonui [" nickname "]); $ datainfo ["sex"] = $ jsonui ["sex"]; $ datainfo ["portrait"] = $ jsonui ["headimgurl"]; $ datainfo ["token"] = $ this-> token; $ datainfo ["wecha_id"] = $ jsonui ["openid"]; $ datainfo ["city"] = $ jsonui ["city"]; $ datainfo ["province"] = $ jsonui ["province"]; $ datainfo ["truename"] = $ datainfo ["wechaname"]; $ datainfo ["wecha_id"] = $ this-> wecha_id; if ($ Fake) {$ datainfo ["fakeopenid"] = $ jsonui ["openid"];} if (3 = $ wexintype) {$ datainfo ["fakeopenid"] = ""; $ datainfo ["issub"] = $ this-> _ issubService ($ datainfo ["wecha_id"]);} if ($ exist) {D ("Userinfo")-> where (array ("id" => $ exist)-> save ($ datainfo );} else {D ("Userinfo")-> add ($ datainfo) ;}} else {$ this-> error ("incorrect authorization. please reset your appsecret!
". $ This-> wxuser [" appid "]."
". $ This-> wxuser [" appsecret "]."
". $ Jsonui ["errcode"], "#"); exit () ;}} if (empty ($ this-> wxuser ["oauthinfo"]) & (MODULE_NAME! = "Index") {if ($ fansInfo) {$ exist = $ fansInfo ["id"];} else {$ existInfo = M ("Userinfo ") -> where (array ("token" => $ this-> token, "wecha_id" => $ this-> wecha_id)-> find (); $ exist = $ existInfo ["id"] ;}$ datainfo ["token"] = $ this-> token; $ datainfo ["wecha_id"] = $ this-> wecha_id; if ($ fake) {$ datainfo ["fakeopenid"] = $ token_info ["openid"];} if (3 = $ wexintype) {$ datainfo ["fakeopenid"] = ""; $ datainfo ["issub"] = $ This-> _ issubService ($ datainfo ["wecha_id"]);} if ($ exist) {D ("Userinfo ") -> where (array ("id" => $ exist)-> save ($ datainfo);} else {D ("Userinfo ") -> add ($ datainfo) ;}}$ _ SESSION [$ session_openid_name] = $ this-> wecha_id; $ _ SESSION [$ session_oauthed_name] = 1; cookie ("oau2 _". $ this-> token, array ("wap_token" => $ this-> token, "wecha_id" => $ this-> wecha_id, "appid" => $ this-> wxuser ["appid"]), 311040000);} else {$ th Is-> wecha_id = $ this-> _ get ("wecha_id"); if ($ fake & $ toAuth &&! Isset ($ _ GET ["isappinstalled"]) {$ _ SESSION [$ session_fakeopenid_name] = $ this-> wecha_id;} if (! $ ToAuth) {$ _ SESSION [$ session_openid_name] = $ this-> wecha_id;} if (isset ($ _ GET ["wecha_id"]) & strlen ($ _ GET ["wecha_id"]) & $ toAuth) {$ get_parms =$ _ GET; unset ($ get_parms ["wecha_id"]); $ get_parm_str = ""; if ($ get_parms) {$ comma = ""; foreach ($ get_parms as $ gpk => $ gpv) {$ get_parm_str. = $ comma. $ gpk. "= ". $ gpv; $ comma = "&" ;}}$ get_parm_str. = "& g = ". GROUP_NAME. "& m = ". MODULE_NAME. "& a = ". ACTION _ NAME; $ _ SESSION [$ session_reopenid_name] = $ this-> wecha_id; header ("Location:". $ this-> siteUrl. "/index. php? ". $ Get_parm_str); exit () ;}}} else {$ this-> wecha_id =$ _ SESSION [$ session_openid_name];} if ($ _ GET ["yundabao"] = 1) {cookie ("yundabao", "1", 31536000) ;}$ yundabao = cookie ("yundabao "); if ($ yundabao! = "1") {if ($ this-> wecha_id &&! Preg_match ("/^ [0-9a-zA-Z _ \-\ s] {3, 82} $/", $ this-> wecha_id) {exit ("error openid :". $ this-> wecha_id );}}
It sometimes outputs error openid: "This line of things, sometimes outputs no token, and then does not know how to sometimes jump back to the home page,