MerchantClass.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace bizGhs\merchant\classes;
  3. use bizHd\ad\classes\AdClass;
  4. use bizHd\admin\classes\AdminRoleClass;
  5. use bizHd\shop\classes\ShopAdminClass;
  6. use bizHd\coupon\classes\CouponAssetClass;
  7. use bizHd\goods\classes\CategoryClass;
  8. use bizHd\goods\classes\GoodsSettingClass;
  9. use common\components\business;
  10. use common\components\httpUtil;
  11. use common\components\qrCodeUtil;
  12. use common\components\stringUtil;
  13. use Yii;
  14. use bizHd\base\classes\BaseClass;
  15. class MerchantClass extends BaseClass
  16. {
  17. //状态
  18. const STATUS_UN_CHECK = 0;
  19. const STATUS_HAS_CHECK = 1;
  20. const STATUS_CHECK_NOT_PASS = 2;
  21. const STATUS_FREEZE = 3;
  22. const STATUS_EXPIRE = 4;
  23. public static $baseFile = '\bizGhs\merchant\models\Merchant';
  24. //常用链接
  25. public static $commonUrl = [
  26. 1 => ['id' => 1, 'url' => '/mall/index?account=12358', 'img' => 'http://a.huahb.com/images/avatar.jpg', 'sign' => 'mall', 'name' => '商城'],
  27. 2 => ['id' => 2, 'url' => '/mall/index?account=12358', 'img' => 'http://a.huahb.com/images/avatar.jpg', 'sign' => 'mall', 'name' => '申请会员'],
  28. 3 => ['id' => 3, 'url' => '/mall/index?account=12358', 'img' => 'http://a.huahb.com/images/avatar.jpg', 'sign' => 'mall', 'name' => '点我付款'],
  29. ];
  30. //商家信息组合 ssh 2019.12.20
  31. public static function groupMerchantBaseInfo($list)
  32. {
  33. return $list;
  34. }
  35. public static function getMerchantByIds($ids)
  36. {
  37. return self::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
  38. }
  39. public static function getMerchantById($id)
  40. {
  41. $merchant = self::getById($id);
  42. if (empty($merchant)) {
  43. return $merchant;
  44. }
  45. $list = self::groupBaseInfo([$merchant]);
  46. return current($list);
  47. }
  48. public static function groupBaseInfo($list)
  49. {
  50. foreach ($list as $key => $val) {
  51. $list[$key] = business::formatMerchantLogo($list[$key]);
  52. $list[$key]['address'] = '厦门市思明区后埭溪路128号-5';
  53. }
  54. return $list;
  55. }
  56. //h5商城链接二维码 ssh 2020.4.30
  57. public static function getH5MallQrCode($id)
  58. {
  59. $url = Yii::$app->params['mallDomain'] . "/#/?account=" . $id;
  60. //强制转成https
  61. $url = httpUtil::becomeHttps($url);
  62. $respond = qrCodeUtil::generateH5MallQrCode($url);
  63. return isset($respond['url']) ? $respond['url'] : '';
  64. }
  65. public static function getDefaultShopId($merchant)
  66. {
  67. $defaultShopId = isset($merchant['defaultShopId']) ? $merchant['defaultShopId'] : 0;
  68. return $defaultShopId;
  69. }
  70. }