| | |
| | | c.ServeJSON() |
| | | } |
| | | |
| | | // @router /testPush [get] |
| | | func (c *CarController) TestPush() { |
| | | left := getSpaceLeft() |
| | | message := fmt.Sprintf("%s 剩余车位:%d个", time.Now().Format("2006-01-02 15:04:05"), left) |
| | | b, e := service.PushByAlias("育英中学停车", message) |
| | | |
| | | fmt.Println("b:", b,"e:",e, "message:", message) |
| | | resp := code.Code{} |
| | | if b { |
| | | resp.Success = true |
| | | resp.Status = http.StatusOK |
| | | resp.Data = "推送成功" |
| | | } else { |
| | | resp.Success = false |
| | | resp.Status = http.StatusInternalServerError |
| | | resp.Data = e.Error() |
| | | } |
| | | c.Data["json"] = resp |
| | | c.ServeJSON() |
| | | } |
| | | |
| | | // @router /crossRecord [get] |
| | | func (c *CarController) CrossRecord() { |
| | | sv := service.NewCarService() |
| | |
| | | func (uc *UserClient) Exist(phoneNum string) bool { |
| | | var list []UserClient |
| | | o := orm.NewOrm() |
| | | o.Raw("select * from ? where phoneNum=?", uc.TableName(), phoneNum).QueryRows(&list) |
| | | o.QueryTable(uc.TableName()).Filter("phoneNum", phoneNum).All(&list) |
| | | if len(list) >0 { |
| | | return true |
| | | } |
| | |
| | | func (uc *UserClient) ExistByCid(phoneNum string, cid string) bool { |
| | | var list []UserClient |
| | | o := orm.NewOrm() |
| | | o.Raw("select * from ? where phoneNum=? and clientId=?", uc.TableName(), phoneNum, cid).QueryRows(&list) |
| | | o.QueryTable(uc.TableName()).Filter("phoneNum", phoneNum).Filter("clientId", cid).All(&list) |
| | | if len(list) >0 { |
| | | return true |
| | | } |
| | |
| | | beego.Router(preApi+"/user/sync", &controllers.UserController{}, "*:Sync") |
| | | |
| | | beego.Router(preApi+"/car/crossRecord", &controllers.CarController{}, "*:CrossRecord") |
| | | beego.Router(preApi+"/car/testPush", &controllers.CarController{}, "*:TestPush") |
| | | } |