{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "from datetime import datetime\n",
    "ip = 'https://band.hxzhxy.cn'\n",
    "param = {\n",
    "    \"username\": \"xiatianle\",\n",
    "    \"password\": \"123456\",\n",
    "    \"client_id\": \"client\",\n",
    "    \"grant_type\": \"password\",\n",
    "    \"client_secret\": \"123456\",\n",
    "}\n",
    "data = requests.get(url=f\"{ip}/oauth/token\", params=param).json()\n",
    "token = data[\"access_token\"]\n",
    "header = {\n",
    "    \"content-type\": \"application/json\",\n",
    "    \"authorization\": f\"Bearer {token}\",\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'success': True,\n",
       " 'msg': '操作成功',\n",
       " 'code': 0,\n",
       " 'data': {'imgUrl': None,\n",
       "  'gradeId': None,\n",
       "  'classId': None,\n",
       "  'teaName': '夏天乐',\n",
       "  'nickName': None,\n",
       "  'teamId': 19,\n",
       "  'teaId': None,\n",
       "  'userName': 'xiatianle'}}"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "requests.get(f'{ip}/uc/account/getInfo',params={\"access_token\": token}).json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'success': True, 'msg': '操作成功', 'code': 0, 'data': [{'refundFee': 0.0, 'refundNum': 0, 'payFee': 23115000.0, 'totalNum': 609, 'totalFee': 23115000.0, 'payNum': 609, 'payName': '晚自习延时'}, {'refundFee': 0.0, 'refundNum': 0, 'payNum': 3462, 'payFee': 37168400.0, 'totalFee': 37168400.0, 'payName': '餐费充值', 'totalNum': 3462}, {'refundFee': 0.0, 'refundNum': 0, 'totalNum': 953, 'payNum': 953, 'totalFee': 25735500.0, 'payName': '延时服务费', 'payFee': 25735500.0}, {'refundFee': 0.0, 'refundNum': 0, 'payNum': 143, 'payFee': 3170000.0, 'totalNum': 143, 'totalFee': 3170000.0, 'payName': '周末托管报名'}]}\n"
     ]
    }
   ],
   "source": [
    "startDate = int(datetime.strptime(\"2023-06-01\", \"%Y-%m-%d\").timestamp()*1000)\n",
    "endDate = int(datetime.strptime(\"2023-07-15\", \"%Y-%m-%d\").timestamp()*1000)\n",
    "res = requests.get(f\"{ip}/pay/stu/total\",params={\n",
    "    \"access_token\": token,\n",
    "    \"teamId\": \"19\",\n",
    "    \"startDate\":startDate,\n",
    "    \"endDate\":endDate\n",
    "}).json()\n",
    "print(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1685548800000"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "startDate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "vscode": {
     "languageId": "javascript"
    }
   },
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (14025782.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[12], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    function formatAmount(amount) {\u001b[0m\n\u001b[1;37m             ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "function formatAmount(amount) {\n",
    "    return amount.toLocaleString('en-US', { style: 'currency', currency: 'CNY' });\n",
    "  }\n",
    "  \n",
    "  let amount = 72538000;\n",
    "  console.log(formatAmount(amount)); "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1720972800000"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "refundFee tuikuan\n",
    "totalFee shenyu\n",
    "payFee\n",
    "payNum shoufeibishu\n",
    "refundNum tuikuanbishu"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
