# wxapp **Repository Path**: cynen/wxapp ## Basic Information - **Project Name**: wxapp - **Description**: 小程序代码仓 - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-29 - **Last Updated**: 2024-06-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # wxapp ## 介绍 CynenDemo小程序代码仓 主要是学习如何发布小程序.熟悉流程和外部交互. ## 说明文档 ### 前后端分离. server 是后端模块 app是前端模块 ### 请求方式 方法: POST 路劲: http://127.0.0.1:9090/api/loan ```json // 参数json: 数据类型,带小数点的都是float64, 不带的都是int类型. { "loanMode": 0, // 贷款模式 0 等额本金/ 1 等额本息 "loanAmount": 1650000.00, // 贷款总金额 "loanMonths": 360, // 贷款期限,传递贷款月数(非年). "loanRate": 0.049 // 贷款利率, 传递为 0.043 , 不要传递 4.3 } ``` ### 返回结构: ```json { "data": { "totalInterest": 962792.36, // 总利息 "totalMoney": 2612792.36, // 还款总额 = 贷款金额 + 总利息 "loanAmount": 1650000, // 贷款总金额,接口传进来的值. "loanMode": 0, // 贷款模式. 接口传递过来的. "loanMonths": 360, // 贷款期限. 月数 "loanRate": 0.049, // 贷款利率 "monthPay": 11320.83, // 每个月支付, 如果是等额本金,就取第一个月的值. "monthlyPays": [ // 每个月的还款信息 { "seqMonth": 1, // 第几个月 "monthPay": 11320.83, // 本月月供 "MonthPayLoan": 4583.33, // 本月本金 "monthPayInterest": 6737.5, // 本月利息 "releaseLoan": 1645416.67, // 剩余本金 "releaseTotal": 2854797.92 // 剩余总款 }, {}... ] }, "msg": "ok" // 状态,异常会有异常描述. } ``` ### 代码 请求参数 ```go type Param struct { // 接收前端传递过来的参数. LoanMode int `json:"loanMode"` //贷款模式 0 等额本金/ 1 等额本息 LoanAmount float64 `json:"loanAmount"` // 贷款金额 LoanMonths int `json:"loanMonths"` // 贷款期数. 月份期数 LoanRate float64 `json:"loanRate"` // 贷款年利率. 默认传递值: 0.031 } ``` 返回值 ```go type MonthPay struct { SeqMonth int `json:"seqMonth"` // 第几个月 MonthPay float64 `json:"monthPay"` // 本月月供 MonthPayLoan float64 `json:"MonthPayLoan"` // 本月本金 MonthPayInterest float64 `json:"monthPayInterest"` // 本月利息 ReleaseLoan float64 `json:"releaseLoan"` // 剩余本金 -- 贷款金额 - 已供本金. ReleaseTotal float64 `json:"releaseTotal"` // 剩余总额 -- 暂未计算. } ```