Exemplo n.º 1
0
<?php

/*伪删除礼品信息*/
require_once ykfile("source/commodity_service.php");
$id = intval($_GET['com_id']);
$is_delete = intval($_GET['is_delete']);
$comm_ser = new CommodityService();
$result = $comm_ser->is_remove_commodity($id, $is_delete);
echo json_encode(array("status" => 0, "message" => "success"));
Exemplo n.º 2
0
<?php

/*后台商品信息管理*/
require_once ykfile("source/commodity_service.php");
$next_id = intval($_GET['next_id']);
$count = intval($_GET['count']);
if ($count <= 0) {
    $count = 10;
}
$comm_ser = new CommodityService();
$comm_list = $comm_ser->get_commodity($next_id, $count);
$comm_total = $comm_ser->get_count();
// 以下4个参数,必须计算出来,分页器要使用
// page_cur: 当前页, 从1开始计算
// page_count: 总页数
// page_prefix: 点页数后,取数据的url前缀
// next_id: 下一页超始数据
$page_cur = intval(($next_id + 1 + 9) / 10);
$page_count = intval(($comm_total + 9) / 10);
$page_prefix = "/m/admin.php?mod=commodity";
$next_id += $count;
require_once ykfile("pages/admin/commodity_list.php");
Exemplo n.º 3
0
<?php

require_once ykfile("source/commodity_service.php");
if (!empty($_SESSION['current_user'])) {
    $user_id = $_SESSION['current_user']->uuid;
    $comsrv = new CommodityService();
    $record_list = $comsrv->get_exchange_record($user_id, 0, 10);
    $page_title = '我的兑换';
    require_once ykfile("pages/user/exchange_record.php");
} else {
    $url = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
    echo "<script type='text/javascript'>alert('请您先登陆!');window.location.href='/m/user.php?mod=signin&url={$url}'</script>";
}
Exemplo n.º 4
0
<?php

require_once '../config.php';
require_once ykfile('source/commodity_service.php');
header("application/json;charset=utf-8");
$next_id = intval($_GET['next_id']);
$count = intval($_GET['count']);
$comsrv = new CommodityService();
$coms = $comsrv->get_commodity($next_id, $count);
$total = $comsrv->get_count();
echo json_encode(array("total" => $total, "commodity" => $coms));
Exemplo n.º 5
0
<?php

session_start();
header("Content-type: text/html; charset=utf-8");
require_once "config.php";
require_once ykfile("source/commodity_service.php");
$commService = new CommodityService();
$comm_list = $commService->get_commodity(0, 20);
$page_title = "积分商城";
require_once ykfile("pages/commodity/commodityList.php");
Exemplo n.º 6
0
<?php

/*编辑或者添加商品信息*/
require_once ykfile("source/commodity_service.php");
$id = intval($_GET['comm_id']);
$comm_ser = new CommodityService();
$commodity = $comm_ser->get_by_id($id);
$page_title = "";
if ($commodity) {
    $page_title = "商品信息编辑";
} else {
    $page_title = "添加商品信息";
}
require_once ykfile("pages/admin/edit_commodity.php");
Exemplo n.º 7
0
 public function exchange_commodity($com_id, $mobile, $address, $name)
 {
     $comsrv = new CommodityService();
     $com = $comsrv->get_by_id($com_id);
     if ($com->count <= 0) {
         return GOOD_IS_ZERO;
     }
     $user_info = $this->get_by_uuid($this->user->uuid);
     if ($com->price > $user_info->scores) {
         return USER_ERR_SCORE_NOT_ENOUGH;
     }
     // 插入兑换记录
     $result = $comsrv->add_exch_record($com_id, $this->user->uuid, $mobile, $address, $name);
     if ($result) {
         $umod = new UserModule($this->user->uuid);
         $score = 0 - $com->price;
         $rs = $umod->sub_score($this->user->uuid, $score);
         $comsrv->dec_com($com_id);
     }
     return $result;
 }
Exemplo n.º 8
0
<?php

/*礼品兑换记录*/
require_once ykfile("source/commodity_service.php");
$next_id = intval($_GET['next_id']);
$count = intval($_GET['count']);
if ($count <= 0) {
    $count = 10;
}
$comm_ser = new CommodityService();
$comm_rec_list = $comm_ser->get_exchange_record_all($next_id, $count);
$comm_total = $comm_ser->get_count_all();
// 以下4个参数,必须计算出来,分页器要使用
// page_cur: 当前页, 从1开始计算
// page_count: 总页数
// page_prefix: 点页数后,取数据的url前缀
// next_id: 下一页超始数据
$page_cur = intval(($next_id + 1 + 9) / 10);
$page_count = intval(($comm_total + 9) / 10);
$page_prefix = "/m/admin.php?mod=commodity";
$next_id += $count;
require_once ykfile("pages/admin/exchange_list.php");
Exemplo n.º 9
0
<?php

require_once '../config.php';
require_once ykfile('source/commodity_service.php');
$params = json_decode(file_get_contents('php://input'));
$comm_ser = new CommodityService();
$result = $comm_ser->save_commodity($params);
$status = NULL;
$message = NULL;
if ($result != false) {
    $status = 0;
    $message = "发布成功,请等待审核";
    $act = $result;
} else {
    $status = ERR_INTERNAL;
    $message = "发布失败";
    $act = $param;
}
echo json_encode(array("status" => $status, "message" => $message, "activity" => $act));
Exemplo n.º 10
0
<?php

require_once ykfile("source/commodity_service.php");
$user_id = $_GET['user_id'];
$next_id = intval($_GET['next_id']);
$count = intval($_GET['count']);
$comsrv = new CommodityService();
$total = $comsrv->get_exchange_record_count($user_id);
$record = $comsrv->get_exchange_record($user_id, $next_id, $count);
echo json_encode(array("total" => $total, "records" => $record));