@58fe/58tjfrom-util 中文文档教程
提供创建或更新58tjfrom工具方法
安装
npm i @58fe/58tjfrom-util -S
使用
该工具包提供2个工具方法,分别是创建tjfrom(createTJFrom),和更新tjfrom(updateTJFrom)
createTJFrom
创建新的
tjfrom
,接受slot
和slotFrom
两个参数根据规则最后生成tjfrom
参数
|参数|说明|类型|默认值|备注 |-|-|-|-|-| |slot| slot值(可以找主站申请(美事: wanglizhou))|string| |extension| tjfrom中slotFrom的扩展(存放在tjfrom最后json串的slot_from中)|object|
eg:
const { createTJFrom } = require("@58fe/58tjfrom-util");
const slot = "jianli";
const slotFrom = {"jl_hd": 'huodong', "jl_qd": 812};
createTJFrom(slot, slotFrom)
// jianli__eyJ2IjoxLCJ0IjoyLCJyIjp7fSwidyI6eyJzbG90X2Zyb20iOnsiamxfaGQiOiJodW9kb25nIiwiamxfcWQiOjgxMiwic2xvdF9uYW1lIjoiamlhbmxpIn19fQ==
updateTJFrom
在
tjfrom
中追加slotFrom
并生成新的tjfrom
参数
|参数|说明|类型|默认值|备注 |-|-|-|-|-| |tjfrom| tjfrom值|string| |extension| tjfrom中slotFrom的扩展(存放在tjfrom最后json串的slot_from中)|object|
eg:
const { updateTJFrom } = require("@58fe/58tjfrom-util");
const tjfrom = "lm_list_cpt__adtypes__1__null__c61a1b93-1a94-4757-b482-da8c6602cadf";
const slotFrom = {jl_hd: "chaozhiji", jl_qd: 93};
updateTJFrom(tjfrom, slotFrom)
// lm_list_cpt__adtypes__1__null__c61a1b93-1a94-4757-b482-da8c6602cadf__eyJ2IjoxLCJ0IjoyLCJyIjp7fSwidyI6eyJzbG90X2Zyb20iOnsiamxfaGQiOiJjaGFvemhpamkiLCJqbF9xZCI6OTMsInNsb3RfbmFtZSI6ImxtX2xpc3RfY3B0In19fQ==
npm发包:
- 补丁版本(1.0.x): npm version patch && npm run build && npm publish --access public
- 次版本(1.x.0):npm version major && npm run build && npm publish --access public
- 主版本(x.0.0):npm version minor && npm run build && npm publish --access public