255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城id', 'store_id' => '小店id', 'user_id' => '会员id', 'order_id' => '订单id', 'order_no' => '订单编号', 'order_money' => '订单金额', 'store_money' => '小店收益', 'share_money' => '分享奖励', 'promotion_money' => '推广奖励', 'agent_money' => '代理奖励', 'fans_money' => '锁定奖励', 'pension_money' => '养老金', 'pv_money' => 'PV值', 'status' => '状态[0禁用 1启用 -1删除]', 'created_at' => '添加时间戳', 'updated_at' => '更新时间戳', ]; } public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } public function getStore() { return $this->hasOne(HappinessStore::class, ['id' => 'store_id']); } public static function setData($params) { try { if (!empty($params['user_id'] && !empty($params['mall_id'])) && !empty($params['order_id'])) { $model = self::findOne(['user_id' => $params['user_id'], 'mall_id' => $params['mall_id'],'order_id' => $params['order_id'], 'status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]]); } else if(!empty($params['id'])) $model = self::findOne($params['id']); else { $model = new self(); $model->loadDefaultValues(); } if(!$model) { $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; } } }