<?php
/**
* DBShop 电子商务系统
*
* ==========================================================================
* @link https://www.dbshop.net/
* @copyright 北京珑大钜商科技有限公司,并保留所有权利。
* @license https://www.dbshop.net/license.html License
* ==========================================================================
*
* @author 静静的风 <baron@loongdom.cn>
*
*/
namespace Admin\Data;
use Laminas\Config\Factory;
use Laminas\Config\Writer\PhpArray;
use Laminas\Crypt\Password\Bcrypt;
use Laminas\Json\Json;
use Laminas\Math\Rand;
use Laminas\Mvc\I18n\Translator;
use libphonenumber\NumberParseException;
use libphonenumber\PhoneNumberUtil;
use PluginCdnImageSpeed\Common\ImageSpeedCommon;
class Common
{
const ORDER_CANCEL_ORDER = 0; //取消订单
const ORDER_WAIT_PAYMENT = 10; //待付款
const ORDER_WAIT_GOODS_ARRIVE = 19; //等待预售商品到货
const ORDER_FINISH_PAYMENT = 20; //已付款
const ORDER_DISTRIBUTION_GOODS = 30; //正在配货
const ORDER_WAIT_MOVE_WAREHOUSE = 35; //等待移仓
const ORDER_MOVE_WAREHOUSE = 38; //正在移仓
const ORDER_FINISH_DISTRIBUTION_GOODS = 40; //已配货
const ORDER_GOODS_SHIPPED = 50; //已发货
const ORDER_GOODS_RECEIVED = 60; //已收货
const ORDER_COMPLETE = 80; //交易完成
/**
* 当前文件内部赋值使用的值
* @var array
*/
private static $commonData = [];
/**
* 生成的配置文件的后缀名
* @var string
*/
private static $configFileSuffix = '.php';
/**
* 状态(通用)
* @param Translator $translator
* @param int $style
* @return array
*/
public static function state(Translator $translator, $style = 1)
{
return [
1 => $translator->translate('启用'),
0 => $style == 1 ? $translator->translate('禁用') : '<label class="text-red">'. $translator->translate('禁用') .'</label>'];
}
/**
* 是、否 通用状态
* @param Translator $translator
* @return array
*/
public static function generalState(Translator $translator)
{
return [0 => $translator->translate('否'), 1 => $translator->translate('是')];
}
/**
* 提现状态
* @param Translator $translator
* @return array
*/
public static function withdrawState(Translator $translator)
{
return [1 => $translator->translate('处理中'), 2 => $translator->translate('提现完成'), 3 => $translator->translate('拒绝提现')];
}
/**
* 邮件服务器类型
* @param Translator $translator
* @return array
*/
public static function emailServiceType(Translator $translator)
{
return [
'smtpService' => $translator->translate('SMTP邮件服务器'),
'dbshopEmailService'=> $translator->translate('珑大官方邮件服务')
];
}
/**
* 注册会员验证方式
* @param Translator $translator
* @return array
*/
public static function userAuditType(Translator $translator)
{
return [
'no' => $translator->translate('无验证'),
'email' => $translator->translate('邮箱验证'),
'phone' => $translator->translate('手机验证'),
'audit' => $translator->translate('人工验证')
];
}
/**
* 商品类型
* @param Translator $translator
* @param int $style
* @return array
*/
public static function goodsType(Translator $translator, $style = 1)
{
return [
1 => $translator->translate('实物商品'),
2 => $translator->translate('虚拟商品')
];
}
/**
* 积分类型
* @param Translator $translator
* @return array
*/
public static function integralType(Translator $translator)
{
return [
1 => $translator->translate('消费积分'),
2 => $translator->translate('等级积分')
];
}
/**
* 余额操作类型
* @param Translator $translator
* @return array
*/
public static function balanceChangeType(Translator $translator)
{
return [
1 => $translator->translate('后台操作'),
2 => $translator->translate('客户充值'),
3 => $translator->translate('客户提现'),
4 => $translator->translate('订单付款'),
5 => $translator->translate('售后退款'),
6 => $translator->translate('充值码充值'),
7 => $translator->translate('分销佣金')
];
}
/**
* 增加与减少,通用类型
* @param Translator $translator
* @param int $style
* @return array
*/
public static function changeType(Translator $translator, $style = 1)
{
return [
'+' => $translator->translate('增加'),
'-' => $translator->translate('减少')
];
}
/**
* 商品优惠客户组范围显示
* @param Translator $translator
* @return array
*/
public static function goodsDiscountUserGroupType(Translator $translator)
{
return [
'allUser' => '全部客户组',
'userGroup' => '个别客户组'
];
}
/**
* 虚拟商品,内容的三种形式
* @param Translator $translator
* @return array
*/
public static function virtualGoodsType(Translator $translator)
{
return [
1 => $translator->translate('手动添加'),
2 => $translator->translate('自动生成'),
3 => $translator->translate('自动重复')
];
}
/**
* 虚拟商品状态
* @param Translator $translator
* @return array
*/
public static function virtualGoodsState(Translator $translator)
{
return [
1 => $translator->translate('未交易'),
2 => $translator->translate('已交易'),
3 => $translator->translate('已过期')
];
}
/**
* 有货显示
* @param Translator $translator
* @param int $style
* @return array
*/
public static function goodsStockShow(Translator $translator, $style = 1)
{
return [
1 => $translator->translate('有货')
];
}
/**
* 缺货显示
* @param Translator $translator
* @param int $style
* @return array
*/
public static function goodsOutStockShow(Translator $translator, $style = 1)
{
return [
1 => $translator->translate('缺货')
];
}
/**
* 商品状态
* @param Translator $translator
* @param int $style
* @return array
*/
public static function goodsState(Translator $translator, $style = 1)
{
return [
1 => $translator->translate('上架'),
2 => $style == 1 ? $translator->translate('下架') : '<label class="text-red">'. $translator->translate('下架') .'</label>'
];
}
/**
* 第三方登录名称
* @param Translator $translator
* @return array
*/
public static function otherLoginTextName(Translator $translator)
{
return [
'wechat' => $translator->translate('微信'),
'wechatScan'=> $translator->translate('微信扫码'),
'qq' => $translator->translate('QQ'),
'alipay' => $translator->t