module/flk/source/model/flk_shop_earnest.model.php

(完整代码) 1KB

<?php
class flk_shop_earnestModel extends model{
	
	public $table="mod_flk_shop_earnest";
	public function __construct(){
		parent::__construct();
	}
	public function get($shopid){
		$row=$this->selectRow("shopid=".$shopid);
		if(!$row){
			$this->insert(array(
				"shopid"=>$shopid,
				"createtime"=>date("Y-m-d H:i:s"),
				"money"=>0
			));
			$row=$this->selectRow("shopid=".$shopid);
		}
		return $row;
	}
	
	public function addMoney($option){
		$shopid=intval($option['shopid']);
		$money=intval($option['money']);
		$row=$this->get($shopid);
		$newMoney=$row['money']+$money;
		$time=date("Y-m-d H:i:s");
		$this->begin();
		M("mod_flk_shop")->update(array(
			"earnest"=>$newMoney
		),"shopid=".$shopid);
		$this->update(array(
			"money"=>$newMoney,
			"lasttime"=>$time,
		),"shopid=".$shopid);
		M("mod_flk_shop_earnest_log")->insert(array(
			"shopid"=>$shopid,
			"createtime"=>$time,
			"money"=>$money,
			"content"=>"您支付了{$money}元,原来{$row['money']},现在{$newMoney}元"
		));
		$this->commit();
	}
	
}
?>

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

AI 解读 AI

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

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