module/flk/source/index/flk_cart.ctrl.php

(开头部分) 4KB

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

<?php
	class flk_cartControl extends skymvc{
		
		public function __construct(){
			parent::__construct();
		}
		public function onInit(){
			M("login")->checkLogin();
		}
		public function onDefault(){
			$userid=M("login")->userid;
			$shopid=get("shopid","i");
			$where="userid=".$userid;
			if($shopid){
				$where.="  shopid=".$shopid;
			}
			$cartList=MM("flk","flk_cart")->Dselect(array(
				"where"=>$where
			));
			$shopids=array();
			$spcarts=array();
			$shopCarts=array();
			if($cartList){
				foreach($cartList as $v){
					$shopids[]=$v["shopid"];
					$spcarts[$v["shopid"]][]=$v;
				}
				$shopids=array_unique($shopids);
				$shops=MM("flk","flk_shop")->getListByIds($shopids);
				if($shops){
	
					foreach($shops as $k=>$shop){
						$cart=$spcarts[$shop["shopid"]];
						$total_num=0;
						$total_money=0;
						foreach($cart as $v){
							$total_num+=$v["amount"];
							$total_money+=$v["amount"]*$v["price"];
						}
						$shop["cart"]=$spcarts[$shop["shopid"]];
						$shop["total_num"]=$total_num;
						$shop["total_money"]=$total_money;
						$shopCarts[$k]=$shop;
					}
				
				}
			}
			 
			
			$this->smarty->goAssign(array(
				"shopCarts"=>$shopCarts,
			));
			$this->smarty->display("flk_cart/index.html");
		}
		public function onAdd(){
			$userid=M("login")->userid;
			
			$productid=get("productid","i");
			$ksid=get("ksid","i");
			$cart=MM("flk","flk_cart")->selectRow("userid=".$userid." AND productid=".$productid." AND ksid=".$ksid);
后面还有 138 行代码,购买后查看完整代码

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

AI 解读 AI

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

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