You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pdd-order-api/app/libs/const/class.VipCrmConst.php

45 lines
1.4 KiB
PHP

<?php
class VipCrmConst {
const sourceTypeAuthGroup = 1;
const sourceTypeAuthShop = 2;
const sourceTypeSameIp = 4;
const sourceTypeSameTraceKey = 8;
const sourceTypeManual = 16;
const sourceTypeAuthGroupTxt = '多店';
const sourceTypeAuthShopTxt = '授权店铺';
const sourceTypeSameIpTxt = 'IP';
const sourceTypeSameTraceKeyTxt = '浏览器';
const sourceTypeManualTxt = '手动';
public static function attachSourceTypeValue($currValue, $newType) {
$newTypeBinNum = $currValue | $newType;
return $newTypeBinNum;
}
public static function getSourceTypeTxtArr($value) {
$allSourceTypeMap = self::getAllSourceTypeMap();
$sourceTypeValueList = array_values($allSourceTypeMap);
$padLen = count($allSourceTypeMap);
$desSourceTypeValue = str_pad(decbin($value), $padLen, '0', STR_PAD_LEFT );
$txtArr = array();
for($i = 0; $i < $padLen; $i++) {
$sourecTypeValue = $desSourceTypeValue[$i];
if ($sourecTypeValue) {
$key = $padLen - $i - 1;
$txtArr[] = $sourceTypeValueList[$key];
}
}
return $txtArr;
}
public static function getAllSourceTypeMap() {
return array(
self::sourceTypeAuthGroup => self::sourceTypeAuthGroupTxt,
self::sourceTypeAuthShop => self::sourceTypeAuthShopTxt,
self::sourceTypeSameIp => self::sourceTypeSameIpTxt,
self::sourceTypeSameTraceKey => self::sourceTypeSameTraceKeyTxt,
self::sourceTypeManual => self::sourceTypeManualTxt
);
}
}