public JsonResult PublishDingApp(DingAppViewModel model)
        {
            ActionResult result;

            //数据验证
            result = ValideDingApp(model);
            System.Web.HttpFileCollectionBase files = HttpContext.Request.Files;
            if (files.Count > 0 && files[0].ContentLength > 1024 * 1024)
            {
                result.Success = false;
                result.Message = "msgGlobalString.ImageMaxLength";
                return(Json(result, "text/html"));
            }
            //获取钉钉微应用头像附件ID
            string attchmentId = Engine.SettingManager.GetCustomSetting(CustomSetting.Setting_DDMediaId);

            if (files.Count > 0 && !string.IsNullOrEmpty(files[0].FileName))
            {
                //ID为空则新建
                attchmentId = attchmentId ?? Guid.NewGuid().ToString();
                SaveImage(files, attchmentId, attchmentId);
                Engine.SettingManager.SetCustomSetting(CustomSetting.Setting_DDMediaId, attchmentId);
            }
            if (string.IsNullOrEmpty(attchmentId))
            {
                result.Success = false;
                result.Message = "msgGlobalString.ImgNotEmpty";
                return(Json(result, "text/html"));
            }
            //更新附件中的DingTalkMediaID
            this.Engine.DingTalkAdapter.GetAttachmentDingTalkViewUrl(this.UserValidator.UserID, DingTalkAdapter.Param_DingTalkCode, attchmentId, attchmentId);
            Attachment attachment = this.Engine.BizObjectManager.GetAttachment(this.UserValidator.UserID, DingTalkAdapter.Param_DingTalkCode, attchmentId, attchmentId);

            if (string.IsNullOrEmpty(attachment.DingTalkMediaID))
            {
                result.Success = false;
                result.Message = "msgGlobalString.ImgNotEmpty";
                return(Json(result, "text/html"));
            }
            //钉钉微应用设置
            Engine.SettingManager.SetCustomSetting(CustomSetting.Setting_DDAppName, model.AppName);
            Engine.SettingManager.SetCustomSetting(CustomSetting.Setting_DDAppDesc, model.AppDesc);
            Engine.SettingManager.SetCustomSetting(CustomSetting.Setting_DDAppHomeUrl, model.HomeUrl);
            Engine.SettingManager.SetCustomSetting(CustomSetting.Setting_DDAppPcUrl, model.PcUrl);
            Engine.SettingManager.SetCustomSetting(CustomSetting.Setting_DDOmpLink, model.OmpLink);
            DingTalkMicroApp dingApp = this.Engine.DingTalkAdapter.CreateMicroApp(attachment.DingTalkMediaID, model.AppName, model.AppDesc, model.HomeUrl, model.PcUrl, model.OmpLink);

            if (dingApp.errcode != "0")
            {
                result.Success = false;
                result.Message = "msgGlobalString.PublishFailed";
            }
            else
            {
                Engine.SettingManager.SetCustomSetting(CustomSetting.Setting_DDAppAgentId, dingApp.agentid);
            }
            result.Extend = dingApp;
            return(Json(result, "text/html", JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 验证钉钉微应用数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private ActionResult ValideDingApp(DingAppViewModel model)
        {
            ActionResult result = new ActionResult(true);

            return(result);
        }