25 lines
560 B
Go
25 lines
560 B
Go
package controllers
|
|
|
|
import (
|
|
"git.rosy.net.cn/jx-callback/business/models"
|
|
"git.rosy.net.cn/jx-callback/globals"
|
|
"github.com/astaxie/beego/orm"
|
|
)
|
|
|
|
func IsAutoAcceptOrder(userMobile string, db orm.Ormer) bool {
|
|
if db == nil {
|
|
db = orm.NewOrm()
|
|
}
|
|
user := &models.BlackClient{
|
|
Mobile: userMobile,
|
|
}
|
|
if err := db.Read(user, "Mobile"); err != nil {
|
|
if err != orm.ErrNoRows {
|
|
globals.SugarLogger.Errorf("read data error:%v, data:%v", err, user)
|
|
}
|
|
// 在访问数据库出错的情况下,也需要自动接单
|
|
return true
|
|
}
|
|
return false
|
|
}
|