public function lists() { $top_more_button[] = array('title' => '导入数据', 'url' => U('import')); $this->assign('top_more_button', $top_more_button); $model = $this->getModel('credit_data'); $map['token'] = get_token(); if (!empty($_GET['uid'])) { $uidArr = wp_explode($_GET['uid']); $map['uid'] = array('in', $uidArr); } elseif (!empty($_REQUEST['nickname'])) { $map['uid'] = array('in', D('Common/User')->searchUser($_REQUEST['nickname'])); } if (!isset($map['uid'])) { $map['uid'] = array('exp', '>0'); } if (!empty($_REQUEST['credit_name'])) { $map['credit_name'] = safe($_REQUEST['credit_name']); } if (!empty($_REQUEST['start_time']) && !empty($_REQUEST['end_time'])) { $map['cTime'] = array('between', '"' . intval($_REQUEST['start_time']) . ',' . intval($_REQUEST['start_time']) . '"'); } elseif (!empty($_REQUEST['start_time'])) { $map['cTime'] = array('egt', intval($_REQUEST['start_time'])); } elseif (!empty($_REQUEST['end_time'])) { $map['cTime'] = array('elt', intval($_REQUEST['end_time'])); } session('common_condition', $map); $list_data = $this->_get_model_list($model); foreach ($list_data['list_data'] as &$vo) { $vo['uid'] = get_nickname($vo['uid']); } $this->assign($list_data); // dump($list_data); $this->display(); }
function getInfo($id, $update = false, $data = array()) { $key = 'Invite_getInfo_' . $id; $info = S($key); if ($info === false || $update) { $info = (array) (empty($data) ? $this->find($id) : $data); $more_button = wp_explode($info['more_button']); foreach ($more_button as $v) { $arr = explode('|', $v); $more_buttonArr[$arr[1]] = $arr[0]; } $info['more_button_arr'] = $more_buttonArr; S($key, $info, 86400); } return $info; }
function getAskInfo($ask_id, $update = false) { $key = 'getAskInfo_' . $ask_id; $info = S($key); if ($info === false || $update) { $map['id'] = intval($ask_id); $info = $this->where($map)->find(); $appids = wp_explode($info['appids']); foreach ($appids as $v) { $arr = explode('|', $v); $appidArr[$arr[1]] = $arr[0]; } $info['appidArr'] = $appidArr; $finish_button = wp_explode($info['finish_button']); foreach ($finish_button as $v) { $arr = explode('|', $v); $finish_buttonArr[$arr[1]] = $arr[0]; } $info['finish_button_arr'] = $finish_buttonArr; $info['shop_address_arr'] = wp_explode($info['shop_address']); S($key, $info, 86400); } return $info; }
function _get_user_openid($sendType = 0, $groupId = 0, $openidStr = '') { $map['has_subscribe'] = 1; $map['token'] = get_token(); $allUser = M('public_follow')->where($map)->getFields('uid,openid'); foreach ($allUser as $k => $v) { $uidArr[$k] = $k; $openidArr[$v] = $k; } if ($sendType == 0 && $groupId == 0) { return $allUser; } else { if ($sendType == 0 && $groupId != 0) { $map1['uid'] = array('in', $uidArr); $map1['group_id'] = $groupId; $groupData = M('auth_group_access')->where($map1)->select(); foreach ($groupData as $gr) { $data[$gr['uid']] = $allUser[$gr['uid']]; } return $data; } else { if ($sendType == 1) { $openids = wp_explode($openidStr); foreach ($openids as $op) { $uid = $openidArr[$op]; if ($uid) { $data[$uid] = $op; } else { $this->error('Openid为: ' . $op . ' 的用户不存在'); } } return $data; } } } }
function get_file_title($attach_ids) { $ids = wp_explode($attach_ids); if (empty($ids)) { return ''; } $map['id'] = array('in', $ids); $names = M('file')->where($map)->getFields('name'); return implode(', ', $names); }
function reserve_success() { $map3['reserve_id'] = $map['reserve_id'] = $map2['reserve_id'] = $this->reserve_id = I('reserve_id', 0, intval); $reserve = M('reserve')->find($this->reserve_id); $reserve['cover'] = !empty($reserve['cover']) ? get_cover_url($reserve['cover']) : ADDON_PUBLIC_PATH . '/background.png'; $reserve['intro'] = str_replace(chr(10), '<br/>', $reserve['intro']); $map2['token'] = $map3['token'] = get_token(); // 获取参与人数 $attend = M('reserve_option')->where($map)->sum('join_count'); $map3['uid'] = $this->mid; $valueArr = M('reserve_value')->where($map3)->field('id,value,is_pay')->find(); $value_data = unserialize($valueArr['value']); $value_data['id'] = $valueArr['id']; // $map ['token'] = get_token (); $fields = M('reserve_attribute')->where($map2)->order('sort asc, id asc')->select(); foreach ($fields as &$fd) { $fd['name'] = 'field_' . $fd['id']; if ($fd['extra']) { $extArr = wp_explode($fd['extra'], ' '); $value_data[$fd['name']] = $extArr[$value_data[$fd['name']]]; } } $option = M('reserve_option')->where(array('id' => $value_data['option_id']))->field('name,money')->find(); $value_data['option_id'] = $option['name']; $value_data['price'] = $option['money']; $value_data['uid'] = $this->mid; // 判断是否支付 $is_pay = $valueArr['is_pay']; if ($is_pay == 0) { $map5['uid'] = $this->mid; $map5['aim_id'] = $this->reserve_id; $map5['from'] = 'reserve'; $payment = M('payment_order')->where($map5)->find(); if (empty($payment['status'])) { $is_pay = 0; } else { $is_pay = 1; $map['id'] = $value_data['id']; $save['is_pay'] = 1; $res = M('reserve_value')->where($map)->save($save); } } $this->assign('is_pay', $is_pay); $this->assign('fields', $fields); $this->assign('value_data', $value_data); $this->assign('reserve', $reserve); $this->assign('attend_num', $attend); $this->display(); }
/** * 将用户添加到用户组,入参uid,group_id * * @author 朱亚杰 <*****@*****.**> */ public function addToGroup() { $members = I('members'); $members = wp_explode($members); $map['nickname'] = array('in', $members); $uid = M('member')->where($map)->getFields('id'); if (empty($uid)) { $this->error('参数有误'); } $uid = implode(',', $uid); $gid = I('group_id'); $AuthGroup = D('AuthGroup'); if (is_numeric($uid)) { if (is_administrator($uid)) { $this->error('该用户为超级管理员'); } if (!M('Member')->where(array('uid' => $uid))->find()) { $this->error('管理员用户不存在'); } } if ($gid && !$AuthGroup->checkGroupId($gid)) { $this->error($AuthGroup->error); } if ($AuthGroup->addToGroup($uid, $gid)) { $this->success('操作成功'); } else { $this->error($AuthGroup->getError()); } }
function store_list() { $id = $param['id'] = I('id', 0, 'intval'); $maps['coupon_id'] = $id; $list = M('coupon_shop_link')->where($maps)->select(); $shop_ids = getSubByKey($list, 'shop_id'); if (!empty($shop_ids)) { $map_shop['id'] = array('in', $shop_ids); $shop_list = M('coupon_shop')->where($map_shop)->select(); foreach ($shop_list as &$s) { $gpsArr = wp_explode($s['gps']); $s['gps'] = $gpsArr[1] . ',' . $gpsArr['0']; } $this->assign('shop_list', $shop_list); } $this->display(); }
function _send_by_openid($openids) { $openids = wp_explode($openids); if (empty($openids)) { $this->error('要发送的OpenID值不能为空'); } if (count($openids) < 2) { $this->error('OpenID至少需要2个或者2个以上'); } $url = 'https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=' . get_access_token(); $info = $this->_sucai_media_info(); $param['touser'] = $openids; if ($info['msgtype'] == 'text') { $param['text']['content'] = $info['media_id']; } else { $param['mpnews']['media_id'] = $info['media_id']; } $param['msgtype'] = $info['msgtype']; $param = JSON($param); $res = post_data($url, $param); if ($res['errcode'] != 0) { $this->error(error_msg($res)); } else { return $res['msg_id']; } }