//订阅模板消息函数

/* tmplId 参数传数组   callback 回调函数*/
function Setting(tmplId,callback){
	uni.getSetting({
	  withSubscriptions: true,
	  success(res) {
		var itemSettings = res.subscriptionsSetting.itemSettings?res.subscriptionsSetting.itemSettings:"";
		console.log("订阅模板消息列表"+JSON.stringify(res))
		if (itemSettings) {
		  if (itemSettings[tmplId]=='accept') {
			  // 已授权过不再显示
			console.log('is accredit：ok')
		  }else{
			  //未授权唤起授权
			  uni.requestSubscribeMessage({
			    tmplIds: tmplId,
			    success (res) {
			  	console.log(res)
			  	  // reject 表示取消授权
			  	  if(res[tmplId] === 'reject'){}
			  	  // accept 表示授权
			  	  if(res[tmplId] === 'accept'){
					  
				  }
			    }
			  })
		  }
		}else{
			uni.requestSubscribeMessage({
			  tmplIds: tmplId,
			  success (res) {
				console.log(res)
				  // reject 表示取消授权
				  if(res[tmplId] === 'reject'){}
				  // accept 表示授权
				  if(res[tmplId] === 'accept'){}
			  }
			})
		}
	  }
	})
}