20], [['change_type'], 'string', 'max' => 12], [['desc', 'source_table', 'from_type'], 'string', 'max' => 255], [['addon_name'], 'string', 'max' => 64], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'user_id' => 'User ID', 'wallet_type' => 'Wallet Type', 'change_type' => 'Change Type', 'change_num' => 'Change Num', 'after_num' => 'After Num', 'desc' => 'Desc', 'source_table' => 'Source Table', 'source_table_id' => 'Source Table ID', 'from_type' => 'From Type', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'addon_name' => 'Addon Name', ]; } /** * 检测奖励是否发放过 * @param $mall_id * @param $user_id * @param $source_table * @param $source_id * @param $from_type * @param $wallet_type * @param $addons_name * @return HigoWalletLog|null */ public static function checkSend($mall_id, $user_id, $source_table, $source_id, $from_type, $wallet_type,$addons_name = HiGoEnum::ADDONS_NAME) { return self::findOne(['mall_id' => $mall_id,'user_id' => $user_id,'wallet_type' => $wallet_type, 'change_type' => CapitalLog::CHANGE_TYPE_ADD,'source_table' => $source_table,'source_table_id' => $source_id, 'from_type' => $from_type,'status' => StatusEnum::ENABLED, 'addon_name' => $addons_name ]); } /** * 保存数据 * @param array $params * @return boolean|self */ 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; } } }