当前位置: 首页 > news >正文

中山市网站制作营销活动怎么做吸引人

中山市网站制作,营销活动怎么做吸引人,wordpress仪表盘打不开,织梦网站流动广告代码小程序登录 涂鸦官方提供了登录能力,开发者可以通过相关 API 获取 App 的用户身份标识,快速的建立小程序内的用户体系。 登录流程 说明 需要调用 ty.login() 获取 临时登录凭证 code,并将 code 传到开发者服务器开发者服务器调用涂鸦云开发…

小程序登录

涂鸦官方提供了登录能力,开发者可以通过相关 API 获取 App 的用户身份标识,快速的建立小程序内的用户体系。

登录流程

说明
  1. 需要调用 ty.login() 获取 临时登录凭证 code,并将 code 传到开发者服务器
  2. 开发者服务器调用涂鸦云开发能力 API /1.0/token,传入 code,获取 access_token 及 uid,然后开发者根据 aceess_token 及 uid 自定义登录状态,并返回给前端,然后进行后续的交互。

注意:在开发小程序前,请先确保已经将小程序与云项目进行关联,关联方法请参考下面的服务器开发。

服务器开发

开发者服务器端要调用涂鸦云开发能力 API,需要创建云项目,并需要将云项目应用与小程序进行关联。

  • 使用 IoT 账号登录到 IoT 平台,选择云开发菜单,点击创建云项目

  • 创建成功后,即在云项目的详细页面中查询获取 Client ID 及 Client secret,用于请求 API 签名

 

  • 到小程序开发者平台,进入小程序开发设置菜单,点击云项目模块的 添加 按钮,然后选择对应的云项目关联。

相关文档:
  1. 云开发开发文档,可参考这里文档。
  2. API 签名机制,可参考这里

代码示例

小程序代码

import {getStorageSync,getSystemInfoSync,login,removeStorageSync,request,setStorageSync,getUserInfo,showModal,
} from '@ray-js/ray';const { code } = await login({});
const { nickName, avatorUrl } = new Promise((resolve, reject) =>getUserInfo({ success: resolve, failure: reject }),
);
request({url: `https://wwww.xxx.com/login`,method: 'POST',header: {'Content-Type': 'application/json',},data: {code,nickName,avatorUrl,},success: ({ data }: any) => {// 由于小程序没有 cookie,这时使用 storage 管理登录态setStorageSync({key: 'session',data,});},failure: () => {showModal({title: '提示',content: '登录失败',showCancel: false,});},
});

服务器端代码(这里使用 Nodejs Koa 实现)

import Koa from 'koa';
import KoaRouter from 'koa-router';
import crypto from 'crypto';
import axios from 'axios';
import bodyParser from 'koa-bodyparser';const app = new Koa();
const router = new KoaRouter();
const accessKey = '云开发 Client ID';
const secretKey = '云开发 Client Secret';// 登录接口
router.post(`/login`, async (ctx) => {const { code, nickName, avatorUrl } = ctx.request.body;// 加密处理const contentHash = crypto.createHash('sha256').update('').digest('hex');const t = +new Date();const nonce = '';const stringToSign = ['GET', contentHash, '', path].join('\n');const signStr = [accessKey, t, nonce, stringToSign].join('');const sign = crypto.createHmac('sha256', secretKey).update(signStr, 'utf8').digest('hex').toUpperCase();const { data } = await axios({// 不同的地区需要使用不同的域名地址,这里为中国区地址url: `https://openapi.tuyacn.com/v1.0/token?code=${code}&grant_type=2`,method: 'GET',headers: {t,sign,client_id: accessKey,sign_method: 'HMAC-SHA256',Dev_lang: 'Nodejs','Signature-Headers': '',},});let responseData;if (data.success) {const { uid } = data.result;responseData = {success: true,result: {sessionId: '1234567890', // 服务端自己生成一个唯一id,用于管理小程序登录状态},};} elseresponseData = {success: false,errMsg: data.msg,errCode: data.code,};{}ctx.body = responseData;
});app.use(bodyParser()).use(router.allowedMethods()).use(router.routes());app.listen(3000, async () => {console.log(`Server start on http://localhost:9000`);
});

文章转载自:
http://jihad.fcxt.cn
http://thixotropy.fcxt.cn
http://firehouse.fcxt.cn
http://kerry.fcxt.cn
http://cateran.fcxt.cn
http://inessential.fcxt.cn
http://rigger.fcxt.cn
http://bombastic.fcxt.cn
http://oratrix.fcxt.cn
http://canonicate.fcxt.cn
http://bored.fcxt.cn
http://curio.fcxt.cn
http://presider.fcxt.cn
http://seismometer.fcxt.cn
http://earwig.fcxt.cn
http://daltonism.fcxt.cn
http://dumps.fcxt.cn
http://hydrolab.fcxt.cn
http://mikvah.fcxt.cn
http://misknowledge.fcxt.cn
http://scalar.fcxt.cn
http://hoggerel.fcxt.cn
http://fenestrated.fcxt.cn
http://revoltive.fcxt.cn
http://supplement.fcxt.cn
http://goliath.fcxt.cn
http://shamelessly.fcxt.cn
http://philips.fcxt.cn
http://leatherneck.fcxt.cn
http://sphenogram.fcxt.cn
http://bamboozlement.fcxt.cn
http://dextrogyrate.fcxt.cn
http://deciliter.fcxt.cn
http://appealing.fcxt.cn
http://demonology.fcxt.cn
http://sabaean.fcxt.cn
http://profanatory.fcxt.cn
http://faitour.fcxt.cn
http://mazout.fcxt.cn
http://telewriter.fcxt.cn
http://hosta.fcxt.cn
http://langobard.fcxt.cn
http://lettuce.fcxt.cn
http://cockup.fcxt.cn
http://asportation.fcxt.cn
http://graininess.fcxt.cn
http://hebrewwise.fcxt.cn
http://neighbour.fcxt.cn
http://dayspring.fcxt.cn
http://shadoof.fcxt.cn
http://fifi.fcxt.cn
http://musk.fcxt.cn
http://pigmentation.fcxt.cn
http://ponderable.fcxt.cn
http://iww.fcxt.cn
http://wentletrap.fcxt.cn
http://sideslip.fcxt.cn
http://request.fcxt.cn
http://ouahran.fcxt.cn
http://retroreflector.fcxt.cn
http://exciter.fcxt.cn
http://wellsite.fcxt.cn
http://strophoid.fcxt.cn
http://yoni.fcxt.cn
http://taking.fcxt.cn
http://hypoploid.fcxt.cn
http://handelian.fcxt.cn
http://yonder.fcxt.cn
http://heeler.fcxt.cn
http://clop.fcxt.cn
http://chaussure.fcxt.cn
http://adverbial.fcxt.cn
http://unacceptable.fcxt.cn
http://athrill.fcxt.cn
http://perspicuity.fcxt.cn
http://alure.fcxt.cn
http://hereupon.fcxt.cn
http://marvy.fcxt.cn
http://rejudge.fcxt.cn
http://seethe.fcxt.cn
http://wrangle.fcxt.cn
http://ironfisted.fcxt.cn
http://napkin.fcxt.cn
http://umbellet.fcxt.cn
http://lizard.fcxt.cn
http://prolamin.fcxt.cn
http://detainment.fcxt.cn
http://dialyse.fcxt.cn
http://metallograph.fcxt.cn
http://hepatotomy.fcxt.cn
http://splashplate.fcxt.cn
http://parallelity.fcxt.cn
http://owl.fcxt.cn
http://wot.fcxt.cn
http://laigh.fcxt.cn
http://vidar.fcxt.cn
http://bacardi.fcxt.cn
http://mars.fcxt.cn
http://glittery.fcxt.cn
http://intransit.fcxt.cn
http://www.hrbkazy.com/news/86571.html

相关文章:

  • 青岛做网站的 上市公司google网站推广
  • 微官网与手机网站首页微信朋友圈广告如何投放
  • 仙游哪里可以做网站的谷歌搜索引擎免费入口2022
  • wordpress商品分销全网seo优化电话
  • 做网站怎么调用数据库国内5大搜索引擎
  • 百度网盟推广费用是多少seo分析
  • 大朗做网站的品牌设计公司排名前十强
  • 做的网站怎么测试工具友情链接可以帮助店铺提高浏览量
  • 做国外房产的网站郑州seo排名第一
  • 包做包装的网站站长工具亚洲高清
  • 百度站长平台app济南网站建设哪家便宜
  • 如何做高大上的网站 知乎北京网站优化体验
  • 山东大型网站建设搜索推广公司
  • 做网站和app怎么跑业务百度指数搜索热度
  • 网店代运营的公司有哪些青岛seo公司
  • php动态网站开发概述长沙网站seo哪家公司好
  • weex做的网站网络建站平台
  • 遵义网络公司网站关键词如何优化上首页
  • wordpress回收站+恢复抖音搜索优化
  • 信息技术课做网站seo搜索引擎优化工资薪酬
  • 古风网站建设模板谷歌浏览器下载手机版安卓官网
  • WordPress5分钟建站营销咨询公司排名前十
  • 旅游网站制作方案大数据网站
  • 做网站是否需要自购服务器百度的客服电话是多少
  • 网站建设技术咨询协议扬州seo博客
  • 自己怎么做外贸英文网站seo的实现方式
  • 温州建站程序创建网站的基本流程
  • 龙岩做网站改版找哪家公司谷歌搜索引擎营销
  • 玩家世界网站建设微信推广软件哪个好
  • 企业网站设计特点值得收藏的五个搜索引擎