Skip to content

fix(dianping): correct 4 wrong cityIds in static city map (kunming/fuzhou/xiamen/hefei) - #2280

Open
fanxiaoyu0 wants to merge 1 commit into
jackwener:mainfrom
fanxiaoyu0:fix/dianping-city-ids
Open

fix(dianping): correct 4 wrong cityIds in static city map (kunming/fuzhou/xiamen/hefei)#2280
fanxiaoyu0 wants to merge 1 commit into
jackwener:mainfrom
fanxiaoyu0:fix/dianping-city-ids

Conversation

@fanxiaoyu0

Copy link
Copy Markdown

Problem

The trailing rows of the curated CITY_ID map in clis/dianping/utils.js contain 4 incorrect cityIds. When a user runs opencli dianping search --city <name> with one of these cities, the adapter builds the search URL with a wrong cityId. www.dianping.com does not recognize it, silently ignores it, and returns results for the cookie's default city instead — with no error surfaced.

Notably, fuzhou and hefei previously shared the same id 110, indicating the last few rows were transposed when the table was hand-written.

Fix

Corrected the 4 entries, verified against live resolution of https://www.dianping.com/<slug> (reading the first /search/keyword/{id}/ anchor on each city landing page):

city before after (real)
kunming 昆明 25 267
fuzhou 福州 110 14
xiamen 厦门 14 15
hefei 合肥 26 110

Verification

Live-checked every entry in the static map; the first 16 are correct, only these 4 were wrong:

beijing:2 shanghai:1 guangzhou:4 shenzhen:7 hangzhou:3 chengdu:8
chongqing:9 nanjing:5 suzhou:6 xian:17 wuhan:16 tianjin:10 qingdao:21
changsha:344 dalian:19 shenyang:18  -- all OK
kunming:  static=25  real=267  MISMATCH
fuzhou:   static=110 real=14   MISMATCH
xiamen:   static=14  real=15   MISMATCH
hefei:    static=26  real=110  MISMATCH

Repro before fix (default city = Tangshan):

opencli dianping search "过桥米线" --city 昆明   # returned Tangshan results (wrong)
opencli dianping search "过桥米线" --city 267    # returns Kunming results (correct)
  • npx vitest run clis/dianping/dianping.test.js → 28 passed
  • npx tsx src/main.ts validate dianping → PASS (4 commands, 0 errors)

Scope: this map is private to the dianping adapter; no other site is affected.

The trailing rows of CITY_ID had incorrect cityIds, causing dianping
search to silently fall back to the cookie's default city for these
cities. Verified against live https://www.dianping.com/<slug> resolution:

- kunming 昆明: 25  -> 267
- fuzhou  福州: 110 -> 14
- xiamen  厦门: 14  -> 15
- hefei   合肥: 26  -> 110

(fuzhou and hefei previously shared the same id 110, indicating the
last few rows were transposed when the table was hand-written.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant