Beispiel #1
0
        public ActionResult UploadImg(string serverId = "")
        {
            if (!string.IsNullOrEmpty(serverId))
            {
                var token    = AccessTokenContainer.TryGetAccessToken(AppConfig.Instance.AppId, AppConfig.Instance.AppSecret);
                var fileName = $"/upload/cardimg/{Guid.NewGuid().ToString("N")}.jpg";
                Senparc.Weixin.MP.AdvancedAPIs.MediaApi.Get(token, serverId, Server.MapPath("~" + fileName));

                var vip = GetVipInfo();
                vip.ImgPath     = fileName;
                vip.UpdatedTime = DateTime.Now;

                _dal.Update(vip);

                _dal.UpdateCommentsVipImg(vip);

                return(Json(AjaxResult.Success()));
            }
            else
            {
                return(Json(AjaxResult.Fail("请上传图片")));
            }
        }