'ID', 'mall_id' => '商城ID', 'user_id' => '用户ID', 'content_id' => '内容 id', 'goods_id' => '商品 id', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; } /** * 保存数据 * @Author: ltm * @DateTime: 2021/12/13 0022 17:13 * @Copyright: copyright (c) 2021 广东七件事集团 * @param array $params * @return AddonsMaterial|bool */ public static function setData(array $params){ try{ if (!empty($params['id'])) { $model = self::findOne(['and',['id'=>$params['id'],'mall_id'=>$params['mall_id']]]); if (empty($model)) throw new Exception('记录不存在或已删除'); }else{ $model = new self(); $model->loadDefaultValues(); $model->mall_id = $params['mall_id']; } if(!$model->load($params,'') || !$model->save()){ throw new Exception($model->getErrorMessage()); } return $model; }catch(\Exception $e){ self::$static_error = $e->getMessage(); return false; } } }