@@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
defined('IN_TS') or die('Access Denied.');
|
||||||
|
|
||||||
|
switch ($ts) {
|
||||||
|
case "":
|
||||||
|
break;
|
||||||
|
case"add_item":
|
||||||
|
echo"add item\n";
|
||||||
|
|
||||||
|
$item_suk=tsTitle($_POST['SUK']);
|
||||||
|
$platform=tsTitle($_POST['platform']);
|
||||||
|
$salestart=tsTitle($_POST['salestart']);
|
||||||
|
$mainphoto=tsTitle($_POST['mainphoto']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//这个phpthinks 会将所有_POST 里面的所有引号加反斜杠,需要使用stripslashes去反斜杠
|
||||||
|
$names=json_decode(stripslashes($_POST['names']));
|
||||||
|
$tags=json_decode(stripslashes($_POST['tags']));
|
||||||
|
|
||||||
|
|
||||||
|
$item = $new ['pricetrend']->find ( 'pricetrend_item', array (
|
||||||
|
'SUK'=>$item_suk,
|
||||||
|
'platform'=>$platform,
|
||||||
|
'salestart'=>$salestart,
|
||||||
|
) );
|
||||||
|
|
||||||
|
if(!$item)
|
||||||
|
{
|
||||||
|
$itemid = $new['pricetrend']->create('pricetrend_item',array(
|
||||||
|
'SUK'=>$item_suk,
|
||||||
|
'platform'=>$platform,
|
||||||
|
'salestart'=>$salestart,
|
||||||
|
'uploaddate'=> date("Y-m-d H:i:s"),
|
||||||
|
));
|
||||||
|
$arrUpload = tsUpload($_FILES['mainphoto'],$itemid,'pricetrend',array('jpg','png','jpeg','gif'));
|
||||||
|
$new['pricetrend'] -> update('pricetrend_item', array('SUK' => $item_suk),
|
||||||
|
array(
|
||||||
|
'mainphoto' => $arrUpload['url'],
|
||||||
|
));
|
||||||
|
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$itemid=$item['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//将名字写进数据库,并对应itemid
|
||||||
|
foreach($names as $name)
|
||||||
|
{
|
||||||
|
$tempname =json_decode(json_encode($name), true);
|
||||||
|
$tempname['name']=tsTitle($tempname['name']);
|
||||||
|
$tempname['region']=tsTitle($tempname['region']);
|
||||||
|
|
||||||
|
$sqlname = $new ['pricetrend']->find ( 'pricetrend_item_name', array (
|
||||||
|
'item_id'=>$itemid,
|
||||||
|
'name'=>$tempname['name'],
|
||||||
|
'region'=>$tempname['region'],
|
||||||
|
) );
|
||||||
|
if(!$sqlname)
|
||||||
|
{
|
||||||
|
$new ['pricetrend']->create ( 'pricetrend_item_name', array (
|
||||||
|
'item_id'=>$itemid,
|
||||||
|
'name'=>$tempname['name'],
|
||||||
|
'region'=>$tempname['region'],
|
||||||
|
) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理标签
|
||||||
|
foreach($tags as $tag)
|
||||||
|
{
|
||||||
|
aac ( 'tag' )->addTag ( 'pricetrend', 'id', $itemid, $tag );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//print_r($itemid);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "add_more":
|
||||||
|
echo "add more\n";
|
||||||
|
$item_suk=tsTitle($_POST['SUK']);
|
||||||
|
$price=tsTitle($_POST['price']);
|
||||||
|
$const=tsIntval($_POST['const']);
|
||||||
|
$price_type=tsTitle($_POST['price_type']);
|
||||||
|
$sources=tsTitle($_POST['sources']);
|
||||||
|
$shop=tsTitle($_POST['shop']);
|
||||||
|
$platform=tsTitle($_POST['platform']);
|
||||||
|
$salestart=tsTitle($_POST['salestart']);
|
||||||
|
//先获取item id
|
||||||
|
$item = $new ['pricetrend']->find ( 'pricetrend_item', array (
|
||||||
|
'SUK'=>$item_suk,
|
||||||
|
'platform'=>$platform,
|
||||||
|
'salestart'=>$salestart,
|
||||||
|
) );
|
||||||
|
|
||||||
|
if(!$item)
|
||||||
|
{
|
||||||
|
$itemid = $new['pricetrend']->create('pricetrend_item',array(
|
||||||
|
'SUK'=>$item_suk,
|
||||||
|
'platform'=>$platform,
|
||||||
|
'salestart'=>$salestart,
|
||||||
|
'uploaddate'=> date("Y-m-d H:i:s"),
|
||||||
|
));
|
||||||
|
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$itemid=$item['id'];
|
||||||
|
}
|
||||||
|
//再获取shop id
|
||||||
|
$shopit = $new ['pricetrend']->find ( 'pricetrend_shop', array (
|
||||||
|
'name'=>$shop,
|
||||||
|
|
||||||
|
) );
|
||||||
|
|
||||||
|
if(!$shopit)
|
||||||
|
{
|
||||||
|
$shopid = $new['pricetrend']->create('pricetrend_shop',array(
|
||||||
|
'name'=>$shop,
|
||||||
|
|
||||||
|
'uploaddate'=> date("Y-m-d H:i:s"),
|
||||||
|
));
|
||||||
|
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$shopid=$shopit['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$new['pricetrend']->create('pricetrend_item_price',array(
|
||||||
|
'item_id'=>$itemid,
|
||||||
|
'shop_id'=>$shopid,
|
||||||
|
'price_type'=>$price_type,
|
||||||
|
'price'=> $price,
|
||||||
|
'sources'=>$sources,
|
||||||
|
'uploaddate'=>date("Y-m-d H:i:s"),
|
||||||
|
));
|
||||||
|
$new['pricetrend']->create('pricetrend_item_const',array(
|
||||||
|
'item_id'=>$itemid,
|
||||||
|
'shop_id'=>$shopid,
|
||||||
|
'const'=>$const,
|
||||||
|
'uploaddate'=>date("Y-m-d H:i:s"),
|
||||||
|
));
|
||||||
|
echo "ok";
|
||||||
|
break;
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
defined('IN_TS') or die('Access Denied.');
|
||||||
|
|
||||||
|
$suk=tsTitle($_GET['suk']);
|
||||||
|
$name=tsTitle($_GET['name']);
|
||||||
|
|
||||||
|
|
||||||
|
$item = $new ['pricetrend']->find ( 'pricetrend_item', array (
|
||||||
|
'SUK'=>$suk,
|
||||||
|
) );
|
||||||
|
|
||||||
|
|
||||||
|
$item_id=$item['id'];
|
||||||
|
|
||||||
|
function getitem($item_id){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$names = $new ['pricetrend']->findall ( 'pricetrend_item_name', array (
|
||||||
|
'item_id'=>$item_id,
|
||||||
|
) );
|
||||||
|
|
||||||
|
$price = $new ['pricetrend']->findall ( 'pricetrend_item_price', array (
|
||||||
|
'item_id'=>$item_id,
|
||||||
|
) );
|
||||||
|
|
||||||
|
$const = $new ['pricetrend']->findall ( 'pricetrend_item_const', array (
|
||||||
|
'item_id'=>$item_id
|
||||||
|
) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "{";
|
||||||
|
|
||||||
|
echo "\"id\":";
|
||||||
|
echo "\"";
|
||||||
|
echo $item_id;
|
||||||
|
echo "\",";
|
||||||
|
|
||||||
|
echo "\"suk\":";
|
||||||
|
echo "\"";
|
||||||
|
echo $item['SUK'];
|
||||||
|
echo "\",";
|
||||||
|
|
||||||
|
echo "\"platform\":";
|
||||||
|
echo "\"";
|
||||||
|
echo $item['platform'];
|
||||||
|
echo "\",";
|
||||||
|
|
||||||
|
echo "\"salestart\":";
|
||||||
|
echo "\"";
|
||||||
|
echo $item['salestart'];
|
||||||
|
echo "\",";
|
||||||
|
|
||||||
|
echo "\"mainphoto\":";
|
||||||
|
echo "\"";
|
||||||
|
echo SITE_URL.'uploadfile/pricetrend/'.$item['mainphoto'];
|
||||||
|
echo "\",";
|
||||||
|
|
||||||
|
echo "\"names\":";
|
||||||
|
echo json_encode($names,JSON_UNESCAPED_UNICODE);
|
||||||
|
echo ",";
|
||||||
|
|
||||||
|
echo "\"price\":";
|
||||||
|
echo json_encode($price,JSON_UNESCAPED_UNICODE);
|
||||||
|
echo ",";
|
||||||
|
|
||||||
|
echo "\"const\":";
|
||||||
|
echo json_encode($const,JSON_UNESCAPED_UNICODE);
|
||||||
|
echo ",";
|
||||||
|
|
||||||
|
echo "}";
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('IN_TS') or die('Access Denied.');
|
defined('IN_TS') or die('Access Denied.');
|
||||||
|
include pubTemplate("header");
|
||||||
include template('index');
|
include template('index');
|
||||||
|
include pubTemplate("footer");
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{php include pubTemplate("header")}
|
|
||||||
|
|
||||||
{php include pubTemplate("footer")}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{php include pubTemplate("header")}
|
|
||||||
|
|
||||||
{php include pubTemplate("footer")}
|
|
||||||
Reference in New Issue
Block a user