package com.fdkankan.common.util;

import cn.hutool.http.ContentType;
import com.alibaba.fastjson.JSON;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * TODO
 * </p>
 *
 * @author dengsixing
 * @since 2022/6/9
 **/
public class WebUtil {

    /**
     * 获取请求参数中的场景码
     * @param pjp
     * @param request
     * @return
     */
    public static String getNum(JoinPoint pjp, HttpServletRequest request){
        Object[] args = pjp.getArgs();
        String contentType = request.getContentType();
        if(contentType.contains(ContentType.JSON.getValue())){
            HashMap hashMap = JSON.parseObject(JSON.toJSONString(args[0]), HashMap.class);
            return (String) hashMap.get("num");
        }
        return request.getParameter("num");
    }

}
