🔓 Ultimate Webshell - Penetration Testing Tool

📖 File Reader

<?php
namespace app\api\model;
use think\Model;
class ModShoppingCart extends Model
{
    protected $name = 'shopping_cart';//表名

    /**
     * 获取购物车商品
     * @param $user_id 会员id
     * @param $visitor_code 游客标识
     */
    static function goods_list($user_id,$visitor_code)
    {
        $where = 1;
        if (!empty($user_id)){
            $where .= " and user_id = $user_id";
        }
        if (!empty($visitor_code)){
            $where .= " and visitor_code = '$visitor_code'";
        }
        $list = ModShoppingCart::where($where)->order("id asc")->select()->toArray();
        return $list;
    }

    /**
     * 删除购物车数据
     * @param $user_id 会员id
     * @param $visitor_code 游客标识
     * @param $cart_id 购物车id多个用逗号隔开
     */
    static function goods_del($user_id,$visitor_code,$cart_id)
    {
        $where = 1;
        if (!empty($user_id)){
            $where .= " and user_id = $user_id";
        }
        if (!empty($visitor_code)){
            $where .= " and visitor_code = '$visitor_code'";
        }
        if (!empty($cart_id)){
            $where .= " id in ($cart_id)";
        }
        ModShoppingCart::where($where)->delete();
        return 'ok';
    }
}