feat: 接入旧站管理端并完整迁移后台能力
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"hfb_jysh/backend/internal/model"
|
||||
"hfb_jysh/backend/internal/modules/invitation"
|
||||
"hfb_jysh/backend/internal/modules/notification"
|
||||
"hfb_jysh/backend/internal/modules/rentergrowth"
|
||||
"hfb_jysh/backend/internal/modules/wallet"
|
||||
"hfb_jysh/backend/internal/timeutil"
|
||||
"hfb_jysh/backend/pkg/money"
|
||||
@@ -307,6 +308,17 @@ func (r *Repository) Complete(ctx context.Context, pickupID uint64, req Complete
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := rentergrowth.AwardPickupOwnerCompleted(
|
||||
tx,
|
||||
pickup.ID,
|
||||
pickup.PickupNo,
|
||||
pickup.OwnerID,
|
||||
pickup.SettleAmountCent,
|
||||
rentergrowth.SourcePickupCompleted,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 邀请返利:线下提号不走正常订单结账流程,必须在这里补发号主(卖家)侧返利,
|
||||
// 否则号主邀请人永远拿不到提号产生的分成。
|
||||
// 基准取「网站加价」与「线下利润」的较小值,避免按虚高的单一利润口径多算。
|
||||
@@ -854,9 +866,9 @@ func applyAdminPickupFilters(db *gorm.DB, query AdminPickupQuery) *gorm.DB {
|
||||
}
|
||||
if kw := strings.TrimSpace(query.Keyword); kw != "" {
|
||||
upper := strings.ToUpper(kw)
|
||||
if len(kw) == 11 && kw[0] == '1' && isAllDigits(kw) {
|
||||
// 11 位手机号:命中 users(phone) 唯一索引
|
||||
db = db.Where("owner.phone = ?", kw)
|
||||
if isPhoneKeyword(kw) {
|
||||
// 先由 users(phone) 唯一索引解析用户,再让 admin_pickups(owner_id) 索引驱动。
|
||||
db = db.Where("p.owner_id = (SELECT id FROM users WHERE phone = ?)", kw)
|
||||
} else if strings.HasPrefix(upper, "PK") || strings.HasPrefix(upper, "P") {
|
||||
// 提号编号:命中 admin_pickups(pickup_no) 唯一索引
|
||||
db = db.Where("p.pickup_no = ?", kw)
|
||||
@@ -894,9 +906,8 @@ func (r *Repository) adminPickupCountQuery(ctx context.Context, query AdminPicku
|
||||
if id, err := strconv.ParseUint(kw, 10, 64); err == nil && id > 0 && kw[0] != '0' && id < 100000000 {
|
||||
return r.db.WithContext(ctx).Table("admin_pickups AS p")
|
||||
}
|
||||
if len(kw) == 11 && kw[0] == '1' && isAllDigits(kw) {
|
||||
return r.db.WithContext(ctx).Table("admin_pickups AS p").
|
||||
Joins("JOIN users AS owner ON owner.id = p.owner_id")
|
||||
if isPhoneKeyword(kw) {
|
||||
return r.db.WithContext(ctx).Table("admin_pickups AS p")
|
||||
}
|
||||
if strings.HasPrefix(upper, "L") || (len(kw) >= 12 && isAllDigits(kw)) {
|
||||
return r.db.WithContext(ctx).Table("admin_pickups AS p").
|
||||
@@ -1974,3 +1985,7 @@ func isAllDigits(s string) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func isPhoneKeyword(s string) bool {
|
||||
return len(s) == 11 && s[0] == '1' && isAllDigits(s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user