代码展示:
/**
* 测算引流SEO程序
* 版权: 奥顺互联
*/
public function zhuge(){
$sanzi = $_POST['zistr'];
$onehanzi=substr($sanzi,0,3);
$twohanzi=substr($sanzi,3,3);
$threehanzi=substr($sanzi,6,3);
$db=D('kangxi');
$onehanziarr = $db->where(array('hanzi'=>'%'.$onehanzi.'%'))->find();
$twohanziarr = $db->where(array('hanzi'=>'%'.$twohanzi.'%'))->find();
$threehanziarr = $db->where(array('hanzi'=>'%'.$threehanzi.'%'))->find();
$bihua1 = $onehanziarr['bihua'];
$bihua2 = $twohanziarr['bihua'];
$bihua3 = $threehanziarr['bihua'];
$bihua=$bihua1.$bihua2.$bihua3;
if($bihua>=384){
do{
$bihua=$bihua-384;
}while($bihua>=384);
}
if($bihua<=9){
$bihua='00'.$bihua;
}
if($bihua<=99){
$bihua='0'.$bihua;
}
$db = D('sm_zhuge');
$rszhuge = $db->where(array('id'=>$bihua))->find();
$zhugetitle=$rszhuge["title"];
$zhugecontent=$rszhuge["content"];
$row['title'] = $zhugetitle;
$row['content'] = $zhugecontent;
$row['hanzi'] = $sanzi;
return_json(array('errcode'=>0,'errmsg'=>'ok','row'=>$row));
}
实现后如下图:
姓名打分代码示例:
/**
* 测算引流SEO程序
* 版权: 奥顺互联
*/
public function xmfx(){
$xing = $_POST['xing'];
$ming = $_POST['ming'];
$xing1=substr($xing,0,3);
$ming1=substr($ming,0,3);
$db=D('kangxi');
$xing1arr = $db->where(array('hanzi'=>'%'.$xing1.'%'))->find();
$ming1arr = $db->where(array('hanzi'=>'%'.$ming1.'%'))->find();
$bihua1 = $xing1arr['bihua'];
if($bihua1==''){
$bihua1 = M('mod_xingming')->get_bihua($xing1)['bihua'];
}
$hzwh1 = $xing1arr['wuxing'];
if($hzwh1==''){
$hzwh1 = M('mod_xingming')->get_bihua($xing1)['hzwh'];
}
$tiange=$bihua1+1;
$tiangee=$bihua1+1;
$renge1=$bihua1;
$xing2=substr($xing,3,3);
if($xing2!=''){
$xing2arr = $db->where(array('hanzi'=>'%'.$xing2.'%'))->find();
$bihua2 = $xing2arr['bihua'];
if($bihua2==''){
$bihua2 = M('mod_xingming')->get_bihua($xing2)['bihua'];
}
$hzwh2 = $xing2arr['wuxing'];
if($hzwh2==''){
$hzwh2 = M('mod_xingming')->get_bihua($xing2)['hzwh'];
}
$tiange=$bihua1+$bihua2;
$tiangee=$bihua1+$bihua2;
$renge1=$bihua2;
}
$bihua3 = $ming1arr['bihua'];
if($bihua3==''){
$bihua3 = M('mod_xingming')->get_bihua($ming1)['bihua'];
}
$hzwh3 = $ming1arr['wuxing'];
if($hzwh3==''){
$hzwh3 = M('mod_xingming')->get_bihua($ming1)['hzwh'];
}
$dige=intval($bihua3)+1;
$digee=intval($bihua3)+1;
$renge2=$bihua3;
$ming2=substr($ming,3,3);
if($ming2!=''){
$ming2arr = $db->where(array('hanzi'=>'%'.$ming2.'%'))->find();
$bihua4 = $ming2arr['bihua'];
if($bihua4==''){
$bihua4 = M('mod_xingming')->get_bihua($ming2)['bihua'];
}
$hzwh4 = $ming2arr['wuxing'];
if($hzwh4==''){
$hzwh4 = M('mod_xingming')->get_bihua($ming2)['hzwh'];
}
$dige=$bihua3+$bihua4;
$digee=$bihua3+$bihua4;
}
$xm_arr = array('xing1'=>$xing1,'xing1py'=>$xing1arr['pinyin'],'xing1gb'=>$xing1arr['fanti'],'xing2'=>$xing2,'xing2py'=>$xing2arr['pinyin'],'xing2gb'=>$xing2arr['fanti'],'ming1'=>$ming1,'ming1py'=>$ming1arr['pinyin'],'ming1gb'=>$ming1arr['fanti'],'ming2'=>$ming2,'ming2py'=>$ming2arr['pinyin'],'ming2gb'=>$ming2arr['fanti']);
$bh_wh_arr = array('bihua1'=>$bihua1,'bihua2'=>$bihua2,'bihua3'=>$bihua3,'bihua4'=>$bihua4,'hzwh1'=>$hzwh1,'hzwh2'=>$hzwh2,'hzwh3'=>$hzwh3,'hzwh4'=>$hzwh4,'whpy1'=>M('mod_xingming')->whpy($hzwh1),'whpy2'=>M('mod_xingming')->whpy($hzwh2),'whpy3'=>M('mod_xingming')->whpy($hzwh3),'whpy4'=>M('mod_xingming')->whpy($hzwh4));
$zhongge=intval($bihua1)+intval($bihua2)+intval($bihua3)+intval($bihua4);
$zhonggee=intval($bihua1)+intval($bihua2)+intval($bihua3)+intval($bihua4);
//计算三才
$renge=intval($renge1)+intval($renge2);
$rengee=intval($renge1)+intval($renge2);
$waige=intval($zhongge)-intval($renge);
$waigee=intval($zhonggee)-intval($rengee);
if($xing2==''){
$waige=intval($waige)+1;
$waigee=intval($waigee)+1;
}
if($ming2==''){
$waige=intval($waige)+1;
$waigee=intval($waigee)+1;
}
//天格 $bihua1=db::queryone($sql);
$db=D('sm_81');
$tiangearr = $db->where(array('num'=>$tiangee))->find();
$tiangearr['tiangee'] = $tiangee;
//人格 $bihua1=db::queryone($sql);
//$sql="select * from `sm_81` where num='".$rengee."'";
$rengearr=$db->where(array('num'=>$rengee))->find();
$rengearr['rengee'] = $rengee;
//地格 $bihua1=db::queryone($sql);
//$sql="select * from `sm_81` where num='".$digee."'";
$digearr=$db->where(array('num'=>$digee))->find();
$digearr['digee'] = $digee;
//外格 $bihua1=db::queryone($sql);
//$sql="select * from `sm_81` where num='".$waigee."'";
$waigearr=$db->where(array('num'=>$waigee))->find();
$waigearr['waigee'] = $waigee;
//总格 $bihua1=db::queryone($sql);
//$sql="select * from `sm_81` where num='".$zhongge."'";
$zonggearr=$db->where(array('num'=>$zhongge))->find();
$zonggearr['zonggee'] = $zhonggee;
$tian_sancai = M('mod_xingming')->getsancai($tiange);
$ren_sancai = M('mod_xingming')->getsancai($renge);
$di_sancai = M('mod_xingming')->getsancai($dige);
//print_r($ren_sancai);
//三才吉凶
$sancai=$tian_sancai.$ren_sancai.$di_sancai;
$db=D('sm_sancai');
//$sqlsancai="select * from `lang_sm_sancai` where `title`='".$sancai."'";
$rssancai=$db->where(array('title'=>$sancai))->find();
$rssancai['sancai'] = $sancai;
$tdr_ge = array('renge'=>$renge,'tiange'=>$tiange,'dige'=>$dige,'tian_sancai'=>$tian_sancai,'ren_sancai'=>$ren_sancai,'di_sancai'=>$di_sancai,'waige'=>$waige,'waige_sancai'=>M('mod_xingming')->getsancai($waige),'zhongge'=>$zhongge,'zongge_sancai'=>M('mod_xingming')->getsancai($zhongge));
$xmdf=M('mod_xingming')->getpf($tiangearr['jx'])/10+M('mod_xingming')->getpf($rengearr['jx'])+M('mod_xingming')->getpf($digearr['jx'])+M('mod_xingming')->getpf($zonggearr['jx'])+M('mod_xingming')->getpf($waigearr['jx'])/10+M('mod_xingming')->getpf($rssancai['jx'])/4+M('mod_xingming')->getpf($rssancai['jx1'])/4+M('mod_xingming')->getpf($rssancai['jx2'])/4+M('mod_xingming')->getpf($rssancai['jx3'])/4;
if($zhonggee>60){
$xmdf=$xmdf-4;
}
$xmdf=58+$xmdf;
$xmdf = round($xmdf);
if($xmdf>100){
$xmdf = 100;
}
$ra['xing'] = $xing;
$ra['ming'] = $ming;
$ra['xing1'] = $xing1;
$ra['ming1'] = $ming1;
$ra['xing2'] = $xing2;
$ra['ming2'] = $ming2;
$ra['xm_arr'] = $xm_arr;
$ra['bh_wh_arr'] = $bh_wh_arr;
$ra['tdr_ge'] = $tdr_ge;
$ra['xmdf'] = $xmdf;
$ra['tiangearr'] = $tiangearr;
$ra['rengearr'] = $rengearr;
$ra['digearr'] = $digearr;
$ra['waigearr'] = $waigearr;
$ra['zonggearr'] = $zonggearr;
$ra['rssancai'] = $rssancai;
return_json(array('errcode'=>0,'errmsg'=>'ok','ra'=>$ra));
}
实现后如下图:
总结
本文由奥顺互联原创发布,转载请注明出处!