/**
  * @param $param
  */
 public function send_msg_to_user($param)
 {
     if (!isset($param['appid']) || !isset($param['appsecret']) || !isset($param['text']) || !isset($param['openid'])) {
         LogRecord("发送微信消息参数错误", __FILE__ . __LINE__);
         return;
     }
     //TODO: 发送消息插件
     $config = $this->getConfig();
     $appid = $param['appid'];
     $appsecret = $param['appsecret'];
     $text = $param['text'];
     $openid = $param['openid'];
     $this->wxapi = new WeixinApi($appid, $appsecret);
     for ($i = 0; $i < $config['cnt']; $i++) {
         $this->sendMsg($openid, $text);
     }
     $entity = array('msg_title' => '', 'msg_desc' => $text, 'send_time' => time(), 'to_user' => $openid, 'from' => $appid, 'phone' => '', 'email' => '', 'status' => 1);
     $model = D('MsgSendHis');
     if ($model->create($entity)) {
         $result = $model->add();
         if ($result === false) {
             LogRecord($model->getDbError(), __FILE__ . __LINE__);
         } else {
         }
     } else {
     }
 }
 /**
  * 关键词
  * keyword     =>    _plugin_promotion
  * data        =>    array('fans'=>粉丝信息)
  * wxaccount   =>    公众号信息
  * @param $param
  */
 public function WeixinInnerProcess(&$param)
 {
     addWeixinLog($param, "插件二维码参数!");
     //固定,只处理这个关键词
     if ($param['keyword'] === "_plugin_promotion") {
     } else {
         return;
     }
     addWeixinLog("插件二维码处理", "WeixinInnerProcess");
     $data = $param['data'];
     $this->config = $this->getConfig();
     $this->config['codeprefix'] = "UID_";
     if (empty($data['fans'])) {
         LogRecord("fans参数为empty", "[PromotioncodePlugin]" . __LINE__);
         $param['result'] = array("缺失粉丝信息-二维码推广插件[调用失败]", "text");
         return;
     }
     if (empty($data['wxaccount'])) {
         LogRecord("wxaccount参数为empty", "[PromotioncodePlugin]" . __LINE__);
         $param['result'] = array("缺失公众号信息-二维码推广插件[调用失败]", "text");
         return;
     }
     $result = $this->process($data['wxaccount']['appid'], $data['wxaccount']['appsecret'], $data['fans']);
     addWeixinLog($result, "二维码插件处理结果");
     if ($result['status']) {
         $param['result'] = array($result['info'], "image");
     } else {
         $param['result'] = array($result['info'], "text");
     }
 }
Ejemplo n.º 3
0
 public function index()
 {
     //get.startdatetime
     $startdatetime = I('startdatetime', date('Y/m/d H:i', time() - 24 * 3600), 'urldecode');
     $enddatetime = I('enddatetime', date('Y/m/d H:i', time()), 'urldecode');
     //分页时带参数get参数
     $params = array('startdatetime' => $startdatetime, 'enddatetime' => $enddatetime);
     $startdatetime = strtotime($startdatetime);
     $enddatetime = strtotime($enddatetime);
     if ($startdatetime === FALSE || $enddatetime === FALSE) {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('ERR_DATE_INVALID'));
     }
     $map = array();
     $map['timestamp'] = array(array('EGT', $startdatetime), array('elt', $enddatetime), 'and');
     $page = array('curpage' => I('get.p', 0), 'size' => C('LIST_ROWS'));
     $order = " timestamp desc ";
     //
     $result = apiCall('Admin/Log/query', array($map, $page, $order, $params));
     //
     if ($result['status']) {
         $this->assign('startdatetime', $startdatetime);
         $this->assign('enddatetime', $enddatetime);
         $this->assign('show', $result['info']['show']);
         $this->assign('list', $result['info']['list']);
         $this->display();
     } else {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('UNKNOWN_ERR'));
     }
 }
 public function index()
 {
     $result = apiCall(DatatreeApi::QUERY_NO_PAGING, array(array("parentid" => getDatatree('BANNERS_TYPE')), "", "id"));
     if (!$result['status']) {
         $this->error($result['info']);
     }
     $result = $result['info'];
     $banners_pos = array();
     foreach ($result as $vo) {
         array_push($banners_pos, $vo['id']);
     }
     if (count($banners_pos) > 0) {
         $map = array();
         $map = array('uid' => UID);
         $map['position'] = array("in", $banners_pos);
         $page = array('curpage' => I('get.p', 0), 'size' => C('LIST_ROWS'));
         $order = " createtime desc ";
         //
         $result = apiCall(BannersApi::QUERY_WITH_POSITION, array($map, $page, $order, $params));
     } else {
         $result = array('status' => true, 'info' => array('show' => '', 'list' => ''));
     }
     //
     if ($result['status']) {
         $this->assign('show', $result['info']['show']);
         $this->assign('list', $result['info']['list']);
         $this->display();
     } else {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('UNKNOWN_ERR'));
     }
 }
 public function index()
 {
     $cate_id = I('cate_id', -1);
     $map = array('cate_id' => $cate_id);
     $name = I('name', '');
     $params = array('cate_id' => $cate_id);
     $page = array('curpage' => I('get.p', 0), 'size' => C('LIST_ROWS'));
     $order = " id asc ";
     $result = apiCall(CategoryApi::GET_INFO, array(array("id" => $cate_id)));
     if (!$result['status']) {
         $this->error($result['info']);
     }
     $cate_vo = $result['info'];
     //
     $result = apiCall(CategoryPropApi::QUERY, array($map, $page, $order, $params));
     //
     if ($result['status']) {
         $this->assign('cate_id', $cate_id);
         $this->assign('cate_vo', $cate_vo);
         $this->assign('show', $result['info']['show']);
         $this->assign('list', $result['info']['list']);
         $this->display();
     } else {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('UNKNOWN_ERR'));
     }
 }
 public function problem()
 {
     $post = I('post.');
     addWeixinLog($post, '[微信告警接口]');
     LogRecord(serialize($post), '[微信告警接口]');
     echo "";
 }
Ejemplo n.º 7
0
 public function add()
 {
     if (IS_GET) {
         $map = array('parentid' => 27);
         $result = apiCall(DatatreeApi::QUERY_NO_PAGING, array($map));
         $this->assign('accountType', $result['info']);
         $this->theme($this->themeType)->display();
     } else {
         if (IS_AJAX) {
             $map = array('uid' => $this->userinfo['uid'], 'money' => I('money'), 'accountType' => I('accountType'), 'accountName' => I('accountName'), 'bankBranch' => I('bankBranch'), 'cashAccount' => I('cashAccount'), 'reason' => '提现');
             $result = apiCall(WalletApi::MINUS, array($map));
             if ($result['status']) {
                 $this->success('操作成功', U('Shop/Index/index'));
             } else {
                 LogRecord($result['info'], __FILE__ . __LINE__);
                 $this->error($result['info']);
             }
         }
     }
     /*$map=array(
     			'uid'=>$this->userinfo['uid'],
     			'money'=>50,
     			'accountType'=>28,
     			'accountName'=>'张铭',
     			'bankBranch'=>'1235',
     			'cashAccount'=>'3212356465464',
     			'reason'=>'提现'
     			
     		);
     		apiCall(WalletApi::MINUS,array($map));*/
 }
Ejemplo n.º 8
0
 public function index()
 {
     $name = I("name", '');
     //get.startdatetime
     //		$startdatetime = I('startdatetime',date('Y/m/d H:i',time()-24*3600),'urldecode');
     //		$enddatetime = I('enddatetime',date('Y/m/d H:i',time()+24*3600),'urldecode');
     //分页时带参数get参数
     $params = array('name' => $name);
     $map = array();
     $map['post_author'] = UID;
     $map['name'] = array('like', '%' . $name . '%');
     $page = array('curpage' => I('get.p', 0), 'size' => C('LIST_ROWS'));
     $order = " post_modified desc ";
     //
     $result = apiCall('Admin/Post/query', array($map, $page, $order, $params));
     //
     if ($result['status']) {
         $this->assign('name', $name);
         $this->assign('show', $result['info']['show']);
         $this->assign('list', $result['info']['list']);
         $this->display();
     } else {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('UNKNOWN_ERR'));
     }
 }
 public function add()
 {
     if (IS_GET) {
         cookie("__forward__", $_SERVER['HTTP_REFERER']);
         $map = array();
         $map['wxuserid'] = $this->userinfo['id'];
         $map['default'] = 1;
         $result = apiCall(AddressApi::GET_INFO, array($map));
         if (!$result['status']) {
             $this->error($result['info']);
         }
         if (is_array($result['info'])) {
             //获取城市,区域信息
             $city = apiCall(CityApi::GET_LIST_BY_PROVINCE_ID, array($result['info']['province']));
             if (!$city['status']) {
                 LogRecord($city['info'], __FILE__ . __LINE__);
             }
             $this->assign("city", $city['info']);
             $area = apiCall(AreaApi::GET_LIST_BY_CITY_ID, array($result['info']['city']));
             if (!$area['status']) {
                 LogRecord($city['info'], __FILE__ . __LINE__);
             }
             $this->assign("area", $area['info']);
         }
         //dump($result['info']);
         $this->assign("address", $result['info']);
         $result = apiCall(ProvinceApi::QUERY_NO_PAGING, array());
         if (!$result['status']) {
             $this->error($result['info']);
         }
         $this->assign("provinces", $result['info']);
         $this->assign("back_url", cookie("__forward__"));
         $this->theme($this->themeType)->display();
     } else {
         $id = I('post.id', 0, 'intval');
         $province = I('post.province', '');
         $city = I('post.city', '');
         $area = I('post.area', '');
         $detail = I('post.detail', '');
         $mobile = I('post.mobile', '');
         $postcode = I('post.postcode', '');
         $contactname = I('post.name', '');
         $entity = array('wxno' => '', 'country' => '中国', 'province' => $province, 'city' => $city, 'area' => $area, 'detailinfo' => $detail, 'mobile' => $mobile, 'default' => 1, 'contactname' => $contactname, 'zip_code' => $postcode);
         if (empty($id)) {
             //新增
             $entity['wxuserid'] = $this->userinfo['id'];
             $result = apiCall(AddressApi::ADD, array($entity));
         } else {
             //保存
             $result = apiCall(AddressApi::SAVE_BY_ID, array($id, $entity));
         }
         if (!$result['status']) {
             $this->error($result['info']);
         }
         $this->success("操作成功!~", cookie("__forward__") . '?fromsession=1');
     }
 }
Ejemplo n.º 10
0
 /**
  * 配置部分内容
  */
 public function config_set($group)
 {
     $map = array('group' => $group);
     $result = apiCall('Ucenter/Config/queryNoPaging', array($map));
     if ($result['status']) {
         $this->assign("list", $result['info']);
         echo $this->fetch("Widget/config_set");
     } else {
         LogRecord($result['info'], "[INFO]:" . __FILE__ . " [LINE]" . __LINE__);
         echo L('ERR_SYSTEM_BUSY');
     }
 }
 /**
  * 更新保存
  */
 public function save($title, $url, $type, $newEntity)
 {
     if (substr_count('/', $url) == 2) {
         $url = 'Ucenter/' . $url;
     }
     $map = array('module' => 'ucenter', 'title' => $title, 'name' => $url, 'status' => 1, 'type' => $type);
     $result = apiCall("Ucenter/AuthRule/save", array($map, $newEntity));
     if (!$result['status']) {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         return false;
     } else {
         return true;
     }
 }
 public function orderQuery_old()
 {
     $out_trade_no = I('get.orderid', '');
     if (empty($out_trade_no)) {
         $out_trade_no = I('post.orderid', '');
     }
     //退款的订单号
     if (empty($out_trade_no)) {
         $out_trade_no = " ";
         $this->error("订单号无效!");
     } else {
         if (!$this->check($out_trade_no)) {
             $this->error("订单号无效!");
         }
         $appid = "";
         $appsecrect = "";
         $config = C("WXPAY_CONFIG");
         //使用订单查询接口
         $orderQuery = new OrderQueryApi($config);
         //设置必填参数
         //appid已填,商户无需重复填写
         //mch_id已填,商户无需重复填写
         //noncestr已填,商户无需重复填写
         //sign已填,商户无需重复填写
         $orderQuery->setParameter("out_trade_no", "{$out_trade_no}");
         //商户订单号
         //非必填参数,商户可根据实际情况选填
         //$orderQuery->setParameter("sub_mch_id","XXXX");//子商户号
         //$orderQuery->setParameter("transaction_id","XXXX");//微信订单号
         //获取订单查询结果
         $orderQueryResult = $orderQuery->getResult();
         //商户根据实际情况设置相应的处理流程,此处仅作举例
         if ($orderQueryResult["return_code"] == "FAIL") {
             LogRecord("[通信出错]", $orderQueryResult['return_msg']);
             //				$this->error("通信出错:" . $orderQueryResult['return_msg'] );
             $this->assign("error", "通信出错:" . $orderQueryResult['return_msg']);
         } elseif ($orderQueryResult["result_code"] == "FAIL") {
             $this->assign("error", $orderQueryResult['err_code_des']);
             //				echo "错误代码描述:" . $orderQueryResult['err_code_des'] . "<br>";
         } else {
             //				dump(self::$WXPAY_TRADE_STATE);
             $orderQueryResult['trade_state'] = self::$WXPAY_TRADE_STATE[$orderQueryResult['trade_state']];
             $orderQueryResult['time_end'] = date('Y-m-d H:i:s', strtotime($orderQueryResult['time_end']));
             $this->assign("orderQueryResult", $orderQueryResult);
         }
         $this->assign("out_trade_no", $out_trade_no);
         $this->display();
     }
 }
 public function writeMenuList()
 {
     $groupid = I('post.groupid', -1);
     $menulist = I('post.menulist', '');
     if ($menulist == ",") {
         $menulist = "";
     }
     $result = apiCall('Ucenter/AuthGroup/writeMenuList', array($groupid, $menulist));
     if ($result['status']) {
         $this->success("操作成功~页面将自动跳转");
     } else {
         LogRecord($result['info'], __FILE__ . __LINE__);
         $this->error($result['info']);
     }
 }
 /**
  * 将指定用户从指定用户组移除
  */
 public function delFromGroup()
 {
     $groupid = I('groupid', -1);
     $uid = I('uid', -1);
     if ($groupid === -1 || $uid === -1) {
         $this->error("参数错误!");
     }
     $map = array('uid' => $uid, "group_id" => $groupid);
     $result = apiCall("Admin/AuthGroupAccess/delete", array($map));
     if ($result['status']) {
         $this->success("操作成功~", U('Admin/AuthManage/user'));
     } else {
         LogRecord($result['info'], __FILE__ . __LINE__);
         $this->error($result['info']);
     }
 }
 public function index()
 {
     $map = array();
     $map = array('uid' => UID, 'position' => $this->position);
     $page = array('curpage' => I('get.p', 0), 'size' => C('LIST_ROWS'));
     $order = " createtime desc ";
     //
     $result = apiCall('Admin/Banners/query', array($map, $page, $order, $params));
     //
     if ($result['status']) {
         $this->assign('show', $result['info']['show']);
         $this->assign('list', $result['info']['list']);
         $this->display();
     } else {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('UNKNOWN_ERR'));
     }
 }
 public function index()
 {
     $map = array();
     $map = array('uid' => UID);
     $map['position'] = array("in", "18,20");
     $page = array('curpage' => I('get.p', 0), 'size' => C('LIST_ROWS'));
     $order = " createtime desc ";
     //
     $result = apiCall(BannersApi::QUERY_WITH_POSITION, array($map, $page, $order, $params));
     //
     if ($result['status']) {
         $this->assign('show', $result['info']['show']);
         $this->assign('list', $result['info']['list']);
         $this->display();
     } else {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('UNKNOWN_ERR'));
     }
 }
 /**
  * 设置
  */
 public function set()
 {
     if (IS_GET) {
         $this->configVars();
         $this->display();
     } else {
         $config = I('config');
         $order = 'sort desc';
         $result = apiCall(ConfigApi::SET, array($config, $order));
         if ($result['status']) {
             //清除缓存
             S("config_" . session_id() . '_' . session("uid"), null);
             $this->success(L('RESULT_SUCCESS'), U('Admin/Config/set'));
         } else {
             LogRecord($result['info'], '[INFO]' . __FILE . __LINE__);
             $this->error($result['info']);
         }
     }
 }
 public function index()
 {
     $parent = I('parent', 0);
     $preparent = I('preparent', -1);
     $level = I('level', 0);
     $map = array('parent' => $parent);
     $name = I('name', '');
     $params = array('parent' => $parent);
     if (!empty($name)) {
         $map['name'] = array('like', "%{$name}%");
         $params['name'] = $name;
     }
     $result = apiCall(CategoryApi::GET_INFO, array(array('id' => $parent)));
     if (!$result['status']) {
         $this->error($result['info']);
     }
     $parent_vo = $result['info'];
     $result = apiCall(CategoryApi::GET_INFO, array(array('id' => $preparent)));
     $prepreparent = "";
     if ($result['status']) {
         $prepreparent = $result['info']['parent'];
     }
     $page = array('curpage' => I('get.p', 0), 'size' => C('LIST_ROWS'));
     $order = " id asc ";
     //
     $result = apiCall(CategoryApi::QUERY, array($map, $page, $order, $params));
     //
     if ($result['status']) {
         $this->assign('level', $level);
         $this->assign('parent_vo', $parent_vo);
         $this->assign('prepreparent', $prepreparent);
         $this->assign('preparent', $preparent);
         $this->assign('parent', $parent);
         $this->assign('name', $name);
         $this->assign('show', $result['info']['show']);
         $this->assign('list', $result['info']['list']);
         $this->display();
     } else {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('UNKNOWN_ERR'));
     }
 }
 /**
  * 提现历史查询
  */
 public function query()
 {
     $arr = getDataRange(3);
     //dump($arr);
     $uid = I('uid', 0);
     $where = array();
     $params = array();
     $status = I('status', "");
     if ($uid != 0) {
         $where['uid'] = $uid;
         $params['uid'] = $uid;
     }
     $startdatetime = urldecode($arr[0]);
     $enddatetime = urldecode($arr[1]);
     $params = array('startdatetime' => $startdatetime, 'enddatetime' => $enddatetime, 'wxaccountid' => getWxAccountID());
     $startdatetime = strtotime($startdatetime);
     $enddatetime = strtotime($enddatetime);
     if ($startdatetime === FALSE || $enddatetime === FALSE) {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('ERR_DATE_INVALID'));
     }
     $where['create_time'] = array(array('EGT', $startdatetime), array('elt', $enddatetime), 'and');
     //dump(!empty($status));
     if ($status != "" && $status != -1) {
         $where['status'] = $status;
     }
     $page = array('curpage' => I('get.p', 0), 'size' => 10);
     $order = " update_time asc ";
     $result = apiCall(WithdrawApi::QUERY, array($where, $page, $order, $params));
     //dump($where);
     //dump($result);
     ifFailedLogRecord($result, __FILE__ . __LINE__);
     $list = $this->type2dtree($result['info']['list']);
     $list = int_to_string($list, "status", array(0 => "待审", "1" => "通过", 2 => "驳回"));
     $this->assign("status", $status);
     $this->assign("list", $list);
     $this->assign("show", $result['info']['show']);
     $this->assign("startdatetime", $startdatetime);
     $this->assign("enddatetime", $enddatetime);
     $this->display();
 }
Ejemplo n.º 20
0
 /**
  * 数据字典
  */
 public function datatree($parent, $hasChildren, $checkedID = 0)
 {
     if ($hasChildren) {
         $map['parents'] = array('like', '%' . $parent . ',%');
         $result = apiCall('Admin/Datatree/queryNoPaging', array($map));
         $tree = new \Common\Model\TreeModel();
         $list = $tree->toFormatTree($result['info'], 'name', 'id', 'parentid', $parent);
     } else {
         $map = array('parentid' => $parent);
         $result = apiCall('Admin/Datatree/queryNoPaging', array($map));
         $list = $result['info'];
     }
     if ($result['status']) {
         $this->assign("checkedID", $checkedID);
         $this->assign("list", $list);
         echo $this->fetch("Widget/datatree");
     } else {
         LogRecord($result['info'], "[INFO]:" . __FILE__ . " [LINE]" . __LINE__);
         echo L('ERR_SYSTEM_BUSY');
     }
 }
 /**
  * weixinjs
  */
 public function index()
 {
     C('SHOW_PAGE_TRACE', false);
     $token = I('get.tk', '');
     //		dump($token);
     $result = apiCall("Weixin/Wxaccount/getInfo", array(array('token' => $token)));
     if (!$result['status']) {
         LogRecord($result['info'], __FILE__ . __LINE__);
         return "无法获取!";
     }
     if (is_null($result['info'])) {
         return "Token 无效!";
     }
     $this->wxapi = new \Common\Api\WeixinApi($result['info']['appid'], $result['info']['appsecret']);
     $url = I('get.url', '', 'urldecode');
     //		addWeixinLog($url,"weixinjs url");
     $signPackage = $this->wxapi->getSignPackage($url);
     //		addWeixinLog($signPackage,"wsignPackage");
     $jsapilist = "'translateVoice','onVoicePlayEnd',\n\t\t'uploadVoice','downloadVoice','chooseImage','previewImage','uploadImage',\n\t\t'downloadImage','getNetworkType','openLocation',\n\t\t'getLocation','chooseCard','openCard','addCard','openProductSpecificView','chooseWXPay','scanQRCode','chooseImage','previewImage','uploadImage',\n\t\t'downloadImage','showMenuItems','showAllNonBaseMenuItem','hideAllNonBaseMenuItem','hideOptionMenu','showOptionMenu','hideMenuItems',\n\t\t'onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','hideAllNonBaseMenuItem','closeWindow',\n\t\t'showAllNonBaseMenuItem','startRecord','stopRecord','onVoiceRecordEnd','playVoice','pauseVoice','stopVoice'";
     //		$jsapilist = "'onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo'";
     $config = "wx.config({\n\t\t\t    debug: false, \n\t\t\t    appId: '" . $signPackage["appId"] . "', \n\t\t\t    timestamp: '" . $signPackage["timestamp"] . "', \n\t\t\t    nonceStr: '" . $signPackage["nonceStr"] . "', \n\t\t\t    signature: '" . $signPackage["signature"] . "',\n\t\t\t    jsApiList: [" . $jsapilist . "]\n\t\t\t});";
     echo $config;
 }
 /**
  * 从数据库中取得配置信息
  */
 protected function getConfig()
 {
     $config = S('weixin_config');
     if ($config === false) {
         $map = array();
         $fields = 'type,name,value';
         $result = apiCall('Admin/Config/queryNoPaging', array($map, false, $fields));
         if ($result['status']) {
             $config = array();
             if (is_array($result['info'])) {
                 foreach ($result['info'] as $value) {
                     $config[$value['name']] = $this->parse($value['type'], $value['value']);
                 }
             }
             //缓存配置300秒
             S("weixin_config", $config, 300);
         } else {
             LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
             $this->error($result['info']);
         }
     }
     C($config);
 }
 public function search()
 {
     $name = I('name', '');
     $map = array();
     $params = array('parent' => $this->parent);
     if (!empty($name)) {
         $map['name'] = array('like', "%{$name}%");
         $params['name'] = $name;
     }
     $page = array('curpage' => I('get.p', 0), 'size' => C('LIST_ROWS'));
     $order = " sort desc ";
     //
     $result = apiCall("Admin/Datatree/query", array($map, $page, $order, $params));
     //
     if ($result['status']) {
         $this->assign('name', $name);
         $this->assign('show', $result['info']['show']);
         $this->assign('list', $result['info']['list']);
         $this->display();
     } else {
         LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error(L('UNKNOWN_ERR'));
     }
 }
 public function delete()
 {
     $map = array('id' => I('id', -1));
     $result = apiCall("Admin/Wxproduct/queryNoPaging", array(array('storeid' => $map['id'])));
     if (!$result['status']) {
         $this->error($result['info']);
     }
     if (is_array($result['info']) && count($result['info']) > 0) {
         $this->error("该商店尚有相关联数据,无法删除!");
     }
     $result = apiCall('Admin/Wxstore/delete', array($map));
     if ($result['status'] === false) {
         LogRecord('[INFO]' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error($result['info']);
     } else {
         $this->success(L('RESULT_SUCCESS'), U('Admin/' . CONTROLLER_NAME . '/index'));
     }
 }
 /**
  * 批量删除
  * @param $success_url 删除成功后跳转
  */
 public function bulkDelete($success_url = false)
 {
     if ($success_url === false) {
         $success_url = U('Admin/' . CONTROLLER_NAME . '/index');
     }
     $ids = I('ids', -1);
     if ($ids === -1) {
         $this->error(L('ERR_PARAMETERS'));
     }
     $ids = implode(',', $ids);
     $map = array('id' => array('in', $ids));
     $result = apiCall('Admin/' . CONTROLLER_NAME . '/delete', array($map));
     if ($result['status'] === false) {
         LogRecord('[INFO]' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
         $this->error($result['info']);
     } else {
         $this->success(L('RESULT_SUCCESS'), $success_url);
     }
 }
 public function delete($redirect_url = false)
 {
     if (IS_GET) {
         $id = I('get.id', 0);
         $result = apiCall(WxuserApi::COUNT_WXUSERS, array($id));
         if ($result['status']) {
             if ($result['info'] > 0) {
                 $this->error("请先去除关联此会员组的会员!");
             }
         } else {
             LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
             $this->error($result['info']);
         }
         $result = apiCall(WxuserGroupApi::DEL_WITH_ACCESS, array($id));
         if ($result['status']) {
             $this->success(L('RESULT_SUCCESS'), U('Admin/WxuserGroup/index'));
         } else {
             LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
             $this->error($result['info']);
         }
     } elseif (IS_POST) {
     }
 }
 /**
  * 保存配置页面详细数据
  * 
  * @return void
  */
 public function saveConfigData()
 {
     if (empty($_POST['systemdata_list']) || empty($_POST['systemdata_key'])) {
         $this->error(L('PUBLIC_SAVE_FAIL'));
         // 保存失败
     }
     $key = t($_POST['systemdata_list']) . ":" . t($_POST['systemdata_key']);
     $title = t($_POST['pageTitle']);
     unset($_POST['systemdata_list'], $_POST['systemdata_key'], $_POST['pageTitle']);
     // rewrite验证.
     if (isset($_POST['site_rewrite_on']) && $_POST['site_rewrite_on'] == 1) {
         $rewrite_test_content = file_get_contents(SITE_URL . '/rewrite');
         if ($rewrite_test_content != 'thinksns') {
             $this->error('服务器设置不支持Rewrite,请检查配置');
         }
     }
     if (isset($_POST['site_analytics_code'])) {
         $_POST['site_analytics_code'] = base64_encode($_POST['site_analytics_code']);
     }
     if (isset($_POST['site_theme_name']) && $_POST['site_theme_name'] != C('THEME_NAME')) {
         $res = $this->_switchTheme(t($_POST['site_theme_name']));
     }
     if ($key == 'admin_Config:attach') {
         $exts = explode(',', $_POST['attach_allow_extension']);
         $objext = array('gif', 'png', 'jpeg', 'zip', 'rar', 'doc', 'xls', 'ppt', 'docx', 'xlsx', 'pptx', 'pdf', 'jpg');
         $_POST['attach_allow_extension'] = implode(',', array_intersect($exts, $objext));
     }
     //$result = model ( 'Xdata' )->put ( $key, $_POST );
     $result = D('Admin/SystemData')->put($key, $_POST);
     LogRecord('admin_config', 'editDetail', array('name' => $title, 'k1' => L('PUBLIC_ADMIN_EDIT_EDTAIL_PEIZHI')), true);
     // 保存修改编辑详细数据
     if ($res === false) {
         $this->error(L('PUBLIC_SWITCH_THEME_FAIL'));
         // 写config.inc.php文件失败
     } else {
         if ($result) {
             $this->success();
         } else {
             $this->error(L('PUBLIC_SAVE_FAIL'));
             // 保存失败
         }
     }
 }
Ejemplo n.º 28
0
 public function delArticle()
 {
     $title = $_POST['type'] == 1 ? L('PUBLIC_ANNOUNCEMENT') : L('PUBLIC_FOOTER_ARTICLE');
     $return = array('status' => 1, 'data' => $title . L('PUBLIC_DELETE_SUCCESS'));
     $id = $_POST['id'];
     if ($res = model('Xarticle')->delArticle($id)) {
         if ($_POST['type'] == 1) {
             LogRecord('admin_content', 'delArticle', array('ids' => $id, 'k' => L('PUBLIC_STREAM_DELETE') . $title), true);
         } else {
             LogRecord('admin_config', 'delFooter', array('ids' => $id, 'k' => L('PUBLIC_STREAM_DELETE') . $title), true);
         }
     } else {
         $error = model('Xarticle')->getError();
         empty($error) && ($error = $title . L('PUBLIC_DELETE_FAIL'));
         $return = array('status' => 0, 'data' => $error);
     }
     echo json_encode($return);
     exit;
 }
 /**
  * 从数据库中取得配置信息
  */
 protected function getConfig()
 {
     $config = S('config_' . session_id() . '_' . session("uid"));
     //dump($config);
     if ($config === false) {
         $map = array();
         $fields = 'type,name,value';
         $result = apiCall(ConfigApi::QUERY_NO_PAGING, array($map, false, $fields));
         if ($result['status']) {
             $config = array();
             if (is_array($result['info'])) {
                 foreach ($result['info'] as $value) {
                     $config[$value['name']] = $this->parse($value['type'], $value['value']);
                 }
             }
             //缓存配置300秒
             S("config_" . session_id() . '_' . session("uid"), $config, 300);
         } else {
             LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
             $this->error($result['info']);
         }
     }
     //dump(session_id());
     // dump($config);
     C($config);
 }
 public function store()
 {
     if (IS_POST) {
         import("Org.String");
         $id = I('post.id', 0, 'intval');
         $len = 43;
         $EncodingAESKey = I('post.encodingAESKey', '');
         if (empty($EncodingAESKey)) {
             $EncodingAESKey = \String::randString($len, 0, '0123456789');
         }
         $tokenvalue = \String::randString(8, 3);
         $entity = array('wxname' => I('post.wxname', ''), 'appid' => I('post.appid'), 'appsecret' => I('post.appsecret'), 'weixin' => I('post.weixin'), 'headerpic' => I('post.headerpic', ''), 'qrcode' => I('post.qrcode', ''), 'wxuid' => I('post.wxuid'), 'encodingAESKey' => $EncodingAESKey);
         if (!empty($id) && $id > 0) {
             $result = apiCall(WxaccountApi::SAVE_BY_ID, array($id, $entity));
             if ($result['status'] === false) {
                 LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
                 $this->error($result['info']);
             } else {
                 $this->success(L('RESULT_SUCCESS'), U('Admin/Wxaccount/edit'));
             }
         } else {
             $entity['uid'] = UID;
             $entity['token'] = $tokenvalue . time();
             $result = apiCall(WxaccountApi::ADD, array($entity));
             if ($result['status'] === false) {
                 LogRecord('INFO:' . $result['info'], '[FILE] ' . __FILE__ . ' [LINE] ' . __LINE__);
                 $this->error($result['info']);
             } else {
                 $this->success(L('RESULT_SUCCESS'), U('Admin/Wxaccount/edit'));
             }
         }
     }
 }