@@ -15,9 +15,12 @@ import (
"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/kuaizhan"
md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
es2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/es"
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"context"
"context"
"encoding/json"
"fmt"
"fmt"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"github.com/olivere/elastic/v7"
"github.com/olivere/elastic/v7"
@@ -321,9 +324,9 @@ func InviteUrl(c *gin.Context) {
}
}
// Delete
// Delete
// @Summary 注销账号
// @Summary 注销账号操作
// @Tags 账号与安全
// @Tags 账号与安全
// @Description 注销账号
// @Description 注销账号操作
// @Accept json
// @Accept json
// @Produce json
// @Produce json
// @Param req body md.DeleteUserReq true "注册参数"
// @Param req body md.DeleteUserReq true "注册参数"
@@ -340,13 +343,13 @@ func Delete(c *gin.Context) {
return
return
}
}
user := svc.GetUser(c)
user := svc.GetUser(c)
// data := svc.AliyunSmsBase(c, "")
//// 校验短信
// err = aliyun.AliyunCheckSms(data["aliyun_sms_id"], data["aliyun_sms_secret"], user.Phone, req.Code)
// if err != nil {
// e.OutErr(c, 400, e.NewErr(400, "验证码错误,请重试"))
// return
// }
data := svc.AliyunSmsBase(c, "")
//校验短信
err = aliyun.AliyunCheckSms(data["aliyun_sms_id"], data["aliyun_sms_secret"], user.Phone, req.Code)
if err != nil {
e.OutErr(c, 400, e.NewErr(400, "验证码错误,请重试"))
return
}
user.State = 3
user.State = 3
db.Db.Where("id=?", user.Id).Cols("state").Update(user)
db.Db.Where("id=?", user.Id).Cols("state").Update(user)
tmp := model.UserDeleteInfo{
tmp := model.UserDeleteInfo{
@@ -373,3 +376,81 @@ func Delete(c *gin.Context) {
e.OutSuc(c, "success", nil)
e.OutSuc(c, "success", nil)
return
return
}
}
// DeleteInfo
// @Summary 注销账号信息
// @Tags 账号与安全
// @Description 注销账号信息
// @Accept json
// @Produce json
// @Success 200 {object} md.UserDeleteInfo "登录成功返回"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/memberCenter/delete/info [get]
func DeleteInfo(c *gin.Context) {
user := svc.GetUser(c)
resp := md.UserDeleteInfo{
Url: fmt.Sprintf("%s%s?id=%s&is_hide=1", svc.GetSysCfgStr("wap_host"), "/#/pages/course-detail-page/course-detail-page", "115"),
}
extendUserCount, _ := db.Db.Where("parent_uid=?", user.Id).Count(&model.User{})
NewUserWalletDb := implement.NewUserWalletDb(db.Db)
walletAmount := "0"
wallet, _ := NewUserWalletDb.GetUserVirtualWallet(user.Id)
if wallet != nil {
walletAmount = wallet.Amount
}
NewUserVirtualAmountDb := implement.NewUserVirtualAmountDb(db.Db)
virtualWallet, _ := NewUserVirtualAmountDb.GetUserVirtualAllWallets(user.Id)
virtualAmount1 := "0"
virtualAmount2 := "0"
virtualAmount3 := "0"
settingDb := implement.NewEggEnergyBasicSettingDb(db.Db)
setting, _ := settingDb.EggEnergyBasicSettingGetOne()
if virtualWallet != nil {
for _, v := range *virtualWallet {
if v.CoinId == setting.PersonEggPointsCoinId {
virtualAmount3 = utils.Float64ToStrPrec8(utils.StrToFloat64(v.Amount) + utils.StrToFloat64(virtualAmount3))
}
if v.CoinId == setting.TeamEggPointsCoinId {
virtualAmount3 = utils.Float64ToStrPrec8(utils.StrToFloat64(v.Amount) + utils.StrToFloat64(virtualAmount3))
}
if v.CoinId == setting.PersonEggEnergyCoinId {
virtualAmount2 = utils.Float64ToStrPrec8(utils.StrToFloat64(v.Amount) + utils.StrToFloat64(virtualAmount2))
}
if v.CoinId == setting.TeamEggEnergyCoinId {
virtualAmount2 = utils.Float64ToStrPrec8(utils.StrToFloat64(v.Amount) + utils.StrToFloat64(virtualAmount2))
}
if v.CoinId == setting.ContributionCoinId {
virtualAmount1 = utils.Float64ToStrPrec8(utils.StrToFloat64(v.Amount) + utils.StrToFloat64(virtualAmount1))
}
}
}
score := 60.00
now := time.Now()
esIndex := es2.GetLatestEffectiveIndexFromAlias(now)
esIndexName := md3.EggEnergyUserEggScoreEsAlias + "_" + esIndex
results, _ := es.FirstDoc(esIndexName, esIndex+"_"+utils.Int64ToStr(user.Id))
if results != nil {
var doc md.UserEggFlowReqRespList
json.Unmarshal(results.Source, &doc)
score = doc.ScoreValue
}
uid := user.Id
sql := fmt.Sprintf("SELECT COUNT(*)AS total FROM `public_platoon_user_relation` WHERE father_uid1 = %d OR father_uid2= %d OR father_uid3= %d OR father_uid4= %d OR father_uid5= %d OR father_uid6= %d OR father_uid7= %d OR father_uid8= %d OR father_uid9= %d", uid, uid, uid, uid, uid, uid, uid, uid, uid)
nativeString1, _ := db.QueryNativeString(db.Db, sql)
hasUserCount := "0"
if len(nativeString1) > 0 {
hasUserCount = nativeString1[0]["total"]
}
info := []md.UserDeleteInfoList{
{Img: svc.GetOssUrl("default_icon/user_delete_icon.png"), Title: "贡献值", Content: "贡献值 " + virtualAmount1},
{Img: svc.GetOssUrl("default_icon/user_delete_icon.png"), Title: "能量值", Content: "能量值 " + virtualAmount2},
{Img: svc.GetOssUrl("default_icon/user_delete_icon.png"), Title: "活跃值", Content: "活跃值 " + virtualAmount3},
{Img: svc.GetOssUrl("default_icon/user_delete_icon.png"), Title: "蛋蛋分", Content: "蛋蛋分 " + utils.Float64ToStr(score)},
{Img: svc.GetOssUrl("default_icon/user_delete_icon.png"), Title: "余额", Content: "余额 " + walletAmount},
{Img: svc.GetOssUrl("default_icon/user_delete_icon.png"), Title: "直推好友", Content: "直推好友 " + utils.Int64ToStr(extendUserCount) + " 人"},
{Img: svc.GetOssUrl("default_icon/user_delete_icon.png"), Title: "团队", Content: "团队 " + hasUserCount + " 人"},
}
resp.Info = info
e.OutSuc(c, resp, nil)
return
}