Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BWCJ加了签名参数 无法签到 #73

Open
ny-bugger opened this issue Aug 29, 2024 · 5 comments
Open

BWCJ加了签名参数 无法签到 #73

ny-bugger opened this issue Aug 29, 2024 · 5 comments

Comments

@ny-bugger
Copy link

No description provided.

@x2rr
Copy link

x2rr commented Aug 29, 2024

+1

@nushena
Copy link

nushena commented Aug 29, 2024

我找不出来
反编译 在bundle.js 1074行
signature是对activityId sellerId timestamp userId取md5

@nameyq11
Copy link

+1

@ny-bugger
Copy link
Author

ny-bugger commented Sep 2, 2024

简单修改了下
1.CHERWIN_TOOLS.py添加一个生成signature的方法

def BWCJ_SIGN(activityId, storeId, timestamp, userId):
    # activityId反转
    key = activityId[::-1]
    # 构建待加密字符串
    raw_string = f"activityId={activityId}&sellerId={storeId}&timestamp={timestamp}&userId={userId}&key={key}"
    # 使用MD5进行加密转大写
    signature = hashlib.md5(raw_string.encode('utf-8')).hexdigest().upper()
    return signature

2.添加一个参数self.store_id = '49006'
image
3.最上方导入
import datetime
4.添加一个获取userId的方法

    def customer_points_flow(self):
        try:
            json_data = {
                'appid': self.appid,
                'pageNo': 1,
                'pageSize': 1,
            }

            response = self.s.post('https://webapi2.qmai.cn/web/mall-apiserver/integral/user/page/customer-points-flow', json=json_data)
            result = response.json()
            status_code = response.status_code

            if result.get('code', status_code) == 0:
                data = result.get('data', {})
                data_list = data.get('data', [])
                
                if data_list:
                    userId = data_list[0].get('customerId', None)
                    if userId:
                        Log(f'获取到的userId: {userId}')
                        return userId
                    else:
                        Log('获取userId失败: 数据中不包含customerId')
                        return None
                else:
                    Log('获取userId失败: 数据列表为空')
                    return None
            else:
                message = result.get('message', '')
                Log(f'获取userId失败: {message}')
                return None

        except Exception as e:
            print(e)
            return None

5.修改签到方法take_part_in_sign

def take_part_in_sign(self):
        try:
            timestamp = int(datetime.datetime.now().timestamp())
            user_id = self.customer_points_flow()
            json_data = {
                'activityId': self.activity_id,
                'appid': self.appid,
                'storeId': self.store_id,
                'timestamp': timestamp,
                'signature': CHERWIN_TOOLS.BWCJ_SIGN(self.activity_id, self.store_id, timestamp, user_id)
            }
            response = self.s.post('https://webapi.qmai.cn/web/cmk-center/sign/takePartInSign', json=json_data)
            result = response.json()
            status_code = response.status_code

            if result.get('code', status_code) == 0:
                data = result.get('data',{})
                rewardDetailList = data.get('rewardDetailList',[{}])
                if rewardDetailList:
                    rewardName = rewardDetailList[0].get('rewardName','')
                    sendNum = rewardDetailList[0].get('sendNum','')
                    Log(f'新版签到成功,获得【{sendNum}】{rewardName}')
                    return True
                else:
                    Log(f'签到失败:【{result.get("message","")}】')
                    return True
            else:
                message = result.get('message', '')
                Log(f'新版签到失败: {message}')
                return False
        except Exception as e:
            print(e)
            return False

@checkToke
Copy link

https://github.com/checkToke/yangtai 这里面的霸王茶几可以用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants