model.py 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. import logging
  2. from peewee import *
  3. from playhouse.pool import PooledMySQLDatabase
  4. database = PooledMySQLDatabase('yixue',
  5. user='yixue',
  6. password='Lai123',
  7. host='test.db.cxhy.cn',
  8. port=3306,
  9. max_connections=32,
  10. stale_timeout=300, )
  11. def get_db():
  12. db = PooledMySQLDatabase('yixue',
  13. user='yixue',
  14. password='Lai123',
  15. host='test.db.cxhy.cn',
  16. port=3306,
  17. max_connections=32,
  18. stale_timeout=300,
  19. timeout=10, )
  20. logging.getLogger().setLevel(logging.INFO)
  21. logging.info("get db")
  22. print("get db 2222")
  23. return db
  24. class UnknownField(object):
  25. def __init__(self, *_, **__): pass
  26. class BaseModel(Model):
  27. class Meta:
  28. database = get_db()
  29. class AreaInfo(BaseModel):
  30. hour = IntegerField(null=True)
  31. jingdu = FloatField(null=True)
  32. minute = IntegerField(null=True)
  33. qu = TextField(null=True)
  34. qu_pinyin = TextField(null=True)
  35. second = IntegerField(null=True)
  36. sheng = TextField(null=True)
  37. shi = TextField(null=True)
  38. shi_pinyin = TextField(null=True)
  39. weidu = FloatField(null=True)
  40. class Meta:
  41. table_name = 'AreaInfo'
  42. class XingGe(BaseModel):
  43. key = TextField(null=True)
  44. level = IntegerField(null=True)
  45. low = TextField()
  46. middle = TextField(null=True)
  47. strong = TextField(null=True)
  48. class Meta:
  49. table_name = 'XingGe'
  50. class CustomUser(BaseModel):
  51. name = TextField(null=True)
  52. online = IntegerField(null=True)
  53. psd = TextField(null=True)
  54. sexy = IntegerField(null=True)
  55. user = TextField(null=True)
  56. class Meta:
  57. table_name = 'custom_user'
  58. class Dashe(BaseModel):
  59. dizhi = TextField(null=True)
  60. rigan = TextField(null=True)
  61. tiangan = TextField(null=True)
  62. class Meta:
  63. table_name = 'dashe'
  64. class Diwang(BaseModel):
  65. dizhi = TextField(null=True)
  66. nianzhi = TextField(null=True)
  67. rizhi = TextField(null=True)
  68. class Meta:
  69. table_name = 'diwang'
  70. class Dizhi(BaseModel):
  71. gan1 = TextField(null=True)
  72. gan2 = TextField(null=True)
  73. gan3 = TextField(null=True)
  74. name = TextField()
  75. wuxing = TextField()
  76. yinyang_dz = TextField()
  77. yuefen = IntegerField()
  78. class Meta:
  79. table_name = 'dizhi'
  80. class GaonengMid(BaseModel):
  81. arg1 = TextField(null=True)
  82. arg2 = TextField(null=True)
  83. arg3 = TextField(null=True)
  84. desc = TextField(null=True)
  85. fangxiang = TextField(null=True)
  86. father = TextField(null=True)
  87. guanxi = TextField(null=True)
  88. hehua = TextField(null=True)
  89. leibie = TextField(null=True)
  90. tip = TextField(null=True)
  91. wuxing1 = TextField(null=True)
  92. wuxing2 = TextField(null=True)
  93. wuxing3 = TextField(null=True)
  94. class Meta:
  95. table_name = 'gaoneng_mid'
  96. class Huagai(BaseModel):
  97. dizhi = TextField(null=True)
  98. nianzhi = TextField(null=True)
  99. rizhi = TextField(null=True)
  100. class Meta:
  101. table_name = 'huagai'
  102. class Liuqin(BaseModel):
  103. guanxi1 = TextField(null=True)
  104. guanxi2 = TextField(null=True)
  105. qiankun = TextField(null=True)
  106. shishen = TextField(null=True)
  107. class Meta:
  108. table_name = 'liuqin'
  109. class LuckyDay(BaseModel):
  110. day = IntegerField(null=True)
  111. desc = TextField(null=True)
  112. jiedu1 = TextField(null=True)
  113. jiedu2 = TextField(null=True)
  114. jiedu3 = TextField(null=True)
  115. jiedu4 = TextField(null=True)
  116. jiedu5 = TextField(null=True)
  117. month = IntegerField(null=True)
  118. riyuan = TextField(null=True)
  119. tip = TextField(null=True)
  120. year = IntegerField(null=True)
  121. class Meta:
  122. table_name = 'lucky_day'
  123. class LushenTip(BaseModel):
  124. key = TextField(null=True)
  125. tip = TextField(null=True)
  126. class Meta:
  127. table_name = 'lushen_tip'
  128. class ShenshaTips(BaseModel):
  129. effects = TextField(null=True)
  130. shensha = TextField(null=True)
  131. tips = TextField(null=True)
  132. class Meta:
  133. table_name = 'shensha_tips'
  134. class Shishen(BaseModel):
  135. guanxi = TextField()
  136. jiancheng = TextField()
  137. ta = TextField()
  138. ta_wu_xing = TextField(column_name='taWuXing')
  139. wo = TextField()
  140. wo_wu_xing = TextField(column_name='woWuXing')
  141. class Meta:
  142. table_name = 'shishen'
  143. class ShishenGeju(BaseModel):
  144. eft = TextField(null=True)
  145. key = TextField(null=True)
  146. solve = TextField(null=True)
  147. class Meta:
  148. table_name = 'shishen_geju'
  149. class ShishenJiedu(BaseModel):
  150. arg1 = TextField(null=True)
  151. arg2 = TextField(null=True)
  152. guanxi = TextField(null=True)
  153. tip1 = TextField(null=True)
  154. tip2 = TextField()
  155. tip3 = TextField(null=True)
  156. tip4 = TextField(null=True)
  157. tip5 = TextField(null=True)
  158. class Meta:
  159. table_name = 'shishen_jiedu'
  160. class ShishenShehuiguanxi(BaseModel):
  161. guanxi = TextField(null=True)
  162. shishen = TextField(null=True)
  163. class Meta:
  164. table_name = 'shishen_shehuiguanxi'
  165. class ShishenZhenjia(BaseModel):
  166. jia = TextField(null=True)
  167. key = TextField(null=True)
  168. zhen = TextField(null=True)
  169. class Meta:
  170. table_name = 'shishen_zhenjia'
  171. class Shishenzhilu(BaseModel):
  172. dizhi = TextField(null=True)
  173. tiangan = TextField(null=True)
  174. class Meta:
  175. table_name = 'shishenzhilu'
  176. class Taiyangpianyi(BaseModel):
  177. day = IntegerField(null=True)
  178. diff = IntegerField(null=True)
  179. month = IntegerField(null=True)
  180. class Meta:
  181. table_name = 'taiyangpianyi'
  182. class Taohua(BaseModel):
  183. dizhi = TextField(null=True)
  184. nianzhi = TextField(null=True)
  185. rizhi = TextField(null=True)
  186. class Meta:
  187. table_name = 'taohua'
  188. class Tiangan(BaseModel):
  189. banlu1 = TextField(null=True)
  190. banlu2 = TextField(null=True)
  191. diwang = TextField()
  192. linguan = TextField()
  193. lushen = TextField()
  194. name = TextField()
  195. wenchang = TextField()
  196. wuxing = TextField()
  197. yinyang = TextField()
  198. class Meta:
  199. table_name = 'tiangan'
  200. class Tianyiguiren(BaseModel):
  201. dizhi = TextField(null=True)
  202. niangan = TextField(null=True)
  203. rigan = TextField(null=True)
  204. class Meta:
  205. table_name = 'tianyiguiren'
  206. class UserInfo(BaseModel):
  207. beizhu = TextField(null=True)
  208. customer = TextField(null=True)
  209. day = IntegerField(null=True)
  210. enabled = IntegerField(null=True)
  211. hour = IntegerField(null=True)
  212. join_time = TextField(column_name='joinTime', null=True)
  213. leibie = IntegerField(null=True)
  214. man = IntegerField(null=True)
  215. minute = IntegerField(null=True)
  216. month = IntegerField(null=True)
  217. name = TextField(null=True)
  218. niangan = TextField(null=True)
  219. nianzhi = TextField(null=True)
  220. qu = TextField(null=True)
  221. rigan = TextField(null=True)
  222. rizhi = TextField(null=True)
  223. sheng = TextField(null=True)
  224. shi = TextField(null=True)
  225. shigan = TextField(null=True)
  226. shizhi = TextField(null=True)
  227. year = IntegerField(null=True)
  228. yuegan = TextField(null=True)
  229. yuezhi = TextField(null=True)
  230. class Meta:
  231. table_name = 'user_info'
  232. class Wannianli(BaseModel):
  233. nian = IntegerField()
  234. nian_gan = TextField(null=True)
  235. nian_zhi = TextField(null=True)
  236. ri = IntegerField()
  237. ri_gan = TextField(null=True)
  238. ri_zhi = TextField(null=True)
  239. yue = IntegerField()
  240. yue_gan = TextField(null=True)
  241. yue_zhi = TextField(null=True)
  242. class Meta:
  243. table_name = 'wannianli'
  244. class WannianliJieqi(BaseModel):
  245. bailu = TextField()
  246. chuxi = TextField()
  247. daxue = TextField()
  248. hanlu = TextField()
  249. jingzhe = TextField()
  250. lichun = TextField()
  251. lidong = TextField()
  252. liqiu = TextField()
  253. lixia = TextField()
  254. mangzhong = TextField()
  255. nianfen = IntegerField()
  256. qingming = TextField()
  257. xiaohan = TextField()
  258. xiaoshu = TextField()
  259. class Meta:
  260. table_name = 'wannianli_jieqi'
  261. class Wuxing(BaseModel):
  262. desc1 = TextField(null=True)
  263. desc2 = TextField(null=True)
  264. effect1 = FloatField(null=True)
  265. effect2 = FloatField(null=True)
  266. guanxi = TextField(null=True)
  267. wuxing1 = TextField(null=True)
  268. wuxing2 = TextField(null=True)
  269. class Meta:
  270. table_name = 'wuxing'
  271. class Yima(BaseModel):
  272. chong = TextField(null=True)
  273. dizhi = TextField(null=True)
  274. sanhe = TextField(null=True)
  275. shoushen = TextField(null=True)
  276. class Meta:
  277. table_name = 'yima'
  278. class Zaisha(BaseModel):
  279. dizhi = TextField(null=True)
  280. nianzhi = TextField(null=True)
  281. rizhi = TextField(null=True)
  282. class Meta:
  283. table_name = 'zaisha'
  284. class Zhangsheng(BaseModel):
  285. dizhi = TextField(null=True)
  286. tiangan = TextField(null=True)
  287. zhangsheng = TextField(null=True)
  288. class Meta:
  289. table_name = 'zhangsheng'