作者 gpj-dev

预约管理修改

@@ -219,10 +219,13 @@ class Sun extends Backend @@ -219,10 +219,13 @@ class Sun extends Backend
219 public function CountNum($UserId, $Id) 219 public function CountNum($UserId, $Id)
220 { 220 {
221 $createtime = Db::name('sun')->where(['id' => $Id])->value('createtime'); 221 $createtime = Db::name('sun')->where(['id' => $Id])->value('createtime');
222 - $map['sun_createtime'] = ['BETWEEN', [$createtime - 2, $createtime + 5]]; 222 + //没明白为啥要用between
  223 +// $map['sun_createtime'] = ['BETWEEN', [$createtime - 2, $createtime + 5]];
  224 +
  225 + $map['sun_createtime'] = $createtime;
223 $map['status'] = ['NEQ', 2]; 226 $map['status'] = ['NEQ', 2];
224 - $count = Db::name('yuyue')->where(['user_id' => $UserId])->where($map)->select();  
225 - if (count($count) > 1) $this->error('超过最大可预约次数', 0); 227 + $count = Db::name('yuyue')->where(['user_id' => $UserId])->where($map)->count();
  228 + if ($count > 1) $this->error('超过最大可预约次数', 0);
226 } 229 }
227 230
228 231