Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:A616567126 GPT WEB JAVA WxOutServiceImpl

From Leeroopedia
Knowledge Sources
Domains WeChat_Integration, Command_Processing
Last Updated 2026-10-13 00:00 GMT

Overview

Concrete tool for processing WeChat user commands (draw, upscale, describe, bind, exchange, recharge, password management) and routing to AI services or account operations, provided by the Spring framework.

Description

The WxOutServiceImpl class implements the WxOutService interface with command methods:

  • draw(content, fromUser) — Parses "/画画 prompt # imageUrl", validates content, checks credits, submits MJ task with subType=2
  • paintingChanges(content, fromUser) — Parses "/U-1-taskId" or "/V-1-taskId", submits upscale/variation
  • spellAnalysis(content, fromUser) — Parses "/咒语解析 imageUrl", submits MJ describe task
  • bind/opened(content, fromUser) — Binds/creates account with mobile number
  • exchange(content, fromUser) — Redeems card key "兑换-XXXX"
  • recharge(content, fromUser) — Creates WeChat Pay Native order, sends QR code via kefu
  • changePassword/resetPassword(content, fromUser) — Password management

All methods log to WxLog via saveWxLog().

Usage

Import this service when you need to:

  • Process WeChat bot commands for MJ, account, and payment operations
  • Submit MJ tasks from WeChat with subType=2 delivery
  • Generate WeChat Pay QR codes for recharge

Code Reference

Source Location

  • Repository: GPT-WEB-JAVA
  • File: src/main/java/com/intelligent/bot/service/wx/impl/WxOutServiceImpl.java

Signature

@Service
public class WxOutServiceImpl implements WxOutService {
    public String bind(String content, String fromUser);
    public String opened(String content, String fromUser);
    public String query(String content, String fromUser);
    public String draw(String content, String fromUser);
    public String paintingChanges(String content, String fromUser);
    public String spellAnalysis(String content, String fromUser);
    public String exchange(String content, String fromUser);
    public String recharge(String content, fromUser) throws Exception;
    public String changePassword(String content, String fromUser);
    public String resetPassword(String content, String fromUser);
    public void cardPin(String fromUser) throws WxErrorException;
    private Task newTask(Long userId);
}

Import

import com.intelligent.bot.service.wx.WxOutService;

I/O Contract

Inputs

Name Type Required Description
content String Yes User message text (e.g. "/画画 一只狗 # https://...")
fromUser String Yes WeChat openid

Outputs

Name Type Description
returns String Response text returned to WeChat as XML

Usage Examples

Draw Command

// User sends: "/画画 一只小狗 # https://img.url"
String respContent = wxOutService.draw(content, fromUser);
// 1. Extract prompt and image URLs from content
// 2. Validate via baiDuService.textToExamine()
// 3. Check credits via checkService.checkWxUser()
// 4. Create Task with subType=2
// 5. Translate prompt, submit via taskService.submitImagine()
// 6. Return "✅咒语已提交,请等待出图"

Recharge Command

// User sends: "/recharge-1" (¥5 for 100 credits)
String respContent = wxOutService.recharge(content, fromUser);
// 1. Create order with WxPayUtil.buildNativePayJson()
// 2. Call WeChat Pay Native API
// 3. Generate QR code from code_url
// 4. Upload QR as WeChat media, send IMAGE kefu message
// 5. Return "✅订单创建完成"

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment