Exemple #1
0
 public function getMarket($merchant_id = null)
 {
     return $merchant_id ? \frontend\models\Market::find()->select(['id', 'settings'])->where("settings LIKE '%" . $merchant_id . "%'")->one() : $merchant_id;
 }
 /**
  * @param null $merchantId
  * @param array $settings
  * @return bool|null
  */
 private function issetMerchantId($merchantId = null, $settings = array())
 {
     $_merchantId = null;
     if (empty($merchantId) && empty($settings)) {
         return null;
     }
     if (!empty($merchantId)) {
         $_merchantId = $merchantId;
     }
     if (!empty($settings) && is_array($settings) && empty($_merchantId)) {
         if (isset($settings['merchant_id']) && empty($settings['merchant_id'])) {
             return null;
         }
         $_merchantId = $settings['merchant_id'];
     } else {
         return null;
     }
     $result = \frontend\models\Market::find()->select(['id', 'settings'])->where("settings LIKE '%" . $_merchantId . "%'")->one();
     if ($result && isset($result->id)) {
         return true;
     }
     return $_merchantId;
 }