예제 #1
0
function xt_admin_ajax_jifen_item_update()
{
    $result = array('code' => 0, 'msg' => '', 'result' => array());
    if (!isset($_POST['id']) || empty($_POST['id'])) {
        exit('未指定商品');
    }
    if (!isset($_POST['title']) || empty($_POST['title'])) {
        exit('未指定商品标题');
    }
    if (!isset($_POST['pic']) || empty($_POST['pic'])) {
        exit('未指定商品图标地址');
    }
    if (!isset($_POST['sort']) || empty($_POST['sort'])) {
        exit('未指定商品排序');
    }
    if (!isset($_POST['stock']) || empty($_POST['stock'])) {
        exit('未指定商品库存');
    }
    if (!isset($_POST['jifen']) || empty($_POST['jifen'])) {
        exit('未指定商品兑换' . xt_jifenbao_text());
    }
    if (!isset($_POST['userCount']) || empty($_POST['userCount'])) {
        exit('未指定商品每人限兑数量');
    }
    global $wpdb;
    $id = (int) $_POST['id'];
    $title = $_POST['title'];
    $pic = $_POST['pic'];
    $sort = $_POST['sort'];
    $stock = $_POST['stock'];
    $jifen = $_POST['jifen'];
    $user_count = $_POST['userCount'];
    $wpdb->update(XT_TABLE_USER_JIFEN_ITEM, array('title' => $title, 'pic' => $pic, 'sort' => (int) $sort, 'stock' => (int) $stock, 'jifen' => (int) $jifen, 'user_count' => $user_count, 'content' => isset($_POST['content']) ? $wpdb->escape($_POST['content']) : ''), array('id' => $id));
    $item = $wpdb->get_row('SELECT * FROM ' . XT_TABLE_USER_JIFEN_ITEM . ' WHERE id=' . $wpdb->escape($id));
    exit(xt_row_jifenItem($item, isset($_POST['alternate']) && $_POST['alternate'] ? 0 : 1));
}
예제 #2
0
			<th class="manage-column" style="width: 60px"><span><?php 
    echo xt_jifenbao_text();
    ?>
</span></th>
			<th class="manage-column" style="width: 60px"><span>库存</span></th>
			<th class="manage-column" style="width: 60px"><span>每人限兑</span></th>
			<th class="manage-column" style="width: 60px"><span>已兑换</span></th>
			<th class="manage-column" style="width: 60px"><span>排序</span></th>
			<th class="manage-column"><span>备注</span></th>
		</tr>
	</tfoot>
	<tbody id="the-list" class="list:tag">
		<?php 
    $_jifenItem_count = 0;
    foreach ($_jifenItems as $jifenItem) {
        xt_row_jifenItem($jifenItem, $_jifenItem_count);
        $_jifenItem_count++;
    }
    ?>
	</tbody>
</table>
<table style="display: none">
	<tbody>
		<tr id="inline-edit" class="inline-edit-row">
			<td colspan="5" class="colspanchange">
				<fieldset>
					<div class="inline-edit-col">
						<h4>快速编辑</h4>
						<label> <span class="title">商品标题</span> <span class="input-text-wrap"><input type="text" name="title" class="ptitle" value="" /></span></label>
						<label> <span class="title">图片地址</span> <span class="input-text-wrap"><input type="text" name="pic" class="ptitle" value="" /></span></label>
						<label> <span class="title">排序</span> <span class="input-text-wrap"><input type="text" style="width:80px;" name="sort" class="ptitle" value="" /></span></label>