module/flk/source/model/flk_coupon.model.php

(开头部分) 1KB

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

<?php
class flk_couponModel extends model{
	 
	public function __construct(){
		parent::__construct();
		 
		$this->table="mod_flk_coupon";
	}
	
	 
	
	public function getByIds($ids){
		if($ids){
			$data=$this->select(array("where"=>" id in("._implode($ids).")"));
			if($data){
				foreach($data as $v){
					$t_d[$v['id']]=$v;
				}
				return $t_d;
			}
		}
	}
	public function listByShop($userid,$shopid){
		$where=" status=0 AND shopid=".$shopid." AND userid=".$userid;
		$da=M("mod_flk_coupon_user")->select(array("where"=>$where));
		if($da){
			foreach($da as $v){
				$ids[]=$v['coupon_id'];
			}
			$coupons=$this->select(array("where"=>"  id in("._implode($ids).") "));
			return $coupons;
		}
	}
	/**
	 * 可用优惠券
	 */
	public function UseList($shopid,$userid,$money){
		//无需取券
		$where=" status=1 AND typeid=1 AND lower_money<".$money." AND end_time>".time()." AND shopid=".$shopid;
		$list=M("mod_flk_coupon")->select(array("where"=>$where));
		//已获取的券
		$where=" status=0 AND shopid=".$shopid."  AND userid=".$userid;
		$da=M("mod_flk_coupon_user")->select(array("where"=>$where));
		$coupons=array();
		if($da){
			foreach($da as $v){
				$ids[]=$v['coupon_id'];
			}
			$coupons=$this->select(array("where"=>"  id in("._implode($ids).") AND lower_money<".$money." "));
		}
		//合并
		$data=array();
		if($list){
			foreach($list as $v){
				$data[$v["id"]]=$v;
			}
		}
		if($coupons){
			foreach($coupons as $v){
				$data[$v["id"]]=$v;
后面还有 19 行代码,购买后查看完整代码

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

AI 解读 AI

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

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