WeChat Official Account Development

Introduction

This is my own Official Account for server side program. which main purpose is to learn how to develop one functional and beautiful official Account which can provide below service in plan.
The code is host under here

The feature may be inclued

  1. implement the e-book download platform, which can push e-book to kindle by email service.
  2. E - book conversion function, which can conver the format between epub, mobi, txt .etc.
  3. add one spider script which will grab e-books from other sites, which can enrich this Official Account.
  4. this official account 杂感123, which also contains my own articles. part of them written by myself, and I also upload some article which interesting and meaningful.

The Task under plan

  1. need add log system which can indicate the issue.
  2. add web spider to grab the e-book from other web site(outer site).
  3. add docker, which can support redis or leveldb or mysql to store the data. done by docker with postgres
  4. to the direction of micro-service architecture evolution. https://linux.cn/article-7584-1.html
  5. need db as a bridge to communicte between threads, in current situation can use simple shared data to communicate with each other, should consider communicate by DB or micro-service.
  6. in final stage, I am considering packge whole project in one docker image, which can listening incoming message and reponse with outside, behind it exist others container service like database service .etc which can evolute to micro-service platform.

Encountered Problem

  1. because Tencent need the account to be verified to get more privilege to use more professional API(need money, I hate it), which limit the function of this official account. take upload media as example, with privilege can upload matrials in forever mode, without this feature the uploaded media can only 3 days available.

    solution operation:

    1. when get the picture, first to upload, then get the media_id, then give back the user wanted picture, but failed with the reason of take too much time, which cause The Official Account is temporarily unavailable. Try again later. display on Official Account.
    2. The reason of above issue — Official Account will request in timeout of 5s, if server not response, Tencent will sent 3-request in sequence, which not in interval of 5s again. if not reponse with these 3 request, **The Official Account is temporarily unavailable. Try again later. ** will be display in Official Account, So code should reponse “success” for Tencent’s request to avoid of 3-time-request.
    3. have to try the second way, start a thread in background with a cycle to upload media, then update corresponding media_id which list in code, then can solve this question.
  2. try to use the containered database postgres, [this ariticle reference](./docker database Provide service.md) By contrast to traditional way to install indenpent database installer, such as mysql, redis, postgresql, which will take much more time to install and configure them, with the container can take more effect. such as extensible、Scalable、flexible .etc

The work under doing

  1. set get_access_token as one single thread, which as single service to supply the access_token. Done
  2. set another thread which in backgroud to upload the media in fixture cycle, then update the corresponing media_id of pictures. Ready To Do.

Related Technologies

  1. Flask
  2. Mysql
  3. Redis
  4. MessageQueue, such as RabbitMQ
  5. multi-thread or multi-process
  6. Restful-API
  7. Micro-service
  8. Docker

Note:

  1. because I am new person to this area, so reference the below link code and doc as the base project code.
    https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1472017492_58YV5
  2. if you really interested in my account杂感123, please follow it, and take an eye on this site’s change.

Reference

  1. 微信公众平台,入门指引
  2. web.py
  3. Postgres
  4. micro-service
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Python 微信支付 wechatsdk 是一个用于处理微信支付功能的 Python 第三方库。它提供了一系列的接口和方法,用于实现微信支付交易的各种功能,包括创建订单、查询订单状态、申请退款等。 使用 wechatsdk,我们可以方便地集成微信支付功能到 Python 项目中。首先,我们需要通过在微信商户平台上注册账号,并获得相应的密钥和证书文件。然后,在 Python 项目中引入 wechatsdk 库,并根据接口文档的要求设置好相关的配置参数,例如商户 ID、商户密钥等。 接下来,我们可以使用 wechatsdk 提供的接口进行各种支付交易操作。例如,创建订单时我们可以使用统一下单接口,传入必要的参数例如商品描述、订单金额等。wechatsdk 会自动将收到的参数进行签名,并生成一个支付链接。用户在微信客户端打开支付链接后,可以进行支付操作。 支付成功后,wechatsdk 提供了查询订单接口,用于查询订单的支付状态。根据订单号或其他标识,我们可以向微信服务器发起查询请求,获取订单的详细信息,例如支付状态、支付金额等。 退款功能也可以通过 wechatsdk 来实现。我们可以使用申请退款接口传入相应的参数,并进行退款操作。微信服务器会根据退款申请的参数进行处理,并返回相应的结果。 总之,Python 微信支付 wechatsdk 是一个方便易用的库,可以帮助开发者快速集成微信支付功能到他们的 Python 项目中。无论是处理支付交易、查询订单状态还是申请退款,都可以借助 wechatsdk 轻松实现。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值