Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -103,18 +103,18 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType string, unionAuthTypeList []st
|
|||||||
// cache相关
|
// cache相关
|
||||||
|
|
||||||
func (a *DefAuther) SaveVerifyCode(keyID, verifyCode string) {
|
func (a *DefAuther) SaveVerifyCode(keyID, verifyCode string) {
|
||||||
api.Cacher.Set(a.buildCacheKey(keyID), verifyCode, DefVerifyCodeDuration)
|
api.Cacher.Set(a.buildCacheKey4Verify(keyID), verifyCode, DefVerifyCodeDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *DefAuther) LoadVerifyCode(keyID string) (verifyCode string) {
|
func (a *DefAuther) LoadVerifyCode(keyID string) (verifyCode string) {
|
||||||
if value := api.Cacher.Get(a.buildCacheKey(keyID)); value != nil {
|
if value := api.Cacher.Get(a.buildCacheKey4Verify(keyID)); value != nil {
|
||||||
return value.(string)
|
return value.(string)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *DefAuther) DeleteVerifyCode(keyID string) {
|
func (a *DefAuther) DeleteVerifyCode(keyID string) {
|
||||||
api.Cacher.Del(a.buildCacheKey(keyID))
|
api.Cacher.Del(a.buildCacheKey4Verify(keyID))
|
||||||
}
|
}
|
||||||
|
|
||||||
// cache相关
|
// cache相关
|
||||||
@@ -136,7 +136,7 @@ func (a *DefAuther) VerifyCode(keyID, verifyCode string) (isSame bool) {
|
|||||||
return isSame
|
return isSame
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *DefAuther) buildCacheKey(keyID string) string {
|
func (a *DefAuther) buildCacheKey4Verify(keyID string) string {
|
||||||
return strings.Join([]string{
|
return strings.Join([]string{
|
||||||
VerifyCodeHeader,
|
VerifyCodeHeader,
|
||||||
VerifyCodeVer,
|
VerifyCodeVer,
|
||||||
|
|||||||
@@ -85,8 +85,9 @@ func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
|
|||||||
"actStatusName": model.ActStatusName,
|
"actStatusName": model.ActStatusName,
|
||||||
"actCreateTypeName": model.ActCreateTypeName,
|
"actCreateTypeName": model.ActCreateTypeName,
|
||||||
"storeAuditStatusName": model.StoreAuditStatusName,
|
"storeAuditStatusName": model.StoreAuditStatusName,
|
||||||
"configTypeList": model.ConfigTypeList,
|
"configTypeName": model.ConfigTypeName,
|
||||||
"autoSaleAt": "20:45:00",
|
"autoSaleAt": "20:45:00",
|
||||||
|
"userTypeName": model.UserTypeName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Init()
|
Init()
|
||||||
@@ -200,7 +201,7 @@ func SendMsg2Somebody(ctx *jxcontext.Context, mobileNum, verifyCode, msgType, ms
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkConfig(configType, value string) (err error) {
|
func checkConfig(configType, key, value string) (err error) {
|
||||||
switch configType {
|
switch configType {
|
||||||
case model.ConfigTypePricePack:
|
case model.ConfigTypePricePack:
|
||||||
if value != "" {
|
if value != "" {
|
||||||
@@ -211,18 +212,18 @@ func checkConfig(configType, value string) (err error) {
|
|||||||
}
|
}
|
||||||
case model.ConfigTypeBank:
|
case model.ConfigTypeBank:
|
||||||
if value != "" {
|
if value != "" {
|
||||||
if model.BankName[value] == "" {
|
if model.BankName[key] == "" {
|
||||||
err = fmt.Errorf("些银行代码:%s不支持,请联系开发", value)
|
err = fmt.Errorf("此银行代码:%s不支持,请联系开发", value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("当前只支持配置:%s, 传入的配置类型:%s", utils.Format4Output(model.ConfigTypeList, true), configType)
|
err = fmt.Errorf("当前只支持配置:%s, 传入的配置类型:%s", utils.Format4Output(model.ConfigTypeName, true), configType)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddConfig(ctx *jxcontext.Context, key, configType, value string) (err error) {
|
func AddConfig(ctx *jxcontext.Context, key, configType, value string) (err error) {
|
||||||
if err = checkConfig(configType, value); err != nil {
|
if err = checkConfig(configType, key, value); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ func AddConfig(ctx *jxcontext.Context, key, configType, value string) (err error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DeleteConfig(ctx *jxcontext.Context, key, configType string) (err error) {
|
func DeleteConfig(ctx *jxcontext.Context, key, configType string) (err error) {
|
||||||
if err = checkConfig(configType, ""); err != nil {
|
if err = checkConfig(configType, key, ""); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
switch configType {
|
switch configType {
|
||||||
@@ -266,7 +267,7 @@ func UpdateConfig(ctx *jxcontext.Context, key, configType, value string) (err er
|
|||||||
if key == "" {
|
if key == "" {
|
||||||
return fmt.Errorf("修改配置必须给定key")
|
return fmt.Errorf("修改配置必须给定key")
|
||||||
}
|
}
|
||||||
if err = checkConfig(configType, value); err != nil {
|
if err = checkConfig(configType, key, value); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ type StoreSkuExt struct {
|
|||||||
SubStoreID int `orm:"column(sub_store_id)" json:"subStoreID"`
|
SubStoreID int `orm:"column(sub_store_id)" json:"subStoreID"`
|
||||||
BindPrice int `json:"price"` // 单位为分,不用int64的原因是这里不需要累加
|
BindPrice int `json:"price"` // 单位为分,不用int64的原因是这里不需要累加
|
||||||
UnitPrice int `json:"unitPrice"` // 这个是一斤的门店商品价,放在这里的原因是避免额外增加一张store sku_name表,逻辑上要保证同一SKU NAME中的所有SKU这个字段的数据一致
|
UnitPrice int `json:"unitPrice"` // 这个是一斤的门店商品价,放在这里的原因是避免额外增加一张store sku_name表,逻辑上要保证同一SKU NAME中的所有SKU这个字段的数据一致
|
||||||
BindStatus int `json:"storeSkuStatus"`
|
StoreSkuStatus int `json:"storeSkuStatus"`
|
||||||
|
|
||||||
EbaiID int64 `orm:"column(ebai_id);index" json:"ebaiID"`
|
EbaiID int64 `orm:"column(ebai_id);index" json:"ebaiID"`
|
||||||
MtwmID int64 `orm:"column(mtwm_id)" json:"mtwmID"` // 这个也不是必须的,只是为了DAO取数据语句一致
|
MtwmID int64 `orm:"column(mtwm_id)" json:"mtwmID"` // 这个也不是必须的,只是为了DAO取数据语句一致
|
||||||
|
|||||||
@@ -298,22 +298,28 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo
|
|||||||
if model.IsSyncStatusUpdate(sku.StoreSkuSyncStatus) && singleStoreHandler != nil {
|
if model.IsSyncStatusUpdate(sku.StoreSkuSyncStatus) && singleStoreHandler != nil {
|
||||||
updateList = append(updateList, calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
|
updateList = append(updateList, calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
|
||||||
} else {
|
} else {
|
||||||
|
isAddedStock := false
|
||||||
if model.IsSyncStatusPrice(sku.StoreSkuSyncStatus) {
|
if model.IsSyncStatusPrice(sku.StoreSkuSyncStatus) {
|
||||||
bareSku = storeSkuSyncInfo2Bare(calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
|
bareSku = storeSkuSyncInfo2Bare(calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
|
||||||
priceList = append(priceList, bareSku)
|
priceList = append(priceList, bareSku)
|
||||||
}
|
}
|
||||||
if model.IsSyncStatusUpdate(sku.StoreSkuSyncStatus) && singleStoreHandler == nil {
|
// if model.IsSyncStatusUpdate(sku.StoreSkuSyncStatus) && singleStoreHandler == nil {
|
||||||
if bareSku == nil {
|
// if bareSku == nil {
|
||||||
bareSku = storeSkuSyncInfo2Bare(sku)
|
// bareSku = storeSkuSyncInfo2Bare(sku)
|
||||||
}
|
// }
|
||||||
stockList = append(stockList, bareSku)
|
// stockList = append(stockList, bareSku)
|
||||||
}
|
// isAddedStock = true
|
||||||
|
// }
|
||||||
if model.IsSyncStatusSale(sku.StoreSkuSyncStatus) {
|
if model.IsSyncStatusSale(sku.StoreSkuSyncStatus) {
|
||||||
if bareSku == nil {
|
if bareSku == nil {
|
||||||
bareSku = storeSkuSyncInfo2Bare(sku)
|
bareSku = storeSkuSyncInfo2Bare(sku)
|
||||||
}
|
}
|
||||||
if sku.MergedStatus == model.SkuStatusNormal {
|
if sku.MergedStatus == model.SkuStatusNormal {
|
||||||
onlineList = append(onlineList, bareSku)
|
onlineList = append(onlineList, bareSku)
|
||||||
|
if !isAddedStock {
|
||||||
|
stockList = append(stockList, bareSku)
|
||||||
|
isAddedStock = true
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
offlineList = append(offlineList, bareSku)
|
offlineList = append(offlineList, bareSku)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,3 +152,7 @@ func OnDingDingMsg(msg map[string]interface{}) (callbackResponse *dingdingapi.Ca
|
|||||||
}
|
}
|
||||||
return api.DingDingAPI.Err2CallbackResponse(nil)
|
return api.DingDingAPI.Err2CallbackResponse(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetUsers(ctx *jxcontext.Context, userType int, userID2, mobile, userName string) (userList []*model.User, err error) {
|
||||||
|
return dao.GetUsers(dao.GetDB(), userType, userID2, mobile, userName)
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,3 +22,28 @@ func GetUserByID(db *DaoDB, fieldName, fieldValue string) (user *model.User, err
|
|||||||
err = GetRow(db, &user, sql, sqlParams...)
|
err = GetRow(db, &user, sql, sqlParams...)
|
||||||
return user, err
|
return user, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetUsers(db *DaoDB, userType int, userID2, mobile, userName string) (userList []*model.User, err error) {
|
||||||
|
sql := `
|
||||||
|
SELECT *
|
||||||
|
FROM user t1
|
||||||
|
WHERE t1.deleted_at = ? AND t1.type & ? <> 0`
|
||||||
|
sqlParams := []interface{}{
|
||||||
|
utils.DefaultTimeValue,
|
||||||
|
userType,
|
||||||
|
}
|
||||||
|
if userID2 != "" {
|
||||||
|
sql += " AND t1.user_id2 = ?"
|
||||||
|
sqlParams = append(sqlParams, userID2)
|
||||||
|
}
|
||||||
|
if mobile != "" {
|
||||||
|
sql += " AND t1.mobile = ?"
|
||||||
|
sqlParams = append(sqlParams, mobile)
|
||||||
|
}
|
||||||
|
if userName != "" {
|
||||||
|
sql += " AND t1.name LIKE ?"
|
||||||
|
sqlParams = append(sqlParams, "%"+userName+"%")
|
||||||
|
}
|
||||||
|
err = GetRows(db, &userList, sql, sqlParams...)
|
||||||
|
return userList, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ConfigTypeList = []string{
|
ConfigTypeName = map[string]string{
|
||||||
ConfigTypeSys,
|
ConfigTypeSys: "系统",
|
||||||
ConfigTypePricePack,
|
ConfigTypePricePack: "价格包",
|
||||||
ConfigTypeBank,
|
ConfigTypeBank: "银行",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ const (
|
|||||||
UserTypeBoss = 8
|
UserTypeBoss = 8
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
UserTypeName = map[int]string{
|
||||||
|
UserTypeConsumer: "消费者",
|
||||||
|
UserTypeStoreBoss: "门店老板",
|
||||||
|
UserTypeOperator: "运营",
|
||||||
|
UserTypeBoss: "老板",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ModelIDCULD
|
ModelIDCULD
|
||||||
UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识
|
UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识
|
||||||
@@ -20,7 +29,7 @@ type User struct {
|
|||||||
Mobile string `orm:"size(32)" json:"mobile"`
|
Mobile string `orm:"size(32)" json:"mobile"`
|
||||||
Email string `orm:"size(32);index" json:"email"`
|
Email string `orm:"size(32);index" json:"email"`
|
||||||
Status int8 `json:"status"`
|
Status int8 `json:"status"`
|
||||||
Type int8 // 用户类型
|
Type int8 `json:"type"` // 用户类型
|
||||||
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo"` // 身份证号
|
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo"` // 身份证号
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,3 +50,20 @@ func (c *User2Controller) GetBindAuthInfo() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 得到用户列表
|
||||||
|
// @Description 得到用户列表
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param userType query int true "用户类型"
|
||||||
|
// @Param userID2 query string faslse "用户id2"
|
||||||
|
// @Param mobile query string faslse "用户手机,必须全匹配"
|
||||||
|
// @Param userName query string faslse "用户名,可以部分匹配"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /GetUsers [get]
|
||||||
|
func (c *User2Controller) GetUsers() {
|
||||||
|
c.callGetUsers(func(params *tUser2GetUsersParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
retVal, err = cms.GetUsers(params.Ctx, params.UserType, params.UserID2, params.Mobile, params.UserName)
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -1726,6 +1726,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:User2Controller"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetUsers",
|
||||||
|
Router: `/GetUsers`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
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: "RegisterUser",
|
Method: "RegisterUser",
|
||||||
|
|||||||
Reference in New Issue
Block a user