예제 #1
0
 /// <summary>
 /// 创建应用菜单
 /// </summary>
 /// <param name="context"></param>
 /// <param name="msg"></param>
 /// <param name="P1"></param>
 /// <param name="P2"></param>
 /// <param name="UserInfo"></param>
 public void CREATEMENU(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
 {
     try
     {
         int id    = Int32.Parse(P1);
         var model = new JH_Auth_ModelB().GetEntity(p => p.ID == id);
         if (model != null)
         {
             if (string.IsNullOrEmpty(model.Token) || string.IsNullOrEmpty(model.EncodingAESKey) || string.IsNullOrEmpty(model.AppID))
             {
                 msg.ErrorMsg = "Token、EncodingAESKey、企业号应用不能为空";
             }
             else
             {
                 WXHelp WX = new WXHelp(UserInfo.QYinfo);
                 List <Senparc.Weixin.Work.Entities.Menu.BaseButton> lm = new List <Senparc.Weixin.Work.Entities.Menu.BaseButton>();
                 WorkJsonResult rel = WX.WX_WxCreateMenuNew(Int32.Parse(model.AppID), model.ModelCode, ref lm);
                 if (rel.errmsg != "ok")
                 {
                     msg.ErrorMsg = "创建菜单失败";
                 }
             }
         }
         else
         {
             msg.ErrorMsg = "当前应用不存在";
         }
     }
     catch (Exception ex)
     {
         msg.ErrorMsg = "创建菜单失败";
     }
 }