begin of thinksaas 3.68

Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
2023-06-22 13:33:25 +08:00
commit 963ec1b2ea
2746 changed files with 331806 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
include template ( "add" );
?>
+105
View File
@@ -0,0 +1,105 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
$userid = aac('user')->isLogin();
$shopid = intval ( $_POST ['shopid'] );
$much=intval ( $_POST ['much'] );
$strshop = $new ['shop']->find ( 'shop', array (
'shopid' => $shopid
) );/*
if ($strshop == '') {
header ( "HTTP/1.1 404 Not Found" );
header ( "Status: 404 Not Found" );
$title = '404';
include pubTemplate ( "404" );
exit ();
}*/
//卖家
$arrshopuser = aac ( 'user' )->getSimpleUser ( $strshop ['userid'] );
// 是否审核
if ($strshop ['isaudit'] == 1 && $TS_USER['isadmin']==0 && $TS_USER['userid']!=$strshop['userid']) {
tsNotice ( '内容审核中...' );
}
switch($_POST ['ts'] )
{
case "do":
$address=h($_POST['address']);
if($strshop['type']==1)//注册类
{
if($strshop['pay_type']==1)//积分支付
{
$preg = '/[^|\s]([\s\S])[$|\s]/';
$arr = explode("\n", $address);
$arr = array_filter($arr); // 删除空元素
$a=count($arr); //获取码数量
if($a!=$much)
{
tsNotice('你的购买数量是:'.$much.'但输入了:'.$a.'个申请');
}
if($much>$strshop['stock'])
{
tsNotice('库存不足!!');
}
$need_pay=$much*$strshop['pay'];
if(aac('user')->delScore($userid,"BUY".$strshop['title']."X".$much,$need_pay))
{
$reorder='';
for($b=0;$b<$a;$b++)
{
preg_replace('# #','',$arr[$b]);
$reorder=$reorder.'</br>for:'.$arr[$b].'</br>Key:'.md5($arr[$b].$strshop['note']).'</br>';
}
$orderid = $new['shop']->create('shop_order',array(
'userid'=>$userid,
'selluserid'=>$strshop['userid'],
'shopid'=>$strshop['shopid'],
'title'=>$strshop['title'],
'content'=>$strshop['content'],
'type'=>$strshop['type'],
'pay' => $strshop['pay'],
'pay_type' => $strshop['pay_type'],
'much'=> $much,
'address' => $address,
'reorder'=>$reorder,
'state' => 1,
'addtime'=>date('Y-m-d H:i:s')
));
$new['shop']->update ( 'shop', array (
'shopid' => $strshop['shopid']
), array (
'stock' => $strshop['stock']-$much
));
aac('user')->addScore($strshop['userid'],"订单:".$orderid."收益",$need_pay,1);
}else
{
tsNotice('积分不足!');
}
tsNotice('成功提交','查看订单',tsUrl('shop','order',array('id'=>$orderid)));
}
}
back;
case "cheack":
include template ( "buy" );
back;
}
+92
View File
@@ -0,0 +1,92 @@
<?php
defined('IN_TS') or die('Access Denied.');
//用户是否登录
$userid = aac('user')->isLogin($js,$userkey);
switch($ts){
case "do":
$authcode = strtolower($_POST['authcode']);
if ($TS_SITE ['isauthcode']) {
if ($authcode != $_SESSION ['verify']) {
getJson ( "验证码输入有误,请重新输入!" ,$js,0);
}
}
$shopid = intval($_POST['shopid']);
$content = tsClean($_POST['content'],$js);
$content2 = emptyText($_POST['content']);//测试空内容
$ispublic = intval($_POST['ispublic']);
//过滤内容开始
if($TS_USER['isadmin']==0){
aac('system')->antiWord($content,$js);
}
//过滤内容结束
if($content2==''){
getJson('没有任何内容是不允许你通过滴^_^',$js);
}else{
$commentid = $new['shop']->create('shop_comment',array(
'shopid' => $shopid,
'userid' => $userid,
'content' => $content,
'addtime'=> time(),
));
//发送系统消息(通知楼主有人回复他的帖子啦)
$strshop = $new['shop']->find('shop',array(
'shopid'=>$shopid,
));
if($strshop['userid'] != $TS_USER['userid']){
$msg_userid = '0';
$msg_touserid = $strshop['userid'];
$msg_content = '你的商品:《'.$strshop['shopname'].'》新增一条评论,快去看看给个回复吧^_^ ';
$msg_tourl = tsUrl('shop','show',array('id'=>$shopid));
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_tourl);
}
header("Location: ".tsUrl('shop','show',array('id'=>$shopid)));
}
break;
//删除评论
case "delete":
$commentid = intval($_GET['commentid']);
$strComment = $new['shop']->find('shop_comment',array(
'commentid'=>$commentid,
));
$strshop = $new['shop']->find('shop',array(
'shopid'=>$strComment['shopid'],
));
if($strshop['userid']==$userid || $TS_USER['isadmin']==1 || $strComment['userid']==$userid){
$new['shop']->delete('shop_comment',array(
'commentid'=>$commentid,
));
}
//跳转回到帖子页
header("Location: ".tsUrl('shop','show',array('id'=>$strComment['shopid'])));
break;
}
+70
View File
@@ -0,0 +1,70 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
//判断用户登录
$userid = aac('user') -> isLogin();
//判断发布者状态
if(aac('user')->isPublisher()==false) tsNotice('你还不能发布内容,检查邮箱是否认证。','->点击认证<-',tsUrl('user','verify'));
//echo print_r($_POST);
$title = trim($_POST['title']);
$type=intval($_POST['type']);
$comkey = trim($_POST['comkey']);
$content = tsClean($_POST['content']);
$pay_type=intval($_POST['pay_type']);
$pay=intval($_POST['pay']);
$stock=intval($_POST['stock']);
if (intval($TS_USER['isadmin']) == 0) {
// 过滤内容开始
aac('system') -> antiWord($title);
aac('system') -> antiWord($content);
// 过滤内容结束
}
if ($title == '' || $type == '' || $pay_type == '' || $pay == '')
{
tsNotice("Have null");
}
$isaudit = 0;
$shopid = $new['shop'] -> create('shop', array(
'userid' => $userid,
'locationid' => aac('user') -> getLocationId($userid),
'type' => $type,
'note' => $comkey,
'pay' => $pay,
'pay_type' => $pay_type,
'stock' => $stock,
'title' => $title,
'content' => $content,
'isaudit' => $isaudit,
'addtime' => date('Y-m-d H:i:s')
));
// 上传图片开始
$arrUpload = tsUpload($_FILES['photo'], $shopid, 'shop', array('jpg', 'gif', 'png', 'jpeg'));
if ($arrUpload) {
$new['shop'] -> update('shop', array(
'shopid' => $shopid
), array(
'path' => $arrUpload['path'],
'photo' => $arrUpload['url']
));
#生成不同尺寸的图片
//tsXimg($arrUpload['url'],'shop',320,180,$arrUpload['path'],'1');
//tsXimg($arrUpload['url'],'shop',640,'',$arrUpload['path']);
}
// 上传图片结束
header("Location: " . tsUrl('shop', 'show', array('id' => $shopid)));
?>
+24
View File
@@ -0,0 +1,24 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
$userid = aac('user')->isLogin();
$shopid = intval ( $_GET ['shopid'] );
$stredit = $new ['shop']->find ( 'shop', array ('shopid' => $shopid ) );
$stredit['content'] = tsDecode($stredit['content']);
if($stredit=='')
{
tsNotice('NO!');
}
if($userid!=$stredit['userid'])
{
tsNotice('NO');
}
include template ( "edit" );
?>
+62
View File
@@ -0,0 +1,62 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
$userid = aac('user')->isLogin();
$shopid = intval ( $_POST ['shopid'] );
$stredit = $new ['shop']->find ( 'shop', array ('shopid' => $shopid ) );
$stredit['content'] = tsDecode($stredit['content']);
if($stredit=='')
{
tsNotice('NO!');
}
if($userid!=$stredit['userid'])
{
tsNotice('NO');
}
$title = trim($_POST['title']);
$type=intval($_POST['type']);
$comkey = trim($_POST['comkey']);
$content = tsClean($_POST['content']);
$pay_type=intval($_POST['pay_type']);
$pay=intval($_POST['pay']);
$stock=intval($_POST['stock']);
if($_FILES['photo']!='')
{
// 上传图片开始
$arrUpload = tsUpload($_FILES['photo'], $shopid, 'shop', array('jpg', 'gif', 'png', 'jpeg'));
if ($arrUpload) {
$new['shop'] -> update('shop', array(
'shopid' => $shopid
), array(
'path' => $arrUpload['path'],
'photo' => $arrUpload['url']
));
#生成不同尺寸的图片
//tsXimg($arrUpload['url'],'shop',320,180,$arrUpload['path'],'1');
//tsXimg($arrUpload['url'],'shop',640,'',$arrUpload['path']);
}
// 上传图片结束
}
$new['shop'] -> update('shop', array('shopid' => $shopid), array(
'type' => $type,
'note' => $comkey,
'pay' => $pay,
'pay_type' => $pay_type,
'stock' => $stock,
'title' => $title,
'content' => $content,
'addtime' => date('Y-m-d H:i:s')
));
header("Location: " . tsUrl('shop', 'show', array('id' => $shopid)));
?>
+19
View File
@@ -0,0 +1,19 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
$page = isset($_GET['page']) ? intval($_GET['page']) : '1';
$url = tsUrl('shop','index',array('page'=>''));
$lstart = $page*30-30;
$arrAlbum = $new['shop']->findAll('shop',"`isaudit`=0",'shopid desc',null,$lstart.',30');
$albumNum = $new['shop']->findCount('shop');
$pageUrl = pagination($albumNum, 30, $page, $url);
include template ( "index" );
+25
View File
@@ -0,0 +1,25 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
$userid = aac('user')->isLogin();
$page = isset($_GET['page']) ? intval($_GET['page']) : '1';
$url = tsUrl('shop','myorder',array('page'=>''));
$lstart = $page*30-30;
$strmyoder = $new['shop']->findAll('shop_order',"`userid`=".$userid,'orderid desc',null,$lstart.',30');
foreach($strmyoder as $key=>$item){
$strmyoder[$key]['needpay'] = $strmyoder[$key]['pay']*$strmyoder[$key]['much'];
//卖家
$selluser = aac ( 'user' )->getSimpleUser ( $strmyoder [$key]['selluserid'] );
$strmyoder[$key]['sellusername']=$selluser['username'];
}
$albumNum = $new['shop']->findCount('shop_order');
$pageUrl = pagination($albumNum, 30, $page, $url);
include template ( "myorder" );
?>
+34
View File
@@ -0,0 +1,34 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
$userid = aac('user')->isLogin();
$oderid = intval ( $_GET ['id'] );
$stroder = $new ['shop']->find ( 'shop_order', array ('orderid' => $oderid ) );
if($stroder=='')
{
tsNotice('NO!');
}
if($userid!=$stroder['userid']&&$userid!=$stroder['selluserid'])
{
tsNotice('NO');
}
$needpay=$stroder['much']*$stroder['pay'];
$stroder['content'] = tsDecode($stroder['content']);
$buyuser=aac ( 'user' )->getSimpleUser ( $stroder['userid'] );
$selluser=aac ( 'user' )->getSimpleUser ( $stroder['selluserid'] );
//print_r($_GET);
//$stroder['address'] = htmlentities($stroder['address'], ENT_NOQUOTES, "utf-8");
include template ( "order" );
?>
+25
View File
@@ -0,0 +1,25 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
$userid = aac('user')->isLogin();
$page = isset($_GET['page']) ? intval($_GET['page']) : '1';
$url = tsUrl('shop','myorder',array('page'=>''));
$lstart = $page*30-30;
$strmyoder = $new['shop']->findAll('shop_order',"`selluserid`=".$userid,'orderid desc',null,$lstart.',30');
foreach($strmyoder as $key=>$item){
$strmyoder[$key]['needpay'] = $strmyoder[$key]['pay']*$strmyoder[$key]['much'];
//买家
$selluser = aac ( 'user' )->getSimpleUser ( $strmyoder [$key]['userid'] );
$strmyoder[$key]['buyusername']=$selluser['username'];
}
$albumNum = $new['shop']->findCount('shop_order');
$pageUrl = pagination($albumNum, 30, $page, $url);
include template ( "sellout" );
?>
+70
View File
@@ -0,0 +1,70 @@
<?php
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
$shopid = intval ( $_GET ['id'] );
$strshop = $new ['shop']->find ( 'shop', array (
'shopid' => $shopid
) );
if ($strshop == '') {
header ( "HTTP/1.1 404 Not Found" );
header ( "Status: 404 Not Found" );
$title = '404';
include pubTemplate ( "404" );
exit ();
}
//卖家
$arrshopuser = aac ( 'user' )->getSimpleUser ( $strshop ['userid'] );
//是否关注
if($TS_USER['userid'] != '' && $TS_USER['userid'] != $arrshopuser['userid']){
$userid=$arrshopuser['userid'];
$followNum = $db->once_num_rows("select * from ".dbprefix."user_follow where userid='".$TS_USER['userid']."' and userid_follow='$userid'");
if($followNum > '0'){
$arrshopuser['isfollow'] = true;
}else{
$arrshopuser['isfollow'] = false;
}
}else{
$arrshopuser['isfollow'] = false;
}
// 是否审核
if ($strshop ['isaudit'] == 1 && $TS_USER['isadmin']==0 && $TS_USER['userid']!=$strshop['userid']) {
tsNotice ( '内容审核中...' );
}
$strshop['content'] = tsDecode($strshop['content']);
// 获取评论
$page = isset ( $_GET ['page'] ) ? intval ( $_GET ['page'] ) : 1;
$url = tsUrl ( 'shop', 'show', array (
'id' => $shopid,
'page' => ''
) );
$lstart = $page * 10 - 10;
$arrComments = $new ['shop']->findAll ( 'shop_comment', array (
'shopid' => $shopid
), 'addtime desc', null, $lstart . ',10' );
foreach ( $arrComments as $key => $item ) {
$arrComment [] = $item;
$arrComment[$key]['content'] = tsDecode($item['content']);
$arrComment [$key] ['user'] = aac ( 'user' )->getSimpleUser ( $item ['userid'] );
}
$commentNum = $new ['shop']->findCount ( 'shop_comment', array (
'shopid' => $shopid
) );
$pageUrl = pagination ( $commentNum, 10, $page, $url );
// 标签
//$strshop ['tags'] = aac ( 'tag' )->getObjTagByObjid ( 'shop', 'shopid', $strshop ['shopid'] );
$title = $strshop['title'];
include template ( "show" );