ErrCode.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * 错误码及错误描述字典
  5. * @author gwang
  6. */
  7. class ErrCode {
  8. /**
  9. * 交互成功
  10. */
  11. const ok = 0;
  12. //
  13. // <editor-fold defaultstate="collapsed" desc=" 基础错误码 10xx ">
  14. /**
  15. * 未知原因错误
  16. */
  17. const err_unknownn = 1001;
  18. /**
  19. * 内部错误
  20. */
  21. const err_innerfault = 1002;
  22. /**
  23. * 数据库操作失败
  24. */
  25. const err_db = 1003;
  26. /**
  27. * 内存操作失败
  28. */
  29. const err_mem = 1004;
  30. /**
  31. * 错误: 断言失败
  32. */
  33. const err_assert = 1005;
  34. /**
  35. * 警告: 断言失败
  36. */
  37. const msg_assert = 1006;
  38. /**
  39. * 消息内容非法(不满足tk校验的条件)
  40. */
  41. const err_illegal = 1011;
  42. /**
  43. * 消息内容缺少校验值
  44. */
  45. const err_signo = 1012;
  46. /**
  47. * 消息超时
  48. */
  49. const err_outtime = 1021;
  50. /**
  51. * Just重试
  52. */
  53. const err_retry = 1024;
  54. /**
  55. * 客户端版本过低-整包更
  56. */
  57. const clientversionlow_err = 1031;
  58. /**
  59. * 客户端版本过低-增量更
  60. */
  61. const clientnewversion_msg = 1032;
  62. /**
  63. * 客户端打印信息并且退出
  64. */
  65. const clientPrintMsg_Halt = 1033;
  66. /**
  67. * 功能码非法
  68. */
  69. const ope_err = 1210;
  70. /**
  71. * 操作码非法
  72. */
  73. const cmd_err = 1211;
  74. /**
  75. * 参数非法
  76. */
  77. const paras_err = 1212;
  78. /**
  79. * 参数不足
  80. */
  81. const parasnotenough_msg = 1213;
  82. /**
  83. * 内容包含敏感词
  84. */
  85. const sensword_msg = 1234;
  86. /**
  87. * 服务器正在维护中
  88. */
  89. const err_server_maintaining = 1301;
  90. /**
  91. * 服务器正在升级,请过会儿再来。
  92. */
  93. const err_server_updating = 1302;
  94. /**
  95. * 已经在其他地方登录
  96. */
  97. const err_anotherlogin = 1303;
  98. /**
  99. * 功能暂未开放
  100. */
  101. const function_notopen_msg = 1801;
  102. /**
  103. * 方法尚未实现
  104. */
  105. const err_method_notimplement = 1802;
  106. /**
  107. * 方法已过时, 废弃的.
  108. */
  109. const err_method_obsoleted = 1803;
  110. /**
  111. * 游戏常量数据错误
  112. */
  113. const err_const_no = 1825;
  114. // </editor-fold>
  115. //
  116. // // <editor-fold defaultstate="collapsed" desc=" 商城/付费 88xx ">
  117. /**
  118. * 尚未首付
  119. */
  120. const pay_firstpayno_err = 8801;
  121. /**
  122. * 已经领取首付
  123. */
  124. const pay_firstpaygetted = 8802;
  125. /**
  126. * 系统繁忙
  127. */
  128. const pay_systembusy_err = 8803;
  129. /**
  130. * 不是黄钻或已经领取黄钻礼包
  131. */
  132. const pay_vipnewerno = 8804;
  133. /**
  134. * amt数值小于等于0
  135. */
  136. const pay_m_amtzero_err = 8805;
  137. /**
  138. * 价格异常
  139. */
  140. const pay_price_err = 8806;
  141. /**
  142. * 支付类型异常
  143. */
  144. const pay_m_type_err = 8807;
  145. /**
  146. * 商品常量数据错误-货物内容
  147. */
  148. const pay_shopItem_cosnt_goods_err = 8808;
  149. /**
  150. * 商城 已达刷新次数上限
  151. */
  152. const pay_refresh_times = 8809;
  153. /**
  154. * 神秘商城 - 购买次数已达上限
  155. */
  156. const pay_secretshop_buytimes = 8810;
  157. /**
  158. * 神秘商城 - 物品数据错误
  159. */
  160. const pay_secretshop_noitem_err = 8811;
  161. /**
  162. * 充值 - 订单不存在
  163. */
  164. const pay_order_no = 8812;
  165. /**
  166. * 充值 - 付款状态不正确 正在重新查询...
  167. */
  168. const pay_order_paystatus = 8813;
  169. /**
  170. * 充值 - 此订单已经发货, 无需重复请求
  171. */
  172. const pay_order_drawed = 8814;
  173. /**
  174. * 充值 - 订单uid不符
  175. */
  176. const pay_order_uid = 8815;
  177. /**
  178. * 神秘商城 - 免费刷新时间未到
  179. */
  180. const pay_secretshopt_freeRefresh_Time = 8816;
  181. /**
  182. * 订单号为null无法支付
  183. */
  184. const pay_order_product_id = 8817;
  185. /**
  186. * 支付失败
  187. */
  188. const pay_fail = 8818;
  189. /**
  190. * 不能重复购买
  191. */
  192. const pay_repeatbuy = 8819;
  193. // </editor-fold>
  194. //
  195. // <editor-fold defaultstate="collapsed" desc=" not enough 系列 ">
  196. /**
  197. * 金币不足
  198. */
  199. const notenough_gold_msg = 3014;
  200. /**
  201. * 宝石不足
  202. */
  203. const notenough_cash_msg = 3015;
  204. /**
  205. * 友情点不足
  206. */
  207. const notenough_friendshippoint = 3016;
  208. /**
  209. * 玩家荣誉值不足[荣誉值兑换]
  210. */
  211. const notenough_honour = 3032;
  212. /**
  213. * 元宝不足
  214. */
  215. const notenought_yuanbao = 3040;
  216. /**
  217. * 玩家体力值不足
  218. */
  219. const notenough_tili = 3046;
  220. /**
  221. * 晶石不足
  222. */
  223. const notenough_spar = 3047;
  224. /**
  225. * 资源点不足
  226. */
  227. const notenough_resPoint = 3048;
  228. /**
  229. * 道具数量不足
  230. */
  231. const notenough_item = 3049;
  232. // </editor-fold>
  233. //
  234. // <editor-fold defaultstate="collapsed" desc=" user 31xx ">
  235. /**
  236. * 玩家未登录
  237. */
  238. const user_login_err = 3101;
  239. /**
  240. * 玩家不存在
  241. */
  242. const user_no_err = 3102;
  243. /**
  244. * 玩家数据损坏
  245. */
  246. const user_data_broken_err = 3103;
  247. /**
  248. * 连续登录天数不够
  249. */
  250. const user_contigiftno_msg = 3104;
  251. /**
  252. * 已经领取连续登录礼包
  253. */
  254. const user_contigiftfalse_msg = 3105;
  255. /**
  256. * 设置新手引导进度失败
  257. */
  258. const user_settutorialscompletedfail_err = 3106;
  259. /**
  260. * 玩家等级不足
  261. */
  262. const user_levelnotenough_msg = 3107;
  263. /**
  264. * 找不到玩家的交互体数据
  265. */
  266. const user_interact_no_err = 3108;
  267. /**
  268. * 找不到玩家的分区记录
  269. */
  270. const user_zoneinfo_no_err = 3109;
  271. /**
  272. * 玩家昵称已经存在,请换一个再试
  273. */
  274. const user_nicknameexist = 3110;
  275. /**
  276. * 没有这种奖励类型
  277. */
  278. const user_reward_typeno = 3031;
  279. // </editor-fold>
  280. //
  281. // // <editor-fold defaultstate="collapsed" desc=" 关卡 ">
  282. /**
  283. * 没有玩家关卡信息
  284. */
  285. const gate_NoUserGateInfo = 3201;
  286. /**
  287. * 当前关卡没有解锁
  288. */
  289. const gate_GateNoUnlock = 3202;
  290. /**
  291. * 奖励已经被领取
  292. */
  293. const gate_GatePriceHasReceive = 3203;
  294. /**
  295. * 不能扫荡
  296. */
  297. const gate_NoSweep = 3204;
  298. /**
  299. * 今日扫荡已达最大次数
  300. */
  301. const gate_SweepMaxNum_limit = 3205;
  302. /**
  303. * 挑战关卡: 今日挑战次数已用完
  304. */
  305. const tower_timeNo = 3210;
  306. /**
  307. * 挑战关卡: 今日技能免费刷新次数已经用完
  308. */
  309. const tower_refreshNo = 3211;
  310. /**
  311. * 挑战关卡: 没有奖励
  312. */
  313. const tower_rewardNo = 3212;
  314. /**
  315. * 挑战关卡: 起始层id有误
  316. */
  317. const tower_layerNum = 3213;
  318. /**
  319. * 排行榜荣誉榜奖励已经领取
  320. */
  321. const rankReward_HasReceive = 3214;
  322. /**
  323. * 没有达到解锁等级
  324. */
  325. const evolve_canotUnlock_levelLimit = 3215;
  326. // </editor-fold>
  327. //
  328. // // <editor-fold defaultstate="collapsed" desc=" store 3300 ">
  329. /**
  330. * 不存在该装备
  331. */
  332. const user_store_NoEquip = 3301;
  333. /**
  334. * 背包
  335. */
  336. const user_store_NoItem = 3302;
  337. /**
  338. * 宝石不能被镶嵌
  339. */
  340. const user_store_GemCanotSet = 3303;
  341. /**
  342. * 不存在可以替换的宝石
  343. */
  344. const user_store_NoExistGemReplace = 3304;
  345. /**
  346. * 同一件装备无法镶嵌多个技能相同的宝石
  347. */
  348. const user_store_SameGemCanotEquip = 3305;
  349. /**
  350. * 合成宝石条件不足无法合成
  351. */
  352. const user_store_GemCanotCompose = 3306;
  353. /**
  354. * 背包不存在该宝石
  355. */
  356. const user_store_NotExistGem = 3307;
  357. /**
  358. * 洗练石不足
  359. */
  360. const user_store_XilianStoneNoEnough = 3308;
  361. /**
  362. * 没有找到对应词条信息
  363. */
  364. const user_store_NoFindPredicate = 3309;
  365. // </editor-fold>
  366. //
  367. // // <editor-fold defaultstate="collapsed" desc=" shop 3400 ">
  368. /**
  369. * 商品不能重复购买
  370. */
  371. const user_shop_NotRepeatBuy = 3401;
  372. /**
  373. * 购买次数已达最大值
  374. */
  375. const user_shop_LimitNum = 3402;
  376. /**
  377. * 活动过期
  378. */
  379. const user_shop_activeExpire = 3403;
  380. /**
  381. * 免费次数已达上限
  382. */
  383. const user_shop_FreeNumLimit = 3404;
  384. /**
  385. * 购买次数已达上限
  386. */
  387. const user_shop_buyTiliNumLimit = 3405;
  388. /**
  389. * 广告购买体力次数已达上限
  390. */
  391. const user_shop_GuanggaoGetTiliNumLimit = 3406;
  392. /**
  393. * 广告获得次数已达上限
  394. */
  395. const user_shop_GuanggaoFreeNumLimit = 3407;
  396. /**
  397. * 倒计时时间限制暂时无法购买
  398. */
  399. const user_shop_DownTsLimit = 3408;
  400. // </editor-fold>
  401. //
  402. // // <editor-fold defaultstate="collapsed" desc=" active 3500 ">
  403. /**
  404. * 奖励已经领过
  405. */
  406. const active_hasgetted = 3501;
  407. /**
  408. * 无效的时间内不能领取奖励
  409. */
  410. const active_day7_expired = 3502;
  411. /*
  412. * 不存在活动配置信息
  413. */
  414. const active_const_no_err = 3503;
  415. /**
  416. * 活动 - 激活码 无效
  417. */
  418. const active_activecode_format = 3504;
  419. /**
  420. * 活动 - 激活码 渠道错误.
  421. */
  422. const active_activecode_plat = 3505;
  423. /**
  424. * 激活码礼包已经过期
  425. */
  426. const active_activecode_outtime = 3506;
  427. /**
  428. * 活动 - 兑换码已经使用过了
  429. */
  430. const active_activecode_used = 3507;
  431. /**
  432. * 活动 - 此活动尚未开放
  433. */
  434. const active_time = 3508;
  435. // </editor-fold>
  436. //
  437. // // <editor-fold defaultstate="collapsed" desc=" task 3600 ">
  438. /**
  439. * 任务不存在
  440. */
  441. const task_NoExist = 3601;
  442. /**
  443. * 不能领取该任务奖励
  444. */
  445. const task_CanotPriceReviced = 3602;
  446. /**
  447. * 任务奖励不能重复领取
  448. */
  449. const task_PriceRepeatReviced = 3603;
  450. /**
  451. * 活跃点宝箱奖励领取条件不达标无法领取
  452. */
  453. const task_CanotReviced_ActivePointBox = 3604;
  454. /**
  455. * 活跃点宝箱奖励重复领取
  456. */
  457. const task_RepeatReviced_ActivePointBox = 3605;
  458. /**
  459. * 限时活动未开启不能领取任务奖励
  460. */
  461. const task_NotOpen_Day7Happy = 3606;
  462. /**
  463. * 时间校验错误请检查当前时间是否
  464. */
  465. const task_DownTsLimit = 3607;
  466. // </editor-fold>
  467. //
  468. // <editor-fold defaultstate="collapsed" desc=" 邮件错误码 37xx ">
  469. /**
  470. * 邮件 - 错误的邮件id
  471. */
  472. const email_wrongid = 3701;
  473. /**
  474. * 邮件 - 未找到指定邮件
  475. */
  476. const email_not_found = 3702;
  477. /**
  478. * 邮件 - 不存在附件
  479. */
  480. const email_no_appendix = 3703;
  481. /**
  482. * 邮件 - 附件已领取
  483. */
  484. const email_appendix_drawed = 3704;
  485. // </editor-fold>
  486. //
  487. // <editor-fold defaultstate="collapsed" desc=" 反射方法 ">
  488. /**
  489. * 辅助方法, 将所有错误码信息转换到CSV文本中.
  490. * 用法: 先在本文件中用ctrl + H 全部替换掉 'c onst ' -> 's tatic $'
  491. * 然后再调用本方法,即可在同目录下生成ErrCode.txt, 里面包含了所需信息.
  492. * @throws \Exception
  493. * @author gwang
  494. */
  495. static function L() {
  496. $class = new \ReflectionClass(__CLASS__); # 建立这个类的反射对象
  497. $properties = $class->getProperties(\ReflectionProperty::IS_STATIC); # 拉取所有静态属性
  498. $fileName = __DIR__ . "/ErrCode.txt"; # 输出文件名
  499. $fd = fopen($fileName, "w");
  500. if (false === $fd) { # 打开文件失败
  501. throw new \Exception("打开$fileName 失败");
  502. }
  503. foreach ($properties as &$p) {
  504. $d = preg_replace('/[\*|\/|\s+]/', '', $p->getDocComment()); # 处理下注释
  505. $type = (strpos($p->getName(), 'err') === false ? 0 : 1); # errorType: 0 继续, 1 重启
  506. $n = fputs($fd, $p->getName() . ";" . $p->getValue() . ";$type;$d" . PHP_EOL); # 写入文件
  507. if (false === $n) { # 写入时失败
  508. throw new Exception("写入$fileName 时失败");
  509. }
  510. }
  511. fclose($fd);
  512. }
  513. /**
  514. * 辅助方法, 将所有错误码信息转换到CS文件中.
  515. * 用法: 先在本文件中用ctrl + H 全部替换掉 'c onst ' -> 's tatic $'
  516. * 然后再调用本方法,即可在同目录下生成ErrCode.cs, 里面包含了所有错误信息.
  517. * @throws \Exception
  518. * @author gwang
  519. */
  520. static function M() {
  521. $class = new \ReflectionClass(__CLASS__); # 建立这个类的反射对象
  522. $properties = $class->getProperties(\ReflectionProperty::IS_STATIC); # 拉取所有静态属性
  523. $fileName = __DIR__ . "/ErrCode.cs"; # 输出文件名
  524. $fd = fopen($fileName, "w");
  525. if (false === $fd) { # 打开文件失败
  526. throw new \Exception("打开$fileName 失败");
  527. }
  528. $classHead = <<<HEAD
  529. /// <summary>
  530. /// 错误码
  531. /// </summary>
  532. class ErrCode
  533. {
  534. HEAD;
  535. $classEnd = <<<END
  536. }
  537. END;
  538. $cst = 'const';
  539. fputs($fd, $classHead); # 类头
  540. foreach ($properties as &$p) {
  541. $d = preg_replace('/[\*|\/|\s+]/', '', $p->getDocComment()); # 提取注释
  542. $pname = $p->getName(); # 字段名称
  543. $pvalue = $p->getValue(); # 错误码
  544. $filed = <<<FILED
  545. /// <summary>
  546. /// {$d}
  547. /// </summary>
  548. public {$cst} int {$pname} = {$pvalue};
  549. FILED;
  550. $n = fputs($fd, $filed); # 写入错误编号
  551. if (false === $n) { # 写入时失败
  552. throw new Exception("写入$fileName 时失败");
  553. }
  554. }
  555. fputs($fd, $classEnd); # 类尾
  556. fclose($fd);
  557. }
  558. // </editor-fold>
  559. }
  560. //ErrCode::L();
  561. //ErrCode::M();