Esempio n. 1
0
 function get_info($request_id = NULL, $unsubscribe_key = NULL)
 {
     if (is_null($result = $this->lib_archive->get_info($request_id, $unsubscribe_key))) {
         output_error($this->lib_archive->get_error_message());
     }
     output($result);
 }
Esempio n. 2
0
 /**
  * GET 服务详情
  */
 public function serviceOp()
 {
     if (!isset($_GET['sid'])) {
         output_error("缺少服务id参数");
         die;
     }
     $service_id = $_GET['sid'];
     $m_service = Model('serviceapi');
     $where = array('service_id' => $service_id);
     $service_info = $m_service->where($where)->order('service_id desc')->select();
     // TODO 服务收藏
     //        if (intval($_GET['fav_id']) > 0) {
     //            $favorites_class = Model('flea_favorites');
     //            if (!$favorites_class->checkFavorites(intval($_GET['fav_id']), 'flea', intval($_GET['user_id']))) {
     //                $service_info[0][is_favorite] = false;
     //            }
     //        }
     $goods_image_path = UPLOAD_SITE_URL . DS . ATTACH_SERVICE . '/';
     //店铺商品图片目录地址
     $desc_image = $m_service->getListImageService(array('item_id' => $service_id, 'upload_type' => 8));
     $m_service->getThumb($desc_image, $goods_image_path);
     $service_info[0]['service_image'] = $desc_image;
     /**
      * 浏览次数更新
      */
     $m_service->updateService(array('service_click' => $service_info[0]['service_click'] + 1), $service_id);
     if (!empty($service_info)) {
         output_data(array('service_info' => $service_info));
     } else {
         output_error("没有此交易");
     }
 }
Esempio n. 3
0
 /**
  * 商品评价详细页
  */
 public function comments_listOp()
 {
     $goods_id = intval($_GET['goods_id']);
     // 商品详细信息
     $model_goods = Model('goods');
     $goods_info = $model_goods->getGoodsInfoByID($goods_id, '*');
     // 验证商品是否存在
     if (empty($goods_info)) {
         output_error('商品不存在');
     }
     //评价信息
     $goods_evaluate_info = Model('evaluate_goods')->getEvaluateGoodsInfoByGoodsID($goods_id);
     $buy_comments['goods_evaluate_info']['good'] = $goods_evaluate_info['good'];
     $buy_comments['goods_evaluate_info']['normal'] = $goods_evaluate_info['normal'];
     $buy_comments['goods_evaluate_info']['bad'] = $goods_evaluate_info['bad'];
     $buy_comments['goods_evaluate_info']['all'] = $goods_evaluate_info['all'];
     $buy_comments['goods_evaluate_info']['good_percent'] = $goods_evaluate_info['good_percent'];
     $buy_comments['goods_evaluate_info']['normal_percent'] = $goods_evaluate_info['normal_percent'];
     $buy_comments['goods_evaluate_info']['bad_percent'] = $goods_evaluate_info['bad_percent'];
     $buy_comments['goods_evaluate_info']['good_star'] = $goods_evaluate_info['good_star'];
     $buy_comments['goods_evaluate_info']['star_average'] = $goods_evaluate_info['star_average'];
     $buy_comments['comments'] = $this->_get_comments($goods_id, $_GET['type'], 5);
     $buy_comments['goods_evaluate_info']['page'] = $this->_getcomments($goods_id, $_GET['type'], 5);
     if (empty($buy_comments['comments'])) {
         output_error('暂时没有评论');
     }
     if ($buy_comments['goods_evaluate_info']['page']['page'] > $buy_comments['goods_evaluate_info']['page']['show_pa']) {
         $buy_comments['comments'] = null;
     }
     output_data($buy_comments);
 }
Esempio n. 4
0
 public function transactional($message_id = 0)
 {
     if (is_null($result = $this->lib_message->add_request($message_id))) {
         output_error($this->lib_message->get_error_message());
     }
     output($result);
 }
Esempio n. 5
0
 /**
  * 登录
  */
 public function indexOp()
 {
     if (empty($_POST['seller_name']) || empty($_POST['password']) || !in_array($_POST['client'], $this->client_type_array)) {
         output_error('用户名密码不能为空');
     }
     $model_seller = Model('seller');
     $seller_info = $model_seller->getSellerInfo(array('seller_name' => $_POST['seller_name']));
     if (!$seller_info) {
         output_error('登录失败');
     }
     //店铺所有人或者授权的子账号可以从客户端登录
     if (!($seller_info['is_admin'] || $seller_info['is_client'])) {
         output_error('权限验证失败');
     }
     //验证身份
     $model_member = Model('member');
     $member_info = $model_member->getMemberInfo(array('member_id' => $seller_info['member_id'], 'member_passwd' => strtolower($_POST['password'])));
     if (!$member_info) {
         output_error('用户名密码错误');
     }
     //读取店铺信息
     $model_store = Model('store');
     $store_info = $model_store->getStoreInfoByID($seller_info['store_id']);
     //更新卖家登陆时间
     $model_seller->editSeller(array('last_login_time' => TIMESTAMP), array('seller_id' => $seller_info['seller_id']));
     //生成登录令牌
     $token = $this->_get_token($seller_info['seller_id'], $seller_info['seller_name'], $_POST['client']);
     if ($token) {
         output_data(array('seller_name' => $seller_info['seller_name'], 'store_name' => $store_info['store_name'], 'key' => $token));
     } else {
         output_error('登录失败');
     }
 }
Esempio n. 6
0
 public function indate_code_listOp()
 {
     $order_id = intval($_POST['order_id']);
     if ($order_id <= 0) {
         output_error('订单不存在');
     }
     $model_vr_order = Model('vr_order');
     $condition = array();
     $condition['order_id'] = $order_id;
     $condition['buyer_id'] = $this->member_info['member_id'];
     $order_info = $model_vr_order->getOrderInfo($condition);
     if (empty($order_info) || $order_info['delete_state'] == ORDER_DEL_STATE_DROP) {
         output_error('订单不存在');
     }
     $order_list = array();
     $order_list[$order_id] = $order_info;
     $order_list = $model_vr_order->getCodeRefundList($order_list);
     //没有使用的兑换码列表
     $code_list = array();
     if (!empty($order_list[$order_id]['code_list'])) {
         foreach ($order_list[$order_id]['code_list'] as $value) {
             $code = array();
             $code['vr_code'] = $value['vr_code'];
             $code['vr_indate'] = $value['vr_indate'];
             $code_list[] = $code;
         }
     }
     output_data(array('code_list' => $code_list));
 }
Esempio n. 7
0
 public function addRule()
 {
     $express_id = $this->input->get_post('express_id');
     $province_code = $this->input->get_post('province_code');
     $rule = $this->express_rule_model->getOneByProvince($express_id, $province_code);
     if (!$rule) {
         $rule_add = array('express_id' => $express_id, 'province_code' => $province_code);
         $rule['rule_id'] = $this->express_rule_model->add($rule_add);
     }
     //先检查是否存在该区间
     $weight_min = $this->input->get_post('weight_min');
     $weight_max = $this->input->get_post('weight_max');
     $item1 = $this->express_rule_model->getItemByRuleAndWeight($rule['rule_id'], $weight_min);
     $item2 = $this->express_rule_model->getItemByRuleAndWeight($rule['rule_id'], $weight_max);
     $item3 = $this->express_rule_model->getItemByRuleAndWeightBetween($rule['rule_id'], $weight_min, $weight_max);
     if ($item1) {
         output_error('其他区间已经包含起始重量');
     }
     if ($item2) {
         output_error('其他区间已经包含结束重量');
     }
     if ($item3) {
         output_error('重量区间重复');
     }
     $item = array('rule_id' => $rule['rule_id'], 'express_id' => $express_id, 'price_type' => $this->input->get_post('price_type'), 'price' => $this->input->get_post('price'), 'weight_min' => $weight_min, 'weight_max' => $weight_max, 'sort_order' => $this->input->get_post('sort_order'));
     $this->express_rule_item_model->add($item);
     $this->show();
 }
Esempio n. 8
0
 /**
  * 编辑店铺
  */
 public function store_editOp()
 {
     $upload = new UploadFile();
     /**
      * 上传店铺图片
      */
     if (!empty($_FILES['store_banner']['name'])) {
         $upload->set('default_dir', ATTACH_STORE);
         $upload->set('thumb_ext', '');
         $upload->set('file_name', '');
         $upload->set('ifremove', false);
         $result = $upload->upfile('store_banner');
         if ($result) {
             $_POST['store_banner'] = $upload->file_name;
         } else {
             showDialog($upload->error);
         }
     }
     //删除旧店铺图片
     if (!empty($_POST['store_banner']) && !empty($store_info['store_banner'])) {
         @unlink(BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $this->store_info['store_banner']);
     }
     /**
      * 更新入库
      */
     $param = array('store_banner' => empty($_POST['store_banner']) ? $this->store_info['store_banner'] : $_POST['store_banner'], 'store_qq' => $_POST['store_qq'], 'store_ww' => $_POST['store_ww'], 'store_phone' => $_POST['store_phone'], 'store_zy' => $_POST['store_zy'], 'store_keywords' => $_POST['seo_keywords'], 'store_description' => $_POST['seo_description']);
     $result = Model('store')->editStore($param, array('store_id' => $this->store_info['store_id']));
     if (!$result) {
         output_error('编辑失败');
     }
     output_data('1');
 }
 public function addRule()
 {
     $customer_id = 0;
     $customer_rent_id = $this->input->get_post('customer_rent_id');
     $province_code = $this->input->get_post('province_code');
     $rule = $this->customer_express_rule_model->getOneByRent($customer_rent_id, $province_code);
     $customer_id = $rule['customer_id'];
     if (!$rule) {
         $rent = $this->customer_rent_model->getCustomerRent($customer_rent_id);
         $customer_id = $rent['customer_id'];
         $rule_add = array('customer_id' => $customer_id, 'customer_rent_id' => $customer_rent_id, 'province_code' => $province_code);
         $rule['rule_id'] = $this->customer_express_rule_model->add($rule_add);
     }
     $weight_min = $this->input->get_post('weight_min');
     $weight_max = $this->input->get_post('weight_max');
     //先检查是否存在该区间
     $item1 = $this->customer_express_rule_model->getItemByRuleAndWeight($rule['rule_id'], $weight_min);
     $item2 = $this->customer_express_rule_model->getItemByRuleAndWeight($rule['rule_id'], $weight_max);
     $item3 = $this->customer_express_rule_model->getItemByRuleAndWeightBetween($rule['rule_id'], $weight_min, $weight_max);
     if ($item1) {
         output_error('其他区间已经包含起始重量');
     }
     if ($item2) {
         output_error('其他区间已经包含结束重量');
     }
     if ($item3) {
         output_error('重量区间重复');
     }
     $item = array('rule_id' => $rule['rule_id'], 'customer_id' => $customer_id, 'customer_rent_id' => $customer_rent_id, 'weight_price_type' => $this->input->get_post('weight_price_type'), 'weight_min' => $weight_min, 'weight_max' => $weight_max, 'weight_start' => $this->input->get_post('weight_start'), 'weight_start_price' => $this->input->get_post('weight_start_price'), 'weight_pre' => $this->input->get_post('weight_pre'), 'weight_pre_price' => $this->input->get_post('weight_pre_price'), 'sort_order' => $this->input->get_post('sort_order'));
     $this->customer_express_rule_item_model->add($item);
     $this->show();
 }
Esempio n. 10
0
 public function __construct()
 {
     parent::__construct();
     if (C('voucher_allow') != 1) {
         output_error('暂不支持代金券设置');
         //showDialog(L('voucher_pointunavailable'),'index.php','error');
     }
 }
Esempio n. 11
0
function load_member($pid)
{
    $member = new MEMBER(array('person_id' => $pid));
    if (!$member->valid) {
        output_error('Unknown ID');
    }
    $member->load_extra_info();
    return $member;
}
Esempio n. 12
0
 private function getMysqlConnection($db)
 {
     if (!@is_string($db) || empty($db)) {
         output_error(404, "404 Database Not Found");
     } else {
         $result = @mysqli_connect($this->hostname, $this->myql_username, $this->myql_password, $db) or output_error(503, "503 Database Unavailable");
         return $result;
     }
 }
Esempio n. 13
0
 public function returnopenidOp()
 {
     $payment_api = $this->_get_payment_api();
     if ($this->payment_code != 'wxpay') {
         output_error('支付参数异常');
         die;
     }
     $payment_api->getopenid();
 }
Esempio n. 14
0
 public function image_uploadOp()
 {
     $logic_goods = Logic('goods');
     $result = $logic_goods->uploadGoodsImage($_POST['name'], $this->seller_info['store_id'], $this->store_grade['sg_album_limit']);
     if (!$result['state']) {
         output_error($result['msg']);
     }
     output_data(array('image_name' => $result['data']['name']));
 }
Esempio n. 15
0
 public function recommend_voucherOp()
 {
     //开启代金券功能后查询推荐的热门代金券列表
     if (C('voucher_allow') == 1) {
         $recommend_voucher = Model('voucher')->getRecommendTemplate(6);
         output_data(array('vouchers' => $recommend_voucher));
     } else {
         output_error("并没有开启代金券功能");
         die;
     }
 }
Esempio n. 16
0
 public function direct()
 {
     $this->load->library('lib_send_email');
     if (is_null($result = $this->lib_send_email->direct(getenv('email_admin'), 'Foobar', '👍'))) {
         output_error($this->lib_send_email->get_error_message());
     } else {
         $this->load->helper('api');
         $response = array('email_admin' => getenv('email_admin'), 'result' => $result);
         output($response);
     }
 }
Esempio n. 17
0
 /**
  * 店铺商品分类
  */
 public function store_goods_classOp()
 {
     $store_id = (int) $_REQUEST['store_id'];
     $store_online_info = Model('store')->getStoreOnlineInfoByID($store_id);
     if (empty($store_online_info)) {
         output_error('店铺不存在或未开启');
     }
     $store_info = array();
     $store_info['store_id'] = $store_online_info['store_id'];
     $store_info['store_name'] = $store_online_info['store_name'];
     output_data(array('store_info' => $store_info, 'store_goods_class' => Model('store_goods_class')->getStoreGoodsClassPlainList($store_id)));
 }
Esempio n. 18
0
 public function update_metadata($list = NULL)
 {
     $this->load->library('lib_list_unsubscribe');
     $list_unsubscribe = $this->lib_list_unsubscribe->get_by_name($list);
     if (empty($list_unsubscribe)) {
         output_error(['status' => 404, 'message' => 'list not found']);
     }
     if (is_null($result = $this->lib_recipient->update_metadata($list_unsubscribe['list_id']))) {
         output_error($this->lib_recipient->get_error_message());
     }
     output($result);
 }
Esempio n. 19
0
 /**
  * 删除收藏
  */
 public function favorites_delOp()
 {
     $fav_id = intval($_POST['fav_id']);
     if ($fav_id <= 0) {
         output_error('参数错误');
     }
     $model_favorites = Model('favorites');
     $condition = array();
     $condition['fav_id'] = $fav_id;
     $condition['member_id'] = $this->member_info['member_id'];
     $model_favorites->delFavorites($condition);
     output_data('1');
 }
Esempio n. 20
0
 public function copy()
 {
     $rent_no_from = $this->input->post('rent_no_from');
     $rent_from = $this->customer_rent_model->getCustomerRentByRentNo($rent_no_from);
     $rent_no_to = $this->input->post('rent_no_to');
     $rent_to = $this->customer_rent_model->getCustomerRentByRentNo($rent_no_to);
     if ($rent_to) {
         $this->customer_rent_model->copyRule($rent_from['customer_rent_id'], $rent_to['customer_rent_id']);
         output_success();
     } else {
         output_error('填写的合同编号不存在');
     }
 }
Esempio n. 21
0
 /**
  * 单篇文章显示
  */
 public function article_showOp()
 {
     $article_model = Model('article');
     if (!empty($_GET['article_id']) && intval($_GET['article_id']) > 0) {
         $article = $article_model->getOneArticle(intval($_GET['article_id']));
         if (empty($article)) {
             output_error('文章不存在');
         } else {
             output_data($article);
         }
     } else {
         output_error('缺少参数:文章编号');
     }
 }
Esempio n. 22
0
 /**
  * 单篇文章显示
  */
 public function article_showOp()
 {
     $article_model = Model('cms_article');
     if (!empty($_GET['article_id']) && intval($_REQUEST['article_id']) > 0) {
         $condition['article_id'] = $_REQUEST['article_id'];
         $article = $article_model->getOne($condition);
         if (empty($article)) {
             output_error('文章不存在');
         } else {
             output_data($article);
         }
     } else {
         output_error('缺少参数:文章编号');
     }
 }
Esempio n. 23
0
 /**
  * 注销
  */
 public function indexOp()
 {
     if (empty($_POST['seller_name']) || !in_array($_POST['client'], $this->client_type_array)) {
         output_error('参数错误');
     }
     $model_mb_seller_token = Model('mb_seller_token');
     if ($this->seller_info['seller_name'] == $_POST['seller_name']) {
         $condition = array();
         $condition['seller_id'] = $this->seller_info['seller_id'];
         $model_mb_seller_token->delSellerToken($condition);
         output_data('1');
     } else {
         output_error('参数错误');
     }
 }
Esempio n. 24
0
 /**
  * 发票信息添加
  */
 public function invoice_addOp()
 {
     $model_invoice = Model('invoice');
     $data = array();
     $data['inv_state'] = 1;
     $data['inv_title'] = $_POST['inv_title_select'] == 'person' ? '个人' : $_POST['inv_title'];
     $data['inv_content'] = $_POST['inv_content'];
     $data['member_id'] = $this->member_info['member_id'];
     $result = $model_invoice->addInv($data);
     if ($result) {
         output_data(array('inv_id' => $result));
     } else {
         output_error('添加失败');
     }
 }
Esempio n. 25
0
 /**
  * 修改订单状态
  */
 private function change_order_state($state_type, $extend_msg = '')
 {
     $order_id = intval($_POST['order_id']);
     $model_order = Model('order');
     $condition = array();
     $condition['order_id'] = $order_id;
     $condition['buyer_id'] = $this->member_info['member_id'];
     $order_info = $model_order->getOrderInfo($condition);
     $result = $model_order->memberChangeState($state_type, $order_info, $this->member_info['member_id'], $this->member_info['member_name'], $extend_msg);
     if (empty($result['error'])) {
         output_data('1');
     } else {
         output_error($result['error']);
     }
 }
Esempio n. 26
0
 /**
  * 添加反馈
  */
 public function feedback_addOp()
 {
     $model_mb_feedback = Model('mb_feedback');
     $param = array();
     $param['content'] = $_POST['feedback'];
     $param['type'] = $this->member_info['client_type'];
     $param['ftime'] = TIMESTAMP;
     $param['member_id'] = $this->member_info['member_id'];
     $param['member_name'] = $this->member_info['member_name'];
     $result = $model_mb_feedback->addMbFeedback($param);
     if ($result) {
         output_data('1');
     } else {
         output_error('保存失败');
     }
 }
Esempio n. 27
0
 /**
  * 第三方在线支付接口
  *
  */
 private function _api_pay($order_pay_info, $payment_info)
 {
     $inc_file = BASE_PATH . DS . 'api' . DS . 'payment' . DS . $payment_info['payment_code'] . DS . $payment_info['payment_code'] . '.php';
     if (!file_exists($inc_file)) {
         output_error('支付接口不存在');
     }
     require_once $inc_file;
     $param = array();
     $param = unserialize($payment_info['payment_config']);
     $param['order_sn'] = $order_pay_info['pay_sn'];
     $param['order_amount'] = $order_pay_info['pay_amount'];
     $param['sign_type'] = 'MD5';
     $payment_api = new $payment_info['payment_code']($param);
     $return = $payment_api->submit();
     echo $return;
     exit;
 }
Esempio n. 28
0
 /**
  * 第三方在线支付接口
  *
  */
 private function _api_pay($order_pay_info, $mb_payment_info)
 {
     $inc_file = BASE_PATH . DS . 'api' . DS . 'payment' . DS . $this->payment_code . DS . $this->payment_code . '.php';
     if (!is_file($inc_file)) {
         output_error('支付接口不存在');
     }
     require $inc_file;
     $param = array();
     $param = $mb_payment_info['payment_config'];
     $param['order_sn'] = $order_pay_info['pay_sn'];
     $param['order_amount'] = $order_pay_info['api_pay_amount'];
     $param['order_type'] = $order_pay_info['order_type'] == 'real_order' ? 'r' : 'v';
     $payment_api = new $this->payment_code();
     $return = $payment_api->submit($param);
     echo $return;
     exit;
 }
Esempio n. 29
0
 /**
  * GET 专题详情
  */
 public function specialOp()
 {
     if (!isset($_GET['sid'])) {
         output_error("缺少专题id参数");
         die;
     }
     $special_id = $_GET['sid'];
     $m_special = Model('cms_special');
     $where = array('special_id' => $special_id);
     $special_info = $m_special->getOne($where);
     /**
      * 浏览次数更新
      */
     $m_special->modify(array('special_view' => $special_info[0]['special_view'] + 1), $special_id);
     if (!empty($special_info)) {
         output_data(array('special' => $special_info));
     } else {
         output_error("没有此专题");
     }
 }
Esempio n. 30
-1
 public function store_codeOp()
 {
     if ($_GET['text']) {
         $text = $_GET['text'];
         $size = '6';
         $level = 'H';
         $logo = BASE_RESOURCE_PATH . DS . '/logo_2.png';
         $padding = '2';
         $path = BASE_RESOURCE_PATH . DS . 'phpqrcode';
         $QR = $path . 'qrcode.png';
         require_once BASE_RESOURCE_PATH . DS . 'phpqrcode' . DS . 'phpqrcode.php';
         QRcode::png($text, $QR, $level, $size, $padding);
         if ($logo !== false) {
             $QR = imagecreatefromstring(file_get_contents($QR));
             $logo = imagecreatefromstring(file_get_contents($logo));
             $QR_width = imagesx($QR);
             $QR_height = imagesy($QR);
             $logo_width = imagesx($logo);
             $logo_height = imagesy($logo);
             $logo_qr_width = $QR_width / 5;
             $scale = $logo_width / $logo_qr_width;
             $logo_qr_height = $logo_height / $scale;
             $from_width = ($QR_width - $logo_qr_width) / 2;
             imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
         }
         header("Content-Type:image/jpg");
         imagepng($QR);
     } else {
         output_error('参数错误00023');
     }
 }