欢迎各位兄弟 发布技术文章
这里的技术是共享的
unction shipingzhongcustom_views_query_alter(&$view, &$query) { if ($view->name == 'allcontentview' && $view->current_display=='page_33') { //$export = kprint_r($query->where, TRUE); // $vars - is a variable which you want to print. //print $export; //$query->add_where(1, "node_data_field_is_baoming.field_is_baoming_value IS NULL and node_data_field_is_dingjing.field_is_dingjing_value IS NULL "); $query->add_where(1, "node_data_field_is_baoming.field_is_baoming_value IS NULL or node_data_field_is_baoming.field_is_baoming_value <> '是' "); $query->add_where(1, "node_data_field_xueshenname.field_is_zx_shangmen_value = '是' "); $query->set_where_group('OR', 1); $query->add_where(2, "node_data_field_is_dingjing.field_is_dingjing_value IS NULL or node_data_field_is_dingjing.field_is_dingjing_value <> '是' "); $query->add_where(2, "node_data_field_xueshenname.field_is_zx_shangmen_value = '是' "); $query->set_where_group('OR', 2); //$export = kprint_r($query->where, TRUE); //print $export; } }
上门未报名的条件相当于 where (DATE_FORMAT(ADDTIME(node_data_field_shangmeng_time.field_shangmeng_time_value, SEC_TO_TIME(28800)), '%Y-%m-%d') <= '2017-02-20') AND ((node_data_field_is_shangmen.field_is_shangmen_value = '是') AND (node.type in ('kefuchat'))) AND ((node_data_field_is_baoming.field_is_baoming_value IS NULL or node_data_field_is_baoming.field_is_baoming_value <> '是' ) OR (node_data_field_xueshenname.field_is_zx_shangmen_value = '是' )) AND ((node_data_field_is_dingjing.field_is_dingjing_value IS NULL or node_data_field_is_dingjing.field_is_dingjing_value <> '是' ) OR (node_data_field_xueshenname.field_is_zx_shangmen_value = '是' ))
# 为什么我自己写的sql 要用 '%Y-%m-%%d' (为什么要用两上百分号d)
select c_t_xiaonenzhibantime.nid,
count(field_xnzbt_start_time_value) as date_cou,
DATE_FORMAT(ADDTIME(field_xnzbt_start_time_value, SEC_TO_TIME(28800)), '%Y-%m-%%d') as date_one
from content_type_xiaonenzhibantime c_t_xiaonenzhibantime
inner join content_field_xnfx_person c_f_xnfx_person on c_f_xnfx_person.nid=c_t_xiaonenzhibantime.nid where
field_xnzbt_start_time_value>='2019-07-01'
and field_xnzbt_end_time_value<='2019-07-04 00:00:00'
group by DATE_FORMAT(ADDTIME(field_xnzbt_start_time_value, SEC_TO_TIME(28800)),
'%Y-%m-%%d') order by field_xnzbt_start_time_value asc
难道是因为 public_html/sites/all/modules/views/includes/handlers.inc 这个里面对mysqli的%d进行了处理?