禁用用户测试
This commit is contained in:
@@ -992,61 +992,62 @@ func UpdateUserWxNoAndPercent(user *model.User, isReceiver bool) (num int64, err
|
||||
dao.Rollback(db)
|
||||
}
|
||||
if isReceiver {
|
||||
// param := &wxpayapi.ProfitSharingReceiverParam{
|
||||
// Receiver: wxpayapi.CData(`{
|
||||
// "type":"` + wxpayapi.AccountTypeOpen + `",
|
||||
// "account":"` + auth[0].AuthID + `",
|
||||
// "relation_type":" ` + wxpayapi.Relation + `"
|
||||
// }`),
|
||||
// }
|
||||
// _, err := api.WxpayAPI.AddProfitSharingReceiver(param)
|
||||
// if err != nil {
|
||||
// return 0, err
|
||||
// } else {
|
||||
// user2.IsReceiver = 1
|
||||
// num3, err := dao.UpdateEntity(db, user2, "IsReceiver")
|
||||
// num += num3
|
||||
// if err != nil {
|
||||
// dao.Rollback(db)
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
dao.Commit(db)
|
||||
return num, err
|
||||
}
|
||||
|
||||
func DeleteProfitSharingReceiver(ctx *jxcontext.Context, userID string) (err error) {
|
||||
func DeleteUserInfo(ctx *jxcontext.Context, userID string) (err error) {
|
||||
// db := dao.GetDB()
|
||||
// auth, err := dao.GetUserBindAuthInfo(db, userID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "")
|
||||
// if len(auth) == 0 {
|
||||
// return fmt.Errorf("未找到此用户的微信验证方式!用户ID:[%v]\n", userID)
|
||||
// sql := `
|
||||
// UPDATE user
|
||||
// SET status = ?
|
||||
// WHERE user_id = ?
|
||||
// `
|
||||
// sqlParams := []interface{}{
|
||||
// model.NO,
|
||||
// userID,
|
||||
// }
|
||||
// dao.Begin(db)
|
||||
// defer func() {
|
||||
// if r := recover(); r != nil || err != nil {
|
||||
// dao.Rollback(db)
|
||||
// if r != nil {
|
||||
// panic(r)
|
||||
// }
|
||||
// }
|
||||
// }()
|
||||
// param := &wxpayapi.ProfitSharingReceiverParam{
|
||||
// Receiver: wxpayapi.CData(`{
|
||||
// "type":"` + wxpayapi.AccountTypeOpen + `",
|
||||
// "account":"` + auth[0].AuthID + `"
|
||||
// }`),
|
||||
// }
|
||||
// _, err = api.WxpayAPI.DeleteProfitSharingReceiver(param)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// } else {
|
||||
// user2, err := dao.GetUserByID(db, "user_id", userID)
|
||||
// user2.IsReceiver = 0
|
||||
// _, err = dao.UpdateEntity(db, user2, "IsReceiver")
|
||||
// if err != nil {
|
||||
// dao.Rollback(db)
|
||||
// }
|
||||
// }
|
||||
// dao.Commit(db)
|
||||
// _, err = dao.ExecuteSQL(db, sql, sqlParams)
|
||||
|
||||
// /* 删除离职人员门店市场人员 */
|
||||
// sql2 := `
|
||||
// UPDATE store t1
|
||||
// LEFT JOIN user t2 ON t2.mobile = t1.market_man_phone AND t2.status <> 0
|
||||
// SET t1.market_man_phone = ''
|
||||
// WHERE t2.id IS NULL
|
||||
// `
|
||||
// _, err = dao.ExecuteSQL(db, sql2, nil)
|
||||
|
||||
// /* 删除离职人员门店运营人员 */
|
||||
// sql3 := `
|
||||
// UPDATE store t1
|
||||
// LEFT JOIN user t2 ON t2.mobile = t1.operator_phone AND t2.status <> 0
|
||||
// SET t1.operator_phone = ''
|
||||
// WHERE t2.id IS NULL
|
||||
// `
|
||||
// _, err = dao.ExecuteSQL(db, sql3, nil)
|
||||
|
||||
// /* 删除离职人员门店运营人员 */
|
||||
// sql4 := `
|
||||
// UPDATE store t1
|
||||
// LEFT JOIN user t2 ON t2.mobile = t1.operator_phone2 AND t2.status <> 0
|
||||
// SET t1.operator_phone2 = ''
|
||||
// WHERE t2.id IS NULL
|
||||
// `
|
||||
// _, err = dao.ExecuteSQL(db, sql4, nil)
|
||||
|
||||
// /*删除离职人员的角色信息*/
|
||||
// sql5 := `
|
||||
// DELETE t1
|
||||
// FROM casbin_rule t1
|
||||
// LEFT JOIN user t2 ON t2.user_id = t1.v0 AND t2.status <> 0
|
||||
// WHERE t2.id IS NULL
|
||||
// `
|
||||
// _, err = dao.ExecuteSQL(db, sql5, nil)
|
||||
|
||||
tokens, err := api.Cacher.Keys("TOKEN.V2.*")
|
||||
globals.SugarLogger.Debugf("DeleteUserInfo,[%v]", tokens)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -472,16 +472,16 @@ func (c *User2Controller) UpdateUserWxNoAndPercent() {
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 删除分账接收方
|
||||
// @Description 删除分账接收方
|
||||
// @Title 禁用用户(删除离职用户信息)
|
||||
// @Description 禁用用户(删除离职用户信息)
|
||||
// @Param token header string true "认证token"
|
||||
// @Param userID query string true "用户userID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /DeleteProfitSharingReceiver [delete]
|
||||
func (c *User2Controller) DeleteProfitSharingReceiver() {
|
||||
c.callDeleteProfitSharingReceiver(func(params *tUser2DeleteProfitSharingReceiverParams) (retVal interface{}, errCode string, err error) {
|
||||
err = cms.DeleteProfitSharingReceiver(params.Ctx, params.UserID)
|
||||
// @router /DeleteUserInfo [delete]
|
||||
func (c *User2Controller) DeleteUserInfo() {
|
||||
c.callDeleteUserInfo(func(params *tUser2DeleteUserInfoParams) (retVal interface{}, errCode string, err error) {
|
||||
err = cms.DeleteUserInfo(params.Ctx, params.UserID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2315,8 +2315,8 @@ func init() {
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
||||
beego.ControllerComments{
|
||||
Method: "DeleteProfitSharingReceiver",
|
||||
Router: `/DeleteProfitSharingReceiver`,
|
||||
Method: "DeleteRoles4User",
|
||||
Router: `/DeleteRoles4User`,
|
||||
AllowHTTPMethods: []string{"delete"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
@@ -2324,8 +2324,8 @@ func init() {
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
||||
beego.ControllerComments{
|
||||
Method: "DeleteRoles4User",
|
||||
Router: `/DeleteRoles4User`,
|
||||
Method: "DeleteUserInfo",
|
||||
Router: `/DeleteUserInfo`,
|
||||
AllowHTTPMethods: []string{"delete"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
|
||||
Reference in New Issue
Block a user