$data['merchantId'], 'shopName' => $shopName]); if (!empty($exists)) { util::fail('门店名称已经存在'); } $shop = self::add($data); return $shop; } //更新门店 shish 2020.2.29 public static function updateShop($id, $data) { $shopName = isset($data['shopName']) ? $data['shopName'] : ''; $merchantId = $data['merchantId']; $findShop = self::getByCondition(['merchantId' => $merchantId, 'shopName' => $shopName]); if (!empty($findShop) && $findShop['id'] != $id) { util::fail('门店名称已经存在'); } return self::updateById($id, $data); } //取商家所有门店 shish 2020.2.29 public static function getAllShop($merchantId) { return self::getAllByCondition(['merchantId' => $merchantId]); } //验证所属权限 shish 2020.2.29 public static function valid($shop, $merchantId) { if (empty($shop)) { util::fail('门店无效'); } if (isset($shop['merchantId']) == false || $shop['merchantId'] != $merchantId) { util::fail('您没有权限访问'); } } //删除门店 shish 2020.3.1 public static function deleteShop($shop) { if (isset($shop['default']) && $shop['default'] == 1) { util::fail('默认门店不允许删除'); } $id = $shop['id']; self::updateById($id, ['delStatus' => 1]); } //生成收款码 shish 2020.3.9 public static function generateGatheringCode($merchantId, $shopId) { $url = Yii::$app->params['mallDomain'] . "/#/pages/pay/index?account={$merchantId}&shopId=" . $shopId; //强制转成https $url = httpUtil::becomeHttps($url); $gatheringCode = qrCodeUtil::generateGatheringQrCode($url, $merchantId, $shopId, '', 10); return $gatheringCode; } }