示例#1
0
        /// <summary>
        /// 获取位置签名AddrSign
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="appSecret"></param>
        /// <param name="noncestr"></param>
        /// <param name="timestamp"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public static string GetAddrSign(string appId, string appSecret, string noncestr, string timestamp, string url)
        {
            string  err         = "";
            CRMComm com         = new CRMComm();
            var     accessToken = com.GetAccessToken(1, out err);
            var     parameters  = new Hashtable();

            parameters.Add("appId", appId);
            parameters.Add("noncestr", noncestr);
            parameters.Add("timestamp", timestamp);
            parameters.Add("url", url);
            parameters.Add("accesstoken", accessToken);
            return(CreateSha1(parameters));
        }
示例#2
0
        //批量清空菜单
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("weixin_custom_menu", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount = 0;
            int errorCount = 0;
            CRMComm cpp = new CRMComm();
            BLL.weixin_account bll = new BLL.weixin_account();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    Model.weixin_account model = new BLL.weixin_account().GetModel(id);
                    if (model != null)
                    {
                        string error = string.Empty; //定义错误
                        string token = cpp.GetAccessToken(id, out error); //获取最新的AccessToken
                        if (string.IsNullOrEmpty(error))
                        {
                            var result = Senparc.Weixin.MP.CommonAPIs.CommonApi.DeleteMenu(token);
                            if ((int)result.errcode == 0)
                            {
                                sucCount += 1;
                            }
                            else
                            {
                                errorCount += 1;
                            }
                        }
                        else
                        {
                            errorCount += 1;
                        }
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "清空公众平台自定义菜单成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("menu_list.aspx", "keywords={0}", this.keywords));
        }