CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-com-github-binarywang--weixin-java-miniapp

Comprehensive Java SDK for WeChat MiniApp development with complete platform integration

Pending
Overview
Eval results
Files

development-tools.mddocs/

Development Tools

Development and management tools including code deployment, API management, plugin support, and testing utilities for WeChat MiniApp development workflow.

Capabilities

Code Management

Mini program code version control, deployment management, and code audit functionality.

public interface WxMaCodeService {
    // Version Control
    boolean commitCode(String templateId, String userVersion, String userDesc, ExtJson extJson) throws WxErrorException;
    WxMaCodeVersionsResult getCodeVersions() throws WxErrorException;
    boolean releaseCode(String userVersion) throws WxErrorException;
    boolean rollbackRelease() throws WxErrorException;
    WxMaReleaseResult getRelease() throws WxErrorException;
    
    // Code Auditing
    WxMaSubmitAuditResult submitAudit() throws WxErrorException;
    WxMaSubmitAuditResult submitAudit(List<WxMaCategory> categoryList) throws WxErrorException;
    WxMaGetAuditStatusResult getAuditStatus(String auditId) throws WxErrorException;
    WxMaGetLatestAuditStatusResult getLatestAuditStatus() throws WxErrorException;
    boolean undoCodeAudit() throws WxErrorException;
    
    // Testing & Preview
    boolean setTestWhiteList(List<String> wechatidList) throws WxErrorException;
    WxMaQrCodeResult getTestQrCode(String path, Map<String, String> queryParams) throws WxErrorException;
    
    // Domain Management
    boolean modifyDomain(String action, List<String> requestDomains, List<String> wsRequestDomains, 
                        List<String> uploadDomains, List<String> downloadDomains) throws WxErrorException;
    WxMaDomainResult getDomain() throws WxErrorException;
}

JSAPI Configuration

JavaScript API configuration and signature management for WeChat MiniApp frontend integration.

public interface WxMaJsapiService {
    // JSAPI Ticket Management
    String getJsapiTicket() throws WxErrorException;
    String getJsapiTicket(boolean forceRefresh) throws WxErrorException;
    
    // JS SDK Configuration
    WxJsapiSignature createJsapiSignature(String url) throws WxErrorException;
    
    // Card Extension Signatures
    String getCardApiTicket() throws WxErrorException;
    String getCardApiTicket(boolean forceRefresh) throws WxErrorException;
    WxJsapiSignature createCardApiSignature(String... params) throws WxErrorException;
}

Plugin Management

Plugin installation, configuration, and management for extending mini program functionality.

public interface WxMaPluginService {
    // Plugin Operations
    boolean applyPlugin(String action, String pluginAppid, String reason) throws WxErrorException;
    WxMaPluginListResult getPluginList() throws WxErrorException;
    boolean setDevPluginList(String action, String appid, String userVersion) throws WxErrorException;
    WxMaDevPluginResult getDevPlugin() throws WxErrorException;
    
    // Plugin Development
    boolean unbindPlugin(String action, String pluginAppid) throws WxErrorException;
    WxMaPluginDevApplyListResult getPluginDevApplyList(Integer page, Integer num) throws WxErrorException;
}

Open API Management

API quota monitoring, rate limiting management, and usage analytics for WeChat platform APIs.

public interface WxMaOpenApiService {
    // Quota Management
    WxOpenMaQuotaGetResult getApiQuota(String cgiPath) throws WxErrorException;
    WxOpenMaQueryQuotaResult queryQuota(String cgiPath) throws WxErrorException;
    
    // Rate Limiting
    boolean clearQuota(String appid, String cgiPath) throws WxErrorException;
    
    // API Statistics
    WxMaApiStatsResult getApiStats(Date startDate, Date endDate) throws WxErrorException;
    List<WxMaApiQuotaInfo> getQuotaList() throws WxErrorException;
}

Settings Management

Server configuration, member management, and application settings.

public interface WxMaSettingService {
    // Member Management
    boolean bindTester(String wechatid) throws WxErrorException;
    boolean unbindTester(String wechatid) throws WxErrorException;
    WxMaMemberAuthResult getMemberAuth(String action) throws WxErrorException;
    boolean modifyMemberAuth(String action, String auth) throws WxErrorException;
    
    // Server Configuration
    boolean modifyServerDomain(String action, List<String> requestDomains, List<String> wsRequestDomains,
                              List<String> uploadDomains, List<String> downloadDomains) throws WxErrorException;
    WxMaServerDomainResult getServerDomain() throws WxErrorException;
    
    // WebView Domain Configuration
    boolean setWebViewDomain(String action, List<String> webViewDomains) throws WxErrorException;
    WxMaWebViewDomainResult getWebViewDomain() throws WxErrorException;
}

Data Models

Code Management Models

Data models for code deployment and version management.

public class WxMaSubmitAuditResult implements Serializable {
    private String auditId;             // Audit ID
    
    public String getAuditId();
    public void setAuditId(String auditId);
    
    public static WxMaSubmitAuditResult fromJson(String json);
}

public class WxMaGetAuditStatusResult implements Serializable {
    private Integer status;             // Audit status (0: pending, 1: failed, 2: passed, 3: cancelled)
    private String reason;              // Failure reason
    private Long auditId;               // Audit ID
    private String screenshot;          // Screenshot URL
    
    public Integer getStatus();
    public void setStatus(Integer status);
    public String getReason();
    public void setReason(String reason);
    public Long getAuditId();
    public void setAuditId(Long auditId);
    public String getScreenshot();
    public void setScreenshot(String screenshot);
}

public class WxMaCodeVersionsResult implements Serializable {
    private List<WxMaCodeVersion> codeVersions;  // Code versions
    
    public List<WxMaCodeVersion> getCodeVersions();
    public void setCodeVersions(List<WxMaCodeVersion> codeVersions);
}

public class WxMaCodeVersion implements Serializable {
    private String userVersion;         // User version
    private String userDesc;            // Version description
    private Long createTime;            // Creation time
    
    public String getUserVersion();
    public void setUserVersion(String userVersion);
    public String getUserDesc();
    public void setUserDesc(String userDesc);
    public Long getCreateTime();
    public void setCreateTime(Long createTime);
}

Plugin Models

Data models for plugin management.

public class WxMaPluginListResult implements Serializable {
    private List<WxMaPluginInfo> pluginList;    // Plugin list
    
    public List<WxMaPluginInfo> getPluginList();
    public void setPluginList(List<WxMaPluginInfo> pluginList);
}

public class WxMaPluginInfo implements Serializable {
    private String appid;               // Plugin App ID
    private Integer status;             // Status
    private String nickname;            // Plugin name
    private String headimgurl;          // Plugin avatar
    
    public String getAppid();
    public void setAppid(String appid);
    public Integer getStatus();
    public void setStatus(Integer status);
    public String getNickname();
    public void setNickname(String nickname);
    public String getHeadimgurl();
    public void setHeadimgurl(String headimgurl);
}

API Management Models

Data models for API quota and statistics management.

public class WxOpenMaQuotaGetResult implements Serializable {
    private Long quotaValue;            // Quota limit
    private Long usedQuota;             // Used quota
    private Long remainQuota;           // Remaining quota
    
    public Long getQuotaValue();
    public void setQuotaValue(Long quotaValue);
    public Long getUsedQuota();
    public void setUsedQuota(Long usedQuota);
    public Long getRemainQuota();
    public void setRemainQuota(Long remainQuota);
}

public class WxOpenMaQueryQuotaResult implements Serializable {
    private Integer errcode;            // Error code
    private String errmsg;              // Error message
    private WxOpenMaQuotaInfo quota;    // Quota information
    
    public Integer getErrcode();
    public void setErrcode(Integer errcode);
    public String getErrmsg();
    public void setErrmsg(String errmsg);
    public WxOpenMaQuotaInfo getQuota();
    public void setQuota(WxOpenMaQuotaInfo quota);
}

Usage Examples

Code Deployment Workflow

@Service
public class MiniProgramDeploymentService {
    
    @Autowired
    private WxMaService wxMaService;
    
    public void deployNewVersion(String templateId, String version, String description) {
        try {
            WxMaCodeService codeService = wxMaService.getCodeService();
            
            // 1. Commit code
            ExtJson extJson = new ExtJson();
            extJson.setExtAppid("your-appid");
            extJson.setExt(Map.of("test", "value"));
            
            boolean committed = codeService.commitCode(templateId, version, description, extJson);
            if (!committed) {
                throw new RuntimeException("Failed to commit code");
            }
            
            // 2. Submit for audit
            List<WxMaCategory> categories = Arrays.asList(
                new WxMaCategory(1, 2, "工具", "信息查询")
            );
            WxMaSubmitAuditResult auditResult = codeService.submitAudit(categories);
            String auditId = auditResult.getAuditId();
            
            // 3. Monitor audit status
            WxMaGetAuditStatusResult status = codeService.getAuditStatus(auditId);
            logger.info("Audit status: {}, reason: {}", status.getStatus(), status.getReason());
            
            // 4. Release when approved (status == 2)
            if (status.getStatus() == 2) {
                boolean released = codeService.releaseCode(version);
                if (released) {
                    logger.info("Version {} released successfully", version);
                } else {
                    logger.error("Failed to release version {}", version);
                }
            }
            
        } catch (WxErrorException e) {
            logger.error("Deployment failed: {}", e.getMessage(), e);
            throw new RuntimeException("Deployment failed", e);
        }
    }
}

Plugin Management

@Service
public class PluginManagementService {
    
    @Autowired
    private WxMaService wxMaService;
    
    public void managePlugins() {
        try {
            WxMaPluginService pluginService = wxMaService.getPluginService();
            
            // Apply for plugin
            boolean applied = pluginService.applyPlugin("apply", "plugin-appid", "Need this plugin for functionality");
            
            if (applied) {
                // Get plugin list
                WxMaPluginListResult result = pluginService.getPluginList();
                for (WxMaPluginInfo plugin : result.getPluginList()) {
                    logger.info("Plugin: {} - {}, Status: {}", 
                               plugin.getAppid(), plugin.getNickname(), plugin.getStatus());
                }
                
                // Set development plugin
                pluginService.setDevPluginList("dev_add", "plugin-appid", "1.0.0");
            }
            
        } catch (WxErrorException e) {
            logger.error("Plugin management failed: {}", e.getMessage(), e);
        }
    }
}

API Quota Monitoring

@Service
public class ApiQuotaService {
    
    @Autowired
    private WxMaService wxMaService;
    
    @Scheduled(fixedRate = 300000) // Check every 5 minutes
    public void monitorApiQuotas() {
        try {
            WxMaOpenApiService openApiService = wxMaService.getOpenApiService();
            
            // Check critical API quotas
            String[] criticalApis = {
                "/cgi-bin/message/subscribe/send",
                "/wxa/getwxacode",
                "/cgi-bin/token"
            };
            
            for (String apiPath : criticalApis) {
                WxOpenMaQuotaGetResult quota = openApiService.getApiQuota(apiPath);
                
                long usagePercent = (quota.getUsedQuota() * 100) / quota.getQuotaValue();
                
                if (usagePercent > 80) {
                    logger.warn("High API usage for {}: {}% ({}/{})", 
                               apiPath, usagePercent, 
                               quota.getUsedQuota(), quota.getQuotaValue());
                    
                    // Send alert to monitoring system
                    sendQuotaAlert(apiPath, usagePercent, quota);
                }
            }
            
        } catch (WxErrorException e) {
            logger.error("Quota monitoring failed: {}", e.getMessage(), e);
        }
    }
    
    private void sendQuotaAlert(String apiPath, long usagePercent, WxOpenMaQuotaGetResult quota) {
        // Implementation for sending alerts (email, SMS, etc.)
    }
}

JSAPI Configuration

@RestController
public class JsapiController {
    
    @Autowired
    private WxMaService wxMaService;
    
    @GetMapping("/jsapi/config")
    public Map<String, Object> getJsapiConfig(@RequestParam String url) {
        try {
            WxMaJsapiService jsapiService = wxMaService.getJsapiService();
            WxJsapiSignature signature = jsapiService.createJsapiSignature(url);
            
            Map<String, Object> config = new HashMap<>();
            config.put("appId", wxMaService.getWxMaConfig().getAppid());
            config.put("timestamp", signature.getTimestamp());
            config.put("nonceStr", signature.getNonceStr());
            config.put("signature", signature.getSignature());
            
            return config;
            
        } catch (WxErrorException e) {
            logger.error("JSAPI config generation failed: {}", e.getMessage(), e);
            throw new RuntimeException("JSAPI config generation failed", e);
        }
    }
}

This development tools module provides comprehensive support for the complete mini program development lifecycle, from code deployment to API management and monitoring.

Install with Tessl CLI

npx tessl i tessl/maven-com-github-binarywang--weixin-java-miniapp

docs

analytics.md

cloud-development.md

configuration.md

core-services.md

development-tools.md

ecommerce.md

index.md

live-streaming.md

logistics.md

media-content.md

messaging.md

qr-codes.md

user-management.md

tile.json