示例#1
0
        /// <summary>
        /// 修改门店服务信息
        /// </summary>
        /// <param name="AppId"></param>
        /// <param name="updateStoreData">修改门店服务信息需要Post的数据</param>
        /// 商户可以通过该接口,修改门店的服务信息,包括:图片列表、营业时间、推荐、特色服务、简介、人均价格、电话7 个字段。目前基础字段包括(名称、坐标、地址等不可修改)
        /// 若有填写内容则为覆盖更新,若无内容则视为不修改,维持原有内容。
        /// photo_list 字段为全列表覆盖,若需要增加图片,需将之前图片同样放入list 中,在其后增加新增图片。如:已有A、B、C 三张图片,又要增加D、E 两张图,则需要调用该接口,photo_list 传入A、B、C、D、E 五张图片的链接。
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static WxJsonResult UpdatePoi(string AppId, string AppSecret, UpdateStoreData updateStoreData, int timeOut = Config.TIME_OUT)
        {
            return(ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var url = string.Format("http://api.weixin.qq.com/cgi-bin/poi/updatepoi?access_token={0}", accessToken.AsUrlData());

                return CommonJsonSend.Send <WxJsonResult>(null, url, updateStoreData, CommonJsonSendType.POST, timeOut);
            }, AppId, AppSecret));
        }
示例#2
0
        public bool UpdatePoi(UpdateStoreData updateStoreData)
        {
            WxJsonResult wxJsonResult = Senparc.Weixin.MP.AdvancedAPIs.PoiApi.UpdatePoi(_accessToken, updateStoreData, 10000);

            if (wxJsonResult.errcode != ReturnCode.请求成功)
            {
                throw new Exception(wxJsonResult.errmsg);
            }
            if (wxJsonResult.errcode == (ReturnCode.获取access_token时AppSecret错误或者access_token无效 | ReturnCode.合法的凭证类型 | ReturnCode.合法的OpenID | ReturnCode.合法的按钮个数1 | ReturnCode.合法的按钮个数2 | ReturnCode.合法的按钮名字长度 | ReturnCode.合法的按钮KEY长度 | ReturnCode.access_token超时 | ReturnCode.refresh_token超时 | ReturnCode.oauth_code超时 | ReturnCode.客服帐号个数超过限制 | ReturnCode.无效头像文件类型invalid_file_type))
            {
                throw new HimallException("暂时不允许修改");
            }
            return(true);
        }
示例#3
0
        public bool UpdatePoi(UpdateStoreData updateStoreData)
        {
            var result = PoiApi.UpdatePoi(this._accessToken, updateStoreData);

            if (result.errcode != 0)
            {
                throw new Exception(result.errmsg);
            }
            else if ((int)result.errcode == 65107)
            {
                throw new HimallException("暂时不允许修改");
            }
            return(true);
        }
示例#4
0
        private void Save()
        {
            StringBuilder  sbLocalImage = new StringBuilder();
            IList <string> list         = new List <string>();
            StoresInfo     storeById    = StoresHelper.GetStoreById(this.storeId);

            if (!storeById.WXState.HasValue)
            {
                this.AddWXStore();
            }
            else if (storeById.WXState.HasValue && storeById.WXState.Value.Equals(WXStoreState.Pass))
            {
                IEnumerable <string> enumerable      = this.BuildImages(sbLocalImage, list);
                UpdateStoreData      updateStoreData = new UpdateStoreData();
                foreach (string item in enumerable)
                {
                    updateStoreData.business.base_info.photo_list.Add(new Store_Photo
                    {
                        photo_url = item
                    });
                }
                updateStoreData.business.base_info.avg_price    = this.txtWXAvgPrice.Text.ToInt(0);
                updateStoreData.business.base_info.introduction = this.txtWXIntroduction.Text.Trim();
                updateStoreData.business.base_info.open_time    = this.txtWXOpenTime.Text.Trim();
                updateStoreData.business.base_info.recommend    = this.txtWXRecommend.Text.Trim();
                updateStoreData.business.base_info.poi_id       = (storeById.WXPoiId.HasValue ? storeById.WXPoiId.Value.ToString() : string.Empty);
                updateStoreData.business.base_info.special      = this.txtWXSpecial.Text.Trim();
                updateStoreData.business.base_info.telephone    = this.txtWXTelephone.Text.Trim();
                WXStoreHelper.UpdateWXStore(updateStoreData);
                storeById.StoreImages = ((list.Count == 0) ? string.Empty : string.Join(",", list.ToArray()));
                StoresHelper.UpdateWXStore(updateStoreData, storeById.StoreId, storeById.StoreImages);
            }
            else
            {
                this.ShowMsg("微信门店审核中不能修改", false);
            }
        }
示例#5
0
        public ActionResult Save(PoiEditModel model)
        {
            string wxPath = "";

            if (!string.IsNullOrEmpty(model.photo_list) && !(model.photo_list.IndexOf("http") >= 0))
            {
                string path = Server.MapPath("~" + model.photo_list);
                wxPath = this._iPoiService.UploadImage(path);
            }


            if (model.id == 0)
            {
                StoreBaseInfo data = new StoreBaseInfo();
                data.sid = Guid.NewGuid().ToString();

                var province = Himall.Application.RegionApplication.GetRegion(model.RegionId, CommonModel.Region.RegionLevel.Province);
                var city     = Himall.Application.RegionApplication.GetRegion(model.RegionId, CommonModel.Region.RegionLevel.City);
                var county   = Himall.Application.RegionApplication.GetRegion(model.RegionId, CommonModel.Region.RegionLevel.County);
                data.province      = province.Name;
                data.city          = city.Name;
                data.district      = county.Name;
                data.address       = model.address;
                data.business_name = model.business_name;
                data.branch_name   = model.branch_name;
                if (string.IsNullOrEmpty(model.categoryTwo))
                {
                    data.categories = new string[] { model.categoryOne };
                }
                else
                {
                    data.categories = new string[] { model.categoryOne + "," + model.categoryTwo };
                }

                data.photo_list = new List <Store_Photo> {
                    new Store_Photo {
                        photo_url = wxPath
                    }
                };
                data.telephone    = model.telephone;
                data.avg_price    = model.avg_price;
                data.open_time    = model.open_time;
                data.offset_type  = 1;
                data.recommend    = model.recommend;
                data.special      = model.special;
                data.longitude    = "0";
                data.latitude     = "0";
                data.introduction = model.introduction;
                CreateStoreData cd = new CreateStoreData();
                cd.business           = new CreateStore_Business();
                cd.business.base_info = data;
                bool result = this._iPoiService.AddPoi(cd);
                return(Json(new
                {
                    success = result
                }));
            }
            else
            {
                UpdateStore_BaseInfo data = new UpdateStore_BaseInfo();
                data.poi_id       = model.poi_id;
                data.telephone    = model.telephone;
                data.recommend    = model.recommend;
                data.special      = model.special;
                data.introduction = model.introduction;
                data.open_time    = model.open_time;
                data.avg_price    = model.avg_price;
                data.photo_list   = new List <Store_Photo> {
                    new Store_Photo {
                        photo_url = wxPath
                    }
                };

                UpdateStoreData ud = new UpdateStoreData();
                ud.business           = new UpdateStore_Business();
                ud.business.base_info = data;
                bool result = this._iPoiService.UpdatePoi(ud);
                return(Json(new
                {
                    success = result
                }));
            }
        }
示例#6
0
        public ActionResult Save(PoiEditModel model)
        {
            string str = "";

            if (!string.IsNullOrEmpty(model.photo_list) && model.photo_list.IndexOf("http") < 0)
            {
                string str1 = Server.MapPath(string.Concat("~", model.photo_list));
                str = _poiService.UploadImage(str1);
            }
            if (model.id != 0)
            {
                UpdateStore_BaseInfo updateStoreBaseInfo = new UpdateStore_BaseInfo()
                {
                    poi_id       = model.poi_id,
                    telephone    = model.telephone,
                    recommend    = model.recommend,
                    special      = model.special,
                    introduction = model.introduction,
                    open_time    = model.open_time,
                    avg_price    = model.avg_price
                };
                List <Store_Photo> storePhotos = new List <Store_Photo>()
                {
                    new Store_Photo()
                    {
                        photo_url = str
                    }
                };
                updateStoreBaseInfo.photo_list = storePhotos;
                UpdateStoreData updateStoreDatum = new UpdateStoreData()
                {
                    business = new UpdateStore_Business()
                    {
                        base_info = updateStoreBaseInfo
                    }
                };
                bool flag = _poiService.UpdatePoi(updateStoreDatum);
                return(Json(new { success = flag }));
            }
            StoreBaseInfo storeBaseInfo = new StoreBaseInfo()
            {
                sid           = Guid.NewGuid().ToString(),
                province      = model.province,
                city          = model.city,
                district      = model.district,
                address       = model.address,
                business_name = model.business_name,
                branch_name   = model.branch_name
            };

            string[] strArrays = new string[] { string.Concat(model.categoryOne, ",", model.categoryTwo) };
            storeBaseInfo.categories = strArrays;
            List <Store_Photo> storePhotos1 = new List <Store_Photo>()
            {
                new Store_Photo()
                {
                    photo_url = str
                }
            };

            storeBaseInfo.photo_list   = storePhotos1;
            storeBaseInfo.telephone    = model.telephone;
            storeBaseInfo.avg_price    = model.avg_price;
            storeBaseInfo.open_time    = model.open_time;
            storeBaseInfo.offset_type  = 1;
            storeBaseInfo.recommend    = model.recommend;
            storeBaseInfo.special      = model.special;
            storeBaseInfo.longitude    = "0";
            storeBaseInfo.latitude     = "0";
            storeBaseInfo.introduction = model.introduction;
            CreateStoreData createStoreDatum = new CreateStoreData()
            {
                business = new CreateStore_Business()
                {
                    base_info = storeBaseInfo
                }
            };
            bool flag1 = _poiService.AddPoi(createStoreDatum);

            return(Json(new { success = flag1 }));
        }
示例#7
0
        /// <summary>
        /// 【异步方法】修改门店服务信息
        /// </summary>
        /// <param name="accessTokenOrAppId"></param>
        /// <param name="updateStoreData">修改门店服务信息需要Post的数据</param>
        /// 商户可以通过该接口,修改门店的服务信息,包括:图片列表、营业时间、推荐、特色服务、简介、人均价格、电话7 个字段。目前基础字段包括(名称、坐标、地址等不可修改)
        /// 若有填写内容则为覆盖更新,若无内容则视为不修改,维持原有内容。
        /// photo_list 字段为全列表覆盖,若需要增加图片,需将之前图片同样放入list 中,在其后增加新增图片。如:已有A、B、C 三张图片,又要增加D、E 两张图,则需要调用该接口,photo_list 传入A、B、C、D、E 五张图片的链接。
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static async Task <WxJsonResult> UpdatePoiAsync(string accessTokenOrAppId, UpdateStoreData updateStoreData, int timeOut = Config.TIME_OUT)
        {
            return(await ApiHandlerWapper.TryCommonApiAsync(accessToken =>
            {
                var url = string.Format("https://api.weixin.qq.com/cgi-bin/poi/updatepoi?access_token={0}", accessToken.AsUrlData());

                return Core.CommonAPIs.CommonJsonSend.SendAsync <WxJsonResult>(null, url, updateStoreData, CommonJsonSendType.POST, timeOut);
            }, accessTokenOrAppId));
        }
示例#8
0
 public static WxJsonResult UpdateWXStore(UpdateStoreData updateStoreData)
 {
     return(PoiApi.UpdatePoi(WXStoreHelper.siteSettings.WeixinAppId, updateStoreData, 10000));
 }