'ID', 'mall_id' => 'Mall ID', 'user_id' => 'User ID', 'video_id' => 'Video ID', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public static function setData(array $params) { try { $model = self::findOne(['user_id' => $params['user_id'], 'mall_id' => $params['mall_id'], 'video_id' => $params['video_id']]); if (empty($model)) { $model = new self(); $model->loadDefaultValues(); } if (!$model->load($params, '') || !$model->save()) throw new \Exception($model->getErrorMessage()); return $model; } catch (\Exception $e) { self::setStaticError($e->getMessage()); return false; } } //更改观看记录状态 public static function changeWatchStatus($params) { try { $res = ShortVideoUserWatch::updateAll(['status' => StatusEnum::DISABLED], ['mall_id' => $params['mall_id'], 'user_id' => $params['user_id']]); if (!$res) throw new Exception(ShortVideoUserWatch::$static_error); } catch (\Exception $e) { throw new Exception($e->getMessage()); } } }