|
|
@@ -14,106 +14,102 @@ use bizHd\base\classes\BaseClass;
|
|
|
|
|
|
class MerchantClass extends BaseClass
|
|
|
{
|
|
|
-
|
|
|
- public static $baseFile = '\biz\sj\models\Merchant';
|
|
|
-
|
|
|
- //常用链接
|
|
|
- public static $commonUrl = [
|
|
|
- 1 => ['id' => 1, 'url' => '/mall/index?account=12358', 'img' => 'http://a.huahb.com/images/avatar.jpg', 'sign' => 'mall', 'name' => '商城'],
|
|
|
- 2 => ['id' => 2, 'url' => '/mall/index?account=12358', 'img' => 'http://a.huahb.com/images/avatar.jpg', 'sign' => 'mall', 'name' => '申请会员'],
|
|
|
- 3 => ['id' => 3, 'url' => '/mall/index?account=12358', 'img' => 'http://a.huahb.com/images/avatar.jpg', 'sign' => 'mall', 'name' => '点我付款'],
|
|
|
- ];
|
|
|
-
|
|
|
- //零售店
|
|
|
- const STYLE_RETAIL = 1;
|
|
|
- //供货商
|
|
|
- const STYLE_SUPPLIER = 2;
|
|
|
-
|
|
|
- //状态
|
|
|
- const STATUS_UN_CHECK = 0;
|
|
|
- const STATUS_HAS_CHECK = 1;
|
|
|
- const STATUS_CHECK_NOT_PASS = 2;
|
|
|
- const STATUS_FREEZE = 3;
|
|
|
- const STATUS_EXPIRE = 4;
|
|
|
-
|
|
|
- //开店初始化更多信息,有提供营业执照才初始化的信息 ssh 2021.2.27
|
|
|
- public static function initMore($applyData, $sjId, $shopId)
|
|
|
- {
|
|
|
- if ($applyData['style'] == MerchantClass::STYLE_RETAIL) {
|
|
|
- self::initRetailMore($applyData, $sjId, $shopId);
|
|
|
- }
|
|
|
- if ($applyData['style'] == MerchantClass::STYLE_SUPPLIER) {
|
|
|
- self::initGhsMore($applyData, $sjId, $shopId);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static function initRetailMore($applyData, $sjId, $shopId)
|
|
|
- {
|
|
|
- //初始化员工和角色
|
|
|
- AdminClass::initAdmin($applyData, $sjId, $shopId);
|
|
|
- //商品和分类初始化
|
|
|
- CategoryClass::initCategoryGoods($sjId);
|
|
|
- //商城和门店广告初始化
|
|
|
- AdClass::initAdd($sjId);
|
|
|
- //优惠券资产与配置信息初始化
|
|
|
- CouponAssetClass::add(['merchantId' => $sjId, 'switch' => 1]);
|
|
|
- }
|
|
|
-
|
|
|
- public static function initGhsMore($applyData, $sjId, $shopId)
|
|
|
- {
|
|
|
- //初始化员工和角色
|
|
|
- \bizGhs\admin\classes\AdminClass::initAdmin($applyData, $sjId, $shopId);
|
|
|
- }
|
|
|
-
|
|
|
- //商家信息组合 ssh 2019.12.20
|
|
|
- public static function groupMerchantBaseInfo($list)
|
|
|
- {
|
|
|
- return $list;
|
|
|
- }
|
|
|
-
|
|
|
- public static function getMerchantByIds($ids)
|
|
|
- {
|
|
|
- $list = self::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
|
|
|
- return self::groupBaseInfo($list);
|
|
|
- }
|
|
|
-
|
|
|
- public static function getMerchantById($id)
|
|
|
- {
|
|
|
- $sj = self::getById($id);
|
|
|
- if (empty($sj)) {
|
|
|
- return $sj;
|
|
|
- }
|
|
|
- $list = self::groupBaseInfo([$sj]);
|
|
|
- return current($list);
|
|
|
- }
|
|
|
-
|
|
|
- //组合商家信息 ssh 2021.3.1
|
|
|
- public static function groupBaseInfo($list)
|
|
|
- {
|
|
|
- if (empty($list)) {
|
|
|
- return $list;
|
|
|
- }
|
|
|
- foreach ($list as $key => $val) {
|
|
|
- $list[$key] = business::formatMerchantLogo($list[$key]);
|
|
|
- $list[$key]['address'] = '厦门市思明区后埭溪路128号-5';
|
|
|
- }
|
|
|
- return $list;
|
|
|
- }
|
|
|
-
|
|
|
- //h5商城链接二维码 ssh 2020.4.30
|
|
|
- public static function getH5MallQrCode($id)
|
|
|
- {
|
|
|
- $url = Yii::$app->params['mallDomain'] . "/#/?account=" . $id;
|
|
|
- //强制转成https
|
|
|
- $url = httpUtil::becomeHttps($url);
|
|
|
- $respond = qrCodeUtil::generateH5MallQrCode($url);
|
|
|
- return isset($respond['url']) ? $respond['url'] : '';
|
|
|
- }
|
|
|
-
|
|
|
- public static function getDefaultShopId($sj)
|
|
|
- {
|
|
|
- $defaultShopId = isset($sj['defaultShopId']) ? $sj['defaultShopId'] : 0;
|
|
|
- return $defaultShopId;
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
+ public static $baseFile = '\biz\sj\models\Merchant';
|
|
|
+
|
|
|
+ //常用链接
|
|
|
+ public static $commonUrl = [
|
|
|
+ 1 => ['id' => 1, 'url' => '/mall/index?account=12358', 'img' => 'http://a.huahb.com/images/avatar.jpg', 'sign' => 'mall', 'name' => '商城'],
|
|
|
+ 2 => ['id' => 2, 'url' => '/mall/index?account=12358', 'img' => 'http://a.huahb.com/images/avatar.jpg', 'sign' => 'mall', 'name' => '申请会员'],
|
|
|
+ 3 => ['id' => 3, 'url' => '/mall/index?account=12358', 'img' => 'http://a.huahb.com/images/avatar.jpg', 'sign' => 'mall', 'name' => '点我付款'],
|
|
|
+ ];
|
|
|
+
|
|
|
+
|
|
|
+ //状态
|
|
|
+ const STATUS_UN_CHECK = 0;
|
|
|
+ const STATUS_HAS_CHECK = 1;
|
|
|
+ const STATUS_CHECK_NOT_PASS = 2;
|
|
|
+ const STATUS_FREEZE = 3;
|
|
|
+ const STATUS_EXPIRE = 4;
|
|
|
+
|
|
|
+ //开店初始化更多信息,有提供营业执照才初始化的信息 ssh 2021.2.27
|
|
|
+ public static function initMore($applyData, $sjId, $shopId)
|
|
|
+ {
|
|
|
+ if ($applyData['style'] == SjClass::STYLE_RETAIL) {
|
|
|
+ self::initRetailMore($applyData, $sjId, $shopId);
|
|
|
+ }
|
|
|
+ if ($applyData['style'] == SjClass::STYLE_SUPPLIER) {
|
|
|
+ self::initGhsMore($applyData, $sjId, $shopId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function initRetailMore($applyData, $sjId, $shopId)
|
|
|
+ {
|
|
|
+ //初始化员工和角色
|
|
|
+ AdminClass::initAdmin($applyData, $sjId, $shopId);
|
|
|
+ //商品和分类初始化
|
|
|
+ CategoryClass::initCategoryGoods($sjId);
|
|
|
+ //商城和门店广告初始化
|
|
|
+ AdClass::initAdd($sjId);
|
|
|
+ //优惠券资产与配置信息初始化
|
|
|
+ CouponAssetClass::add(['merchantId' => $sjId, 'switch' => 1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function initGhsMore($applyData, $sjId, $shopId)
|
|
|
+ {
|
|
|
+ //初始化员工和角色
|
|
|
+ \bizGhs\admin\classes\AdminClass::initAdmin($applyData, $sjId, $shopId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //商家信息组合 ssh 2019.12.20
|
|
|
+ public static function groupMerchantBaseInfo($list)
|
|
|
+ {
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function getMerchantByIds($ids)
|
|
|
+ {
|
|
|
+ $list = self::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
|
|
|
+ return self::groupBaseInfo($list);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function getMerchantById($id)
|
|
|
+ {
|
|
|
+ $sj = self::getById($id);
|
|
|
+ if (empty($sj)) {
|
|
|
+ return $sj;
|
|
|
+ }
|
|
|
+ $list = self::groupBaseInfo([$sj]);
|
|
|
+ return current($list);
|
|
|
+ }
|
|
|
+
|
|
|
+ //组合商家信息 ssh 2021.3.1
|
|
|
+ public static function groupBaseInfo($list)
|
|
|
+ {
|
|
|
+ if (empty($list)) {
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+ foreach ($list as $key => $val) {
|
|
|
+ $list[$key] = business::formatMerchantLogo($list[$key]);
|
|
|
+ $list[$key]['address'] = '厦门市思明区后埭溪路128号-5';
|
|
|
+ }
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+
|
|
|
+ //h5商城链接二维码 ssh 2020.4.30
|
|
|
+ public static function getH5MallQrCode($id)
|
|
|
+ {
|
|
|
+ $url = Yii::$app->params['mallDomain'] . "/#/?account=" . $id;
|
|
|
+ //强制转成https
|
|
|
+ $url = httpUtil::becomeHttps($url);
|
|
|
+ $respond = qrCodeUtil::generateH5MallQrCode($url);
|
|
|
+ return isset($respond['url']) ? $respond['url'] : '';
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function getDefaultShopId($sj)
|
|
|
+ {
|
|
|
+ $defaultShopId = isset($sj['defaultShopId']) ? $sj['defaultShopId'] : 0;
|
|
|
+ return $defaultShopId;
|
|
|
+ }
|
|
|
+
|
|
|
}
|