更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -18,7 +18,6 @@ import (
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// PlatformCommissionController 平台端推广佣金(台账 / 统计 / 规则维护)
|
||||
type PlatformCommissionController struct {
|
||||
beego.Controller
|
||||
}
|
||||
@@ -38,8 +37,6 @@ func (c *PlatformCommissionController) ok(data interface{}) {
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
// commissionRuleDTO 规则出参。
|
||||
// 比例值统一按「百分比」返回:库里存百分比×100(500 = 5%),接口返回 5,便于前端直接编辑。
|
||||
func commissionRuleDTO(row *models.PlatformCommissionRule) map[string]interface{} {
|
||||
dto := map[string]interface{}{
|
||||
"id": row.ID, "rule_name": row.RuleName, "calc_type": row.CalcType,
|
||||
@@ -49,9 +46,9 @@ func commissionRuleDTO(row *models.PlatformCommissionRule) map[string]interface{
|
||||
"steps": []map[string]interface{}{},
|
||||
}
|
||||
if row.CalcType == models.CommissionCalcFixed {
|
||||
dto["value"] = row.Value // 固定金额:分
|
||||
dto["value"] = row.Value
|
||||
} else {
|
||||
dto["value"] = float64(row.Value) / 100 // 比例:5% -> 5
|
||||
dto["value"] = float64(row.Value) / 100
|
||||
}
|
||||
if row.CalcType == models.CommissionCalcTiered && row.TierJSON != nil && *row.TierJSON != "" {
|
||||
var tiers []models.CommissionTier
|
||||
@@ -72,7 +69,6 @@ func commissionRuleDTO(row *models.PlatformCommissionRule) map[string]interface{
|
||||
return dto
|
||||
}
|
||||
|
||||
// commissionOrderDTO 佣金单出参
|
||||
func commissionOrderDTO(row *models.PlatformCommissionOrder) map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"id": row.ID, "commission_no": row.CommissionNo,
|
||||
@@ -86,7 +82,6 @@ func commissionOrderDTO(row *models.PlatformCommissionOrder) map[string]interfac
|
||||
}
|
||||
}
|
||||
|
||||
// List GET /platform/commission/list 佣金台账
|
||||
func (c *PlatformCommissionController) List() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -117,7 +112,6 @@ func (c *PlatformCommissionController) List() {
|
||||
c.ok(map[string]interface{}{"list": list, "total": total, "page": page, "pageSize": pageSize})
|
||||
}
|
||||
|
||||
// Stats GET /platform/commission/stats 台账统计
|
||||
func (c *PlatformCommissionController) Stats() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -132,7 +126,6 @@ func (c *PlatformCommissionController) Stats() {
|
||||
c.ok(stats)
|
||||
}
|
||||
|
||||
// MarkPaid POST /platform/commission/:id/pay 标记已付(发放登记)
|
||||
func (c *PlatformCommissionController) MarkPaid() {
|
||||
claims, err := c.platformClaims()
|
||||
if err != nil {
|
||||
@@ -171,8 +164,6 @@ func (c *PlatformCommissionController) MarkPaid() {
|
||||
c.ok(commissionOrderDTO(row))
|
||||
}
|
||||
|
||||
/* ---------------- 佣金规则 ---------------- */
|
||||
|
||||
type commissionRulePayload struct {
|
||||
RuleName string `json:"rule_name"`
|
||||
CalcType string `json:"calc_type"`
|
||||
@@ -187,7 +178,6 @@ type commissionRulePayload struct {
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// buildTierJSON 组装阶梯配置(金额分;rate 存百分比×100)
|
||||
func buildTierJSON(steps []struct {
|
||||
Min *float64 `json:"min"`
|
||||
Max *float64 `json:"max"`
|
||||
@@ -221,7 +211,6 @@ func buildTierJSON(steps []struct {
|
||||
return string(b), err
|
||||
}
|
||||
|
||||
// RulesList GET /platform/commission/rules 规则列表
|
||||
func (c *PlatformCommissionController) RulesList() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -261,7 +250,6 @@ func (c *PlatformCommissionController) RulesList() {
|
||||
c.ok(map[string]interface{}{"list": list, "total": total, "page": page, "pageSize": pageSize})
|
||||
}
|
||||
|
||||
// RuleCreate POST /platform/commission/rules 新增规则
|
||||
func (c *PlatformCommissionController) RuleCreate() {
|
||||
claims, err := c.platformClaims()
|
||||
if err != nil {
|
||||
@@ -302,7 +290,6 @@ func (c *PlatformCommissionController) RuleCreate() {
|
||||
c.ok(commissionRuleDTO(row))
|
||||
}
|
||||
|
||||
// RuleUpdate POST /platform/commission/rules/:id 更新规则
|
||||
func (c *PlatformCommissionController) RuleUpdate() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -350,7 +337,6 @@ func (c *PlatformCommissionController) RuleUpdate() {
|
||||
c.ok(commissionRuleDTO(row))
|
||||
}
|
||||
|
||||
// applyCommissionRuleValues 按计算方式写入 value / tier_json
|
||||
func applyCommissionRuleValues(row *models.PlatformCommissionRule, p *commissionRulePayload) error {
|
||||
switch row.CalcType {
|
||||
case models.CommissionCalcPercent:
|
||||
@@ -384,7 +370,6 @@ func applyCommissionRuleValues(row *models.PlatformCommissionRule, p *commission
|
||||
return nil
|
||||
}
|
||||
|
||||
// RuleDelete DELETE /platform/commission/rules/:id 删除规则(软删除;历史佣金单不受影响)
|
||||
func (c *PlatformCommissionController) RuleDelete() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -406,7 +391,6 @@ func (c *PlatformCommissionController) RuleDelete() {
|
||||
c.ok(nil)
|
||||
}
|
||||
|
||||
// RuleToggle POST /platform/commission/rules/:id/status 启用/停用
|
||||
func (c *PlatformCommissionController) RuleToggle() {
|
||||
if _, err := c.platformClaims(); err != nil {
|
||||
code := identity.Status(err)
|
||||
|
||||
Reference in new issue
Block a user