Esempio n. 1
0
        //获取用户基本信息(OAuth2 授权的 Access Token 获取 未关注用户,Access Token为临时获取)
        private string oauth2_get_user_info(string access_token, string openid)
        {
            //"https://api.weixin.qq.com/sns/userinfo?access_token=".$access_token."&openid=".$openid."&lang=zh_CN";
            string url = string.Format("https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}&lang=zh_CN", access_token, openid);
            string res = HttpClientUlity.Post(url, "");

            return(res);
        }
Esempio n. 2
0
        //获取用户基本信息
        private string get_user_info(string openid)
        {
            //"https://api.weixin.qq.com/cgi-bin/user/info?access_token=".$this->access_token."&openid=".$openid."&lang=zh_CN";
            string url = string.Format("https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}", "", openid);
            string res = HttpClientUlity.Post(url, "");

            return(res);
        }
Esempio n. 3
0
        //生成OAuth2的Access Token
        private string oauth2_access_token(string code)
        {
            //"https://api.weixin.qq.com/sns/oauth2/access_token?appid=".$this->appid."&secret=".$this->appsecret."&code=".$code."&grant_type=authorization_code";
            string url = string.Format("https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code", appid, appsecret, code);
            string res = HttpClientUlity.Post(url, "");

            return(res);
        }
Esempio n. 4
0
        protected void btnCharge_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"]    = "IDIP_DO_PAY_CASH_REQ";
            dic["remark"]    = this.txtOrderNo.Text.Trim();
            dic["dis_uin"]   = this.txtPlayerId.Text.Trim();
            dic["src_uin"]   = "10372";
            dic["role_name"] = "niuniu";
            dic["us_source"] = "2";
            dic["amount"]    = this.txtDiamondNum.Text.Trim();
            dic["ui_ip"]     = Common.PubFuncs.GetIpAddress();
            dic["gameId"]    = "hlynzy";
            dic["sz_desc"]   = this.txtDesc.Text.Trim();
            string json = new JavaScriptSerializer().Serialize(dic);

            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);

            LogPaymentEO lp  = new LogPaymentEO();
            int          res = (Int32)jo["paystatus"];

            lp.Remarkid    = this.txtOrderNo.Text.Trim();
            lp.Areaid      = "1";
            lp.Worldid     = "1";
            lp.Dstuin      = this.txtPlayerId.Text.Trim();
            lp.Roleid      = "1";
            lp.Rolename    = "niuniu";
            lp.Srcuin      = "1011";
            lp.Source      = "1";
            lp.Amount      = this.txtDiamondNum.Text.Trim();
            lp.Uiip        = Common.PubFuncs.GetIpAddress();
            lp.Description = this.txtDesc.Text.Trim();;

            if (res == 0)
            {
                lp.Paystatus = "0";
            }
            else
            {
                lp.Paystatus = "1";
            }
            lp.Paymsg             = "Paymsg";
            lp.CreateTime         = DateTime.Now.ToString("yyyy-MM-dd");
            lp.FinishTime         = DateTime.Now.ToString("yyyy-MM-dd");
            this.divAlert.Visible = true;
            if (lpMange.addLg(lp) > 0)
            {
                this.lblAlert.Text = "充值成功";
            }
            else
            {
                this.lblAlert.Text = "充值失败";
            }
        }
Esempio n. 5
0
        protected void btnReplay_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"] = "IDIP_DO_REPLAY_LOG_REQ";
            dic["uin"]    = this.txtPlayerId.Text.Trim();
            string json        = new JavaScriptSerializer().Serialize(dic);
            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);
            //this.lblTotalNum.Text = jo["roomNum"].ToString();
        }
Esempio n. 6
0
        protected void btnRequestRoomNum_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"] = "IDIP_DO_ROOM_NUM_REQ";
            string json        = new JavaScriptSerializer().Serialize(dic);
            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);

            this.lblTotalNum.Text = jo["roomNum"].ToString();
        }
Esempio n. 7
0
        protected void btnOnLine_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"] = "IDIP_QUERY_CURRENT_ONLINE_NUMBER_REQ";
            string json        = new JavaScriptSerializer().Serialize(dic);
            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);

            //this.txtOnline.Text = responseStr;
            this.lblOnLineNum.Text = jo["currentUser"].ToString();
        }
Esempio n. 8
0
        protected void btnPublish_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"]  = "IDIP_DO_SEND_NOTICE_REQ";
            dic["content"] = this.txtNotice.Text.Trim();
            string json        = new JavaScriptSerializer().Serialize(dic);
            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);

            this.divAlert.Visible = true;
            this.lblAlert.Text    = jo["msg"].ToString();
        }
Esempio n. 9
0
        /// <summary>
        /// 解封
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDeArchive_Click(object sender, EventArgs e)
        {
            if (this.checkFrom(this.txtdeArchive.Text.Trim()))
            {
                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic["action"] = "IDIP_DO_UNBAN_USR_REQ";
                dic["uid"]    = this.txtdeArchive.Text.Trim();
                string json        = new JavaScriptSerializer().Serialize(dic);
                string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

                JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);
                this.divAlert.Visible = true;
                ShowCommonDlg(jo["msg"].ToString());
            }
        }
Esempio n. 10
0
        protected void btnQueryPlayerInfo_Click(object sender, EventArgs e)
        {
            if (this.checkFrom(this.txtPlayerInfoId.Text.Trim()))
            {
                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic["action"] = "IDIP_DO_PLAYER_INFO_REQ";
                dic["uid"]    = this.txtPlayerInfoId.Text.Trim();
                string json        = new JavaScriptSerializer().Serialize(dic);
                string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

                JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);
                this.divAlert.Visible = true;
                this.lblAlert.Text    = jo["msg"].ToString();
            }
        }
Esempio n. 11
0
        protected void btnOrderNo_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"] = "IDIP_DO_CHECK_PAY_CASH_REQ";
            dic["remark"] = this.txtOrder.Text.Trim();
            string json        = new JavaScriptSerializer().Serialize(dic);
            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            this.txtOrder.Text = responseStr;
            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);

            this.lblIsDone.Text = jo["msg"].ToString();
            //this.divAlert.Visible = true;
            //this.lblAlert.Text = jo["msg"].ToString();
        }
Esempio n. 12
0
        protected void btn_queryPlayer_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"] = "IDIP_QUERY_CASH_REQ";
            dic["uin"]    = this.txtPlayer.Text.Trim();
            string json        = new JavaScriptSerializer().Serialize(dic);
            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            //this.txtPlayer.Text = responseStr;
            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);

            this.lblDiamondNum.Text = jo["amount"].ToString();
            //this.divAlert.Visible = true;
            //this.lblAlert.Text = jo["msg"].ToString();
        }
Esempio n. 13
0
        protected void btnModify_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"] = "IDIP_DO_UPDATE_CASH_REQ";
            dic["uin"]    = this.txtModifyPlayerId.Text.Trim();
            dic["source"] = "0";
            dic["amount"] = this.txtModifyNum.Text.Trim();
            string json        = new JavaScriptSerializer().Serialize(dic);
            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);

            this.divAlert.Visible = true;
            this.lblAlert.Text    = jo["msg"].ToString();
        }
Esempio n. 14
0
        protected void btnRecord_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"]     = "IDIP_DO_CHECK_PAY_LIST_REQ";
            dic["uin"]        = this.txtPlayerIdRecored.Text.Trim();
            dic["begin_time"] = this.txtStartTime1.Text.Trim();
            dic["end_time"]   = this.txtEndTime1.Text.Trim();
            string json        = new JavaScriptSerializer().Serialize(dic);
            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            //JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);
            //this.divAlert.Visible = true;
            //this.lblAlert.Text = jo["msg"].ToString();

            Response.Redirect("WptMall/MallTChargeList.aspx");
        }
Esempio n. 15
0
        protected void queryTotal_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"]     = "IDIP_QUERY_CASH_NUM_REQ";
            dic["uin"]        = this.txtChargePlayerId.Text.Trim();
            dic["begin_time"] = this.txtStartTime.Text.Trim();
            dic["end_time"]   = this.txtEndTime.Text.Trim();
            string json        = new JavaScriptSerializer().Serialize(dic);
            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);

            this.lblTotal.Text = jo["amount"].ToString();
            //this.divAlert.Visible = true;
            //this.lblAlert.Text = jo["msg"].ToString();
        }
Esempio n. 16
0
        protected void btnCharge_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtPlayerId.Text.Trim()))
            {
                ShowCommonDlg("请输入玩家ID!");
                return;
            }
            if (string.IsNullOrEmpty(this.txtDiamondNum.Text.Trim()))
            {
                ShowCommonDlg("请输入钻石数量!");
                return;
            }
            UsersEO um     = umMange.GetUser(GetUserID());
            string  srcuid = string.Empty;

            if (um != null)
            {
                srcuid = um.UrGameId;
            }
            string orderNo = PubFuncs.GenerateOrderNumber();
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic["action"]    = "IDIP_DO_PAY_CASH_REQ";
            dic["remark"]    = orderNo;//this.txtOrderNo.Text.Trim();
            dic["dis_uin"]   = this.txtPlayerId.Text.Trim();
            dic["src_uin"]   = srcuid;
            dic["role_name"] = "niuniu";
            dic["us_source"] = "2";
            dic["amount"]    = this.txtDiamondNum.Text.Trim();
            dic["ui_ip"]     = Common.PubFuncs.GetIpAddress();
            dic["gameId"]    = "hlynzy";
            dic["sz_desc"]   = this.txtDesc.Text.Trim();
            string json = new JavaScriptSerializer().Serialize(dic);

            string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

            JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);

            LogPaymentEO lp = new LogPaymentEO();

            if (string.IsNullOrEmpty(this.txtDiamondNum.Text.Trim()))
            {
                return;
            }
            if ((Convert.ToInt32(this.txtDiamondNum.Text.Trim()) < 0))
            {
                ShowCommonDlg("请输入正确钻石数量!");
                return;
            }
            int res = (Int32)jo["paystatus"];

            lp.Remarkid    = orderNo;
            lp.Areaid      = "1";
            lp.Worldid     = "1";
            lp.Dstuin      = this.txtPlayerId.Text.Trim();
            lp.Roleid      = "1";
            lp.Rolename    = "niuniu";
            lp.Srcuin      = srcuid;
            lp.Source      = "1";
            lp.Amount      = this.txtDiamondNum.Text.Trim();
            lp.Uiip        = Common.PubFuncs.GetIpAddress();
            lp.Description = this.txtDesc.Text.Trim();;

            if (res == 0)
            {
                lp.Paystatus = "0";
            }
            else
            {
                lp.Paystatus = "1";
            }
            lp.Paymsg             = "Paymsg";
            lp.CreateTime         = DateTime.Now.ToString("yyyy-MM-dd");
            lp.FinishTime         = DateTime.Now.ToString("yyyy-MM-dd");
            this.divAlert.Visible = true;
            if (lpMange.addLg(lp) > 0)
            {
                //UsersEO um = umMange.GetUser(GetUserID());
                int subDiamondNum = Convert.ToInt32(this.txtDiamondNum.Text.Trim());
                int resNum        = Convert.ToInt32(um.UrDiamondNum) - subDiamondNum;
                int resUpdate     = umMange.PutUrDiamondNumByPK(GetUserID(), resNum.ToString());
                if (resUpdate > 0)
                {
                    //this.lblAlert.Text = "充值成功";
                    ShowCommonDlg("充值成功");
                }
                else
                {
                    //this.lblAlert.Text = "充值失败";
                    ShowCommonDlg("充值失败");
                }
            }
            else
            {
                //this.lblAlert.Text = "充值失败";
                ShowCommonDlg("充值失败");
            }
        }
Esempio n. 17
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string code = context.Request.QueryString["code"];

            context.Response.Write("code:" + code);

            if (context.Request.QueryString["code"] != null && context.Request.QueryString["code"] != "")
            {
                //获取微信回传的code
                code = context.Request.QueryString["code"].ToString();
                OAuth_Token Model           = Get_token(code);                      //获取token
                OAuthUser   OAuthUser_Model = Get_UserInfo(Model.access_token, Model.openid);
                if (OAuthUser_Model.openid != null && OAuthUser_Model.openid != "") //已获取得openid及其他信息
                {
                    //在页面上输出用户信息
                    context.Response.Write("用户OPENID:" + OAuthUser_Model.openid + "NUidod:" + OAuthUser_Model.unionid + "<br>用户昵称:" + OAuthUser_Model.nickname + "<br>性别:" + OAuthUser_Model.sex + "<br>所在省:" + OAuthUser_Model.province + "<br>所在市:" + OAuthUser_Model.city + "<br>所在国家:" + OAuthUser_Model.country + "<br>头像地址:" + OAuthUser_Model.headimgurl + "<br>用户特权信息:" + OAuthUser_Model.privilege);
                    //或跳转到自己的页面,想怎么处理就怎么处理
                    //Response.Redirect(reurl);
                    WxUserManage wxManager = new WxUserManage();
                    WxusersEO    resEo     = wxManager.getWxUserByPk(OAuthUser_Model.unionid);
                    if (resEo != null)
                    {
                        context.Response.Write("resEo in not null");
                    }
                    else
                    {
                        context.Response.Write("resEo in null");
                        string    did  = context.Request["duid"];
                        WxusersEO wxEo = new WxusersEO();
                        wxEo.WxId       = OAuthUser_Model.unionid;
                        wxEo.WxOpenid   = OAuthUser_Model.openid;
                        wxEo.WxNickname = OAuthUser_Model.nickname;
                        wxEo.WxHeadurl  = OAuthUser_Model.headimgurl;
                        wxEo.WxSex      = OAuthUser_Model.sex;
                        wxEo.WxDuid     = did;
                        wxEo.WxBindtime = DateTime.Now;
                        context.Response.Write("did " + did);

                        Dictionary <string, string> dic = new Dictionary <string, string>();
                        dic["action"]  = "IDIP_DO_BAND_DAILI_REQ";
                        dic["unionId"] = OAuthUser_Model.unionid;
                        dic["duid"]    = did;
                        string  json        = new JavaScriptSerializer().Serialize(dic);
                        string  serverUrl   = ConfigurationManager.AppSettings["ServerUrl"].ToString();
                        string  responseStr = HttpClientUlity.PostJsonData(serverUrl, json);
                        JObject jo          = (JObject)JsonConvert.DeserializeObject(responseStr);
                        context.Response.Write("errCode " + jo["errCode"].ToString());
                        wxEo.WxState = jo["errCode"].ToString();

                        context.Response.Write("WxId: " + wxEo.WxId);
                        context.Response.Write("WxOpenid: " + wxEo.WxOpenid);
                        context.Response.Write("WxNickname: " + wxEo.WxNickname);
                        context.Response.Write("WxHeadurl: " + wxEo.WxHeadurl);
                        context.Response.Write("WxSex: " + wxEo.WxSex);
                        context.Response.Write("WxDuid: " + wxEo.WxDuid);
                        int ret = wxManager.addWxUser(wxEo);
                        context.Response.Write("ret: " + ret.ToString());
                        if (ret > 0)
                        {
                            context.Response.Write("绑定成功");
                        }
                        else
                        {
                            context.Response.Write("绑定失败");
                        }

                        context.Response.Write("resEo in null");
                    }
                }
                else  //未获得openid,回到wxProcess.aspx,访问弹出微信授权页面,提示用户授权
                {
                    context.Response.Redirect("获取OpenId失败");
                }
            }
            else
            {
                context.Response.Write("code is null");
            }

            //context.Response.Write(vParamData);
        }
Esempio n. 18
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            #region 验证表单合法性
            if (this.CheckForms() == false)
            {
                CloseDivImplementation();
                return;
            }
            tarnsferids = Request.QueryString["tranferids"];
            openids     = Request.QueryString["openids"];

            string[] oids = openids.Split(',');
            string[] ids  = tarnsferids.Split(',');

            string toUserId = this.txtToUser.Text.Trim();
            int    ret      = 0;
            for (int i = 0; i < ids.Length; i++)
            {
                string curId = ids[i];
                if (!string.IsNullOrEmpty(curId))
                {
                    ret = wxUserManage.PutWxDuidByPK(curId, toUserId);
                }
            }
            this.div1.Visible = true;
            if (ret > 0)
            {
                //var recharData = { "action": "IDIP_DO_BAND_MORE_DAILI_REQ", "unionIdArray": ["jjjjsdsd:11102", "jjsdsddsd:2222", "jjsdfasdsd:33333", "asdfasdfw:44444", ] };
                StringBuilder to_json = new StringBuilder();
                to_json.Append("[");
                for (int i = 0; i < ids.Length; i++)
                {
                    string curId = ids[i];
                    if (!string.IsNullOrEmpty(curId))
                    {
                        to_json.Append("\"");
                        to_json.Append(oids[i]);
                        to_json.Append(":");
                        to_json.Append(curId);
                        to_json.Append("\"");
                        to_json.Append(",");
                    }
                }
                to_json.Append("]");
                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic["action"]       = "IDIP_DO_BAND_MORE_DAILI_REQ";
                dic["unionIdArray"] = to_json.ToString();//"["jjjjsdsd:11102", "jjsdsddsd:2222", "jjsdfasdsd:33333", "asdfasdfw:44444", ]";
                string json        = new JavaScriptSerializer().Serialize(dic);
                string responseStr = HttpClientUlity.PostJsonData(serverUrl, json);

                JObject jo = (JObject)JsonConvert.DeserializeObject(responseStr);
                this.Label2.Text = "转移成功";
            }
            else
            {
                this.Label2.Text = "转移失败";
            }
            // new UsersMO().GetByUrLoginName()

            //if (new UsersMO().GetByUrLoginName(txtToUser.Text.Trim()).Count() > 0)
            //{
            //    Label1.Text = Resources.Resource.verification_successful;
            //    //"验证成功!";
            //}
            //else
            //{
            //    Label1.Text = Resources.Resource.usernotexist;
            //    //"用户不存在!";
            //    return;
            //}
            #endregion

            /*
             * string _eoid = "";
             * string _eomid = "";
             *
             * foreach (UsersEO _eos in new UsersMO().GetByUrLoginName(lblUser.Text.Trim())) // 被复制ID
             * {
             *  _eoid = _eos.UrId;
             * }
             * foreach (UsersEO _eoss in new UsersMO().GetByUrLoginName(txtToUser.Text.Trim())) // 目标ID
             * {
             *  _eomid = _eoss.UrId;
             * }
             *
             *
             * string result = "";
             * int winnum = 0; // 成功个数
             * int losenum = 0; // 失败个数
             *
             * foreach (RoleuserEO _ruEO in new RoleuserMO().GetByUrId(_eoid)) // 循环 目标ID 拥有角色
             * {
             *  RoleuserEO _fzeo = new RoleuserEO();
             *  _fzeo.UrId = _eomid;
             *  _fzeo.RlId = _ruEO.RlId;
             *  _fzeo.RuAddUser = GetUserID();
             *  _fzeo.RuAddTime = DateTime.Now;
             *
             *  if (new RoleuserMO().GetByPK(_fzeo.UrId, _fzeo.RlId) == null) // 不存在添加 存在不变
             *  {
             *      if (new RoleuserMO().Add(_fzeo) > 0) // 添加目标Id成功
             *      {
             *          result += GetDisPlayName(_fzeo) + Resources.Resource.Tip_SuscessCopy;//(成功):复制权限:
             *          if (rdoType.Text == "1") // 转移
             *          {
             *              new RoleuserMO().RemoveByPK(_eoid, _fzeo.RlId); // 删除原有角色
             *              result += "id:" + _eoid + ",roleid:" + _fzeo.RlId + Resources.Resource.tip_delete_success;//删除成功
             *          }
             *          winnum++;
             *      }
             *      else //  失败
             *      {
             *          result += GetDisPlayName(_fzeo) + Resources.Resource.Tip_FaileCopy;//(失败):复制权限:
             *          losenum++;
             *      }
             *  }
             *  else
             *  {
             *      if (rdoType.Text == "1") // 转移
             *      {
             *          new RoleuserMO().RemoveByPK(_eoid, _fzeo.RlId); // 删除原有角色
             *          result += "id:" + _eoid + ",roleid:" + _fzeo.RlId + Resources.Resource.tip_delete_success;
             *              //"删除成功";
             *      }
             *  }
             * }
             *
             * if (rdoType.Text == "1") // 转移
             * {
             *  userManage.EditStateByPk(_eoid, "1"); // 将用户改为停用
             * }
             *
             * this.div1.Visible = true;
             * //this.Label2.Text = result;
             * this.Label2.Text = "复制或转移成功";
             * CloseDivImplementation();
             * InsertLog(rdoType.Text == "1" ? Resources.Resource.transfer_authority : Resources.Resource.copy_authority, Resources.Resource.tip_content + result, -7, GetPlatformIdByValue(1));
             */
        }