获取验证码
- 接口:https://m-center-prod-linli.timesgroup.cn/times/pub-center/verifycode/api/v1/send
- 请求方法:POST
- 请求参数
// 只需要修改 phoneNumber 为自己的手机号码 {"phoneNumber":"1342341234","areaCode":"86"}
- 返回结果
{ "code":200, "data":"验证码发送成功", "message":"success" }
根据验证码获取 token
- 接口:https://m-center-prod-linli.timesgroup.cn/times/times-bff/bff/api-c/v1/oauth/token
- 请求方法:POST
- 请求参数
// 修改 username 为自己的手机号码 // 修改 password 为收到的验证码 { "grant_type":"sms_code", "scope":"all", "client_id":"mini_charge", "client_secret":"times", "username":"13412341234", "password":"123456", "areaCode":"86" }
- 返回结果
{ "code":200, "data":{ "authUserDTO":{ "expiresIn":86399, "refreshToken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9", "token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9", "tokenHead":"Bearer " }, "userDTO":{ "eWechatOpenId":"", "eWechatUnionId":"", "extUserId":1, "id":1, "isCancel":0, "isEnable":0, "isShowRealName":0, "isSupplement":0, "phone":"13412341234", "phoneAreaCode":"86", "projectId":1, "projectName":"", "sex":0, "storeType":1, "storeUrl":"https://mall-prod-app-linli.timesgroup.cn/app/index", "updateTime":1, "userImage":"https://thirdwx.qlogo.cn/", "userName":"", "wxMinipOpenId":"", "wxOpenId":"", "wxUnionId":"" }, "userProjectHistoryDTOS":[ { "projectId":1, "projectName":"", "storeType":1, "storeUrl":"https://mall-prod-app-linli.timesgroup.cn/app/index" } ] }, "message":"success" }
获取会员 id - memberId
- 接口:https://m-center-prod-linli.timesgroup.cn/times/member-bff/member/api-c/v1/member/detailByPhone?phone=13412341234&phoneArea=86
- 请求方法:GET
- 请求参数
// 把 url 中的 phone 值替换为自己的手机号码
- 请求头加入上一步返回来的 token 拼接在
Bearer
后,如下:{ headers: { Authorization: "Bearer eyJhbGciOiJSU" } }
- 返回结果,只需要拿到结果中的 memberId
{ "code": 200, "data": { "cardNo": "", "cardType": "111", "couponNum": 0, "createTime": 1702007451000, "createUser": 2, "email": "", "grow": 0, "integral": 1, "integralTotal": 1, "isDeleted": 0, "isEnable": 0, "isShowRealName": 0, "memberCardRelats": [ { "createTime": 1702007451000, "createUser": 2, "expirationTime": 1, "grow": 300, "id": 1, "isDeleted": 0, "levelId": 1, "levelName": "普通会员", "memberCardId": 3, "memberCardImage": "", "memberCardName": "时代邻里会员卡", "memberCode": "", "memberId": 1, "rangeBegin": 0, "rangeEnd": 5000, "updateTime": 1702187857000, "updateUser": 2, "upgradedTime": 1702007451000 } ], "memberCode": "1", "memberId": 1, "memberIdStr": "1", "memberImage": "https://thirdwx.qlogo.cn/mmopen/vi_32", "memberName": "", "memberSources": [ { "createTime": 1702007451000, "createUser": 2, "id": 1, "isDeleted": 0, "memberId": 1, "sourceCode": "linlipro", "updateTime": 1702007451000, "updateUser": 2 } ], "memberType": 0, "memo": "", "phone": "", "phoneAreaCode": "86", "realName": "微信用户", "sex": 0, "updateTime": 1735185253000, "updateUser": 2 }, "message": "success" }
签到
- 接口:https://m-center-prod-linli.timesgroup.cn/times/member-bff/user-behaviour//api-c/v1/user-behaviour/collect
- 请求方法:POST
- 请求头
// 第二步返回来的 token 拼接在 `Bearer `后 { headers: { Authorization: 'Bearer eyJhbGciOiJSU', Content-Type: 'application/json' } }
- 请求参数
// memberId 为第三步返回的 memberId // createTime、sign为当前时间 格式:YYYY-MM-DD HH:mm:ss { "behaviourId": 10, "clientCode": "sys_linlibang", "createTime": "2024-11-27 08:19:45", "mapPamater": { "sign": "2024-11-27 08:19:45" }, "memberId": "12332131232133" }
- 返回结果
{ code: 200, data: true, message: 'success' }
自动刷新 token
token 过期时间,当前测试为 8 小时过期,需要在过期前刷新 token,下次签到就不用重新获取验证码登录(理论上可以无限续期)
接口:https://m-center-prod-linli.timesgroup.cn/times/auth/oauth/token
请求方法:POST
请求参数(FormData 格式)
// grant_type=refresh_token&client_secret=times&client_id=app_c&scope=all&refresh_token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2iMava32uw // 第一次刷新:refresh_token 需要设置为第二步获取返回来的 refreshToken // 第一次以后的刷新:refresh_token 获取本接口返回来的 refreshToken 即可 let formData = new FormData() formData.append("grant_type", "refresh_token") formData.append("client_secret", "times") formData.append("client_id", "app_c") formData.append("scope", "all") formData.append("refresh_token", "")
返回结果
{ "code":200, "data":{ "expiresIn":86399, "refreshToken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2", "token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25", "tokenHead":"Bearer " }, "message":"操作成功" }