Skip to content

Commit

Permalink
V1.7版本
Browse files Browse the repository at this point in the history
  • Loading branch information
szvone committed May 6, 2019
1 parent c6eaedd commit 2784ef4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ V免签为完全开源项目,开源项目意味着作者没有任何收入来

## 更新记录

+ v1.7(2019.05.06)
+ 修复部分情况下无法自动释放被锁定金额的情况(本版本数据库有变动,旧版升级请覆盖文件后,将tmp_price表中增加一列,字段名为oid,类型varchar(255),如果您不会增加,请删除原有数据库并重新导入vmq.sql)

+ v1.6.2(2019.04.30)
+ 修复部分情况下出现订单已过期,但是页面还在倒计时的问题

Expand Down
13 changes: 7 additions & 6 deletions application/index/controller/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,13 @@ public function createOrder()
$payQf = $payQf['vvalue'];


$orderId = date("YmdHms") . rand(1, 9) . rand(1, 9) . rand(1, 9) . rand(1, 9);

$ok = false;
for ($i = 0; $i < 10; $i++) {
$tmpPrice = $reallyPrice . "-" . $type;

$row = Db::execute("INSERT IGNORE INTO tmp_price (price) VALUES ('" . $reallyPrice . "-" . $type . "')");
$row = Db::execute("INSERT IGNORE INTO tmp_price (price,oid) VALUES ('" . $tmpPrice . "','".$orderId."')");
if ($row) {
$ok = true;
break;
Expand All @@ -200,7 +202,7 @@ public function createOrder()
}
//echo $reallyPrice;

$reallyPrice = bcdiv($reallyPrice, 100, 2);
$reallyPrice = bcdiv($reallyPrice, 100);

if ($type == 1) {
$payUrl = Db::name("setting")->where("vkey", "wxpay")->find();
Expand Down Expand Up @@ -231,7 +233,6 @@ public function createOrder()
}


$orderId = date("YmdHms") . rand(1, 9) . rand(1, 9) . rand(1, 9) . rand(1, 9);


$createDate = time();
Expand Down Expand Up @@ -359,7 +360,7 @@ public function closeOrder(){
}
Db::name("pay_order")->where("order_id",$orderId)->update(array("state"=>-1,"close_date"=>time()));
Db::name("tmp_price")
->where("price",bcmul(round($res['really_price'],2),100)."-".$res['type'])
->where("oid",$res['order_id'])
->delete();
return json($this->getReturn(1, "成功"));
}else{
Expand Down Expand Up @@ -454,7 +455,7 @@ public function appPush(){
if ($res){

Db::name("tmp_price")
->where("price",bcmul(round($res['really_price'],2),100)."-".$res['type'])
->where("oid",$res['order_id'])
->delete();

Db::name("pay_order")->where("id",$res['id'])->update(array("state"=>1,"pay_date"=>time(),"close_date"=>time()));
Expand Down Expand Up @@ -532,7 +533,7 @@ public function closeEndOrder(){
$rows = Db::name("pay_order")->where("close_date",$close_date)->select();
foreach ($rows as $row){
Db::name("tmp_price")
->where("price",bcmul(round($row['really_price'],2),100)."-".$row['type'])
->where("oid",$row['order_id'])
->delete();
}
return json($this->getReturn(1,"成功清理".$res."条订单"));
Expand Down
4 changes: 3 additions & 1 deletion vmq.sql
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ INSERT INTO `setting` (`vkey`, `vvalue`) VALUES
--

CREATE TABLE `tmp_price` (
`price` varchar(255) NOT NULL
`price` varchar(255) NOT NULL,
`oid` varchar(255) NOT NULL

) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
Expand Down

0 comments on commit 2784ef4

Please sign in to comment.