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