@@ -73,10 +73,14 @@ func Version(c *gin.Context) { | |||||
appVersion := svc.GetSysCfgStr("app_version") | appVersion := svc.GetSysCfgStr("app_version") | ||||
version := make([]md.Version, 0) | version := make([]md.Version, 0) | ||||
json.Unmarshal([]byte(appVersion), &version) | json.Unmarshal([]byte(appVersion), &version) | ||||
for k, v := range version { | |||||
version[k].Img = svc.GetOssUrl("default_icon/" + v.Type + "_icon.png") | |||||
newVersion := make([]md.Version, 0) | |||||
for _, v := range version { | |||||
v.Img = svc.GetOssUrl("default_icon/" + v.Type + "_icon.png") | |||||
if v.Type != "360" { | |||||
newVersion = append(newVersion, v) | |||||
} | |||||
} | } | ||||
res := md.VersionResp{Version: version, IsAuditVersion: "0"} | |||||
res := md.VersionResp{Version: newVersion, IsAuditVersion: "0"} | |||||
NewCloudBundleDb := implement.NewCloudBundleDb(db.Db) | NewCloudBundleDb := implement.NewCloudBundleDb(db.Db) | ||||
os := "1" | os := "1" | ||||
if c.GetHeader("platform") == "iOS" { | if c.GetHeader("platform") == "iOS" { | ||||
@@ -14,7 +14,7 @@ import ( | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/aliyun" | "code.fnuoos.com/EggPlanet/egg_system_rules.git/aliyun" | ||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/kuaizhan" | |||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/baidu" | |||||
md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" | md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" | ||||
md4 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | md4 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | ||||
es2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/es" | es2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/es" | ||||
@@ -202,6 +202,56 @@ func UserBindParent(c *gin.Context) { | |||||
return | return | ||||
} | } | ||||
// BindUserInfo | |||||
// @Summary 绑定用户信息 | |||||
// @Tags 会员中心 | |||||
// @Description 绑定用户信息 | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param req body md.WechatAccountUserInfoReq true "注册参数" | |||||
// @Success 200 {string} "具体数据" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/v1/memberCenter/bindUserInfo [post] | |||||
func BindUserInfo(c *gin.Context) { | |||||
var req md.WechatAccountUserInfoReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = svc.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
if req.WechatAccount == "" { | |||||
e.OutErr(c, 400, e.NewErr(400, "微信号不能为空")) | |||||
return | |||||
} | |||||
ownUser := svc.GetUser(c) | |||||
cols := "" | |||||
if req.Nickname != "" { | |||||
ownUser.Nickname = req.Nickname | |||||
cols += ",nickname" | |||||
} | |||||
if req.HeadImg != "" { | |||||
ownUser.Avatar = req.HeadImg | |||||
cols += ",avatar" | |||||
} | |||||
if req.WechatAccount != "" { | |||||
ownUser.WechatAccount = req.WechatAccount | |||||
cols += ",wechat_account" | |||||
} | |||||
if cols == "" { | |||||
e.OutErr(c, 400, e.NewErr(400, "修改失败")) | |||||
return | |||||
} | |||||
_, err = db.Db.Where("id=?", ownUser.Id).Cols(cols[1:]).Update(ownUser) | |||||
if err != nil { | |||||
e.OutErr(c, 400, e.NewErr(400, "修改失败")) | |||||
return | |||||
} | |||||
e.OutSuc(c, "success", nil) | |||||
return | |||||
} | |||||
// UpdatePassword | // UpdatePassword | ||||
// @Summary 修改密码-不要原密码 换成验证码 | // @Summary 修改密码-不要原密码 换成验证码 | ||||
// @Tags 账号与安全 | // @Tags 账号与安全 | ||||
@@ -308,11 +358,11 @@ func InviteUrl(c *gin.Context) { | |||||
} | } | ||||
} | } | ||||
if isHas == 0 { | if isHas == 0 { | ||||
send, _ := kuaizhan.KuaizhanSend(svc.GetSysCfgStr("kuaizhan_app_key"), svc.GetSysCfgStr("kuaizhan_app_secret"), link) | |||||
if gjson.Get(send, "url").String() != "" { | |||||
url, _ := baidu.BaiduShortenUrl(svc.GetSysCfgStr("baidu_token"), link) | |||||
if url != "" { | |||||
var uniqueId = php2go.Md5(link) | var uniqueId = php2go.Md5(link) | ||||
oldLink := link | oldLink := link | ||||
link = gjson.Get(send, "url").String() | |||||
link = url | |||||
tmp := map[string]interface{}{ | tmp := map[string]interface{}{ | ||||
"uid": user.Id, | "uid": user.Id, | ||||
"link": oldLink, | "link": oldLink, | ||||
@@ -1,8 +1,6 @@ | |||||
package md | package md | ||||
type MemberCenterGetBasicResp struct { | type MemberCenterGetBasicResp struct { | ||||
Nickname string `json:"nickname"` // 会员名称 | |||||
LevelName string `json:"level_name"` // 会员等级名称 | |||||
ActiveNum string `json:"active_num"` // 活跃值 | ActiveNum string `json:"active_num"` // 活跃值 | ||||
EggScore string `json:"egg_score"` // 蛋蛋分 | EggScore string `json:"egg_score"` // 蛋蛋分 | ||||
EggEnergy string `json:"egg_energy"` // 能量值 | EggEnergy string `json:"egg_energy"` // 能量值 | ||||
@@ -11,10 +9,13 @@ type MemberCenterGetBasicResp struct { | |||||
Date string `json:"date"` // 兑换时间(每月x日) | Date string `json:"date"` // 兑换时间(每月x日) | ||||
Ratio string `json:"ratio"` // 能量值兑换比例(x:y) | Ratio string `json:"ratio"` // 能量值兑换比例(x:y) | ||||
Amount string `json:"amount"` // 账户余额 | Amount string `json:"amount"` // 账户余额 | ||||
Id string `json:"id"` | |||||
Phone string `json:"phone"` | |||||
InviteCode string `json:"invite_code"` | |||||
HeadImg string `json:"head_img"` | |||||
Nickname string `json:"nickname" example:"昵称"` | |||||
LevelName string `json:"level_name" example:"等级"` | |||||
InviteCode string `json:"invite_code" example:"邀请码"` | |||||
HeadImg string `json:"head_img" example:"头像"` | |||||
Id string `json:"id" example:"个人ID号"` | |||||
Phone string `json:"phone" example:"手机号"` | |||||
WechatAccount string `json:"wechat_account" example:"微信号"` | |||||
IsBindExtend string `json:"is_bind_extend" example:"是否绑定了上级 0否 1是"` | IsBindExtend string `json:"is_bind_extend" example:"是否绑定了上级 0否 1是"` | ||||
IsRealName string `json:"is_real_name" example:"是否实名认证 0否 1是"` | IsRealName string `json:"is_real_name" example:"是否实名认证 0否 1是"` | ||||
} | } | ||||
@@ -11,6 +11,11 @@ type UserInfoResp struct { | |||||
type InviteCodeUserInfoReq struct { | type InviteCodeUserInfoReq struct { | ||||
InviteCode string `json:"invite_code"` | InviteCode string `json:"invite_code"` | ||||
} | } | ||||
type WechatAccountUserInfoReq struct { | |||||
WechatAccount string `json:"wechat_account" example:"微信号 不是修改不用传"` | |||||
HeadImg string `json:"head_img" example:"头像 不是修改不用传"` | |||||
Nickname string `json:"nickname" example:"昵称 不是修改不用传"` | |||||
} | |||||
type InviteCodeUserInfoResp struct { | type InviteCodeUserInfoResp struct { | ||||
Nickname string `json:"nickname"` | Nickname string `json:"nickname"` | ||||
HeadImg string `json:"head_img"` | HeadImg string `json:"head_img"` | ||||
@@ -119,6 +119,7 @@ func route(r *gin.RouterGroup) { | |||||
{ | { | ||||
rMemberCenter.GET("/getBasic", hdl.MemberCenterGetBasic) // 会员中心-基础数据 | rMemberCenter.GET("/getBasic", hdl.MemberCenterGetBasic) // 会员中心-基础数据 | ||||
rMemberCenter.POST("/bindParent", hdl.UserBindParent) //绑定上级 | rMemberCenter.POST("/bindParent", hdl.UserBindParent) //绑定上级 | ||||
rMemberCenter.POST("/bindUserInfo", hdl.BindUserInfo) //绑定用户信息 | |||||
rMemberCenter.GET("/parentInfo", hdl.ParentInfo) //上级信息 | rMemberCenter.GET("/parentInfo", hdl.ParentInfo) //上级信息 | ||||
rMemberCenter.POST("/updatePassword", hdl.UpdatePassword) //修改密码 | rMemberCenter.POST("/updatePassword", hdl.UpdatePassword) //修改密码 | ||||
rMemberCenter.POST("/updatePasscode", hdl.UpdatePasscode) //修改支付密码 | rMemberCenter.POST("/updatePasscode", hdl.UpdatePasscode) //修改支付密码 | ||||
@@ -100,7 +100,7 @@ func AdvertisingCheck(c *gin.Context) { | |||||
if NewAdvertisingLimit != nil && NewAdvertisingLimit.ImeiNum > 0 { | if NewAdvertisingLimit != nil && NewAdvertisingLimit.ImeiNum > 0 { | ||||
sql := `SELECT uid FROM user_imei WHERE create_at>='%s' and ip='%s' GROUP BY imei LIMIT %s` | sql := `SELECT uid FROM user_imei WHERE create_at>='%s' and ip='%s' GROUP BY imei LIMIT %s` | ||||
now := time.Now().Unix() - int64(NewAdvertisingLimit.Minute*60) | now := time.Now().Unix() - int64(NewAdvertisingLimit.Minute*60) | ||||
sql = fmt.Sprintf(sql, time.Unix(now, 0).Format("2006-01-02 15:04:05"), c.ClientIP(), NewAdvertisingLimit.ImeiNum) | |||||
sql = fmt.Sprintf(sql, time.Unix(now, 0).Format("2006-01-02 15:04:05"), utils.GetIP(c.Request), NewAdvertisingLimit.ImeiNum) | |||||
nativeString, _ := db.QueryNativeString(db.Db, sql) | nativeString, _ := db.QueryNativeString(db.Db, sql) | ||||
for _, v := range nativeString { | for _, v := range nativeString { | ||||
if utils.StrToInt64(v["uid"]) == user.Id { | if utils.StrToInt64(v["uid"]) == user.Id { | ||||
@@ -65,14 +65,14 @@ func CheckRealName(uid int64) string { | |||||
func UserImeiAdd(c *gin.Context, uid int64) { | func UserImeiAdd(c *gin.Context, uid int64) { | ||||
var tmp model.UserImei | var tmp model.UserImei | ||||
get, _ := db.Db.Where("uid=? and imei=? and ip=?", uid, c.GetHeader("imei"), c.ClientIP()).Get(&tmp) | |||||
get, _ := db.Db.Where("uid=? and imei=? and ip=?", uid, c.GetHeader("imei"), utils.GetIP(c.Request)).Get(&tmp) | |||||
if get == false { | if get == false { | ||||
var data = model.UserImei{ | var data = model.UserImei{ | ||||
Uid: int(uid), | Uid: int(uid), | ||||
Imei: c.GetHeader("imei"), | Imei: c.GetHeader("imei"), | ||||
CreateAt: time.Now(), | CreateAt: time.Now(), | ||||
UpdateAt: time.Now(), | UpdateAt: time.Now(), | ||||
Ip: c.ClientIP(), | |||||
Ip: utils.GetIP(c.Request), | |||||
} | } | ||||
db.Db.Insert(&data) | db.Db.Insert(&data) | ||||
} else { | } else { | ||||
@@ -84,7 +84,7 @@ func UserImeiAdd(c *gin.Context, uid int64) { | |||||
user, _ := NewUserDb.GetUser(uid) | user, _ := NewUserDb.GetUser(uid) | ||||
if user != nil { | if user != nil { | ||||
user.LastLoginAt = time.Now().Format("2006-01-02 15:04:05") | user.LastLoginAt = time.Now().Format("2006-01-02 15:04:05") | ||||
user.LastLoginIp = c.ClientIP() | |||||
user.LastLoginIp = utils.GetIP(c.Request) | |||||
db.Db.Where("id=?", user.Id).Cols("last_login_at,last_login_ip").Update(user) | db.Db.Where("id=?", user.Id).Cols("last_login_at,last_login_ip").Update(user) | ||||
UpdateUserTime(user.Id, "login") | UpdateUserTime(user.Id, "login") | ||||
} | } | ||||
@@ -37,10 +37,16 @@ func PlayletBase(c *gin.Context) { | |||||
NewEggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db) | NewEggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db) | ||||
eggData, _ := NewEggEnergyBasicSettingDb.EggEnergyBasicSettingGetOne() | eggData, _ := NewEggEnergyBasicSettingDb.EggEnergyBasicSettingGetOne() | ||||
NewUserVirtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | NewUserVirtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | ||||
var eggPoints float64 = 0 | |||||
coin, _ := NewUserVirtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggData.PersonEggPointsCoinId) | coin, _ := NewUserVirtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggData.PersonEggPointsCoinId) | ||||
if coin != nil { | if coin != nil { | ||||
res.Sum = coin.Amount | |||||
eggPoints += utils.StrToFloat64(coin.Amount) | |||||
} | } | ||||
TeamEggPointsCoin, _ := NewUserVirtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggData.TeamEggPointsCoinId) | |||||
if TeamEggPointsCoin != nil { | |||||
eggPoints += utils.StrToFloat64(TeamEggPointsCoin.Amount) | |||||
} | |||||
res.Sum = utils.Float64ToStrPrec8(eggPoints) | |||||
e.OutSuc(c, res, nil) | e.OutSuc(c, res, nil) | ||||
return | return | ||||
} | } | ||||
@@ -121,7 +121,7 @@ func UserFeedbackSave(c *gin.Context) { | |||||
Idea: req.Idea, | Idea: req.Idea, | ||||
Phone: req.Phone, | Phone: req.Phone, | ||||
Cid: utils.StrToInt(req.Cid), | Cid: utils.StrToInt(req.Cid), | ||||
Ip: c.ClientIP(), | |||||
Ip: utils.GetIP(c.Request), | |||||
CreateAt: time.Now(), | CreateAt: time.Now(), | ||||
} | } | ||||
eg.Insert(&data) | eg.Insert(&data) | ||||
@@ -37,10 +37,16 @@ func VideoBase(c *gin.Context) { | |||||
NewEggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db) | NewEggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db) | ||||
eggData, _ := NewEggEnergyBasicSettingDb.EggEnergyBasicSettingGetOne() | eggData, _ := NewEggEnergyBasicSettingDb.EggEnergyBasicSettingGetOne() | ||||
NewUserVirtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | NewUserVirtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | ||||
var eggPoints float64 = 0 | |||||
coin, _ := NewUserVirtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggData.PersonEggPointsCoinId) | coin, _ := NewUserVirtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggData.PersonEggPointsCoinId) | ||||
if coin != nil { | if coin != nil { | ||||
res.Sum = coin.Amount | |||||
eggPoints += utils.StrToFloat64(coin.Amount) | |||||
} | } | ||||
TeamEggPointsCoin, _ := NewUserVirtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggData.TeamEggPointsCoinId) | |||||
if TeamEggPointsCoin != nil { | |||||
eggPoints += utils.StrToFloat64(TeamEggPointsCoin.Amount) | |||||
} | |||||
res.Sum = utils.Float64ToStrPrec8(eggPoints) | |||||
e.OutSuc(c, res, nil) | e.OutSuc(c, res, nil) | ||||
return | return | ||||
} | } | ||||
@@ -33,7 +33,7 @@ require ( | |||||
require ( | require ( | ||||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241213090643-10ffb038ded6 | code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241213090643-10ffb038ded6 | ||||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241212140020-c99f60b4f868 | |||||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241213103509-834ad0148103 | |||||
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be | code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | ||||
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible | github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible | ||||