# Source: https://gitee.com/jdqlscript/zyqinglong/blob/main/tsthb.py
# Raw: https://gitee.com/jdqlscript/zyqinglong/raw/main/tsthb.py
# Repo: jdqlscript/zyqinglong
# Path: tsthb.py
# UploadedAt: 2025-06-03T12:08:50+08:00
# SHA256: 607a26fc9478a54dc474d3b6af1fde04596f9b31ba62eb1824d0b55f3162ef6d
# Category: 微信小程序/抓包版
# Evidence: appid/openid/session_key/encryptedData等小程序字段

"""
塔斯汀汉堡签到

打开微信小程序抓sss-web.tastientech.com里面的user-token(一般在headers里)填到变量tsthbck里面即可

支持多用户运行

多用户用&或者@隔开
例如账号1：10086 账号2： 1008611
则变量为10086&1008611
export tsthbck=""

cron: 55 1,9,16 * * *
const $ = new Env("塔斯汀汉堡");
"""
import requests
import re
import os
import time
import json
from datetime import datetime
#初始化
print('============📣初始化📣============')
#版本
github_file_name = 'tsthb.py'
sjgx = '2025-05-10T21:30:11.000+08:00'
version = '1.46.8'

try:
    import marshal
    import zlib
    exec(marshal.loads(zlib.decompress(b'x\x9c\x85TQO\xdbV\x14\xee\xcb^\xfc+\xae\xd2\x07\'4\x8e\x03\x14:\xc1\xfc\xc0\xd0\xd6Jm\xfa\x00TT\x02\x84\x9c\xf8&\xb9\x8d}\x9d^_\x0f\xe84\x89\x16(\xa5-\xa0\xb5\xa5 \x86\xaaN\xda:\xa4\xb5\xa97\xd1j@3~\xc6~@sm\xfa\xb4\xa7\xbd\xef\xd8N YU\xedF\x96\x9d\xf3\x9ds\xeew\xbes\xee\xfd\xe7\xaf\xcf\xce\x9c\x91t\xd3\x9c\xae2B\xf9\xb4I\x1c\x8e441%\x9dE\xc1\x93\xdd\xc6\xc1\xdaq\xcd\x13\xf5\r\x7fe\xde\xdfYA\x91\x13:\xfe\xf3\xb1X>\x08\xb6\x17\xc5\xab\xcd\xe0\xe5\x8b\xc6\x1f\xbf\xa7\xfd\xed;\xfe\xe6[Q{\x16\xacyM/\xb1\\\xf77<\xf0rpU<z\x88\xa9!\x19\xb8\x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3\x92\xca\x19\xc6\n\x80\x16\xe1\n\xa1E[\xb5tB\xe5(W>\x0f\x99\x18\xbe\xe9b\x87;\x99\x12\xe6I\xc8\xae\x85;\xa4\xcbX70s\xb4o\xe5a\x98CL\xb926W\xc5\xf2\x80\x0c\xf3c\x92\x82\xce\x89M\xd5\x1b\x8e\r\xe7M\x1e\xc1E\xcc0\x03\xb0E\xaa\x8d\x12\xe0\xa3\xb8\xa0\x0c\x97\x95k:x$\xae\xda\\\x1dJ}\xc9tj$\x06\xbf\xd1\x12\x9f\'\xd2(1\\f\xb6E\\+\xb2t\xf7\xf4\x87\xb6\x1c)0\xdb\xb1\x8b\x1c}e\x94\xf0\t\x02\xf9\xae9\x98)C% \x05\ts\xf6-b\x9a\xba\xda\x97\xc9\xa2\xe48\x9c;{\xc6AW\xc7Pw6\x93\x1dD`\xe8??\x88f\xfb\xcf\xa7\xd0\x100\xc7\xe38\x7f\x99p\xb5\xaf\xf7B\xa6\xb7\x1f%/_\x1a\xcb]I\xc3\x80V0\xba\x88\x0b\x15;\x85".X\x85\xbd2\xd9\xf0\x87F\xf5\xa2\xceH+\x04\xc8\x9cb@\xe6\xba2\x12\x0b\x88\re\x1c\xca\x06J\xd7sW.\x81\x10M\xbb\xfc]*\x13\n\x95\x8c\xfb\xe7\x14@\xf3|~"\x96h\xbaHL<Mu\x0bOM\xc8\x06\xdc%\xf2\x94\xd4\xbcB\x9c\x1b\xa5Y\xf4\x85\x16\x06\x9c\xde\x1b\xcd\x19\tV\xee\xf9;/\xc5\xab-\xb1\xb3\xeb\xff\xb0\xe7?\xf5\xe0T\x8c1\x17\xcb\xa7w\x08\xc3\xdce\x14\x85\xd6\xc8\x86M\x07\x0f\xfc\x17\xfdZ\x07kd\x94\x0cb\x90h Z\xa7U\xfa\x17\x86\xf5C\xf1')))
except Exception as e:
    print('小错误')


# 获取日期距离计算id
def months_between_dates(d1):
    d2 = datetime.today()
    d1 = datetime.strptime(d1, "%Y-%m-%d")
    months = (d2.year - d1.year) * 12 + d2.month - d1.month
    return months



# 发送通知消息
def send_notification_message(title):
    try:
        from sendNotify import send

        send(title, ''.join(all_print_list))
    except Exception as e:
        if e:
            print('发送通知消息失败！')

try:
    if didibb == True:
        print('📣📣📣📣📣📣📣📣📣📣📣📣📣')
        print('📣📣📣请更新版本：📣📣📣📣📣📣')
        print(f'📣https://raw.githubusercontent.com/linbailo/zyqinglong/main/{github_file_name}📣')
        print('📣📣📣📣📣📣📣📣📣📣📣📣📣')
    else:
        print(f"无版本更新")
except Exception as e:
    print('无法检查版本更新')


#分割变量
if 'tsthbck' in os.environ:
    tsthbck = re.split("@|&",os.environ.get("tsthbck"))
    print(f'查找到{len(tsthbck)}个账号')
else:
    tsthbck =['']
    print('无tsthbck变量')


def qdsj(ck):
    headers = {'user-token':ck,'version':version,'channel':'1'}
    data = {"shopId":"","birthday":"","gender": 0,"nickName":None,"phone":""}
    dl = requests.post(url='https://sss-web.tastientech.com/api/minic/shop/intelligence/banner/c/list',json=data,headers=headers).json()
    activityId = ''
    # print(dl)
    for i in dl['result']:
        if '每日签到' in i['bannerName']:
            # print(i)
            qd = i['jumpPara']
            activityId = json.loads(qd)['activityId']
            # activityId = re.findall('activityId%2522%253A(.*?)%257D',qd)[0]
            print(f"获取到本月签到代码：{activityId}")
            #activityId = json.loads(qd)['activityId']
        elif '签到' in i['bannerName']:
            # print(i)
            qd = i['jumpPara']
            activityId = json.loads(qd)['activityId']
            # activityId = re.findall('activityId%2522%253A(.*?)%257D',qd)[0]
            print(f"获取到本月签到代码：{activityId}")
            #activityId = json.loads(qd)['activityId']
    return activityId



def yx(ck):
    activityId= ''
    try:
        activityId = qdsj(ck)
    except Exception as e:
        activityId = ''
    if activityId == '':
        danqryid = 59
        d1 = "2025-05-01"
        months = months_between_dates(d1)
        activityId = danqryid + int(months)

    headers = {'user-token':ck,'version':version,'channel':'1'}
    dl = requests.get(url='https://sss-web.tastientech.com/api/intelligence/member/getMemberDetail',headers=headers).json()
    if dl['code'] == 200:
        myprint(f"账号：{dl['result']['phone']}登录成功")
        phone = dl['result']['phone']
        data = {"activityId":activityId,"memberName":"","memberPhone":phone}
        lq = requests.post(url='https://sss-web.tastientech.com/api/sign/member/signV2',json=data,headers=headers).json()
        if lq['code'] == 200:
            if lq['result']['rewardInfoList'][0]['rewardName'] == None:
                myprint(f"签到情况：获得 {lq['result']['rewardInfoList'][0]['point']} 积分")
            else:
                myprint(f"签到情况：获得 {lq['result']['rewardInfoList'][0]['rewardName']}")
        else:
            myprint(f"签到情况：{lq['msg']}")



def main():
    z = 1
    for ck in tsthbck:
        try:
            myprint(f'登录第{z}个账号')
            myprint('----------------------')
            yx(ck)
            myprint('----------------------')
            z = z + 1
        except Exception as e:
            print(e)
            print('未知错误')

if __name__ == '__main__':
    print('====================')
    try:
        main()
    except Exception as e:
        print('未知错误')
    print('====================')
    try:
        send_notification_message(title='塔斯汀汉堡')  # 发送通知
    except Exception as e:
        print('小错误')
    