本文整理汇总了PHP中CommonModel::get_product_list方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonModel::get_product_list方法的具体用法?PHP CommonModel::get_product_list怎么用?PHP CommonModel::get_product_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonModel
的用法示例。
在下文中一共展示了CommonModel::get_product_list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transactionp
/**
* @按产品查询交易数据信息
* @param int $p_id 产品id
*/
public function transactionp($p_id)
{
if (!$this->check_power('statistics_manage')) {
return;
}
$p_id = intval($p_id);
$student = CommonModel::get_product_list($p_id);
if (empty($student)) {
message('信息不存在');
return;
}
$admin = $this->session->userdata('admin_id');
$managers = explode(',', $student['p_managers']);
if (!in_array($admin, $managers) && !$this->is_super_user()) {
message('没有管理权限');
return;
}
/*
* 基本信息
*/
$p_id = intval($p_id);
$student = CommonModel::get_product_list($p_id);
if (empty($student)) {
message('信息不存在');
return;
}
$data = array();
$data['p_id'] = $p_id;
$data['p_name'] = $student[p_name];
$query = array();
$query['p_id'] = $p_id;
$query['pt_type'] = 0;
/* 搜索条件 */
if (isset($_GET['begin_time']) && !empty($_GET['begin_time'])) {
$query['pt_u_time >='] = strtotime($_GET['begin_time'] . '00:00:59');
$search['begin_time'] = $_GET['begin_time'];
}
if (isset($_GET['end_time']) && !empty($_GET['end_time'])) {
$query['pt_u_time <='] = strtotime($_GET['end_time'] . '23:59:59');
$search['end_time'] = $_GET['end_time'];
}
// 公共数据
$res = CommonModel::get_list($query, 'v_trans_log', 'count(pt_id) as pt_id_count,sum(pt_money)*(-1) as pt_money_count');
$data['p_id_count'] = $res[0]['pt_id_count'];
$data['p_money_count'] = !empty($res[0]['pt_money_count']) ? $res[0]['pt_money_count'] : 0;
$total = $res[0]['pt_id_count'];
/*
* 分页读取数据列表,并处理相关数据
*/
$size = 10;
$page = isset($_GET['page']) && intval($_GET['page']) > 1 ? intval($_GET['page']) : 1;
$offset = ($page - 1) * $size;
$list = array();
if ($total) {
$res = CommonModel::get_list($query, 'v_trans_log', 'pt_id,p_name,pc_name,end_time,start_time,a_name,pt_money', $page, $size);
foreach ($res as $row) {
$row['start_time'] = $row['start_time'] > 0 ? date('Y-m-d H:i:s', $row['start_time']) : date('Y-m-d H:i:s', time());
$row['end_time'] = $row['end_time'] > 0 ? date('Y-m-d H:i:s', $row['end_time']) : date('Y-m-d H:i:s', time());
$row['p_name'] = !empty($row['p_name']) ? $row['p_name'] : '充值';
$row['pt_money'] = !empty($row['pt_money']) ? $row['pt_money'] * -1 : '0';
$row['pc_name'] = !empty($row['pc_name']) ? $row['pc_name'] : '充值';
$list[] = $row;
}
}
$data['list'] = $list;
// 分页
$purl = site_url('admin/account/transactionp/' . $p_id);
$data['pagination'] = multipage($total, $size, $page, $purl);
$data['search'] = $search;
// 模版
$this->load->view('account/transactionp', $data);
}
示例2: batch_delete
/**
* @description 批量删除产品信息
* @author
* @final
* @param array $ids 产品id
*/
public function batch_delete()
{
if (!$this->check_power_new('production_batch_delete')) {
return;
}
$ids = $this->input->post('ids');
if (empty($ids) or !is_array($ids)) {
message('请选择要删除的项目!');
return;
}
// 检查被关联试题
$success = $fail = 0;
foreach ($ids as $id) {
$p_id = intval($id);
$p_ids = CommonModel::get_product_list($p_id);
$bool = true;
if (empty($p_ids)) {
$bool = false;
}
$admin = $this->session->userdata('admin_id');
/*
$managers = explode(',',$p_ids['p_managers']);
if(!in_array($admin, $managers)&&!$this->check_power_new('production_del'))
{
$bool = false;
}
*/
$query = array();
$query['p_id'] = $p_id;
$res = CommonModel::get_list($query, 'v_trans_log_count', 'pt_id_count');
$pt_id_count = $res[0]['pt_id_count'];
if ($pt_id_count > 0) {
$bool = false;
}
if (!$bool) {
$fail++;
continue;
}
$num = Fn::db()->delete('rd_product', "p_id={$p_id}");
admin_log('delete', 'product', $p_id);
if ($num > 0) {
$success += $num;
} else {
$fail++;
}
}
$back_url = 'admin/prodution/index/';
message('批量操作完成,成功删除:' . $success . ' 个,失败:' . $fail . ' 个。', 'javascript');
}
示例3: place_in
/**
* 测试报名
* @param int $exam 期次id
* @param int $place 场次id, 多个ID用英文逗号分隔开
* @param int $p_id 产品id
* @return json 成功/失败
*/
public function place_in()
{
$exam = intval($this->input->post('exam'));
$place = $this->input->post('place');
$uid = $this->session->userdata('uid');
$p_id = intval($this->input->post('p_id'));
$force = intval($this->input->post('force'));
$b_pushcourse = intval($this->input->post('b_pushcourse'));
if (!Validate::isJoinedIntStr($place)) {
output_json(CODE_ERROR, '报名失败,考场不正确');
}
// 检查是否存在该学生
$account = StudentModel::get_student($uid, 'account,account_status');
if (!count($account['account'])) {
output_json(CODE_ERROR, '报名失败,不存在该学生.');
} else {
if ($account['account_status']) {
output_json(CODE_ERROR, '报名失败,学生帐号已被冻结');
}
}
if (CommonModel::get_product_trans($p_id, $uid, $place, $exam)) {
output_json(CODE_ERROR, '报名失败,已报名该产品');
}
$res = CommonModel::get_product_list($p_id);
if (!$res) {
output_json(CODE_ERROR, '报名失败,产品不存在');
} else {
$price = $b_pushcourse ? $res['p_price_pushcourse'] : $res['p_price'];
$pc_id = $res['pc_id'];
}
$account = $account['account'];
$account1 = $account - $price;
if ($account1 < 0) {
output_json(CODE_ERROR, '帐号余额不足');
}
$inserts = array();
$error = array();
$code = CODE_ERROR;
$place_id_arr = array_unique(explode(',', $place));
$place_id_arr2 = array();
foreach ($place_id_arr as $place_id) {
if ($place_id) {
$query = $this->db->select('p.*,e.exam_name,e.exam_id,e.exam_pid,e.grade_id')->from('exam_place p')->join('exam e', 'p.exam_pid=e.exam_id')->where(array('p.place_id' => $place_id))->get();
$place = $query->row_array();
} else {
continue;
}
if (empty($place)) {
$error[] = "考场[{$place_id}]信息不存在";
//output_json(CODE_ERROR, '考场信息不存在');
continue;
}
$ids = $uid;
// 控制考场只能在未开始考试操作
$no_start = ExamPlaceModel::place_is_no_start($place_id);
if (!$no_start) {
$error[] = "考场[{$place_id}]正确考试或已结束,无法报名";
continue;
//output_json(CODE_ERROR, '该考场正在考试或已结束,无法做此操作');
}
// $ids = my_intval($ids);
// $school_id = (int)$this -> input ->post('school_id');
// 该考场所考到的学科
$subject_ids = array();
$query = $this->db->select('subject_id')->from('exam_place_subject')->where(array('place_id' => $place['place_id']))->get();
$subjects = $query->result_array();
$subject_ids = array();
foreach ($subjects as $subject) {
$subject_ids[] = $subject['subject_id'];
}
$subject_ids = count($subject_ids) ? implode(',', $subject_ids) : '""';
$place['start_time'] = $place['start_time'] + 1;
$place['end_time'] = $place['end_time'] - 1;
if ($force == 0) {
$sql = "SELECT count(u.uid) FROM rd_student u\n WHERE u.grade_id={$place['grade_id']} AND u.is_delete=0 AND u.uid ={$ids}";
$query = Fn::db()->fetchOne($sql);
if ($query == 0) {
$error[] = "考场[{$place_id}]您的年级不符合要求";
$code = -2;
continue;
//output_json('-2', '你的年级不符合要求');
}
}
$not_exists_sql = <<<EOT
SELECT uid
FROM rd_exam_place_student ps, rd_exam_place p, rd_exam e
WHERE e.exam_isfree = 0
AND ps.place_id = p.place_id
AND p.place_index = {$place['place_index']}
AND ps.uid = u.uid
AND p.exam_pid = e.exam_id
AND
(
//.........这里部分代码省略.........