zhaojs
2023-07-12 87940848162256b5adaa125408b297dba3e8691b
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,40 @@
            'url_type' => "3",          //商品详情,
            'isCollect' => 0,            //是否收藏
            'topLevelName' => self::$topLevelName,  //顶级等级名称
            'predictPromotionRate'=>0,//比价行为预判定佣金,需要用户备案-拼多多专用
        ];
    }
 /***
  * 疯抢榜数据字段
  */
    public static function FqgoodsField()
    {
        return [
            'dtitle' => '',                 //商品title
            'goodsSign' => '',
            'goods_sign'=>'',
            'goodsid' => '',
            'goodsId'=>'',
            'huodongType' => '',
            'id' => '',
            'jiage' => '',
            'mallDesc' => '',
            'pic' => '',
            'quanId' => '',
            'quanJine' => '',
            'quanNum' => '',
            'quanOver' => '',
            'reachPrice' => '',
            'renqi' => '',
            'salesNum' => '',
            'xiaoliang' => '',
            'yongjin' => '',
            'yuanjia' => '',
            'fanli' => '',
            'topFanli' => '',
            'sourceType'=>''
        ];
    }
@@ -150,8 +199,8 @@
    /**
     * 计算商品展示返利金额
     *
     * @param [type] $price
     * @param [type] $commissionRate
     * @param [type] $price 券后价
     * @param [type] $commissionRate 分佣比例
     * @return void
     */
    public static function rebate($price,$commissionRate,$otherRate = "")