12], [['desc', 'source_table', 'from_type', 'capital_type', 'contributor_name'], 'string', 'max' => 255], [['order_no'], 'string', 'max' => 100], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'user_id' => 'User ID', 'change_type' => 'Change Type', 'change_num' => 'Change Num', 'current_num' => 'Current Num', 'desc' => 'Desc', 'source_table' => 'Source Table', 'source_table_id' => 'Source Table ID', 'from_type' => 'From Type', 'capital_type' => 'Capital Type', 'order_no' => 'Order No', 'contributor_name' => 'Contributor Name', 'contributor_money' => 'Contributor Money', 'contributor_id' => 'Contributor ID', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } /** * 保存数据 * @param array $params * @return bool|UserInfo */ public static function setData(array $params) { try { $model = new self(); $model->loadDefaultValues(); if (!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage()); return $model; } catch (Exception $e) { self::$static_error = $e->getMessage(); return false; } } }