源战役
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
3.7 KiB

  1. %% ---------------------------------------------------------
  2. %% Author: xyj
  3. %% Email: 156702030@qq.com
  4. %% Created: 2011-12-13
  5. %% Description: 物品装备SQL定义
  6. %% --------------------------------------------------------
  7. %% --------------------------------- 生成物品%% ---------------------------------
  8. -define(SQL_GOODS_INSERT,
  9. <<"insert into goods set id=~p, role_id=~p, goods_id=~p, type=~p, subtype=~p, location=~p, cell=~p,
  10. num=~p, create_time=UNIX_TIMESTAMP(), expire_time=~p, bind=~p, extra_data='~ts' ">>).
  11. %% --------------------------------- 获取物品 ---------------------------------
  12. -define(SQL_GOODS_LIST_DEFAULT,
  13. <<"select id, role_id, goods_id, type, subtype, location, cell, num, create_time, expire_time, bind, extra_data">>).
  14. -define(SQL_GOODS_SELECT_BY_ID, <<?SQL_GOODS_LIST_DEFAULT/binary,
  15. <<" from `goods` where id=~p and role_id = ~p">>/binary >>).
  16. -define(SQL_GOODS_LIST_BY_LOCATION, <<?SQL_GOODS_LIST_DEFAULT/binary,
  17. <<" from `goods` where role_id = ~p and location = ~p">>/binary >>).
  18. %% --------------------------------- 物品更改 ---------------------------------
  19. -define(SQL_GOODS_UPDATE_NUM,
  20. <<"update `goods` set num = ~p where id = ~p and role_id = ~p">>).
  21. -define(SQL_GOODS_UPDATE_LOCATION_CELL,
  22. <<"update `goods` set location = ~p, cell = ~p, extra_data='~ts' where id = ~p and role_id = ~p">>).
  23. -define(SQL_GOODS_UPDATE_LOCATION_CELL_BIND,
  24. <<"update `goods` set location = ~p, cell = ~p, bind=~p, extra_data='~ts' where id = ~p and role_id = ~p">>).
  25. -define(SQL_GOODS_UPDATE_OTHER,
  26. <<"update `goods` set extra_data = '~ts' where id = ~p and role_id = ~p">>).
  27. -define(SQL_GOODS_UPDATE_EXPIRE,
  28. <<"update `goods` set expire_time = ~p where id = ~p and role_id = ~p">>).
  29. -define(SQL_GOODS_UPDATE_EXTRA, <<"update `goods_extra` set stren = ~p, exp = ~p, stage = ~p, dstone = '~s', stren_expend = ~p where gid = ~p">>).
  30. -define(SQL_GOODS_UPDATE_INFO,
  31. <<"update goods set goods_id=~p,type=~p,subtype=~p,create_time=UNIX_TIMESTAMP(),extra_data='~ts' where id=~p and role_id=~p">>).
  32. %% --------------------------------- 物品删除 ---------------------------------
  33. -define(SQL_GOODS_DELETE_BY_ID,
  34. <<"delete from `goods` where `id` = ~p and `role_id` = ~p">>).
  35. %% --------------------------------- 背包操作 ---------------------------------
  36. -define(SQL_PLAYER_UPDATE_CELL, <<"update `player_attr` set cell_num=~p where id=~p">>).
  37. -define(SQL_PLAYER_UPDATE_STORAGE_NUM, <<"update `player_attr` set storage_num=~p where id=~p">>).
  38. %% --------------------------------- 虚拟货币 ---------------------------------
  39. -define (SQL_INSERT_CURRENCY, <<"INSERT INTO `player_special_currency`(`player_id`, `currency_id`, `num`) VALUES (~p, ~p, ~p)">>).
  40. -define (SQL_UPDATE_CURRENCY, <<"UPDATE `player_special_currency` SET `num`=~p WHERE `player_id` = ~p AND `currency_id` = ~p">>).
  41. -define (LOAD_CURRENCY, <<"SELECT `currency_id`, `num` FROM `player_special_currency` WHERE `player_id` = ~p">>).
  42. %% --------------------------------- 礼包 ---------------------------------
  43. -define(SQL_GIFT_QUEUE_DELETE, <<"delete from `gift_list` where player_id=~p ">>).
  44. %% gift_card
  45. -define(SQL_GIFT_CARD_INSERT, <<"insert into `gift_card` set player_id=~p, card_no='~s', type=~p, time=~p, status=1 ">>).
  46. -define(SQL_GIFT_CARD_SELECT, <<"select status from `gift_card` where card_no='~s' ">>).
  47. -define(SQL_GIFT_CARD_BASE_SELECT, <<"select card_no from `base_gift_card` where accname='~s' limit 1 ">>).
  48. -define(SQL_CHARGE_SELECT, <<"select id from `charge` where player_id=~p and status=1 limit 1 ">>).