'减少', self::INC => '增加', ]; if ($flag) { return $desc; } return $desc[$action] ?? ''; } /** * @notes 变动类型描述 * @param $changeType * @param false $flag * @return string|string[] * @author 段誉 * @date 2023/2/23 10:07 */ public static function getChangeTypeDesc($changeType, $flag = false) { $desc = [ self::UM_DEC_ADMIN => '平台减少余额', self::UM_INC_ADMIN => '平台增加余额', self::UM_INC_RECHARGE => '充值增加余额', self::UM_INC_TASK => '任务收益金额增加', self::UM_INC_TASKUSER => '任务账户余额增加', self::UM_DEC_RECHARGE_REFUND => '充值订单退款减少余额', self::UM_DEC_WITHDRAW => '提现减少余额' ]; if ($flag) { return $desc; } return $desc[$changeType] ?? ''; } /** * @notes 获取用户余额类型描述 * @return string|string[] * @author 段誉 * @date 2023/2/23 10:08 */ public static function getUserMoneyChangeTypeDesc() { $UMChangeType = self::getUserMoneyChangeType(); $changeTypeDesc = self::getChangeTypeDesc('', true); return array_filter($changeTypeDesc, function ($key) use ($UMChangeType) { return in_array($key, $UMChangeType); }, ARRAY_FILTER_USE_KEY); } /** * @notes 获取用户余额变动类型 * @return int[] * @author 段誉 * @date 2023/2/23 10:08 */ public static function getUserMoneyChangeType() : array { return array_merge(self::UM_DEC, self::UM_INC); } /** * @notes 获取变动对象 * @param $changeType * @return false * @author 段誉 * @date 2023/2/23 10:10 */ public static function getChangeObject($changeType) { // 用户余额 $um = self::getUserMoneyChangeType(); if (in_array($changeType, $um)) { return self::UM; } // 其他... return false; } }