function getList($sportsId, $update = false) { $key = 'LotteryPrizeList_getList_' . $sportsId; $info = S($key); if ($info === false || $update) { $map['sports_id'] = $sportsId; $map['uid'] = session('manager_id'); if (empty($map['uid'])) { $map['uid'] = get_mid(); } $info = (array) $this->where($map)->select(); $awardDao = D('Addons://Draw/Award'); if (count($info) != 0) { foreach ($info as &$v) { $award = $awardDao->getInfo($v['award_id']); $v['awardarr'] = $award; $v['award_name'] = $award['name']; $v['award_pic'] = get_cover_url($award['img']); } } // $info['awardarr']=M('Award')->getInfo($info['sports_id']); // $info['sports']=M('Addons://Sports/Sports')->getInfo($info['sports_id']); S($key, $info, 86400); } return $info; }
function updateCount($sports_id, $follow_id, $count) { $count++; $map['sports_id'] = $sports_id; $map['follow_id'] = $follow_id; $map['uid'] = session('manager_id'); if (empty($map['uid'])) { $map['uid'] = get_mid(); } $res = $this->where($map)->setField('count', $count); if ($res) { $this->hasDraw($sports_id, $follow_id, true); } return $res; }
function showComment() { $map['id'] = I('id'); if (IS_POST) { $param['id'] = $data['loveId'] = I('loveId'); $data['content'] = I('content'); $data['cTime'] = time(); $data['token'] = get_token(); $data['openid'] = get_mid(); $res = M('love_comment')->add($data); $jump_url = addons_url('Love://Love/showComment', $param); redirect($jump_url); } $comment_map['loveId'] = I('id'); $comment_info = M('love_comment')->where($comment_map)->order('id desc')->select(); $this->assign('comment_info', $comment_info); $info = M('love')->where($map)->find(); // $this->assign('oo',I('id').'kk'); $this->assign('info', $info); $this->display(); }
function card_show() { $model = $this->getModel('wish_card'); $Model = D(parse_name(get_table_name($model['id']), 1)); if (IS_POST) { //保存贺卡 $write_info = session('write_info'); $post_data = array_merge($write_info, $_POST); $post_data['mid'] = get_mid(); $post_data['token'] = get_token(); $post_data['create_time'] = time(); if ($id = $Model->add($post_data)) { $data = $post_data; $isMake = 1; } } else { $id = I('id'); $data = $Model->find($id); $Model->where('id=' . $id)->setInc('read_count', 1); //统计浏览数加1 $isMake = 0; } if ($data) { $sendUser = get_followinfo($data['mid']); $this->assign('sendUser', $sendUser); $this->assign('data', $data); $shareUrl = addons_url('WishCard://Wap/card_show', array('id' => $id)); $makeUrl = addons_url('WishCard://Wap/card_type'); $this->assign('shareUrl', $shareUrl); $this->assign('makeUrl', $makeUrl); $this->assign('isMake', $isMake); //是否制作的 //dump($shareUrl); $template = ONETHINK_ADDON_PATH . 'WishCard/View/default/Template/' . $data['template_cate'] . '/' . $data['template'] . '/index.html'; $this->assign("assetsPath", SITE_URL . '/Addons/WishCard/View/default/Template/' . $data['template_cate'] . '/' . $data['template']); $this->display($template); } else { $this->error("没有该模板或模板保存不成功!"); } }
/** * 获取插件配置 * 获取的优先级:当前用户插件权限》当前公众号设置》后台默认配置》安装文件上的配置 */ function getList($is_admin = false) { // 当前公众号的设置 $map['token'] = get_token(); if (empty($map['token'])) { return array(); } $info = get_token_appinfo($map['token']); $token_status = json_decode($info['addon_status'], true); // 等级权限 if ($info['group_id']) { $map2['id'] = $info['group_id']; $addon_ids = M('public_group')->where($map2)->getField('addon_status'); if ($addon_ids) { $map3['id'] = array('in', $addon_ids); $addons = M('addons')->where($map3)->field('`name`')->select(); foreach ($addons as $a) { $token_status[$a['name']] = '-1'; } } } // 对当前用户的权限进行判断 if ($is_admin) { unset($map); $map['uid'] = get_mid(); $map['mp_id'] = $info['id']; $addon_ids = M('public_link')->where($map)->getField('addon_status'); if ($addon_ids) { $map3['id'] = array('in', $addon_ids); $addons = M('addons')->where($map3)->field('`name`')->select(); foreach ($addons as $a) { $token_status[$a['name']] = '-1'; } } } // dump ( $token_status ); // dump(M ( 'public' )->getLastSql());exit; return $token_status; }
$longlen = strlen($longint); echo $longint . "\n"; for ($i = $longlen - 7; $i > -7; $i -= 7) { $offset1 = $i < 0 ? 0 : $i; $sublen = $i > 0 ? 7 : $i + 7; $subint = substr($longint, $offset1, $sublen); $substr = ten2base62($subint) . $substr; } return $substr; } $num = '218340105584896'; $num = '52036560683837093888'; $num = '3226266762397899821056'; $num = 2.000285392686698E+23; $num = 620000000000000006; $num = 839299365868340227; $num = 221110410216147026; $num = 3482583008837912; // yyEmoB58Y $num = 3482583008708876; // yyEmoAxzK $num = 3482583004642731; // yyEmojtML $num = 3486096061137924; // yA7KC4M1C $num = 5612814510546515491; // eBi65u6rkYz //$num = 56800235589; //$base62 = ten2base62($num); $base62 = get_mid($num); echo $base62 . "\n";
function get_package_template() { $addons = I('addons'); /* * $dir = ONETHINK_ADDON_PATH . $addons . '/View/default/Package'; * $url = SITE_URL . '/Addons/' . $addons . '/View/default/Package'; * * $dirObj = opendir ( $dir ); * while ( $file = readdir ( $dirObj ) ) { * if ($file === '.' || $file == '..' || $file == '.svn' || is_file ( $dir . '/' . $file )) * continue; * * $res ['dirName'] = $res ['title'] = $file; * * // 获取配置文件 * if (file_exists ( $dir . '/' . $file . '/info.php' )) { * $info = require_once $dir . '/' . $file . '/info.php'; * $res = array_merge ( $res, $info ); * } * * // 获取效果图 * if (file_exists ( $dir . '/' . $file . '/info.php' )) { * $res ['icon'] = __ROOT__ . '/Addons/'.$addons.'/View/default/Package/' . $file . '/icon.png'; * } else { * $res ['icon'] = __IMG__ . '/default.png'; * } * * $tempList [] = $res; * unset ( $res ); * } * closedir ( $dir ); */ $map['uid'] = get_mid(); $map['addons'] = $addons; $Model = D('SucaiTemplate'); $tempList = $Model->where($map)->select(); // dump($tempList); if (!$tempList) { $default['addons'] = $addons; $default['template'] = 'default'; $tempList[] = $default; } else { $hasDefault = false; foreach ($tempList as $vo) { if ($vo['template'] == 'default') { $hasDefault = true; break; } } if ($hasDefault == false) { $default['addons'] = $addons; $default['template'] = 'default'; $tempList[] = $default; } } // dump($tempList); foreach ($tempList as &$vo) { $info = $this->_readSucaiTemplateInfo($vo['addons'], $vo['template']); // dump($info); $vo['title'] = $info['title']; $vo['icon'] = $info['icon']; } // dump($tempList); $this->ajaxReturn($tempList, 'JSON'); }
function getSnCount($type = '') { $count = 0; $mid = get_mid(); $list = $this->getMyAll($mid, 'ShopCoupon'); foreach ($list as $k => &$v) { $coupon = (array) D('Addons://ShopCoupon/Coupon')->getInfo($v['target_id']); if ($coupon) { $v['sn_id'] = $v['id']; $v = array_merge($v, $coupon); if ($type != '') { if ($coupon['type'] == $type) { $count++; } } else { $count++; } } else { unset($list[$k]); } } return $count; }
function _getGuessInfo($id) { // 检查ID是否合法 if (empty($id) || 0 == $id) { $this->error("错误的竞猜ID"); } // $map ['id'] = $map2 ['guess_id'] = $map3['guess_id'] = intval ( $id ); $guess_id = intval($id); $follow_id = get_mid(); // $info = M ( 'guess' )->where ( $map )->find (); $info = D('Guess')->getInfo($guess_id); $this->assign('info', $info); // dump($info); // $opts = M ( 'guess_option' )->where ( $map2 )->order ( '`order` asc' )->select (); $opts = D('GuessOption')->getGuessOption($guess_id); foreach ($opts as $p) { $total += $p['guess_count']; } foreach ($opts as &$vo) { $vo['percent'] = round($vo['guess_count'] * 100 / $total, 1); } $this->assign('opts', $opts); $this->assign('num_total', $total); // $voteInfo = M ( 'guess_log' )->where ( $map3 )->select (); $voteInfo = D('GuessLog')->getFollowLog($follow_id, $guess_id); // dump($voteInfo); // exit; if ($voteInfo) { $joinData = explode(',', $voteInfo[0]['optionids']); $this->assign('joinData', $joinData); // dump($joinData); // exit; } return $info; }
$kategorie = $url_subdir_entry; } else { $menu = explode("_", str_replace(".odt", "", $file), 3); $ebene = "/" . substr(rawurlencode($url_subdir_entry), 0, $len_max["site_menu"]["entry"]); $kategorie = ""; foreach ($menu as $key => $part) { if ($kategorie != "") { $ebene .= "/" . $kategorie; } $kategorie = substr(rawurlencode($part), 0, $len_max["site_menu"]["entry"]); $index_child = $key + 2; $var_child = "refid_" . $index_child; $index_parent = $key + 1; $var_parent = "refid_" . $index_parent; // $ausgaben["output"] .= $ebene."/".$kategorie.": ".$menu_csv[$ebene."/".$kategorie]."<br>"; ${$var_child} = get_mid($kategorie, ${$var_parent}, $menu_csv[$ebene . "/" . $kategorie]); } } // 3.1 odt auspacken $zip = new ZipArchive(); if ($zip->open($cfg["migrate"]["path"] . $subdir_entry . "/txt/" . $file) == TRUE) { $content = $zip->getFromName('content.xml'); if ($cfg["migrate"]["utf-8"] == False) { $content = utf8_decode($content); } $style = $zip->getFromName('styles.xml'); } // 3.2 ggf weitere tags aus dem odt-header holen preg_match_all("/(\\<style:style )(.*)(>)/" . $preg_mod, $content, $match); foreach ($match[0] as $key => $value) { preg_match("/style:parent-style-name=\"(.*)\"/" . $preg_mod, $value, $parent);
function get_addon_jump_url() { $addonName = I('addon_name'); $id = I('id'); $jumpType = I('jump_type'); $public_info = get_token_appinfo(); $url = ''; switch ($addonName) { case 'Shop': // 获取当前登录的用户的商城 // 获取当前登录的用户的商城 $map['token'] = get_token(); $map['manager_id'] = $this->mid; $currentShopInfo = M('shop')->where($map)->find(); $id = $currentShopInfo['id']; $url = addons_url('Shop://Wap/index', array('shop_id' => $id, 'publicid' => $public_info['id'], 'uid' => get_mid())); break; case 'Coupon': if ($jumpType == 0) { $url = addons_url('Coupon://Wap/lists', array('publicid' => $public_info['id'], 'id' => $id)); } else { $url = addons_url('Coupon://Wap/lists', array('publicid' => $public_info['id'])); } break; case 'WishCard': $url = addons_url('WishCard://Wap/card_type', array('publicid' => $public_info['id'])); break; case 'CardVouchers': $url = addons_url('CardVouchers://Wap/index', array('publicid' => $public_info['id'], 'id' => $id)); break; case 'RedBag': $url = addons_url('RedBag://Wap/index', array('publicid' => $public_info['id'], 'id' => $id)); break; case 'Invite': $url = addons_url('Invite://Wap/index', array('publicid' => $public_info['id'], 'id' => $id)); break; default: $param_name = 'id'; if (!$url) { $param['publicid'] = $public_info['id']; $param[$param_name] = $id; $url = addons_url("{$addonName}://{$addonName}/index", $param); } break; } echo $url; }
function _replyData($uid, $param, $msg_type) { $map['token'] = get_token(); $map['uid'] = $uid; $param['touser'] = M('public_follow')->where($map)->getField('openid'); $param['msgtype'] = $msg_type; $url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' . get_access_token(); // dump($param); // die; $result['status'] = 0; $result['msg'] = '回复失败'; $res = post_data($url, $param); if ($res['errcode'] != 0) { $result['msg'] = error_msg($res); } else { $data['ToUserName'] = get_token(); $data['FromUserName'] = $param['touser']; $data['CreateTime'] = NOW_TIME; $data['Content'] = isset($param['text']['content']) ? $param['text']['content'] : json_encode($param); $data['MsgId'] = get_mid(); // 该字段保存管理员ID $data['type'] = 1; $data['is_read'] = 1; M('weixin_message')->add($data); $result['status'] = 1; $result['msg'] = '回复成功'; } return $result; }
public function my() { // 输出用户基本信息 $followInfo = M('follow')->where(array('token' => get_token(), 'openid' => get_openid()))->find(); //var_dump($followInfo); if (!$followInfo['headimgurl']) { $followInfo['headimgurl'] = 'http://idouly.com/wechat/Uploads/Headimgs/oOWE4tzFL9UjMBTiV2Wgmbaon390/1436673771.png'; } if (!$followInfo['nickname']) { $followInfo['nickname'] = '未填写昵称'; } $followInfo['uid'] = get_mid(); $this->assign('followInfo', $followInfo); // 输出用户积分记录 $creditData = M('credit_data')->where(array('token' => get_token(), 'uid' => get_mid()))->select(); foreach ($creditData as $k => &$v) { $v['title'] = M('credit_config')->where(array('name' => $v['credit_name']))->getField('title'); } $this->assign('creditData', $creditData); $this->display('userCenter'); }
function getLzwgUserAllPrizeData($follow_id, $update = false) { $key = 'LuckyFollow_getLzwgUserAllPrizeData_' . $follow_id; $info = S($key); if ($info === false || $update) { $map['follow_id'] = $follow_id; $map['uid'] = session('manager_id'); if (empty($map['uid'])) { $map['uid'] = get_mid(); } $info = M('lucky_follow')->where($map)->field('award_id,state,zjtime')->order('zjtime desc')->select(); $awardDao = D('Addons://Draw/Award'); foreach ($info as &$i) { $award = $awardDao->getInfo($i['award_id']); $i = array_merge($i, $award); } } S($key, $info, 86400); return $info; }
public function add() { $this->assign('normal_tips', '请不设置相同的关键词,相同的关键词只回复最新的设置'); $replyInfo = M('auto_reply')->where(array('id' => I('id')))->find(); $this->assign('data', $replyInfo); $model = $this->getModel('AutoReply'); if (IS_POST) { if ($_POST['reply_scene'] == 2 && $_POST['keyword'] == '') { $this->error('请填写关键词'); } // dump($_POST);die; if (I('video_id')) { $data['msg_type'] = 'video'; } if (I('voice_id')) { $data['msg_type'] = 'voice'; } if (I('image_material') || I('image')) { $data['msg_type'] = 'image'; } if (I('appmsg_id')) { $data['msg_type'] = 'news'; } if (I('content')) { $data['msg_type'] = 'text'; } $data['keyword'] = I('keyword'); $data['reply_scene'] = I('reply_scene'); $data['content'] = I('content'); $data['group_id'] = intval(I('appmsg_id')); $data['image_id'] = intval(I('image')); $data['voice_id'] = intval(I('voice_id')); $data['video_id'] = intval(I('video_id')); $data['manage_id'] = intval(get_mid()); $data['token'] = get_token(); $data['image_material'] = intval(I('image_material')); // dump($data);die; $Model = D(parse_name(get_table_name($model['id']), 1)); // 获取模型的字段信息 if ($_POST['reply_scene'] == 2) { $Model = $this->checkAttr($Model, $model['id']); } if ($Model->create()) { if (I('reply_scene') == 0) { $url = U('subscribe'); } elseif (I('reply_scene') == 1) { $url = U('message'); } else { $url = U('lists'); } if (I('id')) { // 更新 $result = M('auto_reply')->where(array('id' => I('id')))->save($data); if ($result || $result === 0) { $this->success('更新' . $model['title'] . '成功!', $url); } } else { // 新增 $id = $Model->add($data); $this->_saveKeyword($model, $id); $this->success('添加' . $model['title'] . '成功!', $url); } } else { $this->error($Model->getError()); } } else { $fields = get_model_attribute($model['id']); $fields = $this->_deal_fields($fields, $type); $this->assign('fields', $fields); $postUrl = U('add', array('model' => $model['id'])); $this->assign('post_url', $postUrl); $this->assign('reply_scene', 2); // 回复场景:关键词回复 $this->display('reply'); } }
function save_address($prizeid) { $uid = get_mid(); $data = D('Addons://RealPrize/RealPrize')->getInfo($prizeid); // $num = M ( 'prize_address' )->where ( "uid = $uid and prizeid = $prizeid" )->find (); $num = D('PrizeAddress')->getAddressInfo($uid, $prizeid); $this->assign("data", $data); // 判断是否领取 if (!empty($num)) { $res['result'] = "fail"; $res['msg'] = "您已经领取该奖品了,请不要重复领取"; $this->assign("res", $res); $this->display('result'); exit; } else { $data = D('Addons://RealPrize/RealPrize')->getInfo($prizeid); if ($data['prize_count'] > 0) { $model = $this->getModel('prize_address'); // 实体奖品保存收货地址 if (IS_POST) { $Model = D(parse_name(get_table_name($model['id']), 1)); // dump($model);die(); // 获取模型的字段信息 $Model = $this->checkAttr($Model, $model['id']); if ($Model->create() && ($id = $Model->add())) { // 清空缓存 method_exists($Model, 'clear') && $Model->clear($id, 'add'); D('PrizeAddress')->getAddressInfo($uid, $prizeid, true); // 减1 // M ( 'prize_address' )->where ( "prizeid = $prizeid" )->setDec ( 'prize_count' ); D('RealPrize')->updatePrizeCount($prizeid); // 结果 $res['result'] = "success"; $res['msg'] = "恭喜你,领取成功!"; $this->assign("res", $res); $this->assign('address', $_POST); $this->display('result'); exit; } } else { // 虚拟奖品保存uid // $data ['address'] = ''; // $data ['city'] = ''; // $data ['mobile'] = ''; // $data ['uid'] = $uid; // $data ['remark'] = ''; // $data ['prizeid'] = $prizeid; // $result = M ( 'prize_address' )->add ( $data ); // D('PrizeAddress')->getAddressInfo($uid,$prizeid,true); // 减1 // M ( 'prize_address' )->where ( "prizeid = $prizeid" )->setDec ( 'prize_count' ); D('RealPrize')->updatePrizeCount($prizeid); // 结果 $res['result'] = "success"; $res['msg'] = "恭喜你,领取成功!"; $this->assign("res", $res); $this->display('result'); exit; } } else { $res['result'] = "fail"; $res['msg'] = "抱歉手太慢,奖品被领取完了"; $this->assign("res", $res); $this->display('result'); exit; } } // $this->display (); }
function addon_condition_check($addon_condition) { preg_match_all("/\\[([\\s\\S]*):([\\*,\\d]*)\\]/i", $addon_condition, $match); if (empty($match[1][0]) || empty($match[2][0])) { return true; } $conditon['token'] = get_token(); $conditon['uid'] = get_mid(); switch ($match[1][0]) { case '投票': $match[2][0] != '*' && $match[2][0] > 0 && ($conditon['vote_id'] = $match[2][0]); $conditon['user_id'] = get_mid(); unset($conditon['uid']); $res = M('vote_log')->where($conditon)->find(); break; case '通用表单': $match[2][0] != '*' && $match[2][0] > 0 && ($conditon['forms_id'] = $match[2][0]); $res = M('forms_value')->where($conditon)->find(); break; case '微考试': $match[2][0] != '*' && $match[2][0] > 0 && ($conditon['exam_id'] = $match[2][0]); $res = M('exam_answer')->where($conditon)->find(); break; case '微测试': $match[2][0] != '*' && $match[2][0] > 0 && ($conditon['test_id'] = $match[2][0]); $res = M('test_answer')->where($conditon)->find(); break; case '微调研': $match[2][0] != '*' && $match[2][0] > 0 && ($conditon['survey_id'] = $match[2][0]); $res = M('survey_answer')->where($conditon)->find(); break; default: $match[2][0] != '*' && $match[2][0] > 0 && ($conditon['id'] = $match[2][0]); $res = M($match[1][0])->where($conditon)->find(); } // dump ( $res ); // dump ( M ()->getLastSql () ); return !empty($res); }
public function suggest() { $config = getAddonConfig('Suggestions'); if (IS_AJAX) { // 保存用户信息 $nickname = I('nickname'); if ($config['need_nickname'] && !empty($nickname)) { $data['nickname'] = $nickname; } $mobile = I('mobile'); if ($config['need_mobile'] && !empty($mobile)) { $data['mobile'] = $mobile; } // 保存内容 $data['cTime'] = time(); $data['content'] = I('content'); $data['token'] = get_token(); $res = M('suggestions')->add($data); if ($res) { // 增加积分 add_credit('suggestions'); $data['status'] = 1; $data['info'] = '反馈成功,感谢您的支持~'; //$this->success ( '增加成功,谢谢您的反馈' ); $openid = getOpenidByUid($config['admin_id']); $kf_data['touser'] = $openid; $kf_data['msgtype'] = 'text'; $kf_data['text']['content'] = "新的反馈内容:" . $data['content']; //replyText(json_encode($kf_data)); sendCustomMessage($kf_data); } else { $data['status'] = 0; $data['info'] = '反馈失败,请重新提交反馈内容~'; //$this->error ( '增加失败,请稍后再试' ); } $this->ajaxReturn($data); } else { $this->assign($config); // dump ( $config ); $user = getUserInfo(get_mid()); $this->assign('user', $user); $this->display(); } }