用户申请入驻

This commit is contained in:
苏尹岚
2020-09-16 13:45:24 +08:00
parent 3d4b13eb98
commit f4796bb9cd
4 changed files with 51 additions and 1 deletions

View File

@@ -3559,3 +3559,16 @@ func UpdateStorePushClient(ctx *jxcontext.Context, storeID int, cID string) (err
}
return err
}
func CreateStoreAudit(ctx *jxcontext.Context, storeAudit *model.StoreAudit) (err error) {
var (
db = dao.GetDB()
)
storeAudits, err := dao.GetStoreAudit(db, model.StoreAuditStatusOnline, storeAudit.UserID, "")
if len(storeAudits) > 0 {
return fmt.Errorf("您已申请过入驻,请不要重复申请!")
}
dao.WrapAddIDCULDEntity(storeAudit, ctx.GetUserName())
dao.CreateEntity(db, storeAudit)
return err
}

View File

@@ -837,3 +837,31 @@ func GetStorePushClient(db *DaoDB, storeID int, cID string) (storePushClient []*
}
return storePushClient, err
}
func GetStoreAudit(db *DaoDB, auditStatus int, userID, keyword string) (storeAudit []*model.StoreAudit, err error) {
sql := `
SELECT *
FROM store_audit
WHERE deleted_at = ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
}
if auditStatus != model.StoreStatusAll {
sql += " AND audit_status = ?"
sqlParams = append(sqlParams, auditStatus)
}
if userID != "" {
sql += " AND user_id = ?"
sqlParams = append(sqlParams, userID)
}
if keyword != "" {
sql += " AND (user_id LIKE ? OR name LIKE ? OR tel1 LIKE ? OR tel2 LIKE ? OR address LIKE ?)"
sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%", "%"+keyword+"%")
}
err = GetRows(db, &storeAudit, sql, sqlParams)
if err != nil {
return nil, err
}
return storeAudit, err
}

View File

@@ -852,7 +852,7 @@ func (c *StoreController) CreateStoreAudit() {
c.callCreateStoreAudit(func(params *tStoreCreateStoreAuditParams) (retVal interface{}, errCode string, err error) {
store := &model.StoreAudit{}
if err = utils.UnmarshalUseNumber([]byte(params.Payload), store); err == nil {
// retVal, err = cms.CreateStore(params.Ctx, store, params.Ctx.GetUserName())
err = cms.CreateStoreAudit(params.Ctx, store)
}
return retVal, "", err
})

View File

@@ -1773,6 +1773,15 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
beego.ControllerComments{
Method: "CreateStoreAudit",
Router: `/CreateStoreAudit`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
beego.ControllerComments{
Method: "CreateStorePriceScore",