def shopwindowlist(self, shopWindowId, shopId, offset, pageSize): """ V1.2.0 橱窗全部商品 :param shopWindowId:加密的橱窗id :param shopId:加密的店铺id :param offset: :param pageSize: :return: """ url = '%s/webapi/customer/shop/window/list' % self.env.http_base_url params = { "shopWindowId": encryption.id_encry(shopWindowId), "shopId": encryption.id_encry(shopId), "offset": offset, "pageSize": pageSize } # content_type = "application/x-www-form-urlencoded" content_type = "application/json" headers = self.header.http_header(params, content_type) self.log.debug(headers) res = requests.post(url=url, data=json.dumps(params), headers=headers).content res_json = json.loads(res) self.log.debug(res_json) return res_json
def pageinit(self, roomId): """ 主播进房页面初始化 :param roomid: :return: """ url = '%s/webapi/liveroom/customer/room/pageInit' % self.env.http_base_url params = {"roomId": encryption.id_encry(roomId)} content_type = "application/x-www-form-urlencoded" # content_type = "application/json" headers = self.header.http_header(params, content_type) self.log.debug(headers) res = requests.get(url=url, params=params, headers=headers).content res_json = json.loads(res) self.log.debug(res_json) return res_json
def book(self,roomId): """ 用户订阅直播 :param roomId: :return: """ url = '%s/webapi/liveroom/customer/user/booked' % self.env.http_base_url params = { "roomId":encryption.id_encry(roomId) } content_type = "application/x-www-form-urlencoded" # content_type = "application/json" headers = self.header.http_header(params,content_type) self.log.debug(headers) res = requests.post(url=url, data=params, headers=headers).content res_json = json.loads(res) self.log.debug(res_json) return res_json
def updateDefaultAddress(self, addressId): """ 修改用户默认收货地址 :param addressId: :return: """ url = '%s/webapi/customer/address/updateDefaultAddress' % self.env.http_base_url params = { "addressId": encryption.id_encry(addressId), } content_type = "application/x-www-form-urlencoded" # content_type = "application/json" headers = self.header.http_header(params, content_type) self.log.debug(headers) res = requests.get(url=url, params=params, headers=headers).content res_json = json.loads(res) self.log.debug(res_json) return res_json
def shopcommodityinfo(self, shopId, commodityCode): """ C端用户首页商品详情页面 :param roomId: :param shopId: :param commodityCode: :return: """ url = '%s/webapi/commonModule/commodity/info' % self.env.http_base_url params = { "shopId": encryption.id_encry(shopId), "commodityCode": commodityCode } content_type = "application/x-www-form-urlencoded" # content_type = "application/json" headers = self.header.http_header(params, content_type) self.log.debug(headers) res = requests.get(url=url, params=params, headers=headers).content res_json = json.loads(res) self.log.debug(res_json) return res_json
def shopplanList(self,offset,pageSize,shopid): """ 直播预告(一个店铺下的直播预告列表) :param offset: :param pageSize: :return: """ url = '%s/webapi/liveroom/customer/plan/shop/live/list/%s' % (self.env.http_base_url,encryption.id_encry(shopid)) params = { "offset":offset, "pageSize":pageSize } # content_type = "application/x-www-form-urlencoded" content_type = "application/json" headers = self.header.http_header(params,content_type) self.log.debug(headers) res = requests.get(url=url, data=json.dumps(params), headers=headers).content res_json = json.loads(res) self.log.debug(res_json) return res_json
def shoppagequery(self, shopId): """ 店铺主页 "section": { "LIVE": { "show": "bool,是否展示,true:展示,false可以不传" }, "LIVE_V2": { "show": "bool,是否展示,true:展示,false可以不传" }, "LIVE_PLAN": { "show": "bool,是否展示,true:展示,false可以不传"}, "COMMODITY_TYPE": { "show": "bool,是否展示,true:展示,false可以不传"}, "BASE_INFO": { "show": "bool,是否展示,true:展示,false可以不传" }, "COMMODITY": { "offset": "int,偏移量", "show": "bool,是否展示,true:展示,false可以不传", "needTotalSize": "bool,是否需要总条数,true:要", "pageSize": "init,分页展示数量", "commodityTypeId": "string,商品分类id,默认不传获取全部" }, "SHOP_WINDOW": { "show": "bool,是否展示,true:展示,false可以不传" }}, "shopId": "string,店铺id" """ url = '%s/webapi/customer/shop/page/query' % self.env.http_base_url params = { "section": { "LIVE": { "show": True }, "LIVE_V2": { "show": True }, "LIVE_PLAN": { "show": True }, "COMMODITY_TYPE": { "show": True }, "BASE_INFO": { "show": True }, "COMMODITY": { "offset": 0, "show": True, "needTotalSize": True, "pageSize": 20 }, "SHOP_WINDOW": { "show": True } }, "shopId": encryption.id_encry(shopId) } # content_type = "application/x-www-form-urlencoded" content_type = "application/json" headers = self.header.http_header(params, content_type) self.log.debug(headers) res = requests.post(url=url, data=json.dumps(params), headers=headers).content res_json = json.loads(res) self.log.debug(res_json) return res_json