作者 王智

1111

... ... @@ -187,12 +187,19 @@ class Config extends Api
{
$UserId = $this->IsToken($this->request->header());
$Params = $this->request->param();
$data = [
'user_id' => $UserId,
'ob_id' => $Params['ob_id'],
'createtime' => time()
];
$Res = Db::name('for_ob')->insert($data);
$IsFor = Db::name('for_ob')->where('user_id', $UserId)->where('ob_id', $Params['ob_id'])->find();
if (empty($IsFor)) {
$data = [
'user_id' => $UserId,
'ob_id' => $Params['ob_id'],
'createtime' => time()
];
$Res = Db::name('for_ob')->insert($data);
} else {
$Res = Db::name('for_ob')->where('id', $IsFor['id'])->update([
'createtime' => time()
]);
}
$this->Res($Res);
}
... ...