/** * 登陆,如果失败,返回失败原因(用户名或者密码不正确),如果成功,返回用户信息, * 附带返回系统服务器时间戳 */ public function login() { //查user表 $User = M('User'); check_error($User); $user = $User->field(array('id' => 'userId', 'username' => 'userName', 'name', 'role_id' => 'roleId', 'role'))->where(array('username' => safe_post_param('username'), '_string' => "`password`=MD5('" . safe_post_param('password') . "')"))->find(); if (!empty($user)) { //根据权限查菜单 $Menu = M('Menu'); check_error($Menu); $menu = $Menu->join('`role_privilege` on `menu`.`id`=`role_privilege`.`menu_id`')->join('`user` on `user`.`role_id`=`role_privilege`.`role_id`')->field(array('`menu`.`id`', 'level', 'label', 'icon', 'widget', 'show', 'big_icon'))->where("`user`.`id`='" . $user['userId'] . "'")->order('`level` ASC')->select(); check_error($Menu); //保存session session('logined', true); session('user', $user); session('menu', $menu); //设置返回数据 $data = array(); $data['serverTime'] = time(); $data['user'] = $user; $data['menu'] = $menu; //保存日志 R('Log/adduserlog', array('登录', '登录成功', '成功')); //返回结果:用户数据+服务器时间 return_value_json(true, 'data', $data); } else { //保存日志 R('Log/adduserlog', array('登录', '登录失败:用户名或者密码不正确', '失败:权限不够', '用户名:' . safe_post_param('username'))); return_value_json(false, 'msg', '用户名或者密码不正确'); } }
/** * 用户去向 add */ public function add($user_id = NULL, $shop_id = NULL) { if (IS_POST) { /* 定义变量 */ $model = D(CONTROLLER_NAME); $result = $model->do_add(); /* 返回信息 */ if ($result) { /* 关注的人收到通知 */ // 获取关注你的人 $where_attention['user_attention.to_user_id'] = array('EQ', $user_id); $where_attention['user.push_id'] = array('NEQ', ''); $where_attention['user.status'] = array('EQ', 1); $where_attention['user.display'] = array('EQ', 1); $where_attention['user.trace_notify'] = array('EQ', 1); $attention_user_id = M('UserAttention')->alias('user_attention')->field('user.push_id')->where($where_attention)->join('__USER__ user on user_attention.user_id = user.id')->select(); if ($attention_user_id) { // 获取去向资料 $data_shop_user_went = get_shop_user_went($user_id, $shop_id); if ($data_shop_user_went) { foreach ($attention_user_id as $k => $v) { $push_id[] = $v['push_id']; } $push_id = array_filter(array_unique(array_slice($push_id, 0, 1000))); $this->push_one($push_id, $data_shop_user_went); } } $this->ajaxReturn(array('RESPONSE_STATUS' => 100, 'Tips' => L('YZ_return_success'))); } else { $this->return_post($model); } } $this->ajaxReturn(array('RESPONSE_STATUS' => 500, 'Tips' => L('YZ_return_failure'))); }
public function _initialize() { parent::_initialize(); $this->reply_info_model=M('reply_info'); $this->token=session('token'); $this->assign('token',$this->token); // $this->infoTypes=array( 'Groupon'=>array('type'=>'Groupon','name'=>'团购','keyword'=>'团购','url'=>U('Wap/Groupon/grouponIndex',array('token'=>$this->token))), 'Dining'=>array('type'=>'Dining','name'=>'订餐','keyword'=>'订餐','url'=>U('Wap/Dining/index',array('token'=>$this->token))), 'Zuche'=>array('type'=>'Zuche','name'=>'租车','keyword'=>'租车','url'=>U('Wap/Zuche/index',array('token'=>$this->token))), 'Shop'=>array('type'=>'Shop','name'=>'商城','keyword'=>'商城','url'=>U('Wap/Product/index',array('token'=>$this->token))), 'panorama'=>array('type'=>'panorama','name'=>'全景','keyword'=>'全景','url'=>U('Wap/Panorama/index',array('token'=>$this->token))), 'Liuyan'=>array('type'=>'Liuyan','name'=>'留言','keyword'=>'留言','url'=>U('Wap/Liuyan/index',array('token'=>$this->token))), 'Scoregift'=>array('type'=>'Scoregift','name'=>'积分换礼','keyword'=>'积分换礼','url'=>U('Wap/Scoregift/index',array('token'=>$this->token))), ); //是否是餐饮 if (isset($_GET['infotype'])&&$_GET['infotype']=='Dining'){ $this->isDining=1; }else { $this->isDining=0; } //是否是租车 if (isset($_GET['infotype'])&&$_GET['infotype']=='Zuche'){ $this->iszuche=1; $this->assign('iszuche',$this->iszuche); } $this->assign('isDining',$this->isDining); }
public function index() { $data = I('post.'); if (!empty($data['username']) && !empty($data['password']) && !empty($data['verify'])) { if ($this->Verify->check($data['verify'])) { $user = M('user'); $userdata = $user->where("username='******' and state=0", $data['username'])->find(); if ($userdata && $userdata['password'] === md5(C('SECURE_CODE') . md5($data['password']))) { unset($userdata['password']); $userdata['ip'] = get_client_ip(); $user->where('id=' . $userdata['id'])->save(array('logintime' => time())); $user_auth = json_encode($userdata); $user_auth_cookie = authcode($user_auth, ENCODE); cookie('auth', $user_auth_cookie, 3600); $this->success('登陆成功', U('index/index')); exit; } else { $this->error("用户名或密码错误"); } } else { $this->error("验证码填写错误"); } } $this->display(); }
public function co_star_edit() { if ($_POST['submit'] and $_POST['index'] != "") { $Stars = M('Co_stars'); $index = $_POST['index']; $star = $Stars->where('photo_index=' . $index)->find(); if ($_POST['title'] != "") { $data['photo_title'] = $_POST['title']; } $tmp_name = $_FILES['upfile']['tmp_name']; $file = $_FILES["upfile"]; //上傳文件名稱 //C('__PUBLIC__')爲 /Quanquan/Public move_uploaded_file($tmp_name, 'Public/WebResources/co_star/' . $file['name']); //將上傳文件移動到指定目錄待解壓 if ($file['name']) { unlink($star['photo_url']); $data['photo_url'] = C('__PUBLIC__') . '/WebResources/co_star/' . $file['name']; } if ($Stars->where('photo_index=' . $index)->save($data)) { echo '修改成功'; } else { echo $star['photo_url']; } } else { echo '未輸入數據'; } $this->display(); }
public function __construct() { parent::_initialize(); $this->token = $this->_get('token'); $this->wecha_id = $this->wecha_id; if (!$this->token) { $product_cart_model = M('product_cart'); $out_trade_no = $this->_get('out_trade_no'); $order = $product_cart_model->where(array('orderid' => $out_trade_no))->find(); if (!$order) { $order = $product_cart_model->where(array('id' => intval($this->_get('out_trade_no'))))->find(); } $this->token = $order['token']; } $payConfig = M('Alipay_config')->where(array('token' => $this->token))->find(); $payConfigInfo = unserialize($payConfig['info']); $this->payConfig = $payConfigInfo['weixin']; if (ACTION_NAME == 'pay' || ACTION_NAME == 'new_pay') { if (empty($this->payConfig['is_old'])) { $this->new_pay(); exit; } else { $this->pay(); exit; } } }
public function index() { if (empty($_SESSION['aid'])) { $this->redirect('Login/login'); } $news = M('news'); $info = array('PCTYPE' => PHP_OS, 'RUNTYPE' => $_SERVER["SERVER_SOFTWARE"], 'ONLOAD' => ini_get('upload_max_filesize'), 'ThinkPHPTYE' => THINK_VERSION); $start = strtotime(date('Y-m-01 00:00:00')); $end = strtotime(date('Y-m-d H:i:s')); $data['news_time'] = array('between', array($start, $end)); $news_list = $news->where($data)->order('news_hits desc')->limit(0, 8)->select(); //热门文章排行 $news_count = $news->count(); //总文章数 $this->assign('news_count', $news_count); $today = strtotime(date('Y-m-d 00:00:00')); //今天开始日期 $todata['news_time'] = array('egt', $today); $tonews_count = $news->where($todata)->count(); //今日发表文章数 $this->assign('tonews_count', $tonews_count); $ztday = strtotime(date('Y-m-d 00:00:00')) - 60 * 60 * 24; //昨天开始日期 $ztdata['news_time'] = array('between', array($ztday, $today)); $ztnews_count = $news->where($ztdata)->count(); //总文章数 $this->assign('ztnews_count', $ztnews_count); $difday = ($tonews_count - $ztnews_count) / $ztnews_count * 100; //今日与昨日的差 $this->assign('difday', $difday); $this->assign('info', $info); $this->assign('news_list', $news_list); $this->display(); }
public function __construct($token, $wechat_id, $data, $siteUrl) { $this->item = M('bargain')->where(array('tp_id' => $data['pid']))->find(); $this->wechat_id = $wechat_id; $this->siteUrl = $siteUrl; $this->token = $token; }
public function login($username = null, $password = null, $verify = null) { if (IS_POST) { $db = M('user'); $map['name'] = $username; $map['password'] = md5($password); $userInfo = $db->where($map)->find(); if (!$userInfo) { $this->error('帐号不存在或被禁用'); } $_SESSION['userid'] = $userInfo['id']; $_SESSION['username'] = $userInfo['name']; $_SESSION['truename'] = $userInfo['name']; $_SESSION['usertype'] = $userInfo['usertype']; $_SESSION['studentid'] = $userInfo['studentid']; $this->success('登录成功!', U('Index/index')); return; } else { if (is_login()) { $this->display('Project/projectList'); return; } else { $this->display('User/login'); } } }
public function index() { if (!session('openid_' . $this->token)) { $this->info = M('wxuser')->where(array('token' => $this->token))->find(); vendor("Oauth2.OAuth2", LIB_PATH . '../Extend/Vendor'); vendor("Oauth2.Provider.Wechat", LIB_PATH . '../Extend/Vendor'); $wechat = new Wechat(); $wechat->config(array('id' => $this->info['appid'], 'secret' => $this->info['appsecret'])); $redirect_uri = C('site_url') . '/index.php/Wap/Coupons/index?token=' . $this->token . '&coupon_id=' . $this->coupon_id; if (!$_GET['code']) { // By sending no options it'll come back here $url = $wechat->authorize(array('redirect_uri' => $redirect_uri)); redirect($url); } else { try { // Have a go at creating an access token from the code $token = $wechat->access($_GET['code'], array('redirect_uri' => $redirect_uri)); // Use this object to try and get some user details (username, full name, etc) $user = $wechat->get_user_info($token); $this->openid = $user->openid; session('openid_' . $this->token, $user->openid); } catch (OAuth2_Exception $e) { print_r($e); die; } } } else { $this->openid = session('openid_' . $this->token); } $url = C('site_url') . "/index.php?g=Wap&m=Coupon&a=index&type=1&token=" . $this->token . '&id=' . $this->coupon_id . '&wecha_id=' . $this->openid; header('Location:' . $url); }
function index(){ if (!$this->sub){ return array( 'name'=>'微排号', 'subkeywords'=>1, 'sublinks'=>1, ); }else { $db = M('numqueue_action'); $where =array('token'=>$this->token); $items = $db->where($where)->order('id DESC')->select(); $arr=array( 'name'=>'微排号', 'subkeywords'=>array( ), 'sublinks'=>array( ), ); if ($items){ foreach ($items as $v){ $arr['subkeywords'][$v['id']]=array('name'=>$v['reply_title'],'keyword'=>$v['reply_keyword']); $arr['sublinks'][$v['id']]=array('name'=>$v['reply_title'],'link'=>'{siteUrl}/index.php?g=Wap&m=Numqueue&a=index&token='.$this->token.'&wecha_id={wechat_id}&id='.$v['id']); } } return $arr; } }
/** +---------------------------------------------------------- * 默认排序操作 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @return void +---------------------------------------------------------- */ public function sort() { $node = M('HomeNode'); if (!empty($_GET['sortId'])) { $map = array(); $map['status'] = 1; $map['id'] = array('in', $_GET['sortId']); $sortList = $node->where($map)->order('sort asc')->select(); } else { if (!empty($_GET['pid'])) { $pid = $_GET['pid']; } else { $pid = $_SESSION['currentNodeId']; } if ($node->getById($pid)) { $level = $node->level + 1; } else { $level = 1; } $this->assign('level', $level); $sortList = $node->where('status=1 and pid=' . $pid . ' and level=' . $level)->order('sort asc')->select(); } $this->assign("sortList", $sortList); $this->display(); return; }
public function index() { header("content-type:text/html;charset=utf-8"); // if($_SESSION['phone']){ // $Model // $where['phone'] = $_SESSION['phone']; // $this -> redirect('Act/index?phone='.$_SESSION['phone']); // exit; // } if (!empty($_POST)) { $user_model = M('user'); // $where['name'] = $_POST['admin']; $where['phone'] = $_POST['phone']; $res = $user_model->where($where)->find(); if ($res) { //echo $_SESSION['userId'];exit; $_SESSION['userId'] = $res['id']; //echo $_SESSION['userId1'];exit; if ($_SESSION['userId1'] != "") { $aaa = $_SESSION['userId1']; unset($_SESSION['userId1']); echo "<script type='text/javascript'>alert('登录成功');location='/index.php/Act/index1/id/1/userId/" . $aaa . "';</script>"; //$this -> success('登录成功','__APP__/Act/index1/id/1/userId/'.$aaa); } else { echo "<script type='text/javascript'>alert('登录成功');location='/index.php/Act/actlist';</script>"; //$this -> success('登录成功','__APP__/Act/actlist'); } exit; } else { echo "<script type='text/javascript'>alert('用户不存在!');location='/index.php/Login';</script>"; //$this -> error('用户不存在!'); } } $this->display(); }
public function index() { $jobtitle = M('jobtitle'); $list = $jobtitle->find('1'); $this->assign('list', $list); $this->display(); }
public function index() { $sysinfo = M('sys')->order('id asc')->find(); $this->assign('sys', $sysinfo); $appid = $sysinfo['web_appid']; $appsecret = $sysinfo['web_appsecret']; if (!defined('VIRIFY')) { virifylocal(); } $_scene = M('scene'); $where['scenecode_varchar'] = I('get.id', 0); $where['delete_int'] = 0; $_scene_list = $_scene->where($where)->select(); // print_r($_scene_list); exit('dddd'); $sysinfo = M('sys')->order('id asc')->find(); if ($sysinfo['is_user_anli_shenghe'] && !isset($_GET['preview'])) { if ($_scene_list[0]["shenhe"] != 1) { $this->error('抱歉,您的场景还没通过管理员审核', '/#/main'); } } $argu2 = array(); $argu2['title'] = $_scene_list[0]["scenename_varchar"]; $argu2['url'] = C('IS_OPEN_STATIC') ? 'v-' . $_scene_list[0]["scenecode_varchar"] : 'index.php?c=view&id=' . $_scene_list[0]["scenecode_varchar"]; $argu2['desc'] = $_scene_list[0]["desc_varchar"]; $argu2['imgsrc'] = $_scene_list[0]["thumbnail_varchar"]; $this->assign("confinfo2", $argu2); $mydd = get_client_ip(); if ($mydd !== '127.0.0.1') { $confinfo = $this->get_js_sdk($appid, $appsecret); } $this->assign("confinfo", $confinfo); $this->display(HTML_VESION); }
protected function _send_to_active() { $option = M('Options')->where(array('option_name' => 'member_email_active'))->find(); if (!$option) { $this->error('网站未配置账号激活信息,请联系网站管理员'); } $options = json_decode($option['option_value'], true); //邮件标题 $title = $options['title']; $uid = $_SESSION['user']['id']; $username = $_SESSION['user']['user_login']; $activekey = md5($uid . time() . uniqid()); $users_model = M("Users"); $result = $users_model->where(array("id" => $uid))->save(array("user_activation_key" => $activekey)); if (!$result) { $this->error('激活码生成失败!'); } //生成激活链接 $url = U('user/register/active', array("hash" => $activekey), "", true); //邮件内容 $template = $options['template']; $content = str_replace(array('http://#link#', '#username#'), array($url, $username), $template); $send_result = sp_send_email($_SESSION['user']['user_email'], $title, $content); if ($send_result['error']) { $this->error('激活邮件发送失败!'); } }
/** * 添加定制 * * @param int $user_id * 用户ID * @param string $name * 定制名称 * @param string $goods_list * 商品列表 * @return array */ public function addCustom($user_id, $name, $goods_list) { if ($this->where(array('user_id' => $user_id, 'name' => $name, 'is_delete' => 0))->count()) { return array('status' => 0, 'result' => '定制名称不能重复'); } $now = time(); // 开启事务 $this->startTrans(); if ($this->add(array('user_id' => $user_id, 'name' => $name, 'create_time' => $now))) { $custom_id = $this->getLastInsID(); $goods_list = ob2ar(json_decode($goods_list)); $dataList = array(); foreach ($goods_list as $v) { $dataList[] = array('custom_id' => $custom_id, 'goods_id' => $v['goods_id'], 'quantity' => $v['quantity'], 'add_time' => $now); } if (M('CustomGoods')->addAll($dataList)) { // 添加成功,提交事务 $this->commit(); return array('status' => 1, 'result' => '添加成功'); } else { // 添加失败,回滚事务 $this->rollback(); return array('status' => 0, 'result' => '添加失败'); } } else { // 添加失败,回滚事务 $this->rollback(); return array('status' => 0, 'result' => '添加失败'); } }
/** * 获取某个节点权限的用户组 * * @param unknown_type $node 节点 * @return unknown $gid 用户组ID */ public function getGidByNode($node) { if (($cache = F('Cache_Node')) === false) { $prefix = C('DB_PREFIX'); $sql = "select a.*,b.user_group_id from {$prefix}node a left join {$prefix}user_group_popedom b on a.node_id = b.node_id"; $cache = M('')->query($sql); F('Cache_Node', $cache); } $gid = array(); foreach ($cache as $v) { if (empty($v['user_group_id'])) { continue; } if ($v['app_name'] == $node[0]) { if ($v['mod_name'] == '*') { $gid[] = $v['user_group_id']; continue; } if ($v['mod_name'] == $node[1]) { if ($v['act_name'] == $node[2] || $v['act_name'] == '*') { $gid[] = $v['user_group_id']; } } } } return $gid; }
public function edit() { if (IS_POST) { //dump($_POST);die; unset($_POST['banner'][0]); $_POST['banner'] = json_encode($_POST['banner']); $res = D('Shop')->save_item($_POST); if (!$res['status']) { $this->error('对不起,编辑失败!'); } else { $this->success('恭喜你,编辑成功!', 'shoplist'); } } else { //载入分类 $this->assign('catelist', D('GoodsCate')->get_cate_list(0)); $res = D('Shop')->getRow($_GET['id']); $addr = M('Addr')->where(array('path' => "0"))->select(); //dd($addr); //dump($_GET["cate_id"]); $this->assign('addr', $addr); $this->assign('aid', I('get.cate_id')); $res['banner'] = json_decode($res['banner'], true); $this->assign('page', $res); //图片库提取 $where['status'] = 1; $piclist = M('Picture')->where($where)->field(true)->order('id desc')->limit('0,16')->select(); $this->assign('piclist', $piclist); $this->display(); } }
public function edit() { $id = $this->_get('id', 'intval'); $info = M('Jianshensub')->find($id); $this->assign('info', $info); $this->display(); }
function _after_update($data, $options) { $pid = $data['id']; $data_detail['pid'] = $pid; $subject = array_filter(I('subject')); $model_detail = M("DailyReportDetail"); $model_detail->where($data_detail)->delete(); foreach ($subject as $key => $val) { $data_detail['type'] = 1; $data_detail['subject'] = $val; $data_detail['item'] = implode("|||", I("item_{$key}")); $data_detail['start_time'] = implode("|||", I("start_time_{$key}")); $data_detail['end_time'] = implode("|||", I("end_time_{$key}")); $data_detail['status'] = implode("|||", I("status")); $model_detail->add($data_detail); } $plan_subject = array_filter(I('plan_subject')); $plan_item = I('plan_item'); $plan_start_time = I('plan_start_time'); $plan_end_time = I('plan_end_time'); $plan_priority = I('plan_priority'); $is_need_help = I('is_need_help'); foreach ($plan_subject as $key => $val) { $data_detail['type'] = 2; $data_detail['subject'] = $val; $data_detail['item'] = $plan_item[$key]; $data_detail['start_time'] = $plan_start_time[$key]; $data_detail['end_time'] = $plan_end_time[$key]; $data_detail['priority'] = $plan_priority[$key]; $data_detail['is_need_help'] = $is_need_help[$key]; $model_detail->add($data_detail); } $plan_subject = $data['plan_subject']; }
public function index() { $id = I('id', '', 'htmlspecialchars'); $my_id = session('user_id'); // 只能通过get id才能访问 if (empty($id)) { $this->error('页面不存在!', '/index'); die; } $atten = M()->query("select count(*) from dm_items_support where user_id = {$id} and attention=1"); //关注的人数 $frien = M()->query("select count(*) from dm_person_friends where user_id = {$id} "); //好友数 $topic = M()->query("select count(*) from dm_community_comments_first where user_id = {$id} "); //帖子数 $userinfo = M()->query("select * from dm_user_info where id = {$id}"); if (empty($userinfo[0])) { $this->error('不存在该用户', '/index'); die; } $usernews = M()->query("select * from dm_community_comments_first where user_id = {$id}"); foreach ($usernews as $key => $value) { $usernews[$key]['time'] = date('n\\月j\\日 G:i', $value['time']); } $this->assign('atten', $atten); $this->assign('frien', $frien); $this->assign('topic', $topic); $this->assign('add_id', $id); // $this->assign('my_id',$id); $this->assign('userinfo', $userinfo); $this->assign('usernews', $usernews); $this->display(); }
/** * @desc 添加/发布数据 */ function imgadd() { $plist = M('column')->select(); $this->assign('plist', $plist); $this->assign("imgid", $_GET["imgid"]); $this->display('imgadd'); }
public function lists($model = null, $page = 0, $templateFile = '', $order = 'id desc') { $isAjax = I('isAjax'); $isRadio = I('isRadio'); // 获取模型信息 is_array($model) || ($model = $this->getModel($model)); $list_data = $this->_get_model_list($model, $page, $order); if (!empty($list_data['list_data'])) { $coupon_ids = array_unique(getSubByKey($list_data['list_data'], 'coupon_id')); $map['id'] = array('in', $coupon_ids); $list = M('coupon')->where($map)->field('id,title')->select(); $couponArr = makeKeyVal($list); foreach ($list_data['list_data'] as &$v) { $v['coupon_name'] = $couponArr[$v['coupon_id']]; } } if ($isAjax) { $this->assign('isRadio', $isRadio); $this->assign($list_data); $this->display('ajax_lists_data'); } else { $this->assign($list_data); $templateFile || ($templateFile = $model['template_list'] ? $model['template_list'] : ''); $this->display($templateFile); } }
public function task() { $loginService = D('Login', 'Service')->getuserInfo(); //user $staffUser = M('ScheduleStaff'); $attr = getdaykey(NOW_TIME); $staffname = $staffUser->where('area = "%s" and status = 1 and %s =1', $loginService['area'], $attr)->select(); $staffRegister = M('StaffRegister'); $staffreg = $staffRegister->where('time = "%s" and area = "%s"', date('Y-m-d', NOW_TIME), $loginService['area'])->select(); $reg_leave = count($staffname) - count($staffreg); $this->assign('reg_sum', $reg_leave); $reg_percent = round((1 - $reg_leave / count($staffname)) * 100); $this->assign('reg_percent', $reg_percent); $this->assign('reg_color', getpercentcolor($reg_percent)); $this->assign('reg_all', count($staffname)); $staffVacation = D('StaffVacationUserView'); $staffvac = $staffVacation->where('status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('vac_sum', count($staffvac)); $staffDimission = D('DimissionUserView'); $staffdim = $staffDimission->where('status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('dim_sum', count($staffdim)); $homeApply = D('ApplyView'); $homeapp = $homeApply->where('a_status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('app_sum', count($homeapp)); $this->assign('task_sum', $reg_leave + count($staffvac) + count($staffdim) + count($homeapp)); $this->display('QuickInfo:task'); }
function index() { $db = M('Micrstore_reply'); $where = array('token' => $this->token); $items = $db->where($where)->find(); return array('name' => '微店', 'subkeywords' => 0, 'sublinks' => 0, 'link' => '{siteUrl}/index.php?g=Wap&m=Micrstore&a=api&store_id=' . $items['sid'] . '&token=' . $this->token . '&wecha_id={wechat_id}', 'keyword' => $items['keyword']); }
public function foreverdelete() { //彻底删除指定记录 $ajax = intval($_REQUEST['ajax']); $id = $_REQUEST['id']; $ecv_type_id = 0; if (isset($id)) { $condition = array('id' => array('in', explode(',', $id))); $rel_data = M(MODULE_NAME)->where($condition)->findAll(); foreach ($rel_data as $data) { $info[] = $data['sn']; $ecv_type_id = $data['ecv_type_id']; } if ($info) { $info = implode(",", $info); } $list = M(MODULE_NAME)->where($condition)->delete(); if ($list !== false) { M("EcvType")->where("id=" . $ecv_type_id)->setField("gen_count", M("Ecv")->where("ecv_type_id=" . $ecv_type_id)->count()); save_log($info . l("FOREVER_DELETE_SUCCESS"), 1); $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax); } else { save_log($info . l("FOREVER_DELETE_FAILED"), 0); $this->error(l("FOREVER_DELETE_FAILED"), $ajax); } } else { $this->error(l("INVALID_OPERATION"), $ajax); } }
public function run(&$parms) { //安装时不执行 if (defined('BIND_MODULE') && BIND_MODULE === 'Install') { return; } $data = S('global_hooks'); if (!$data) { $hooks = M('Hooks', "common_")->getField('name,addons'); foreach ($hooks as $key => $value) { if ($value) { $map['status'] = 1; $names = explode(',', $value); $map['name'] = array('IN', $names); $data = M('Addons', "common_")->where($map)->getField('id,name'); if ($data) { $addons = array_intersect($names, $data); Hook::add($key, array_map('get_addon_class', $addons)); } } } S('global_hooks', Hook::get()); } else { Hook::import($data, false); } }
public function __construct($token, $wechat_id, $data, $siteUrl) { $this->item = M('livingcircle')->where(array('pigcms_id' => $data['pid']))->find(); $this->wechat_id = $wechat_id; $this->siteUrl = $siteUrl; $this->token = $token; }
function initGuid() { global $TABLE; M('Db')->exec('DROP TABLE IF EXISTS rm_guid'); M('Db')->exec('CREATE TABLE rm_guid(id INT, type INT);'); M('Db')->exec("INSERT INTO rm_guid(id,type) VALUES (1,?)", G($TABLE)); }