getTemplateState(); $voucher_gettype_array = $voucher_model->getVoucherGettypeArray(); $where = array(); $where[] = array('vouchertemplate_if_private', '=', 0); $where[] = array('vouchertemplate_state', '=', $templatestate_arr['usable'][0]); $store_id = intval($param['store_id']); if ($store_id > 0) { $where[] = array('vouchertemplate_store_id', '=', $store_id); } $where[] = array('vouchertemplate_gettype', 'in', array($voucher_gettype_array['points']['sign'], $voucher_gettype_array['free']['sign'])); if ($param['gettype'] && in_array($param['gettype'], array('points', 'free'))) { $where[] = array('vouchertemplate_gettype', '=', $voucher_gettype_array[$param['gettype']]['sign']); } $order = 'vouchertemplate_id asc'; $voucher_list = $voucher_model->getVouchertemplateList($where, '*', 20, 0, $order); if ($voucher_list) { foreach ($voucher_list as $k => $v) { $v['vouchertemplate_limit'] = floatval($v['vouchertemplate_limit']); $v['vouchertemplate_enddate_text'] = $v['vouchertemplate_enddate'] ? @date('Y.m.d', $v['vouchertemplate_enddate']) : ''; $voucher_list[$k] = $v; } } ds_json_encode(10000, '', array('voucher_list' => $voucher_list)); } }