<?php
|
|
namespace app\api\controller;
|
|
use app\common\controller\Api;
|
use app\api\logic\Category as LogicCategory;
|
use app\api\logic\SuperClass as LogicSuperClass;
|
use app\api\logic\Homemenu as LogicHomemenu;
|
use app\api\logic\TalentInfo as LogicTalentInfo;
|
use app\api\logic\taoke\device\Dataoke as LogicDataoke;
|
use app\api\logic\taoke\device\Haodanku as LogicHaodanku;
|
use app\api\logic\taoke\device\Taobaolianmeng as LogicTaobaolianmeng;
|
use app\api\logic\taoke\device\Jd as LogicJd;
|
use app\api\logic\taoke\device\Pdd as LogicPdd;
|
use app\api\logic\taoke\device\Dingdanxia as LogicDingdanxia;
|
use app\api\logic\taoke\device\Jutuike as LogicJutuike;
|
use app\api\logic\taoke\device\Zhetaoke as LogicZhetaoke;
|
use app\api\logic\Singlepage as LogicSinglepage;
|
use app\api\logic\taoke\Search as LogicSearch;
|
use app\common\model\User as ModelUser;
|
use app\api\logic\Album as LogicAlbum;
|
use app\api\logic\AlbumFollow as LogicAlbumFollow;
|
use app\api\logic\Banner as LogicBanner;
|
use think\log;
|
|
/**
|
* 淘客接口
|
*/
|
class Taoke extends Api
|
{
|
protected $noNeedLogin = ['get_hdk_category_list','get_top_class','get_m','get_super_class','get_homemenu','getMQD','get_goods_things','get_talent_info','get_talent_article','get_goods_details','get_similar_info','hot_key','get_jd_detail','get_pdd_single_page','get_wph_detail','suggestion','goods_search','bd_homemenu','city_cate','searchd_deals','seckill_list','identify_goods','tb_goods_list','super_discount_goods','cate_rank_list','get_album_list','like_album','album_detail','get_dy_detail'];
|
protected $noNeedRight = '*';
|
|
|
/**
|
* 获取顶部导航栏
|
*
|
* @return void
|
*/
|
public function get_top_class()
|
{
|
$ctype = request()->param('ctype');
|
if(empty($ctype)) $this->error('获取类型错误');
|
$parentId = request()->param('parentId',0);
|
$LogicCategory = new LogicCategory();
|
$list = $LogicCategory->getList($ctype, $parentId);
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
public function ele_store_list()
|
{
|
$longitude = request()->param('longitude','');
|
$latitude = request()->param('latitude','');
|
$pageSize = request()->param('pageSize','20');
|
$sessionId = request()->param('sessionId','');
|
|
if(empty($longitude) || empty($latitude)) $this->error('位置信息错误');
|
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
|
$LogicJutuike = new LogicJutuike();
|
|
$info = $LogicJutuike->getEleStoreList($longitude,$latitude,$common_relation_id,$pageSize,$sessionId);
|
|
if($info === false) $this->error($LogicJutuike->getError());
|
|
$this->success('获取成功',$info);
|
}
|
|
/**
|
* 获取好单库单页类目列表
|
*
|
*
|
*/
|
public function get_hdk_category_list()
|
{
|
$type = request()->param('type',4);
|
$LogicHaodanku=new LogicHaodanku();
|
$list=$LogicHaodanku->getCateList($type);
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
/**
|
* 获取超级分类
|
*
|
* @return void
|
*/
|
public function get_super_class()
|
{
|
$LogicSuperClass = new LogicSuperClass();
|
$list = $LogicSuperClass->getList();
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
/**
|
* 获取朋友圈素材
|
*
|
* @return void
|
*/
|
public function friends_circle_list()
|
{
|
$page = request()->param('pageId');
|
$pageSize = request()->param('pageSize');
|
$cid = request()->param('cid');
|
$sort = request()->param('sort');
|
$LogicDataoke = new LogicDataoke();
|
$list = $LogicDataoke->getFriendscircles($page,$pageSize,$cid,$sort);
|
$this->success('获取成功',['list'=>$list]);
|
|
}
|
|
|
/**
|
* 获取金刚区
|
*
|
* @return void
|
*/
|
public function get_homemenu()
|
{
|
$type = request()->param('type',1);
|
if(empty($type)) $this->error('获取类型错误');
|
$LogicHomemenu = new LogicHomemenu();
|
$list = $LogicHomemenu->getList($type,1);
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 热搜榜单
|
*
|
* @return void
|
*/
|
public function getMQD()
|
{
|
$LogicDataoke = new LogicDataoke();
|
|
$phb = $LogicDataoke->getRank(1,'',1,10);
|
|
$LogicHaodanku = new LogicHaodanku();
|
|
$zdm = $LogicHaodanku->getDeserveItem();
|
|
$dygoods = $LogicHaodanku->getDhgoodsList(0,1,1,10);
|
|
$data = [
|
'phb' => $phb ? $phb : [],
|
'zdm' => $zdm ? $zdm : [],
|
'dygoods' => $dygoods ? $dygoods : [],
|
];
|
$this->success('获取成功',$data);
|
|
}
|
|
/**
|
* 热销榜和限时秒杀
|
*
|
* @return void
|
*/
|
public function get_m()
|
{
|
$LogicDataoke = new LogicDataoke();
|
$rank = $LogicDataoke->getRank(1,'',1,10);
|
$ddpGoods = $LogicDataoke->getDdqGoods();
|
$data = [
|
'fqbGoods' => array_slice($rank,0,2),
|
'ddqGoods' => array_slice($ddpGoods['list'],0,2),
|
'ddqTime' => $ddpGoods['ddqTime'],
|
'fqbUrl' => config('site.fqbUrl'),
|
'ddqUrl' => config('site.ddqUrl')
|
];
|
$this->success('获取成功',$data);
|
}
|
|
|
public function get_goods_things(){
|
$type = request()->param('type',1);
|
$page = request()->param('pageId',1);
|
$page_size = request()->param('pageSize',10);
|
$deviceValue = request()->param('deviceValue','');
|
$deviceType = request()->param('deviceType','');
|
$list = [];
|
switch($type){
|
case 1: //淘宝联盟
|
$LogicTaobaolianmeng = new LogicTaobaolianmeng();
|
$list = $LogicTaobaolianmeng->material('6708',$deviceValue,$deviceType,$page,$page_size);
|
break;
|
case 2: //京东
|
$LogicJd = new LogicJd();
|
$list = $LogicJd->getTodayTop('discountReal',$page,$page_size);
|
break;
|
case 3: //拼多多
|
$LogicPdd = new LogicPdd();
|
$list = $LogicPdd->dailyExplosion('','[7,10851]',4,$page,$page_size);
|
$list = isset($list['list']) ? $list['list'] : [];
|
break;
|
case 4: //唯品会
|
$LogicDingdanxia = new LogicDingdanxia();
|
$list = $LogicDingdanxia->wphGoodsList('',1,$page,$page_size,0);
|
break;
|
case 5: //热推榜
|
$LogicDataoke = new LogicDataoke();
|
$list = $LogicDataoke->getRank(8,'',$page,$page_size);
|
//$list = $LogicDingdanxia->wphGoodsList('',1,$page,$page_size,0);
|
break;
|
case 6: //抖音
|
$LogicHaodanku = new LogicHaodanku();
|
$list = $LogicHaodanku->getDygoodsList('','','',$page,$page_size);
|
break;
|
}
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
|
/**
|
* 获取达人说列表
|
*
|
* @return void
|
*/
|
public function get_talent_info()
|
{
|
$talentcat = request()->param('talentcat',0);
|
|
$LogicTalentInfo = new LogicTalentInfo();
|
|
$list = $LogicTalentInfo->getList($talentcat);
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 获取达人说详情
|
*
|
* @return void
|
*/
|
public function get_talent_article()
|
{
|
$id = request()->param('id','');
|
|
if(empty($id)) $this->error('参数错误');
|
|
$LogicTalentInfo = new LogicTalentInfo();
|
|
$info = $LogicTalentInfo->getDetail($id);
|
|
$this->success('获取成功',['info'=>$info]);
|
}
|
|
|
/**
|
* 获取淘宝商品详情
|
*
|
* @return void
|
*/
|
public function get_goods_details()
|
{
|
$goods_id = request()->param('goodsId','');
|
|
if(empty($goods_id)) $this->error('商品id不能为空');
|
|
$LogicDataoke = new LogicDataoke();
|
|
$info = $LogicDataoke->getGoodsDetail($goods_id);
|
|
if($info === false) $this->error($LogicDataoke->getError());
|
|
$this->success('获取成功',['info'=>$info]);
|
}
|
|
/**
|
* 获取抖音商品详情
|
*
|
* @return void
|
*/
|
public function get_dy_detail()
|
{
|
$goods_id = request()->param('goodsId','');
|
|
if(empty($goods_id)) $this->error('商品id不能为空');
|
|
$LogicHaodanku = new LogicHaodanku();
|
|
$info = $LogicHaodanku->getDyGoodsDetail($goods_id);
|
|
if($info === false) $this->error($LogicHaodanku->getError());
|
|
$this->success('获取成功',['info'=>$info]);
|
}
|
|
|
/**
|
* 高佣转链
|
*/
|
public function get_privilege_link()
|
{
|
$goods_id = request()->param('goodsId','');
|
if(empty($goods_id)) $this->error('商品id不能为空');
|
$type = request()->param('type',0);
|
$user = $this->auth->getUser();
|
$common_relation_id = $user['common_relation_id'];
|
switch($type){
|
case 0: //淘宝联盟
|
$LogicDataoke = new LogicDataoke();
|
$info = $LogicDataoke->getPrivilegeLlink($goods_id,$user['t_relation_id']);
|
break;
|
case 1: //京东
|
$LogicJd = new LogicJd();
|
$info = $LogicJd->getPrivilegeLlink($goods_id,$common_relation_id);
|
break;
|
case 2: //拼多多
|
$LogicPdd = new LogicPdd();
|
$info = $LogicPdd->goodsGenerate($common_relation_id,$goods_id);
|
break;
|
case 3: //唯品会
|
$LogicDingdanxia = new LogicDingdanxia();
|
$info = $LogicDingdanxia->idPrivilege($goods_id,$common_relation_id);
|
break;
|
case 4: //抖音
|
$LogicHaodanku = new LogicHaodanku();
|
$info = $LogicHaodanku->idPrivilege($goods_id,$common_relation_id);
|
if(!empty($info['dy_zlink']))
|
{
|
$info['dy_deeplink'] = $info['dy_zlink'];
|
}
|
else{
|
$info['dy_zlink']=$info['detail_url'];
|
}
|
|
break;
|
}
|
|
if($info === false) $this->error('转链失败');
|
|
$this->success('获取成功',['info'=>$info]);
|
}
|
|
|
/**
|
* 获取相似商品
|
*/
|
public function get_similar_info()
|
{
|
$goods_id = request()->param('goodsId','');
|
|
if(empty($goods_id)) $this->error('商品id不能为空');
|
|
// $LogicHaodanku = new LogicHaodanku();
|
|
// $list = $LogicHaodanku->getSimilarInfo($goods_id,10);
|
|
$LogicDataoke=new LogicDataoke();
|
$list=$LogicDataoke->getSimilarInfo($goods_id,10);
|
|
|
if($list === false) $this->error($LogicHaodanku->getError());
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 获取京东详情
|
*
|
* @return void
|
*/
|
public function get_jd_detail()
|
{
|
$goods_id = request()->param('goodsId','');
|
|
if(empty($goods_id)) $this->error('商品id不能为空');
|
|
$goods = request()->param('goods','');
|
|
if(empty($goods)) $this->error('商品参数不能为空');
|
|
$goods = json_decode(htmlspecialchars_decode($goods),true);
|
|
$LogicJd = new LogicJd();
|
|
$info = $LogicJd->getGoodsDetail($goods_id,$goods);
|
|
if($info === false) $this->error($LogicJd->getError());
|
|
$this->success('获取成功',$info);
|
}
|
|
|
/**
|
* 获取拼多多商品详情
|
*
|
* @return void
|
*/
|
public function get_pdd_detail()
|
{
|
$goods_sign = request()->param('goods_sign','');
|
|
if(empty($goods_sign)) $this->error('商品sign不能为空');
|
|
$LogicPdd = new LogicPdd();
|
$ModelUser = new ModelUser();
|
$user = $ModelUser->get(USERID);
|
$info = $LogicPdd->getGoodsDetail($goods_sign,true,$user['common_relation_id']);
|
|
if($info === false) $this->error($LogicPdd->getError());
|
|
$this->success('获取成功',$info);
|
|
}
|
|
/**
|
* 获取唯品会商品详情
|
*
|
* @return void
|
*/
|
public function get_wph_detail()
|
{
|
$goodsId = request()->param('goodsId','');
|
|
if(empty($goodsId)) $this->error('商品id不能为空');
|
|
$LogicDingdanxia = new LogicDingdanxia();
|
|
$info = $LogicDingdanxia->getWphGoodsDetail($goodsId);
|
|
if($info === false) $this->error($LogicDingdanxia->getError());
|
|
$this->success('获取成功',$info);
|
|
}
|
|
/**
|
* 热词
|
*
|
* @return void
|
*/
|
public function hot_key()
|
{
|
$page = request()->param('page','1');
|
|
$page_size = request()->param('pageSize',10);
|
|
$LogicHaodanku = new LogicHaodanku();
|
|
$list = $LogicHaodanku->getHotKey($page,$page_size);
|
|
if($list === false) $this->error($LogicHaodanku->getError());
|
|
$this->success('获取成功',$list);
|
}
|
|
|
/**
|
* 获取联想词
|
*
|
* @return void
|
*/
|
public function suggestion()
|
{
|
$keyword = request()->param('keyword','','trim');
|
|
if(empty($keyword)) $this->error('请输入关键词');
|
|
$LogicDataoke = new LogicDataoke();
|
|
$list = $LogicDataoke->getSuggestion($keyword);
|
|
if($list === false) $this->error($LogicDataoke->getError());
|
|
$this->success('获取成功',$list);
|
}
|
|
|
/**
|
* 活动转链
|
*
|
* @return void
|
*/
|
public function activity_link()
|
{
|
$promotionSceneId = request()->param('promotionSceneId');
|
|
if(empty($promotionSceneId)) $this->error('请输入活动ID');
|
|
$LogicDataoke = new LogicDataoke();
|
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
|
$info = $LogicDataoke->acrivityLink($promotionSceneId,$common_relation_id);
|
|
if($info === false) $this->error($LogicDataoke->getError());
|
|
$this->success('获取成功',$info);
|
}
|
|
|
/**
|
* 超级搜索
|
*
|
* @return void
|
*/
|
public function goods_search()
|
{
|
$type = request()->param('type','');
|
$page = request()->param('pageId',1);
|
$page_size = request()->param('pageSize',10);
|
$keyword = request()->param('keyword','','trim');
|
$sort = request()->param('sort','');
|
$owner = request()->param('owner','');
|
$isCoupon = request()->param('selectCoupon','');
|
|
$list = [];
|
if((boolean)config('site.iosExamine') && APP_VERSION == config('site.IosExamineV') && MOBILE_INFO == 'IOS') $this->success('获取成功',['list'=>$list]);
|
switch($type){
|
case 'tb': //淘宝联盟
|
$LogicDataoke = new LogicDataoke();
|
$list = $LogicDataoke->superSearch($keyword,$page,$page_size,$sort);
|
break;
|
case 'jd': //京东
|
$LogicJd = new LogicJd();
|
$sortName = "inOrderCount30Days";
|
$sortType = 'desc';
|
if(!empty($sort)){
|
if($sort != 'renqi'){
|
$sort = explode("_",$sort);
|
if(count($sort) == 2){ //价格
|
$sortName = "price";
|
$sortType = $sort[1];
|
}else if(count($sort) == 3){ //销量
|
$sortType = $sort[2];
|
}
|
}
|
}
|
$list = $LogicJd->searchGoods($keyword,$sortType,$owner,$isCoupon,$sortName,$page,$page_size);
|
break;
|
case 'pdd': //拼多多
|
if(!$this->auth->isLogin()){
|
$this->error('请先登录',[],401);
|
}
|
$sort_type = 0;
|
if($sort != 'renqi'){
|
$sort = explode("_",$sort);
|
if(count($sort) == 2){ //价格
|
$sortName = "price";
|
$sort_type = $sort[1] == "asc" ? 3 : 4;
|
}else if(count($sort) == 3){ //销量
|
$sort_type = 6;
|
}
|
}else{
|
$sort_type = 6;
|
}
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
$LogicPdd = new LogicPdd();
|
$list = $LogicPdd->searchGoods($keyword,'',$common_relation_id,$isCoupon,$page,$page_size,$sort_type);
|
break;
|
case 'wph': //唯品会
|
$fieldName= '';
|
$order = '';
|
if($sort != 'renqi'){
|
$sort = explode("_",$sort);
|
if(count($sort) == 2){ //价格
|
$fieldName = "PRICE";
|
$order = $sort[1] == "asc" ? 0 : 1;
|
}else if(count($sort) == 3){ //销量
|
$fieldName ='SALES';
|
$order = $sort[1] == "asc" ? 0 : 1;
|
}
|
}
|
$LogicDingdanxia = new LogicDingdanxia();
|
$list = $LogicDingdanxia->searchGoods($keyword,$fieldName,$order,$page,$page_size,'wph','w');
|
break;
|
case 'dy':
|
$sort_type = 0;
|
$catId = request()->param('catid','');
|
if($sort != 'renqi'){
|
$sort = explode("_",$sort);
|
if(count($sort) == 2){ //价格
|
$sort_type = $sort[1] == "asc" ? 4 : 3;
|
}else if(count($sort) == 3){ //销量
|
$sort_type = $sort[1] == "asc" ? 2 : 1;
|
}
|
}
|
$LogicHaodanku = new LogicHaodanku();
|
$list = $LogicHaodanku->getDygoodsList($catId,$keyword,$sort_type,$page,$page_size);
|
break;
|
|
}
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 统一活动转链
|
*
|
* @return void
|
*/
|
public function union_act()
|
{
|
$act_id = request()->param('jtk_act_id','');
|
|
if(empty($act_id)) $this->error('活动id不能为空');
|
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
|
$LogicJutuike = new LogicJutuike();
|
|
$info = $LogicJutuike->unionAact($act_id,$common_relation_id);
|
|
if($info === false) $this->error($LogicJutuike->getError());
|
|
$this->success('获取成功',$info);
|
}
|
|
|
/**
|
* 单页面
|
*/
|
public function single_page(){
|
|
$template_id = request()->param('template_id','');
|
|
if(empty($template_id)) $this->error('单页面id不能为空');
|
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
|
$LogicHaodanku = new LogicHaodanku();
|
|
$info = $LogicHaodanku->getSinglePage($template_id,$common_relation_id);
|
|
$this->success('获取成功',$info);
|
}
|
|
|
/**
|
* 查询pdd是否授权
|
*
|
* @return void
|
*/
|
public function check_pdd_auth()
|
{
|
$LogicPdd = new LogicPdd();
|
|
$info = $LogicPdd->authority();
|
|
if($info === false) $this->error($LogicPdd->getError());
|
|
$this->success('获取成功',$info);
|
}
|
|
|
|
/**
|
* 获取pdd授权参数
|
*/
|
public function get_pdd_auth()
|
{
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
|
$LogicPdd = new LogicPdd();
|
|
$info = $LogicPdd->generate($common_relation_id,10);
|
|
if($info === false) $this->error($LogicPdd->getError());
|
|
$this->success('获取成功',$info);
|
}
|
|
|
/**
|
* 9.9包邮专区
|
*
|
* @return void
|
*/
|
public function get_nine_goods()
|
{
|
$nineCid = request()->param('nineCid','');
|
|
$page = request()->param('page',1);
|
|
$page_size = request()->param('pageSize',10);
|
|
$plat=request()->param('plat','tb');
|
|
if($plat=='tb'&&empty($nineCid)) $this->error('类目id不能为空');
|
|
$LogicDataoke = new LogicDataoke();
|
$list=null;
|
switch($plat)
|
{
|
case 'tb':
|
$list = $LogicDataoke->getOpGoodsList($nineCid,$page,$page_size);
|
break;
|
case 'jd':
|
$list = $LogicDataoke->jdNine($page,$page_size);
|
break;
|
default:
|
$list = $LogicDataoke->getOpGoodsList($nineCid,$page,$page_size);
|
break;
|
}
|
if($list === false) $this->error($LogicDataoke->getError());
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 获取京东商品列表
|
*
|
* @return void
|
*/
|
public function jd_goods_list()
|
{
|
$goodsType = request()->param('goodsType','');
|
|
$page = request()->param('page',1);
|
|
$page_size = request()->param('pageSize',10);
|
|
$LogicJd = new LogicJd();
|
|
$list = $LogicJd->getGoodsList($goodsType,$page,$page_size);
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 辣妈优选
|
*/
|
public function optimus_material()
|
{
|
$material_id = request()->param('materialId','');
|
|
$page = request()->param('page',1);
|
|
$page_size = request()->param('pageSize',10);
|
|
$LogicTaobaolianmeng = new LogicTaobaolianmeng();
|
|
$list = $LogicTaobaolianmeng->material($material_id,'','',$page,$page_size);
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* pdd商品列表
|
*
|
* @return void
|
*/
|
public function pdd_goods_list()
|
{
|
$catId = request()->param('catId','');
|
|
$page = request()->param('page',1);
|
|
$page_size = request()->param('pageSize',10);
|
|
$LogicPdd = new LogicPdd();
|
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
|
$LogicPdd = new LogicPdd();
|
|
$list = $LogicPdd->searchGoods('',$catId,$common_relation_id,'',$page,$page_size,'');
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
/**
|
* 细分类目榜
|
*
|
* @return void
|
*/
|
public function cate_rank_list()
|
{
|
$subdivisionId = request()->param('subdivisionId','');
|
|
if(empty($subdivisionId)) $this->error('细分类目id不能为空');
|
|
$LogicDataoke = new LogicDataoke();
|
|
$list = $LogicDataoke->getRankList($subdivisionId);
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 品牌列表
|
*/
|
public function brand_list()
|
{
|
$brandcat = request()->param('brandcat');
|
|
$page = request()->param('page',1);
|
|
$page_size = request()->param('pageSize',10);
|
|
$LogicHaodanku = new LogicHaodanku();
|
|
$list = $LogicHaodanku->getBrandAndGoods($brandcat,$page,$page_size);
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 获取品牌详情
|
*
|
* @return void
|
*/
|
public function brand_info()
|
{
|
$page = request()->param('page',1);
|
|
$pageSize = request()->param('pageSize',10);
|
|
$brand_id = request()->param('brand_id','');
|
|
if(empty($brand_id)) $this->error('参数错误');
|
|
$LogicHaodanku = new LogicHaodanku();
|
|
$info = $LogicHaodanku->getBrandInfo($brand_id,$page,$pageSize);
|
|
if($info === false) $this->error($LogicHaodanku->getError());
|
|
$this->success('获取成功',['info'=>$info]);
|
}
|
|
|
/**
|
* 唯品会商品列表
|
*
|
* @return void
|
*/
|
public function wph_goods_list()
|
{
|
$page = request()->param('page',1);
|
|
$pageSize = request()->param('pageSize',10);
|
|
$cate = request()->param('cate','');
|
|
$LogicDingdanxia = new LogicDingdanxia();
|
|
$list = $LogicDingdanxia->wphGoodsList($cate,1,$page,$pageSize);
|
|
if($list === false) $this->error($LogicDingdanxia->getError());
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 美团联盟外卖/闪购/酒店/优选红包活动转链接口
|
*
|
* @return void
|
*/
|
public function meituan_act()
|
{
|
$type = request()->param('type');
|
|
$LogicJutuike = new LogicJutuike();
|
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
|
$info = $LogicJutuike->meituanAct($type,$common_relation_id);
|
|
if($info === false) $this->error($LogicJutuike->getError());
|
|
$this->success('获取成功',['info'=>$info]);
|
}
|
|
/**
|
* 饿了么外卖/生鲜红包活动转链接口
|
*
|
* @return void
|
*/
|
public function ele_act()
|
{
|
$type = request()->param('type');
|
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
$LogicJutuike = new LogicJutuike();
|
|
$info = $LogicJutuike->unionAact($type,$common_relation_id);
|
|
if($info === false) $this->error($LogicJutuike->getError());
|
|
/*---兼容客户端----*/
|
$info['wx_qrcode_url'] = $info['we_app_info']['miniCode'];
|
$info['app_id'] = $info['original_id'];
|
$info['wx_miniprogram_path'] = $info['we_app_info']['page_path'];
|
$info['click_url'] = $info['h5'];
|
|
$this->success('获取成功',['info'=>$info]);
|
}
|
|
|
/**
|
* 饿了么赏金模式
|
*
|
* @return void
|
*/
|
public function ele_shangjin()
|
{
|
$this->success('获取成功',config('site.shangjin'));
|
}
|
|
|
/**
|
* 单页活动
|
*
|
* @return void
|
*/
|
public function activity_single()
|
{
|
$type = request()->param('type');
|
|
$page = request()->param('page',1);
|
|
$page_size = request()->param('pageSize',10);
|
|
$LogicSinglepage = new LogicSinglepage();
|
|
$list = $LogicSinglepage->getList($type,$page,$page_size);
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 获取本地生活金刚区
|
*
|
* @return void
|
*/
|
public function bd_homemenu()
|
{
|
$LogicHomemenu = new LogicHomemenu();
|
$list = $LogicHomemenu->getList('3','');
|
$return_data = [
|
'bottomHomeMenu' => [],
|
'topHomeMenu' => [],
|
];
|
if(!empty($list)){
|
foreach($list as $key => $value){
|
if($value['is_top'] == 1){
|
$return_data['topHomeMenu'][] = $value;
|
}else{
|
$return_data['bottomHomeMenu'][] = $value;
|
}
|
}
|
}
|
$this->success('操作成功',['list' => $return_data]);
|
}
|
|
|
/**
|
* 获取对应城市的类目
|
*
|
* @return void
|
*/
|
public function city_cate()
|
{
|
$cityId = request()->param('cityId','');
|
|
if(empty($cityId)) $this->error('城市id不能为空');
|
|
$cateId = request()->param('cateId','');
|
|
$LogicJutuike = new LogicJutuike();
|
|
$list = $LogicJutuike->getCityCategories($cityId,$cateId);
|
|
if($list === false) $this->error($LogicJutuike->getError());
|
|
$this->success('获取成功',['list' => $list]);
|
}
|
|
|
/**
|
* 团单查询
|
*
|
* @return void
|
*/
|
public function search_deals()
|
{
|
$cateId = request()->param('cateId','');
|
|
$cateSecIds = request()->param('cateSecIds','');
|
|
$cat1Ids = request()->param('cat1Ids','');
|
|
$lng = request()->param('lng','0');
|
|
$lat = request()->param('lat','0');
|
|
$sortType = request()->param('sortType','');
|
|
$radii = request()->param('radii','');
|
|
if($lat == 0 || $lng == 0) $this->error('位置信息获取失败(-1)');
|
|
$cityId = request()->param('cityId','');
|
|
$keywords = request()->param('keyWords','','trim');
|
|
$page = request()->param('page',1);
|
|
$pageSize = request()->param('pageSize',10);
|
|
$shopIds = request()->param('shopIds','');
|
|
if($this->auth->isLogin()){
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
}else{
|
$common_relation_id = '9000000';
|
}
|
$LogicJutuike = new LogicJutuike();
|
|
$list = $LogicJutuike->searchDeals(2,$cateId,$cateSecIds,$lng,$lat,$cityId,$common_relation_id,$sortType,$keywords,$page,$pageSize,$cat1Ids,$radii,$shopIds);
|
if($list === false) $this->error($LogicJutuike->getError());
|
|
if(!empty($list)){
|
$list = $LogicJutuike->dealsDetail($list,$cateId,$cateSecIds,$lng,$lat,$cityId,$common_relation_id,$sortType,$keywords,$page,$pageSize,$cat1Ids,$radii);
|
}
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 获取秒杀场次
|
*/
|
public function seckill_showinfo()
|
{
|
$cityId = request()->param('cityId','');
|
|
if(empty($cityId)) $this->error('城市id不能为空');
|
|
$LogicJutuike = new LogicJutuike();
|
|
$list = $LogicJutuike->getSeckillShowinfo($cityId);
|
|
if($list === false) $this->error($LogicJutuike->getError());
|
|
$this->success('获取成功',['list' => $list]);
|
}
|
|
|
/**
|
* 秒杀列表
|
*/
|
public function seckill_list()
|
{
|
$cityId = request()->param('cityId','');
|
|
if(empty($cityId)) $this->error('城市id不能为空');
|
|
$showId = request()->param('showId','');
|
|
if(empty($showId)) $this->error('场次id不能为空');
|
|
$lng = request()->param('lng');
|
|
$lat = request()->param('lat');
|
|
if(empty($lng) || empty($lat)) $this->error('位置信息获取失败');
|
|
$page = request()->param('page',1);
|
|
$LogicJutuike = new LogicJutuike();
|
|
if($this->auth->isLogin()){
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
}else{
|
$common_relation_id = '9000000';
|
}
|
|
$list = $LogicJutuike->seckillList($cityId,$common_relation_id,$showId,$lat,$lng,$page);
|
|
if($list === false) $this->error($LogicJutuike->getError());
|
|
$this->success('获取成功',['list' => $list]);
|
}
|
|
|
/**
|
* 智能识别商品信息
|
*
|
*/
|
public function identify_goods()
|
{
|
$goods_url = request()->param('goods_url','', 'urldecode');
|
|
if (empty($goods_url)) $this->error('链接不能为空');
|
|
$LogicSearch = new LogicSearch();
|
|
$info = $LogicSearch->ast($goods_url);
|
if(!empty($info)&&!$info["goodsId"]&&$info["title"]){
|
$this->success('获取成功',['goods_url'=>$info["title"],'goods'=>[]]);
|
|
}
|
else{
|
$this->success('获取成功',['goods_url'=>$goods_url,'goods'=>$info]);
|
}
|
|
|
}
|
|
|
/**
|
* 获取淘宝商品列表
|
*/
|
public function tb_goods_list()
|
{
|
$cateId = request()->param('cateId','');
|
|
$subcid = request()->param('subcid','');
|
|
//if(empty($cateId) && empty($subcid)) $this->error('分类ID不能为空');
|
|
$page = request()->param('page',1);
|
|
$page_size = request()->param('pageSize',10);
|
|
$sort = request()->param('sort',0);
|
|
$tchaoshi=request()->param('tchaoshi',0);
|
//二级筛选
|
$secrend_search=request()->param('secrend_search',0);
|
$LogicDataoke = new LogicDataoke();
|
|
$list = $LogicDataoke->getGoodsList($cateId,$subcid,$sort,$page,$page_size,$tchaoshi,$secrend_search);
|
|
if($list === false) $this->error($LogicDataoke->getError());
|
|
$topRankList = $LogicDataoke->getRank(1,$cateId);
|
|
$this->success('获取成功',['list' => $list,'topGoodsList' => $topRankList]);
|
}
|
|
|
/**
|
* 获取网盘地址
|
*
|
* @return void
|
*/
|
public function get_wpanurl()
|
{
|
$wpanUrl = config('site.wpanUrl');
|
$this->success('获取成功',['info' => $wpanUrl]);
|
}
|
|
/**
|
* 查询淘宝授权
|
*/
|
public function get_publisher()
|
{
|
$access_token = request()->param('access_token','');
|
if(empty($access_token)) $this->error('授权token不能为空');
|
// $tb_account = request()->param('tb_account','');
|
// if(empty($tb_account)) $this->error('淘宝账号不能为空');
|
$LogicTaobaolianmeng = new LogicTaobaolianmeng();
|
$info = $LogicTaobaolianmeng->publisher($access_token);
|
if(empty($info)) $this->error('授权信息获取失败');
|
$ModelUser = new ModelUser();
|
$find = $ModelUser->where(['t_relation_id'=>$info['relation_id']])->find();
|
if(!empty($find)) $this->error('当前淘宝账号已绑定其他账号');
|
$res = $ModelUser->where(['id'=>USERID])->update(['tb_account'=>$info['relation_id'],'t_relation_id'=>$info['relation_id'],'updatetime'=>time()]);
|
if(!$res) $this->error('绑定失败');
|
$this->success('绑定成功',[]);
|
}
|
|
|
/**
|
* 根据不同平台获取转链内容
|
*/
|
public function get_chain_turning()
|
{
|
$type = request()->param('type','');
|
if(empty($type)) $this->error('转链平台不能为空');
|
$content= request()->param('content','','urldecode');
|
if(empty($content)) $this->error('转链内容不能为空');
|
$user = $this->auth->getUser();
|
switch($type){
|
case 1: //淘宝
|
$LogicZhetaoke = new LogicZhetaoke();
|
$res = $LogicZhetaoke->zhuanlian($content,true,$user['t_relation_id']);
|
$info = empty($res) ? "" : $res;
|
break;
|
case 2: //京东
|
$LogicJd = new LogicJd();
|
$res = $LogicJd->universal($content,true);
|
$info = isset($res['chain_link']) ? $res['chain_link'] : '';
|
break;
|
case 3: //拼多多
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
$LogicPdd = new LogicPdd();
|
$res = $LogicPdd->universal($common_relation_id,$content);
|
$info = empty($res) ? "" : $res;
|
break;
|
case 4: //唯品会
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
$LogicDingdanxia = new LogicDingdanxia();
|
$res = $LogicDingdanxia->urlPrivilege($content,$common_relation_id);
|
$info = empty($res) ? "" : $res;
|
break;
|
case 5: //抖音
|
$common_relation_id = $this->auth->getUser()['common_relation_id'];
|
$LogicHaodanku = new LogicHaodanku();
|
$res = $LogicHaodanku->urlPrivilege($content);
|
if(empty($res) || empty($res['goods_id'])){
|
$info = "";
|
}else{
|
$resLink = $LogicHaodanku->idPrivilege($res['goods_id'],$common_relation_id);
|
if(empty($resLink))
|
{
|
$info ="";
|
}
|
else{
|
$info = empty($resLink['dy_zlink']) ? $resLink['dy_deeplink'] : $resLink['dy_zlink'];
|
}
|
}
|
break;
|
}
|
|
$this->success('获取成功',['info'=>$info]);
|
}
|
|
|
/**
|
* 好货直降
|
*/
|
public function super_discount_goods()
|
{
|
$page = request()->param('page',1);
|
$page_size = request()->param('pageSize',10);
|
$LogicDataoke = new LogicDataoke();
|
$list = $LogicDataoke->dailyExplosion('',$page,$page_size);
|
if($list === false) $this->error($LogicDataoke->getError());
|
$this->success('获取成功',['list' => $list]);
|
}
|
|
|
/**
|
* 获取历史价格
|
*
|
* @return void
|
*/
|
public function get_history()
|
{
|
$content = request()->param('content','');
|
if(empty($content))$this->error('链接不能为空');
|
$user = $this->auth->getUser();
|
$LogicZhetaoke = new LogicZhetaoke();
|
$goods = $LogicZhetaoke->zhuanlian($content,false,$user['t_relation_id']);
|
$info = [];
|
if(!empty($goods)){
|
$LogicDataoke = new LogicDataoke();
|
$info = $LogicDataoke->getPriceTrend($goods['id'],$goods['goodsId']);
|
if(empty($info['goodsInfo']))$info['goodsInfo'] = $goods;
|
}
|
$this->success('获取成功',$info);
|
}
|
|
|
/**
|
* 获取专辑列表
|
*/
|
public function get_album_list()
|
{
|
$page = request()->param('page','1');
|
$pageSize = request()->param('pageSize','10');
|
$LogicAlbum = new LogicAlbum();
|
$list = $LogicAlbum->getList($page,$pageSize);
|
$LogicBanner = new LogicBanner();
|
$banner = $page == 1 ? $LogicBanner->getList(10) : [];
|
$this->success('获取成功',['list'=>$list,'banner'=>$banner]);
|
}
|
|
|
/**
|
* 专辑点赞
|
*
|
* @return void
|
*/
|
public function like_album(){
|
$album_id = request()->param('album_id','');
|
if(empty($album_id)) $this->error('参数错误');
|
$LogicAlbum = new LogicAlbum();
|
$list = $LogicAlbum->likeAlbum($album_id);
|
$this->success('点赞成功',[]);
|
}
|
|
|
/**
|
* 专辑详情
|
*
|
* @return void
|
*/
|
public function album_detail()
|
{
|
$album_id = request()->param('album_id','');
|
if(empty($album_id)) $this->error('参数错误');
|
$user_id = "";
|
if($this->auth->isLogin()){
|
$user_id = $this->auth->getUser()['id'];
|
}
|
$LogicAlbum = new LogicAlbum();
|
$detail = $LogicAlbum->albumDetail($album_id,$user_id);
|
$this->success('获取成功',$detail);
|
}
|
|
|
/**
|
* 关注作者
|
*
|
* @return void
|
*/
|
public function follow_anchor()
|
{
|
$uid = request()->param('uid','');
|
if(empty($uid)) $this->error('参数错误');
|
$LogicAlbumFollow = new LogicAlbumFollow();
|
$res = $LogicAlbumFollow->follow(USERID,$uid);
|
$this->success('操作成功',[]);
|
}
|
|
|
/**
|
* 专辑关注列表
|
*/
|
public function follow_album_list()
|
{
|
$page = request()->param('page','1');
|
$pageSize = request()->param('pageSize','10');
|
$LogicAlbumFollow = new LogicAlbumFollow();
|
$uids = $LogicAlbumFollow->getAllUids(USERID);
|
if(empty($uids))$this->success('获取成功',['list'=>[]]);
|
$LogicAlbum = new LogicAlbum();
|
$list = $LogicAlbum->getList($page,$pageSize,$uids);
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
|
/**
|
* 获取分享链接
|
*
|
* @return void
|
*/
|
public function get_privilege_share_link()
|
{
|
$goodsId = request()->param('goodsId','');
|
if(empty($goodsId)) $this->error('商品id不能为空');
|
$LogicHaodanku = new LogicHaodanku();
|
$user = $this->auth->getUser();
|
$list = $LogicHaodanku->getShareLink($goodsId,$user['common_relation_id'],$user['t_relation_id']);
|
if($list === false) $this->error($LogicHaodanku->getError());
|
$this->success('获取成功',['list' => $list]);
|
}
|
|
/**
|
* 0元购商品列表(调用9.9包邮精选接口,获取3.9元商品)
|
*
|
* @return void
|
*/
|
public function get_first_free_goods(){
|
|
$page = request()->param('page',1);
|
$page_size = request()->param('pageSize',100);
|
$LogicDataoke = new LogicDataoke();
|
|
$list = $LogicDataoke->getOpGoodsList(1,$page,$page_size,['6','7','11','12','13']);
|
//如果不满足40个,则再取一页
|
if(count($list)<40){
|
$list2 = $LogicDataoke->getOpGoodsList(1,$page+1,$page_size,['6','7','11','12','13']);
|
$list = array_merge($list,$list2);
|
}
|
|
if($list === false) $this->error($LogicDataoke->getError());
|
|
foreach($list as $key => $value){
|
$list[$key]['fanli'] = $value['actualPrice'];
|
}
|
$list= array_slice($list, 0, 40);
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
/**
|
* 抖音0元购商品列表
|
*
|
* @return void
|
*/
|
public function get_first_free_dy_goods(){
|
|
$page = request()->param('page',1);
|
$page_size = request()->param('pageSize',40);
|
$LogicHaodanku = new LogicHaodanku();
|
|
$list = $LogicHaodanku->getDyOnebyGood($page,$page_size);
|
|
|
if($list === false) $this->error($LogicHaodanku->getError());
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
/**
|
* 京东0元购商品列表
|
*
|
* @return void
|
*/
|
public function get_first_free_jd_goods()
|
{
|
|
$page = request()->param('page',1);
|
|
$page_size = request()->param('pageSize',40);
|
|
$LogicJd = new LogicJd();
|
|
$list = $LogicJd->getNineSift($page,$page_size);
|
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
/**
|
* 猜你喜欢
|
*
|
* @return void
|
*/
|
public function gussess_like_goods()
|
{
|
$platefrom = request()->param('platefrom','');
|
$page = request()->param('pageId',1);
|
$page_size = request()->param('pageSize',10);
|
$cids= request()->param('cids','');
|
$user = $this->auth->getUser();
|
$common_relation_id = $user['common_relation_id'];
|
$list = [];
|
$clist=[];
|
$cids = explode(',',$cids);
|
$n_count=10;
|
if($page<=count($cids)&&count($cids)>0){
|
switch($platefrom){
|
case 'tb': //淘宝联盟
|
$LogicDataoke = new LogicDataoke();
|
$clist = $LogicDataoke->getGoodsList($cids[$page-1],'',0,$page,$page_size,1,0);
|
break;
|
case 'jd': //京东
|
$LogicJd = new LogicJd();
|
$clist = $LogicJd->search_cid_Goods('','desc','','','inOrderCount30Days',1,10,$cids[$page-1]);
|
break;
|
case 'pdd': //拼多多
|
$LogicPdd = new LogicPdd();
|
$clist = $LogicPdd->searchGoods('','',$common_relation_id,'',1,10,0,$cids[$page-1]);
|
break;
|
case'dy'://抖音
|
$LogicHaodanku = new LogicHaodanku();
|
$clist = $LogicHaodanku->getDygoodsList($cids[$key],'',0,1,10);
|
break;
|
}
|
$clist=array_slice($clist, 0, 3);
|
$n_count=$n_count-count($clist);
|
}
|
if(empty($platefrom)){
|
$platefrom='tb';
|
}
|
switch($platefrom){
|
case "tb": //淘宝联盟
|
$LogicTaobaolianmeng = new LogicTaobaolianmeng();
|
$list = $LogicTaobaolianmeng->material('6708','','OAID',$page,$page_size);
|
break;
|
case "jd": //京东
|
$LogicJd = new LogicJd();
|
$list = $LogicJd->getTodayTop('discountReal',$page,$page_size);
|
break;
|
case "pdd": //拼多多
|
$LogicPdd = new LogicPdd();
|
$list = $LogicPdd->dailyExplosion('','[7,10851]',4,$page,$page_size);
|
$list = isset($list['list']) ? $list['list'] : [];
|
break;
|
case "wph": //唯品会
|
$LogicDingdanxia = new LogicDingdanxia();
|
$list = $LogicDingdanxia->wphGoodsList('',1,$page,$page_size,0);
|
break;
|
case "dy": //抖音
|
$LogicHaodanku = new LogicHaodanku();
|
$list = $LogicHaodanku->getDygoodsList('','','',$page,$page_size);
|
break;
|
}
|
$list=array_slice($list, 0, $n_count);
|
if(!empty($clist)){
|
$list=array_merge($clist,$list);
|
}
|
$this->success('获取成功',['list'=>$list]);
|
}
|
|
/**
|
* 商品比价
|
*
|
* @return void
|
*/
|
|
public function compare_good(){
|
$content = request()->param('content','');
|
if (empty($content)) $this->error('内容不能为空');
|
$exclude_tb = request()->param('exclude_tb',0);
|
$exclude_jd = request()->param('exclude_jd',0);
|
$exclude_pdd = request()->param('exclude_pdd',0);
|
$exclude_dy = request()->param('exclude_dy',0);
|
$content = request()->param('content','');
|
$content = request()->param('content','');
|
$LogicSearch = new LogicSearch();
|
$user = $this->auth->getUser();
|
$common_relation_id = $user['common_relation_id'];
|
$info = $LogicSearch->compare_good($content,$common_relation_id,$exclude_tb,$exclude_jd,$exclude_pdd,$exclude_dy);
|
$this->success('获取成功',['list'=>$info]);
|
|
}
|
|
}
|