| | |
| | | * @param [type] $goods_sign 商品sign |
| | | * @return void |
| | | */ |
| | | public function getGoodsDetail($goods_sign,$is_browse = true) |
| | | public function getGoodsDetail($goods_sign,$is_browse = true,$relationid='') |
| | | { |
| | | $params = [ |
| | | 'goods_sign' => $goods_sign |
| | | ]; |
| | | if(!empty($relationid)) |
| | | { |
| | | $params['custom_parameters']='{"uid":"'.$relationid.'"}'; |
| | | if(!empty(MOBILE_INFO)){ |
| | | $params['pid'] = MOBILE_INFO == "IOS" ? $this->config['ios_pid'] : $this->config['android_pid']; |
| | | }else{ |
| | | return []; |
| | | } |
| | | } |
| | | $send_data = $this->makeSign($params,self::request_url['goods_detail_url']); |
| | | $result = send_get(self::base_url,$send_data); |
| | | if(empty($result)) fault('数据获取失败'); |
| | | if(isset($result['error_response']) && !empty($result['error_response'])) fault('数据获取失败(-1)'); |
| | | //if(isset($result['error_response']) && !empty($result['error_response'])) fault('数据获取失败(-1)'); |
| | | if(isset($result['error_response']) && !empty($result['error_response'])) return []; |
| | | $goods = isset($result['goods_detail_response']['goods_details'][0]) ? $result['goods_detail_response']['goods_details'][0] : []; |
| | | $goods = $this->initGoods($goods); |
| | | if($is_browse)self::browseLog($goods); |
| | |
| | | * @param mixed $sort_type 排序方式:0-综合排序;1-按佣金比率升序;2-按佣金比例降序;3-按价格升序;4-按价格降序;5-按销量升序;6-按销量降序;7-优惠券金额排序升序;8-优惠券金额排序降序;9-券后价升序排序;10-券后价降序排序;11-按照加入多多进宝时间升序;12-按照加入多多进宝时间降序;13-按佣金金额升序排序;14-按佣金金额降序排序;15-店铺描述评分升序;16-店铺描述评分降序;17-店铺物流评分升序;18-店铺物流评分降序;19-店铺服务评分升序;20-店铺服务评分降序;27-描述评分击败同类店铺百分比升序,28-描述评分击败同类店铺百分比降序,29-物流评分击败同类店铺百分比升序,30-物流评分击败同类店铺百分比降序,31-服务评分击败同类店铺百分比升序,32-服务评分击败同类店铺百分比降序 |
| | | * @return void |
| | | */ |
| | | public function searchGoods($keyword='',$opt_id='',$common_relation_id,$with_coupon = '',$page,$pageSize,$sort_type = 0) |
| | | public function searchGoods($keyword='',$opt_id='',$common_relation_id,$with_coupon = '',$page,$pageSize,$sort_type = 0,$cat_id='') |
| | | { |
| | | $params = [ |
| | | 'keyword' => $keyword, |
| | | 'opt_id' => $opt_id, |
| | | 'limit' => $pageSize, |
| | | 'page_size' => $pageSize, |
| | | 'custom_parameters' => '{"uid":"'.$common_relation_id.'"}', |
| | | 'with_coupon' => empty($with_coupon) ? '' : ($with_coupon == 1 ? "true" : "false"), |
| | | 'page' => $page, |
| | | 'sort_type' => $sort_type, |
| | | 'cat_id' => $cat_id |
| | | |
| | | ]; |
| | | if(!empty(MOBILE_INFO)){ |
| | |
| | | } |
| | | $send_data = $this->makeSign($params,self::request_url['search_goods_url']); |
| | | $result = send_get(self::base_url,$send_data); |
| | | if(empty($result) || isset($result['error_response'])) fault('数据获取失败'); |
| | | if(empty($result) || isset($result['error_response'])) return []; //fault('数据获取失败'); |
| | | $list = $result['goods_search_response']['goods_list']; |
| | | if(!empty($list)){ |
| | | $tmp = []; |
| | |
| | | $init_goods['isCollect'] = self::isCollect($init_goods); |
| | | $init_goods['fanli'] = self::rebate($init_goods["actualPrice"],$goods['promotion_rate']/1000); |
| | | $init_goods['topFanli'] = self::rebate($init_goods['actualPrice'],$goods['promotion_rate']/1000,self::$topFanliRate); |
| | | //新增商品类目ID--byhyt |
| | | $init_goods['cid'] = isset($goods['cat_ids'][0]) ? $goods['cat_ids'][0] : ''; |
| | | return $init_goods; |
| | | } |
| | | |