@shencom/api
v1.9.5
Published
shencom api group
Downloads
191
Readme
@shencom/api
描述....
install
pnpm add @shencom/request @shencom/api
# or
yarn add @shencom/request @shencom/api
Usage
Init
import { axiosBrowser } from '@shencom/request';
// import { axiosUniapp } from '@shencom/request';
import { init } from '@shencom/api';
const url = 'xxxx';
init(http, url);
Basic Usage
import { ApiGisShow } from '@shencom/api';
function getGisShow() {
const { data } = await ApiGisShow({ ids: ['xxx'] });
// console.log(data);
}
API
uaa
[x] 获取 sccode:
ApiGetScCode
;[x] sccode 登录:
ApiScCodeLogin
;[x] 使用 refreshToken 续期 token:
ApiRefreshToken
;token
8 小时有效期refreshToken
30 天有效期
[ ] 更新系统用户信息
[ ] 注册用户
[ ] 用户名+密码登录:
[x] 手机号+密码登录:
ApiPhoneAndPasswordLogin
;[ ] 手机号+短信登录:
[ ] 发送短信:
uaa-wechat
- [x] 微信小程序登录:
ApiWechatMiniLogin
; - 小程序手机号登录,并绑定手机号到系统用户(创建系统用户)
- [x] 绑定微信用户登录:
BaseWechatMiniBindPhone
; - [ ] 退出登录 (解除微信绑定)
- [ ] 微信公众号授权登录
- [ ] 更新微信用户信息
- [ ] 通过 openid 获取用户信息
- [ ] 判断是否关注公众号
- [x] 获取公众号 JSSDK 配置:
ApiWechatGetConfig
file
- [x] oss 签名:
ApiFileOssSign
- [x] 将 oss 文件信息更新到数据库:
ApiFileUpdate
- [x] 服务器文件上传:
ApiFileUpload
- [x] 获取文件信息:
ApiFileShow
- [ ] 单个文件上传
- [ ] 文件下载
- [ ] 检查图片是否含有违法违规或政治敏感内容
- [ ] 私有文件下载
- [ ] 私有上传指定 url 的文件
- [ ] 私有文件上传
- [ ] 私有 oss 签名
- [ ] 获取私有临时文件访问链接
gis
- [x] 创建点位:
ApiGisCreate
; - [x] 获取点位:
ApiGisShow
; - [ ] 更新点位
- [ ] 创建范围
- [ ] 更新范围
- [ ] 获取范围
cms
- [x] 获取栏目:
ApiCMSCategoryTree
; - [x] 获取内容列表:
ApiCMSArticlesIndex
; - [x] 获取内容:
ApiCMSArticlesShow
;
AMap
- [x] 高德-地理编码:
ApiAMapGeocodeGeo
; - [x] 高德-逆地理编码:
ApiAMapGeocodeRegeo
; - [x] 高德-天气查询:
ApiAMapWeather
; - [x] 高德-IP定位:
ApiAMapIP
;
QQMap
- [x] 腾讯-地理编码:
ApiQQMapGeocodeGeo
; - [x] 腾讯-逆地理编码:
ApiQQMapGeocodeRegeo
; - [x] 腾讯-IP定位:
ApiQQMapIP
;
Helpers
ApiQueryHandler
- 说明: 查询参数生成格式方法
- 类型: 参考源码
- 参数:
val
: 查询的值prop
: 后端字段operateType?
: 筛选条件 (默认: string)params?
: 同 [val, prop, operateType]
- 返回:
IndexQuery
- 示例:
ApiQueryHandler('1', 'active'); ApiQueryHandler('2020-08-03', 'createdAt', 'rangeDateTime'); ApiQueryHandler([ [1, 'active'], ['2020-08-03', 'createdAt', 'rangeDateTime'], ]);
ApiSortsHandler
- 说明: 排序参数生成格式方法
- 类型: 参考源码
- 参数:
prop
: 排序字段type
: 排序类型 (默认: DESC)params?
: 同 [prop, orderType]
- 返回:
IndexSorts
- 示例:
ApiSortsHandler('aaa'); ApiSortsHandler('aaa', 'ASC'); ApiSortsHandler([['aaa', 'ASC'], ['bbb']]);
Jsencrypt
- 说明: 密码加密
- 类型:
(pwd: string) => string
- 参数:
pwd
: 明文密码
- 返回:
string
- 示例:
const password = Jsencrypt('sc123456');