禁用用户测试

This commit is contained in:
苏尹岚
2020-02-21 16:44:14 +08:00
parent f054243c77
commit ddc0994456
3 changed files with 60 additions and 59 deletions

View File

@@ -992,61 +992,62 @@ func UpdateUserWxNoAndPercent(user *model.User, isReceiver bool) (num int64, err
dao.Rollback(db) dao.Rollback(db)
} }
if isReceiver { 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) dao.Commit(db)
return num, err return num, err
} }
func DeleteProfitSharingReceiver(ctx *jxcontext.Context, userID string) (err error) { func DeleteUserInfo(ctx *jxcontext.Context, userID string) (err error) {
// db := dao.GetDB() // db := dao.GetDB()
// auth, err := dao.GetUserBindAuthInfo(db, userID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "") // sql := `
// if len(auth) == 0 { // UPDATE user
// return fmt.Errorf("未找到此用户的微信验证方式用户ID[%v]\n", userID) // SET status = ?
// WHERE user_id = ?
// `
// sqlParams := []interface{}{
// model.NO,
// userID,
// } // }
// dao.Begin(db) // _, err = dao.ExecuteSQL(db, sql, sqlParams)
// defer func() {
// if r := recover(); r != nil || err != nil { // /* 删除离职人员门店市场人员 */
// dao.Rollback(db) // sql2 := `
// if r != nil { // UPDATE store t1
// panic(r) // 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
// }() // `
// param := &wxpayapi.ProfitSharingReceiverParam{ // _, err = dao.ExecuteSQL(db, sql2, nil)
// Receiver: wxpayapi.CData(`{
// "type":"` + wxpayapi.AccountTypeOpen + `", // /* 删除离职人员门店运营人员 */
// "account":"` + auth[0].AuthID + `" // sql3 := `
// }`), // UPDATE store t1
// } // LEFT JOIN user t2 ON t2.mobile = t1.operator_phone AND t2.status <> 0
// _, err = api.WxpayAPI.DeleteProfitSharingReceiver(param) // SET t1.operator_phone = ''
// if err != nil { // WHERE t2.id IS NULL
// return err // `
// } else { // _, err = dao.ExecuteSQL(db, sql3, nil)
// user2, err := dao.GetUserByID(db, "user_id", userID)
// user2.IsReceiver = 0 // /* 删除离职人员门店运营人员 */
// _, err = dao.UpdateEntity(db, user2, "IsReceiver") // sql4 := `
// if err != nil { // UPDATE store t1
// dao.Rollback(db) // LEFT JOIN user t2 ON t2.mobile = t1.operator_phone2 AND t2.status <> 0
// } // SET t1.operator_phone2 = ''
// } // WHERE t2.id IS NULL
// dao.Commit(db) // `
// _, 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 return err
} }

View File

@@ -472,16 +472,16 @@ func (c *User2Controller) UpdateUserWxNoAndPercent() {
}) })
} }
// @Title 删除分账接收方 // @Title 禁用用户(删除离职用户信息)
// @Description 删除分账接收方 // @Description 禁用用户(删除离职用户信息)
// @Param token header string true "认证token" // @Param token header string true "认证token"
// @Param userID query string true "用户userID" // @Param userID query string true "用户userID"
// @Success 200 {object} controllers.CallResult // @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult
// @router /DeleteProfitSharingReceiver [delete] // @router /DeleteUserInfo [delete]
func (c *User2Controller) DeleteProfitSharingReceiver() { func (c *User2Controller) DeleteUserInfo() {
c.callDeleteProfitSharingReceiver(func(params *tUser2DeleteProfitSharingReceiverParams) (retVal interface{}, errCode string, err error) { c.callDeleteUserInfo(func(params *tUser2DeleteUserInfoParams) (retVal interface{}, errCode string, err error) {
err = cms.DeleteProfitSharingReceiver(params.Ctx, params.UserID) err = cms.DeleteUserInfo(params.Ctx, params.UserID)
return retVal, "", err return retVal, "", err
}) })
} }

View File

@@ -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.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
beego.ControllerComments{ beego.ControllerComments{
Method: "DeleteProfitSharingReceiver", Method: "DeleteRoles4User",
Router: `/DeleteProfitSharingReceiver`, Router: `/DeleteRoles4User`,
AllowHTTPMethods: []string{"delete"}, AllowHTTPMethods: []string{"delete"},
MethodParams: param.Make(), MethodParams: param.Make(),
Filters: nil, 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.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
beego.ControllerComments{ beego.ControllerComments{
Method: "DeleteRoles4User", Method: "DeleteUserInfo",
Router: `/DeleteRoles4User`, Router: `/DeleteUserInfo`,
AllowHTTPMethods: []string{"delete"}, AllowHTTPMethods: []string{"delete"},
MethodParams: param.Make(), MethodParams: param.Make(),
Filters: nil, Filters: nil,