255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城id', 'user_id' => '会员id', 'type' => '类型:1:消费订单;2:直推消费;3:推荐新人', 'order_no' => '订单编号', 'total_times' => '总分红次数', 'divided_times' => '已分次数', 'divided_money' => '已分金额', 'contribution' => '贡献值', 'is_feedback' => '是否退款:0:否:1:是', 'status' => '状态[-1:删除;0:禁用;1启用]', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public static function addData(array $params) { try { $model = self::findOne([ 'mall_id' => $params['mall_id'], 'user_id' => $params['user_id'], 'order_no' => $params['order_no'], 'status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]]); if (empty($model)) { $model = new self(); $model->loadDefaultValues(); } if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage()); $res = $model->save(); if ($res == false) throw new \Exception($model->getErrorMessage()); return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }