$string]); } } /** * 获取推荐信息 */ public static function getByMerchantId($merchantId) { $recommend = xhRecommend::find()->where(['merchantId' => $merchantId])->asArray()->one(); return $recommend; } public static function refreshRecommend($merchantId) { $cacheKey = configDict::getCacheKey('recommendGoods').$merchantId; Yii::$app->redis->executeCommand('DEL', [$cacheKey]); self::getByMerchantId($merchantId); } public static function add($data,$merchantId) { xhRecommend::add($data); self::refreshRecommend($merchantId); } public static function updateByMerchantId($merchantId,$data) { xhRecommend::updateByCondition(['merchantId' => $merchantId], $data); self::refreshRecommend($merchantId); } }