application/index/controller/GoodsDetail.php

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace app\index\controller;

//use think\Controller;
use app\index\model\UserOrderSpace;
use app\index\model\GoodsSpace;
use app\index\model\ShopSpace;
use app\index\model\CommontSpace;

class GoodsDetail extends Base {

    public function index() {
        $goods_status = $this->check_goods_status();
        if ($goods_status != 2) {
            return $this->fetch('ajax/tip', ['info' => '该商品未上架']);
        }
        $GoodsSpace = GoodsSpace::get(['id' => request()->param('id')]);
        if (!$GoodsSpace) {
            return $this->fetch('ajax/tip', ['info' => '该商品不存在或者已删除']);
        }
        $ShopSpace = ShopSpace::where(['shop_uid' => $GoodsSpace['pub_uid']])->find();

        //增加围观次数
        $GoodsSpace->saw_num+=1;
        $GoodsSpace->save();
//     获得该店铺其他商品 开始   
        $goodslist_old = GoodsSpace::where(['pub_uid' => $GoodsSpace['pub_uid'], 'goods_status' => 2])->order('update_time', 'asc')->select();
        foreach ($goodslist_old as $value) {
            $value['arr_pic'] = explode(",", $value['pic']);
            $goodslist[] = $value;
        }
        $this->assign('goodslist', $goodslist);
        //          获得该店铺其他商品 结束     

        if ($GoodsSpace['buy_method'] == 2) {
            $is_download = $this->check_is_download($GoodsSpace['id']);
            $this->assign('is_download', $is_download);
        }
        if ($GoodsSpace['pic']) {
            $arr_pic = explode(",", $GoodsSpace['pic']);
        }
        if ($GoodsSpace['file']) {
            $arr_file = explode(",", $GoodsSpace['file']);
        }
        if ($GoodsSpace['color']) {
            $arr_color = explode(",", $GoodsSpace['color']);
        }
        if ($GoodsSpace['model']) {
            $arr_model = explode(",", $GoodsSpace['model']);
        }
        $this->assign('arr_color', $arr_color);
        $this->assign('arr_model', $arr_model);
        $this->assign('arr_pic', $arr_pic);
        $this->assign('arr_file', $arr_file);
        $brand = db('goods_brand_space')->order('id', 'asc')->select();

        $this->assign('brand', $brand);
        $CommontSpace_old = CommontSpace::where(['commont_type' => 1, 'goods_id' => request()->param('id')])->order('update_time', 'desc')->select();
        $avg_quality = CommontSpace::where(['commont_type' => 1, 'goods_id' => request()->param('id')])->avg("quality");
后面还有 57 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。