Wayne 3 years ago
parent f6a19f95b7
commit 00a74d21fb

1
app/.gitignore vendored

@ -6,6 +6,7 @@
/public/storage
/public/m
/public/adm/assets
/public/temp/*
/public/data/config.php
/adminsrc/node_modules
/adminsrc/dist

@ -4,6 +4,8 @@ namespace app\appapi\controller\v1;
use app\appapi\ApiController;
use think\facade\Db;
use app\common\Goods as GoodsBusiness;
class Goods extends ApiController
{
public function getGoods(){
@ -29,6 +31,8 @@ class Goods extends ApiController
$res['goods_gallery'][$key]['img_url'] = getUrl()."/".$val['img_url'];
}
$res['goods_attr'] = GoodsBusiness::get_goods_properties($id);
//更新產品點擊數
Db::name('goods')->where('goods_id',$id)->inc('click_count')->update();
// return $this->Success($ads);
@ -41,6 +45,7 @@ class Goods extends ApiController
$result = Db::name('goods')
->where('cat_id',$cat_id)
->where('goods_id','>',1)
->where('is_on_sale',1)
->select()
->toArray();

@ -2,12 +2,14 @@
namespace app\appapi\controller\v1;
use app\appapi\ApiController;
use think\facade\Db;
class Test extends ApiController
{
public function test(){
return 'test';
$rtn = \app\common\Goods::get_goods_properties(13);
print_r($rtn);
}
}

@ -311,3 +311,7 @@ function get_order_sn()
function getUserIdByUid($uid){
return Db::name('users')->where('sso_user_id',$uid)->value('user_id');
}
function price_format($price){
return $price;
}

@ -0,0 +1,66 @@
<?php
namespace app\common;
use think\facade\Db;
class Goods
{
public static function get_goods_properties($id)
{
/* 對屬性進行重新排序和分組 */
$grp = Db::name('goods_type')
->alias('gt')
->join('goods g', 'gt.cat_id=g.goods_type')
->where('g.goods_id', $id)
->value('attr_group');
if (!empty($grp)) {
$groups = explode("\n", strtr($grp, "\r", ''));
}
$res = Db::name('goods_attr')
->field('a.attr_id, a.attr_name, a.attr_group, a.is_linked, a.attr_type,g.goods_attr_id, g.attr_value, g.attr_price, g.attr_sort_order,g.thumb_url,g.img_url, g.img_original, hex_color')
->alias('g')
->join('attribute a', 'a.attr_id=g.attr_id')
->where('g.goods_id', $id)
->order('a.sort_order, a.attr_id, g.attr_sort_order, g.attr_price, g.goods_attr_id')
->select();
$arr['pro'] = []; // 屬性
$arr['spe'] = []; // 規格
$arr['lnk'] = []; // 關聯的屬性
foreach ($res as $row) {
$row['attr_value'] = str_replace("\n", '<br />', $row['attr_value']);
if ($row['attr_type'] == 0) {
$group = (isset($groups[$row['attr_group']])) ? $groups[$row['attr_group']] : $GLOBALS['_LANG']['goods_attr'];
$arr['pro'][$group][$row['attr_id']]['name'] = $row['attr_name'];
$arr['pro'][$group][$row['attr_id']]['value'] = $row['attr_value'];
} else {
$arr['spe'][$row['attr_id']]['attr_type'] = $row['attr_type'];
$arr['spe'][$row['attr_id']]['name'] = $row['attr_name'];
$arr['spe'][$row['attr_id']]['values'][] = array(
'label' => $row['attr_value'],
'price' => $row['attr_price'],
'thumb_url' => $row['thumb_url'],
'img_url' => $row['img_url'],
'img_original' => $row['img_original'],
'hex_color' => $row['hex_color'],
'format_price' => price_format(abs($row['attr_price']), false),
'id' => $row['goods_attr_id']
);
}
if ($row['is_linked'] == 1) {
/* 如果該屬性需要關聯,先保存下來 */
$arr['lnk'][$row['attr_id']]['name'] = $row['attr_name'];
$arr['lnk'][$row['attr_id']]['value'] = $row['attr_value'];
}
}
return $arr;
}
}

@ -1094,10 +1094,10 @@ function product_list($goods_id, $conditions = '')
$_goods_attr_array = explode('|', $value['goods_attr']);
if (is_array($_goods_attr_array))
{
$_temp = '';
$_temp = [];
foreach ($_goods_attr_array as $_goods_attr_value)
{
$_temp[] = $goods_attr[$_goods_attr_value];
$_temp[] = $goods_attr[(int)$_goods_attr_value];
}
$row[$key]['goods_attr'] = $_temp;
}

@ -1,9 +1,8 @@
<?php
echo $_REQUEST['act'];
exit;
define('IN_ASC', true);
require(dirname(__FILE__) . '/includes/init.php');
require(ROOT_PATH.'quick_buy_init.php');

@ -1007,6 +1007,7 @@ function get_goods_properties($goods_id)
$sql = "SELECT attr_group ".
"FROM " . $GLOBALS['ecs']->table('goods_type') . " AS gt, " . $GLOBALS['ecs']->table('goods') . " AS g ".
"WHERE g.goods_id='$goods_id' AND gt.cat_id=g.goods_type";
$grp = $GLOBALS['db']->getOne($sql);
if (!empty($grp))
@ -1073,6 +1074,7 @@ function get_goods_properties($goods_id)
*/
function get_same_attribute_goods($attr)
{
$lnk = array();
if (!empty($attr))

@ -1,2 +0,0 @@
*
!.gitignore

@ -1,2 +0,0 @@
*
!.gitignore

@ -1,6 +0,0 @@
<?php
$this->mysql_config_cache_file_time = 1689559229;
$this->timeline = 0;
$this->timezone = 0;
$this->platform = 'OTHER';
?>

@ -1,134 +0,0 @@
<?php
$data = array (
0 =>
array (
'cat_id' => '16',
'cat_name' => '網站資訊',
'cat_type' => '1',
'keywords' => '網站資訊',
'cat_desc' => '',
'sort_order' => '1',
'show_in_nav' => '0',
'parent_id' => '0',
'has_children' => '0',
'aricle_num' => '0',
),
1 =>
array (
'cat_id' => '1',
'cat_name' => '系統分類',
'cat_type' => '2',
'keywords' => '',
'cat_desc' => '系統保留分類',
'sort_order' => '50',
'show_in_nav' => '0',
'parent_id' => '0',
'has_children' => '2',
'aricle_num' => '0',
),
2 =>
array (
'cat_id' => '17',
'cat_name' => '頁面',
'cat_type' => '3',
'keywords' => '',
'cat_desc' => '',
'sort_order' => '50',
'show_in_nav' => '0',
'parent_id' => '0',
'has_children' => '0',
'aricle_num' => '2',
),
3 =>
array (
'cat_id' => '2',
'cat_name' => '網店信息',
'cat_type' => '2',
'keywords' => '',
'cat_desc' => '網店信息分類',
'sort_order' => '50',
'show_in_nav' => '0',
'parent_id' => '1',
'has_children' => '0',
'aricle_num' => '4',
),
4 =>
array (
'cat_id' => '3',
'cat_name' => '網店幫助分類',
'cat_type' => '2',
'keywords' => '',
'cat_desc' => '網店幫助分類',
'sort_order' => '50',
'show_in_nav' => '0',
'parent_id' => '1',
'has_children' => '5',
'aricle_num' => '0',
),
5 =>
array (
'cat_id' => '5',
'cat_name' => '新手上路 ',
'cat_type' => '2',
'keywords' => '',
'cat_desc' => '',
'sort_order' => '50',
'show_in_nav' => '0',
'parent_id' => '3',
'has_children' => '0',
'aricle_num' => '3',
),
6 =>
array (
'cat_id' => '7',
'cat_name' => '配送方式 ',
'cat_type' => '2',
'keywords' => '',
'cat_desc' => '配送與支付 ',
'sort_order' => '50',
'show_in_nav' => '1',
'parent_id' => '3',
'has_children' => '0',
'aricle_num' => '3',
),
7 =>
array (
'cat_id' => '8',
'cat_name' => '售後服務',
'cat_type' => '2',
'keywords' => '',
'cat_desc' => '',
'sort_order' => '50',
'show_in_nav' => '0',
'parent_id' => '3',
'has_children' => '0',
'aricle_num' => '4',
),
8 =>
array (
'cat_id' => '9',
'cat_name' => '關於我們 ',
'cat_type' => '2',
'keywords' => '',
'cat_desc' => '聯繫我們 ',
'sort_order' => '50',
'show_in_nav' => '0',
'parent_id' => '3',
'has_children' => '0',
'aricle_num' => '1',
),
9 =>
array (
'cat_id' => '10',
'cat_name' => '購物指南',
'cat_type' => '2',
'keywords' => '',
'cat_desc' => '',
'sort_order' => '50',
'show_in_nav' => '0',
'parent_id' => '3',
'has_children' => '0',
'aricle_num' => '3',
),
);
?>

@ -1,55 +0,0 @@
<?php
$data = array (
1 =>
array (
'cat_id' => '1',
'cat_name' => '咖啡類',
'cat_ico' => '',
'measure_unit' => '',
'parent_id' => '0',
'is_show' => '1',
'show_in_nav' => '0',
'grade' => '0',
'sort_order' => '10',
'has_children' => '0',
'goods_num' => '11',
'level' => 0,
'id' => '1',
'name' => '咖啡類',
),
3 =>
array (
'cat_id' => '3',
'cat_name' => '荼類',
'cat_ico' => '',
'measure_unit' => '',
'parent_id' => '0',
'is_show' => '1',
'show_in_nav' => '0',
'grade' => '0',
'sort_order' => '20',
'has_children' => '0',
'goods_num' => 0,
'level' => 0,
'id' => '3',
'name' => '荼類',
),
2 =>
array (
'cat_id' => '2',
'cat_name' => '定食類',
'cat_ico' => '',
'measure_unit' => '',
'parent_id' => '0',
'is_show' => '1',
'show_in_nav' => '0',
'grade' => '0',
'sort_order' => '30',
'has_children' => '0',
'goods_num' => '1',
'level' => 0,
'id' => '2',
'name' => '定食類',
),
);
?>

@ -1,46 +0,0 @@
<?php
$data = array (
0 =>
array (
'cat_id' => '1',
'cat_name' => '咖啡類',
'cat_ico' => '',
'measure_unit' => '',
'parent_id' => '0',
'is_show' => '1',
'show_in_nav' => '0',
'grade' => '0',
'sort_order' => '10',
'has_children' => '0',
'goods_num' => '11',
),
1 =>
array (
'cat_id' => '3',
'cat_name' => '荼類',
'cat_ico' => '',
'measure_unit' => '',
'parent_id' => '0',
'is_show' => '1',
'show_in_nav' => '0',
'grade' => '0',
'sort_order' => '20',
'has_children' => '0',
'goods_num' => 0,
),
2 =>
array (
'cat_id' => '2',
'cat_name' => '定食類',
'cat_ico' => '',
'measure_unit' => '',
'parent_id' => '0',
'is_show' => '1',
'show_in_nav' => '0',
'grade' => '0',
'sort_order' => '30',
'has_children' => '0',
'goods_num' => '1',
),
);
?>

@ -1,16 +0,0 @@
<?php
$data = array (
'best' =>
array (
),
'new' =>
array (
),
'hot' =>
array (
),
'brand' =>
array (
),
);
?>

@ -1,214 +0,0 @@
<?php
$data = array (
'shop_name' => '築空間',
'shop_title' => '電商網站',
'shop_desc' => '電商網站',
'shop_keywords' => '',
'shop_address' => '忠孝東路',
'line' => '',
'service_company' => '築空間',
'service_email' => 'arki@abc.com',
'service_phone' => '0900000001',
'shop_closed' => '0',
'close_comment' => '商店盤點中,請稍後',
'shop_logo' => 'images/20230710/dfc117b76fc473110ce9ef085688f1b9.png',
'user_notice' => '用户中心公告!',
'shop_notice' => '',
'shop_reg_closed' => '0',
'lang' => 'zh_tw',
'watermark' => '../images/watermark.gif',
'watermark_place' => '5',
'watermark_alpha' => 50,
'use_storage' => '1',
'market_price_rate' => 1.2,
'rewrite' => '0',
'integral_name' => '金幣',
'integral_scale' => 1.0,
'integral_percent' => '100',
'sn_prefix' => 'MDZ',
'comment_check' => '1',
'no_picture' => 'images/no_picture.gif',
'stats_code' => '',
'cache_time' => 1800,
'register_points' => '5',
'enable_gzip' => '1',
'top10_time' => 0,
'timezone' => '8',
'upload_size_limit' => '4096',
'cron_method' => '0',
'comment_factor' => '3',
'enable_order_check' => '1',
'default_storage' => 500,
'bgcolor' => '#FFFFFF',
'visit_stats' => 'on',
'send_mail_on' => 'off',
'auto_generate_gallery' => '1',
'retain_original_img' => '1',
'member_email_validate' => '0',
'message_board' => '1',
'token' => '1d825bf072672566d6961b48d26b44378a5aff73417223d90a4a43327b17bfdc',
'send_verify_email' => '0',
'ent_id' => '',
'ent_ac' => '',
'ent_sign' => '',
'ent_email' => '',
'date_format' => 'Y-m-d',
'time_format' => 'Y-m-d H:i:s',
'currency_format' => '<font>NT$%s</font>',
'thumb_width' => 400,
'thumb_height' => 400,
'image_width' => 230,
'image_height' => 230,
'top_number' => 10,
'history_number' => 5,
'comments_number' => 5,
'bought_goods' => 5,
'article_number' => 5,
'goods_name_length' => 30,
'price_format' => '0',
'page_size' => 11,
'sort_order_type' => '0',
'sort_order_method' => '0',
'show_order_type' => '1',
'attr_related_number' => '5',
'goods_gallery_number' => 5,
'article_title_length' => '15',
'name_of_region_1' => '國家',
'name_of_region_2' => '省',
'name_of_region_3' => '市',
'name_of_region_4' => '區',
'search_keywords' => '',
'related_goods_number' => '4',
'help_open' => '1',
'article_page_size' => '5',
'page_style' => '1',
'recommend_order' => '0',
'index_ad' => 'sys',
'can_invoice' => '1',
'use_integral' => '1',
'use_bonus' => '1',
'use_surplus' => '1',
'use_how_oos' => '1',
'send_confirm_email' => '0',
'send_ship_email' => '0',
'send_cancel_email' => '0',
'send_invalid_email' => '0',
'order_pay_note' => '1',
'order_unpay_note' => '1',
'order_ship_note' => '1',
'order_receive_note' => '1',
'order_unship_note' => '1',
'order_return_note' => '1',
'order_invalid_note' => '1',
'order_cancel_note' => '0',
'invoice_content' => '購物清單',
'anonymous_buy' => '0',
'min_goods_amount' => 0.0,
'one_step_buy' => 0,
'invoice_type' =>
array (
'type' =>
array (
0 => '增值税普通發票(小規模納税人)',
1 => '增值税專用發票(一般納税人)',
2 => '',
),
'rate' =>
array (
0 => 1.5,
1 => 3.0,
2 => 0.0,
),
),
'stock_dec_time' => '0',
'cart_confirm' => '4',
'send_service_email' => '0',
'show_goods_in_cart' => '3',
'show_attr_in_cart' => '1',
'smtp_host' => 'smtp.qq.com',
'smtp_port' => '25',
'smtp_user' => '',
'smtp_pass' => '',
'smtp_mail' => '',
'mail_charset' => 'UTF8',
'mail_service' => '1',
'smtp_ssl' => '0',
'integrate_code' => 'shop',
'integrate_config' => '',
'hash_code' => '2aab9f77cc5ab4694b2b6009f5785883',
'template' => 'shengxian',
'install_date' => '1447726949',
'ecs_version' => 'v2.7.3',
'sms_user_name' => '',
'sms_password' => '',
'sms_auth_str' => '',
'sms_domain' => '',
'sms_count' => '',
'sms_total_money' => '',
'sms_balance' => '',
'sms_last_request' => '',
'affiliate' => '{"on":"1","config":{"separator_type":"1","expire":"24","expire_unit":"hour","level_money_all":"100","level_point_all":"0","level_register_all":"0","level_register_up":"0"},"item":[{"level_money":"40","level_point":"0"},{"level_money":"5","level_point":"0"},{"level_money":"3","level_point":"0"},{"level_money":"2","level_point":"0"}]}',
'captcha' => '47',
'captcha_width' => '100',
'captcha_height' => '20',
'sitemap' => 'a:6:{s:19:"homepage_changefreq";s:6:"hourly";s:17:"homepage_priority";s:3:"0.9";s:19:"category_changefreq";s:6:"hourly";s:17:"category_priority";s:3:"0.8";s:18:"content_changefreq";s:6:"weekly";s:16:"content_priority";s:3:"0.7";}',
'points_rule' => '',
'flash_theme' => 'dynfocus',
'stylename' => '',
'show_goodssn' => '0',
'show_brand' => '1',
'show_goodsweight' => '0',
'show_goodsnumber' => '1',
'show_addtime' => '0',
'goodsattr_style' => '1',
'show_marketprice' => '1',
'message_check' => '1',
'okback_time' => '3',
'delback_time' => '3',
'weixiu_time' => '2',
'ecsdxt_gateway' => '1',
'ecsdxt_user_name' => 'limingsheng',
'ecsdxt_pass_word' => '111222',
'ecsdxt_shop_mobile' => '15916852053',
'ecsdxt_smsgap' => '60',
'ecsdxt_mobile_reg' => '0',
'ecsdxt_mobile_reg_value' => '您的手機號:{$user_mobile},註冊驗證碼:{$verify_code}24小時內提交有效。感謝您的註冊',
'ecsdxt_mobile_log' => '0',
'ecsdxt_mobile_pwd' => '0',
'ecsdxt_mobile_pwd_value' => '您的用户名:{$user_name},新密碼:{$new_password}。請及時登陸修改密碼!',
'ecsdxt_mobile_changepwd' => '0',
'ecsdxt_mobile_changepwd_value' => '您的用户名:{$user_name},密碼已修改,新密碼:{$new_password}。請牢記新密碼!',
'ecsdxt_mobile_bind' => '0',
'ecsdxt_mobile_bind_value' => '您的手機號:{$user_mobile},綁定驗證碼:{$verify_code}。一天內提交有效!',
'ecsdxt_mobile_cons' => '0',
'ecsdxt_customer_registed' => '0',
'ecsdxt_customer_registed_value' => '您註冊的用户名:{$user_name},密碼:{$user_pwd}。感謝您的註冊!',
'ecsdxt_order_placed' => '0',
'ecsdxt_order_placed_value' => '您有新的訂單:{$order_sn},收貨人:{$consignee},電話:{$tel},請及時確認訂單!',
'ecsdxt_order_canceled' => '0',
'ecsdxt_order_canceled_value' => '訂單號 {$order_sn} 買家已取消訂單!',
'ecsdxt_order_payed' => '0',
'ecsdxt_order_payed_value' => '訂單號 {$order_sn} 買家付款了。收貨人:{$consignee},電話:{$tel}。請及時安排發貨!',
'ecsdxt_order_confirm' => '0',
'ecsdxt_order_confirm_value' => '訂單號 {$order_sn} 買家已確認收貨!',
'ecsdxt_customer_placed' => '0',
'ecsdxt_customer_placed_value' => '您的訂單:{$order_sn},收貨人:{$consignee} 電話:{$tel},已經成功提交。感謝您的購買!',
'ecsdxt_customer_canceled' => '0',
'ecsdxt_customer_canceled_value' => '您的訂單:{$order_sn},已取消!',
'ecsdxt_customer_payed' => '0',
'ecsdxt_customer_payed_value' => '您的訂單:{$order_sn},已於{$time}付款成功。感謝您的購買!',
'ecsdxt_customer_confirm' => '0',
'ecsdxt_customer_confirm_value' => '您的訂單:{$order_sn},確認收貨成功。感謝您購買與支持,歡迎您下次光臨!',
'ecsdxt_order_picking' => '0',
'ecsdxt_order_picking_value' => '訂單號:{$order_sn} 已於{$time}配貨。如有問題請及時聯繫!',
'ecsdxt_order_shipped' => '0',
'ecsdxt_order_shipped_value' => '訂單號:{$order_sn} 已於{$time}發貨,如有問題請及時聯繫!',
'show_sales_type' => '0',
'best_number' => 3,
'new_number' => 3,
'hot_number' => 3,
'promote_number' => 3,
'qq' => '',
'ww' => '',
);
?>

@ -69,60 +69,22 @@
<!-- Product Detail Start -->
<div class="product-detail section-p-t">
<div class="product-detail-box">
<!-- <h2 class="title-color">產品介紹</h2> -->
<!-- <p class="content-color font-base" v-html="goods.goods_desc"> -->
<!-- </p> -->
<h2 class="title-color">產品介紹</h2>
<p class="content-color font-base" v-html="goods.goods_desc">
</p>
</div>
</div>
<!-- Product Detail End -->
</section>
<!-- Product Section Section End -->
<!-- Product Review Section Start -->
<!-- <section class="product-review pb-0">
<div class="top-content">
<h3 class="title-color">用戶評論(15)</h3>
<a href="javascript:void(0)" data-bs-toggle="offcanvas" data-bs-target="#all-review" class="font-xs">See
all</a>
</div>
<div class="review-wrap">
<div class="review-box">
<div class="media">
<img src="@/assets/images/avatar/avatar.jpg" alt="avatar" />
<div class="media-body">
<h4 class="font-sm title-color">Andrea Joanne</h4>
<div class="rating">
<i data-feather="star"></i>
<i data-feather="star"></i>
<i data-feather="star"></i>
<i data-feather="star"></i>
<i data-feather="star"></i>
</div>
</div>
</div>
<p class="font-sm content-color">It's a really cute skirt! I didn't expect to feel so good in a
polyester material. The print is slightly</p>
</div>
<div class="review-box">
<div class="media">
<img src="@/assets/images/avatar/avatar.jpg" alt="avatar" />
<div class="media-body">
<h4 class="font-sm title-color">Andrea Joanne</h4>
<div class="rating">
<i data-feather="star"></i>
<i data-feather="star"></i>
<i data-feather="star"></i>
<i data-feather="star"></i>
<i data-feather="star"></i>
</div>
</div>
</div>
<p class="font-sm content-color">It's a really cute skirt! I didn't expect to feel so good in a
polyester material. The print is slightly</p>
</div>
</div>
</section> -->
<!-- Product Review Section End -->
<section class="attr-section" v-if="goods.goods_attr.spe" v-for="(spec,index) in goods.goods_attr.spe" :key="index">
{{ spec.name }}
<van-radio-group v-model="checked" direction="horizontal" >
<van-radio name="1" v-for="(v,i) in spec.values" :key="i">
{{ v.label }}
</van-radio>
</van-radio-group>
</section>
</main>
<!-- Main End -->
@ -132,13 +94,6 @@
<section class="detail-section" v-html="goods.goods_desc"></section>
</main>
<!-- Main End -->
<!-- Main Start -->
<main class="main-wrap comment-page mb-xxl" v-if="active == 2">
<section class="comment-section">評論</section>
</main>
<!-- Main End -->
<footer class="footer-nav">
<ul class="footer-left">
<li class="footer-item">
@ -170,7 +125,11 @@ const router = useRouter();
const cartStore = useCartStore();
const active = ref(0);
const goods = ref({});
const goods = ref({
goods_attr: {
spe: [],
},
});
const goodsNumber = ref(0);
//goods_id

Loading…
Cancel
Save