application/api/model/v1/Shop.php

(开头部分) 146KB

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

<?php
/**
 * 易优CMS
 * ============================================================================
 * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.eyoucms.com
 * ----------------------------------------------------------------------------
 * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
 * ============================================================================
 * Author: 陈风任 <491085389@qq.com>
 * Date: 2020-05-07
 */

namespace app\api\model\v1;

use think\Db;
use think\Cache;
use think\Config;

/**
 * 微信小程序商城订单模型
 */
load_trait('controller/Jump');

class Shop extends UserBase
{
    use \traits\controller\Jump;

    private $miniproInfo = [];

    //初始化
    protected function initialize()
    {
        // 需要调用`Model`的`initialize`方法
        parent::initialize();
        $dataConf = tpSetting("OpenMinicode.conf_".self::$provider, [], self::$lang);
        $this->miniproInfo = json_decode($dataConf, true);
    }

    public function getCartTotalNum()
    {
        $cart_total_num = 0;
        if (!empty($this->users_id)){
            $cart_total_num = Db::name('shop_cart')->where(['users_id' => $this->users_id])->sum('product_num');
        }
        return $cart_total_num;
    }

    /*购物车操作--Start*/
    // 页面点击直接添加购物车
    public function ShopPageAddCart($post = [])
    {
        $post['product_id']  = intval($post['product_id']);
        $post['users_id']    = intval($post['users_id']);
        $post['product_num'] = intval($post['product_num']);

        // 查询条件
        $ArchivesWhere = [
            'aid'     => $post['product_id'],
            'lang'    => get_home_lang(),
后面还有 3444 行代码,购买后查看完整代码

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

AI 解读 AI

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

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