$id]); return $merchant; } public static function updateById($id, $data) { xhWxOpen::updateById($id, $data); self::refresh($id); } public static function refresh($id) { $preKey = configDict::getCacheKey('wxOpen'); $cacheKey = $preKey.$id; Yii::$app->redis->executeCommand('DEL', [$cacheKey]); self::getById($id); } public static function add($data) { $data = xhWxOpen::add($data); $id = $data['id']; self::refresh($id); return $data; } /** * 取平台相应的商家 */ public static function getMerchant() { $wxOpenId = configDict::getConfig('openId'); $wxOpen = xhWxOpenService::getById($wxOpenId); $merchantId = $wxOpen['merchantId']; $merchant = xhMerchantService::getById($merchantId); return $merchant; } }