1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import datetime
- import GaoNengLogic
- import SiZhuLogic
- from DataCenter import DataCenter
- from LocalModel import BaZi, LuckyDayInfo, SiZhu, SiZhuWeiZhi
- from model import Wannianli
- def calc_simple_lucky_day(bazi: BaZi, dc: DataCenter):
- bazi.luckyDays = []
- dt = datetime.datetime.now()
- for i in range(0, 1):
- diff = datetime.timedelta(days=i)
- cur = dt + diff
- dts = Wannianli.select().where(Wannianli.nian == cur.year, Wannianli.yue == cur.month,
- Wannianli.ri == cur.day).first()
- if dts is not None:
- # print(dts.nian_gan, dts.nian_zhi, "年 ", dts.yue_gan, dts.yue_zhi, "月 ", dts.ri_gan, dts.ri_zhi, "日")
- info = LuckyDayInfo()
- info.year = cur.year
- info.month = cur.month
- info.day = cur.day
- info.niangan = SiZhu(bazi.qiankun, True, dts.nian_gan, SiZhuWeiZhi.liu_niangan)
- info.nianzhi = SiZhu(bazi.qiankun, False, dts.nian_zhi, SiZhuWeiZhi.liu_nianzhi)
- info.yuegan = SiZhu(bazi.qiankun, True, dts.yue_gan, SiZhuWeiZhi.liu_yuegan)
- info.yuezhi = SiZhu(bazi.qiankun, False, dts.yue_zhi, SiZhuWeiZhi.liu_yuezhi)
- info.rigan = SiZhu(bazi.qiankun, True, dts.ri_gan, SiZhuWeiZhi.liu_rigan)
- info.rizhi = SiZhu(bazi.qiankun, False, dts.ri_zhi, SiZhuWeiZhi.liu_rizhi)
- for gan in info.all_gans():
- SiZhuLogic.__fill_sizhu_of_tiangan(gan)
- for zhi in info.all_zhis():
- SiZhuLogic.__fill_sizhu_of_dizhi(zhi)
- SiZhuLogic.__fill_sizhu_of_zhangsheng(info.nianzhi, info.niangan.text, bazi.riGan.text)
- SiZhuLogic.__fill_sizhu_of_zhangsheng(info.yuezhi, info.yuegan.text, bazi.riGan.text)
- SiZhuLogic.__fill_sizhu_of_zhangsheng(info.rizhi, info.rigan.text, bazi.riGan.text)
- for zhi in info.all_zhis():
- SiZhuLogic.__fill_cang_gan(zhi, bazi.riGan)
- for sz in info.all_zhus():
- SiZhuLogic.__fill_shishen(bazi.riGan, sz)
- sz.check_lushen(bazi.riGan.text)
- tgZhus = [info.niangan, info.yuegan, info.rigan, bazi.riGan]
- dzZhus = [info.nianzhi, info.yuezhi, info.rizhi, bazi.riZhi]
- for tg in tgZhus:
- GaoNengLogic.__fix_tiangan_gaoneng(tg, tgZhus, bazi, dc, False)
- for dz in dzZhus:
- GaoNengLogic.__fix_dizhi3_gaoneng(dz, dzZhus, bazi, dc, False)
- for dz in dzZhus:
- GaoNengLogic.__fix_dizhi2_gaoneng(dz, dzZhus, bazi, dc, False)
- for sz in info.all_zhus():
- sz.power = dc.get_shishen_power(sz.shiShen)
- per = dc.get_cangan_power_percentage_by_zhu(sz)
- sz.update_canggan_powers(per)
- sz.selfPower = sz.get_canggan_power_by_wuxing(sz.wuXing)
- bazi.luckyDays.append(info)
|