class ZyGuessService
{
private $dict_repo;
private $surname_config; //复姓姓氏数组
public function __construct(DictRepository $dict_repo)
{
$this->dict_repo = $dict_repo;
$this->surname_config = config('surname');
}
/**
* 天格计算
* 计算规则:
* 单姓氏:取名字第一个字符计算笔画数 + 1
* 复姓氏:取名字前两个字符计算笔画数
* @param $str 名字
* @return int
* @author joniding
* @date 2020-03-12
*/
public function DayGrid($str)
{
$two_name = mb_substr($str,0,2); //取名字前两个检测是否为复姓氏
$first_sur = mb_substr($str,0,1);
$first_info = $this->dict_repo->getFirst(['chinese' => $first_sur]);
$nums = $first_info['nums'];
//检测是否为复姓氏
if ($this->checkIsSurName($two_name)){
$second_sur = mb_substr($str,1,1);
$second_info = $this->dict_repo->getFirst(['ch
PHP- 周易五格计算算法
最新推荐文章于 2023-11-03 10:55:41 发布