Exemple #1
0
        /// <summary>
        /// 发布已通过版本
        /// </summary>
        /// <param name="authorizerAccessToken"></param>
        /// <param name="shopId"></param>
        /// <param name="logDbContext"></param>
        public APIResult ReleaseVersion(string authorizerAccessToken, ShopWechatOpenAuthorizer item, TemplateInfo tempInfo)
        {
            var releaseResult = CodeApi.Release(authorizerAccessToken);

            //如果发布成功,则将请求的结果写入到数据库中
            if (releaseResult.errcode != Senparc.Weixin.ReturnCode.请求成功)
            {
                return(Error("发布失败," + releaseResult.errmsg));
            }

            item.IsRelease = true;
            item.CurrentTemplateUserVersion = item.ReleaseTemplateUserVersion;
            item.CurrentTemplateId          = tempInfo.template_id;
            item.CurrentTemplateUserDesc    = tempInfo.user_desc;
            db.SaveChanges();
            //这里尝试添加二唯码规则
            if (hostingEnvironment != null)
            {
                var qrCodeResult = CodeApiExt.QRCodeJumpAddPublish(item.ShopId, authorizerAccessToken, hostingEnvironment);
                if (qrCodeResult.errcode != ReturnCode.请求成功)
                {
                    return(Error("添加二维码规则失败 ," + qrCodeResult.errmsg));
                }
            }
            return(Success());
        }