MCPcopy
hub / github.com/nodeWechat/wechat4u / init

Method init

src/core.js:151–179  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149 }
150
151 init () {
152 return Promise.resolve().then(() => {
153 let params = {
154 'pass_ticket': this.PROP.passTicket,
155 'skey': this.PROP.skey,
156 'r': ~new Date()
157 }
158 let data = {
159 BaseRequest: this.getBaseRequest()
160 }
161 return this.request({
162 method: 'POST',
163 url: this.CONF.API_webwxinit,
164 params: params,
165 data: data
166 }).then(res => {
167 let data = res.data
168 assert.equal(data.BaseResponse.Ret, 0, res)
169 this.PROP.skey = data.SKey || this.PROP.skey
170 this.updateSyncKey(data)
171 Object.assign(this.user, data.User)
172 return data
173 })
174 }).catch(err => {
175 debug(err)
176 err.tips = '微信初始化失败'
177 throw err
178 })
179 }
180
181 notifyMobile (to) {
182 return Promise.resolve().then(() => {

Callers 4

_initMethod · 0.80
restartMethod · 0.80
MessageFactoryFunction · 0.80
ContactFactoryFunction · 0.80

Calls 2

getBaseRequestMethod · 0.95
updateSyncKeyMethod · 0.95

Tested by

no test coverage detected