This commit is contained in:
suyl
2021-07-19 10:21:23 +08:00
parent 0c41bf7c42
commit cd1c03c834
2 changed files with 38 additions and 2 deletions

View File

@@ -3,8 +3,10 @@ package tempop
import (
"bytes"
"context"
"crypto/md5"
"crypto/sha1"
"fmt"
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
"git.rosy.net.cn/jx-callback/business/auth2"
"net"
"regexp"
"strings"
@@ -1950,7 +1952,38 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
//{"address":"成都市金牛区抚琴综合市场博力多超市旁边扶手楼梯上","cityName": "成都市","id": 100002,"name": "抚琴店-下单送盐","payeeName": "李川川","status": 1,"tel1": "13812641804","tel2": ""}
//`
//weixinmsg.SmartMessageTemplateSend("oYN_usv1RPvrSxCvo1WsbwI8lZa0", weixinmsg.WX_NEWORDER_TEMPLATE_ID, "", weixinmsg.WX_MINI_TO_ORDER_PAGE_URL+fmt.Sprintf("?jxStoreId=%v&data=%v", storeID, data), nil)
orderman.BuildFakeMatterOrder()
//加门店账号
var (
db = dao.GetDB()
user = &model.User{}
)
store, _ := dao.GetStoreDetail(db, 668023, model.VendorIDJX, "")
if store.Tel1 != "" {
if user, _ = dao.GetUserByID(db, "mobile", store.Tel1); err == nil {
if user != nil {
//bind
if auths, _ := dao.GetUserBindAuthInfo(db, user.UserID, 0, []string{auth2.AuthTypePassword}, "", "", nil); len(auths) > 0 {
//已经有密码了?
auth := auths[0]
auth.AuthSecret2 = "AA0D5ABE801F11E98489525400AE46A6"
auth.AuthSecret = fmt.Sprintf("%x", sha1.Sum([]byte(fmt.Sprintf("%x", md5.Sum([]byte(store.Tel1)))+auth.AuthSecret2)))
} else {
auth := &model.AuthBind{
UserID: user.UserID,
Type: auth2.AuthTypePassword,
Status: model.YES,
AuthID: user.UserID,
AuthSecret2: "AA0D5ABE801F11E98489525400AE46A6",
AuthSecret: fmt.Sprintf("%x", sha1.Sum([]byte(fmt.Sprintf("%x", md5.Sum([]byte(store.Tel1)))+"AA0D5ABE801F11E98489525400AE46A6"))),
}
dao.WrapAddIDCULDEntity(auth, "")
dao.CreateEntity(db, auth)
}
} else {
//注册
}
}
}
return err
}

View File

@@ -67,6 +67,9 @@ type User struct {
Profit int `json:"profit"`
ProfitSum int `json:"profitSum"`
Arrears int `json:"arrears"`
BindStoreID int `orm:"column(bind_store_id)" json:"bind_store_id"` //门店老板账号用,表示绑的哪个门店,后权限用
BindStoreUser string `json:"bind_store_user"` //表示绑的哪个账号,密码同这个账号
}
func (*User) TableUnique() [][]string {