Exemplo n.º 1
0
        public WorkJsonResult WX_WxCreateMenuNew(int agentId, string ModelCode, ref List <Senparc.Weixin.Work.Entities.Menu.BaseButton> lm)
        {
            string         strMenuURL = Qyinfo.WXUrl.TrimEnd('/') + "/View_Mobile/UI/UI_COMMON.html";
            WorkJsonResult Ret        = new WorkJsonResult();

            if (Qyinfo.IsUseWX == "Y")
            {
                var list = new JH_Auth_CommonB().GetEntities(p => p.ModelCode == ModelCode && p.Type == "1").OrderBy(p => p.Sort);

                foreach (var l in list)
                {
                    string url = string.Empty;
                    string key = string.Empty;
                    url = strMenuURL + "?funcode=" + l.ModelCode + "_" + l.MenuCode + "&corpId=" + Qyinfo.corpId;
                    key = l.ModelCode;
                    lm.Add(GetButton(l.Type, l.MenuName, url, key));
                }
                if (lm.Count > 0)
                {
                    Senparc.Weixin.Work.Entities.Menu.ButtonGroup buttonData = new Senparc.Weixin.Work.Entities.Menu.ButtonGroup();
                    buttonData.button = lm;
                    Ret = WX_CreateMenu(agentId, buttonData);
                }
            }
            return(Ret);
        }
Exemplo n.º 2
0
        public ActionResult <string> WXINIT()
        {
            try
            {
                var context = _accessor.HttpContext;
                #region 获取Code
                Model.ErrorMsg = "";
                string        P1         = context.Request.Query["P1"].ToString();
                string        P2         = context.Request.Query["P2"].ToString();
                string        szhlcode   = context.Request.Query["szhlcode"].ToString();
                TokenModelJWT tokenModel = JwtHelper.SerializeJWT(szhlcode);
                if (tokenModel.UserName == null)
                {
                    Model.ErrorMsg = "NOCODE";
                }
                else
                {
                    JH_Auth_UserB.UserInfo UserInfo = new JH_Auth_UserB().GetUserInfo(10334, tokenModel.UserName);
                    DataTable dtUsers = new JH_Auth_UserB().GetDTByCommand(" SELECT UserName,UserRealName,mobphone FROM JH_Auth_User where ComId='" + UserInfo.User.ComId + "'");
                    //获取选择用户需要的HTML和转化用户名需要的json数据
                    Model.Result = dtUsers;
                    JH_Auth_Common url = new JH_Auth_CommonB().GetEntity(p => p.ModelCode == P1 && p.MenuCode == P2);
                    if (url != null)
                    {
                        Model.Result1 = url.Url1;
                    }
                    Model.Result2 = UserInfo.User.UserName + "," + UserInfo.User.UserRealName + "," + UserInfo.User.BranchCode + "," + UserInfo.BranchInfo.DeptName;
                    Model.Result3 = UserInfo.QYinfo.FileServerUrl;
                    Model.Result4 = UserInfo.QYinfo.QYCode;
                }


                #endregion
            }
            catch (Exception ex)
            {
                Model.ErrorMsg = "WXINIT接口调用失败,请检查日志";
                Model.Result   = ex.ToString();
                CommonHelp.WriteLOG(ex.ToString());
            }
            return(ControHelp.CovJson(Model));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取当前企业号拥有的IP,只返回和可信域名相同的应用
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1"></param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void GETQYAPP(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            int id    = Int32.Parse(P1);
            var model = new JH_Auth_ModelB().GetEntity(p => p.ID == id);

            msg.Result1 = model;//系统应用数据


            #region 获取应用默认菜单
            DataTable dt = new JH_Auth_CommonB().GetDTByCommand(" select * from JH_Auth_Common where ModelCode='" + model.ModelCode + "' and type='1' order by Sort");
            #endregion

            msg.Result2 = dt;

            //主页型应用的URL
            if (model.AppType == "2")
            {
                msg.Result3 = UserInfo.QYinfo.WXUrl.TrimEnd('/') + "/View_Mobile/UI/UI_COMMON.html?funcode=" + model.ModelCode + "&corpId=" + UserInfo.QYinfo.corpId;;
            }
        }
Exemplo n.º 4
0
        public QyJsonResult WX_WxCreateMenuNew(int agentId, string ModelCode, ref List <Senparc.Weixin.QY.Entities.Menu.BaseButton> lm)
        {
            string       strMenuURL = Qyinfo.WXUrl.TrimEnd('/') + "/View_Mobile/UI/UI_COMMON.html";
            QyJsonResult Ret        = new QyJsonResult();

            if (Qyinfo.IsUseWX == "Y")
            {
                var list = new JH_Auth_CommonB().GetEntities(p => p.ModelCode == ModelCode && p.TopID == 0 && p.Type == "1").OrderBy(p => p.Sort);

                foreach (var l in list)
                {
                    string url = string.Empty;
                    string key = string.Empty;
                    if (string.IsNullOrEmpty(l.MenuCode))
                    {
                        url = strMenuURL + "?funcode=" + l.ModelCode + "&corpId=" + Qyinfo.corpId;
                        key = l.ModelCode;
                    }
                    else
                    {
                        url = strMenuURL + "?funcode=" + l.ModelCode + "_" + l.MenuCode + "&corpId=" + Qyinfo.corpId;
                        key = l.ModelCode + "_" + l.MenuCode;
                    }

                    var list1 = new JH_Auth_CommonB().GetEntities(p => p.ModelCode == ModelCode && p.TopID == l.ID && p.Type == "1").OrderBy(p => p.Sort);
                    if (list1.Count() == 0)
                    {
                        lm.Add(GetButton(l.Type, l.MenuName, url, key));
                    }
                    else
                    {
                        Senparc.Weixin.QY.Entities.Menu.SubButton scb = new Senparc.Weixin.QY.Entities.Menu.SubButton();
                        scb.name = l.MenuName;

                        foreach (var l1 in list1)
                        {
                            string url1 = string.Empty;
                            string key1 = string.Empty;
                            if (string.IsNullOrEmpty(l1.MenuCode))
                            {
                                url1 = strMenuURL + "?funcode=" + l1.ModelCode + "&corpId=" + Qyinfo.corpId;
                                key1 = l1.ModelCode;
                            }
                            else
                            {
                                url1 = strMenuURL + "?funcode=" + l1.ModelCode + "_" + l1.MenuCode + "&corpId=" + Qyinfo.corpId;
                                key1 = l1.ModelCode + "_" + l1.MenuCode;
                            }

                            switch (l1.Type)
                            {
                            case "1":     //跳转URL
                                Senparc.Weixin.QY.Entities.Menu.SingleViewButton svb = new Senparc.Weixin.QY.Entities.Menu.SingleViewButton();
                                svb.name = l1.MenuName;
                                svb.type = "view";
                                svb.url  = url1;

                                scb.sub_button.Add(svb);
                                break;

                            case "2":     //点击推事件
                                Senparc.Weixin.QY.Entities.Menu.SingleClickButton skb = new Senparc.Weixin.QY.Entities.Menu.SingleClickButton();
                                skb.name = l1.MenuName;
                                skb.type = "click";
                                skb.key  = key1;

                                scb.sub_button.Add(skb);
                                break;

                            case "3":    //扫码推事件
                                Senparc.Weixin.QY.Entities.Menu.SingleScancodePushButton spb = new Senparc.Weixin.QY.Entities.Menu.SingleScancodePushButton();
                                spb.name = l1.MenuName;
                                spb.type = "scancode_push";
                                spb.key  = key1;

                                scb.sub_button.Add(spb);
                                break;

                            case "4":    //扫码推事件且弹出“消息接收中”提示框
                                Senparc.Weixin.QY.Entities.Menu.SingleScancodeWaitmsgButton swb = new Senparc.Weixin.QY.Entities.Menu.SingleScancodeWaitmsgButton();
                                swb.name = l1.MenuName;
                                swb.type = "scancode_waitmsg";
                                swb.key  = key1;

                                scb.sub_button.Add(swb);
                                break;

                            case "5":    //弹出系统拍照发图
                                Senparc.Weixin.QY.Entities.Menu.SinglePicSysphotoButton ssb = new Senparc.Weixin.QY.Entities.Menu.SinglePicSysphotoButton();
                                ssb.name = l1.MenuName;
                                ssb.type = "pic_sysphoto";
                                ssb.key  = key1;

                                scb.sub_button.Add(ssb);
                                break;

                            case "6":    //弹出拍照或者相册发图
                                Senparc.Weixin.QY.Entities.Menu.SinglePicPhotoOrAlbumButton sab = new Senparc.Weixin.QY.Entities.Menu.SinglePicPhotoOrAlbumButton();
                                sab.name = l1.MenuName;
                                sab.type = "pic_photo_or_album";
                                sab.key  = key1;

                                scb.sub_button.Add(sab);
                                break;

                            case "7":    //弹出微信相册发图器
                                Senparc.Weixin.QY.Entities.Menu.SinglePicWeixinButton sxb = new Senparc.Weixin.QY.Entities.Menu.SinglePicWeixinButton();
                                sxb.name = l1.MenuName;
                                sxb.type = "pic_weixin";
                                sxb.key  = key1;

                                scb.sub_button.Add(sxb);
                                break;

                            case "8":    //弹出地理位置选择器
                                Senparc.Weixin.QY.Entities.Menu.SingleLocationSelectButton slb = new Senparc.Weixin.QY.Entities.Menu.SingleLocationSelectButton();
                                slb.name = l1.MenuName;
                                slb.type = "location_select";
                                slb.key  = key1;

                                scb.sub_button.Add(slb);
                                break;
                            }
                        }

                        lm.Add(scb);
                    }
                }
                if (lm.Count > 0)
                {
                    Senparc.Weixin.QY.Entities.Menu.ButtonGroup buttonData = new Senparc.Weixin.QY.Entities.Menu.ButtonGroup();
                    buttonData.button = lm;

                    //Ret = CommonApi.CreateMenu(accesstoken, agentId, buttonData);
                    Ret = WX_CreateMenu(agentId, buttonData);
                }
            }
            return(Ret);
        }