|
|
@@ -805,6 +805,76 @@ func InsertWSKHUserInfo(userinfo Wskhuserinfo) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+// UpdateWSKHUserInfo 修改网上开户账户信息(客户资料申请)
|
|
|
+func UpdateWSKHUserInfo(userinfo Wskhuserinfo) error {
|
|
|
+ engine := db.GetEngine()
|
|
|
+
|
|
|
+ // 加密数据
|
|
|
+ key, _ := hex.DecodeString(utils.AESSecretKey)
|
|
|
+ // 证件号码
|
|
|
+ if len(userinfo.Cardnum) > 0 {
|
|
|
+ if encrypted, err := utils.AESEncrypt([]byte(userinfo.Cardnum), key); err == nil {
|
|
|
+ userinfo.Cardnum = hex.EncodeToString(encrypted)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 证件地址
|
|
|
+ if len(userinfo.Cardaddress) > 0 {
|
|
|
+ if encrypted, err := utils.AESEncrypt([]byte(userinfo.Cardaddress), key); err == nil {
|
|
|
+ userinfo.Cardaddress = hex.EncodeToString(encrypted)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 手机
|
|
|
+ if len(userinfo.Mobilephone) > 0 {
|
|
|
+ if encrypted, err := utils.AESEncrypt([]byte(userinfo.Mobilephone), key); err == nil {
|
|
|
+ userinfo.Mobilephone = hex.EncodeToString(encrypted)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 微信
|
|
|
+ if len(userinfo.Wechat) > 0 {
|
|
|
+ if encrypted, err := utils.AESEncrypt([]byte(userinfo.Wechat), key); err == nil {
|
|
|
+ userinfo.Wechat = hex.EncodeToString(encrypted)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 邮件
|
|
|
+ if len(userinfo.Email) > 0 {
|
|
|
+ if encrypted, err := utils.AESEncrypt([]byte(userinfo.Email), key); err == nil {
|
|
|
+ userinfo.Email = hex.EncodeToString(encrypted)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 银行帐号
|
|
|
+ if len(userinfo.Bankaccount) > 0 {
|
|
|
+ if encrypted, err := utils.AESEncrypt([]byte(userinfo.Bankaccount), key); err == nil {
|
|
|
+ userinfo.Bankaccount = hex.EncodeToString(encrypted)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 经纪人ID
|
|
|
+ if len(userinfo.Brokerid) > 0 {
|
|
|
+ if encrypted, err := utils.AESEncrypt([]byte(userinfo.Brokerid), key); err == nil {
|
|
|
+ userinfo.Brokerid = hex.EncodeToString(encrypted)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 登录帐号
|
|
|
+ if len(userinfo.Logincode) > 0 {
|
|
|
+ if encrypted, err := utils.AESEncrypt([]byte(userinfo.Logincode), key); err == nil {
|
|
|
+ userinfo.Logincode = hex.EncodeToString(encrypted)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 修改数据
|
|
|
+ // 由于表的主键未定义成ID,所以这里需要用where来过滤
|
|
|
+ userID := userinfo.Userid
|
|
|
+ userinfo.Userid = 0
|
|
|
+ // m := make(map[string]interface{})
|
|
|
+ // j, _ := json.Marshal(userinfo)
|
|
|
+ // json.Unmarshal(j, &m)
|
|
|
+ // delete(m, "USERID")
|
|
|
+ if _, err := engine.Where("USERID = ?", userID).Update(&userinfo); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
// GetWSKHUserInfos 获取开户信息列表
|
|
|
func GetWSKHUserInfos(userName string) ([]Wskhuserinfo, error) {
|
|
|
engine := db.GetEngine()
|
|
|
@@ -837,3 +907,16 @@ func GetUserInfos(userName string) ([]Userinfo, error) {
|
|
|
|
|
|
return userInfos, nil
|
|
|
}
|
|
|
+
|
|
|
+// UpdateUserAccountStatus 更新用户状态
|
|
|
+func UpdateUserAccountStatus(userID, accountStatus int) error {
|
|
|
+ engine := db.GetEngine()
|
|
|
+
|
|
|
+ if _, err := engine.Table("USERACCOUNT").
|
|
|
+ Where("USERID = ?", userID).
|
|
|
+ Update(map[string]interface{}{"ACCOUNTSTATUS": accountStatus}); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|