zhaojs
2023-07-20 8c00bd0245ca4756ca04483a4980ad202714e43e
application/api/logic/taoke/Parser.php
@@ -7,7 +7,7 @@
use app\api\logic\UserCollect;
use app\api\logic\User as LogicUser;
use app\common\model\UserLevel as ModelUserLevel;
use \app\common\model\UserExtend as ModelUserExtend;
class Parser extends BasicLogic
{
    //TODO 检查所有接口是不是有调整的,需要传代理的相应字段
@@ -26,6 +26,10 @@
    protected static $topLevelName = ""; //顶级等级名称
    protected static $buyCount=-1;//购买次数
    protected static $returnLimit=1;//佣金全返的购买次数限制
    public function __construct(){
        $level = 1;
@@ -42,6 +46,17 @@
        self::$userRate = $leveInfo['own_commission_rate'] * 0.01;
        $topLevelInfo = $ModelUserLevel->where(['level'=>3])->find();
        if(empty($topLevelInfo)) fault('代理配置失败');
        //获取购买次数
       /*  $ModelUserExtend=new ModelUserExtend();
        $userBuy= $ModelUserExtend->where(['id'=>USERID])->find();
        if(!empty($userBuy))
        {
            self::$buyCount=$userBuy['tradecount'];
        }
        if(self::$buyCount>=0&&self::$buyCount<self::$returnLimit)
        {//符合全返规则
            self::$userRate =1;
        } */
        self::$topFanliRate = $topLevelInfo['own_commission_rate'] * 0.01;
        self::$topLevelName = $topLevelInfo['level_name'];
    }
@@ -80,6 +95,7 @@
            'url_type' => "3",          //商品详情,
            'isCollect' => 0,            //是否收藏
            'topLevelName' => self::$topLevelName,  //顶级等级名称
            'predictPromotionRate'=>0,//比价行为预判定佣金,需要用户备案-拼多多专用
        ];
    }
@@ -92,7 +108,9 @@
        return [
            'dtitle' => '',                 //商品title
            'goodsSign' => '',
            'goodsid' => '',
            'goods_sign'=>'',
            'goodsid' => '',
            'goodsId'=>'',
            'huodongType' => '', 
            'id' => '', 
            'jiage' => '', 
@@ -110,30 +128,7 @@
            'yuanjia' => '',
            'fanli' => '',
            'topFanli' => '',
            'id' => '',                 //商品id,若查询结果id=-1,则说明该商品非大淘客平台商品,数据为淘宝直接返回的数据,由于淘宝数据的缓存时间相对较长,会出现商品信息和详情信息不一致的情况
            'goodsId' => '',            //淘宝商品id
            'itemLink' => '',           //商品链接
            'title' => '',              //商品标题
            "actualPrice"=> "",         //券后价
            "originalPrice"=> "",       //商品原价
            "shopName"=> "",            //店铺名称
            "couponPrice"=> "",         //优惠券金额
            "monthSales"=> "",          //30天销量
            "mainPic" => "",            //商品主图
            "imgs" => [],               //商品轮播图
            "detailPics" => [],         //商品详情图
            "reimgs" => [],             //相关商品图
            "video"=> '',               //商品视频
            'couponLink' => '',         //优惠券链接
            'couponEndTime' => '',      //优惠券结束时间
            'couponStartTime' =>'',     //优惠券开始时间
            'shopType' => '',           //店铺类型,
            'couponInfo' => '',         //商品折扣信息
            'sourceType' => '',           //商品来源
            'url_type' => "3",          //商品详情,
            'isCollect' => 0,            //是否收藏
            'topLevelName' => self::$topLevelName,  //顶级等级名称
            'sourceType'=>''
        ];
    }
@@ -204,8 +199,8 @@
    /**
     * 计算商品展示返利金额
     *
     * @param [type] $price
     * @param [type] $commissionRate
     * @param [type] $price 券后价
     * @param [type] $commissionRate 分佣比例
     * @return void
     */
    public static function rebate($price,$commissionRate,$otherRate = "")