diff --git a/fastphp/db/Sql.php b/fastphp/db/Sql.php index 953d54e..e67937d 100644 --- a/fastphp/db/Sql.php +++ b/fastphp/db/Sql.php @@ -45,7 +45,7 @@ class Sql $flag = false; if (is_array($value)) { if (in_array($value[0], $ins)) { - $this->filter .= ' `' . $key . '` ' . $value[0] . '(' . implode(',', $value[1]) . ')'; + $this->filter .= ' `' . $key . '` ' . $value[0] . '(\'' . implode('\',\'', $value[1]) . '\')'; } else { $param_key = $this->paramIsExit($key, $this->param); $this->filter .= ' `' . $key . '` ' . $value[0] . ' :' . $param_key; @@ -58,7 +58,7 @@ class Sql } else { if (is_array($value)) { if (in_array($value[0], $ins)) { - $this->filter .= ' AND `' . $key . '` ' . $value[0] . '(' . implode(',', $value[1]) . ')'; + $this->filter .= ' AND `' . $key . '` ' . $value[0] . '(\'' . implode('\',\'', $value[1]) . '\')'; } else { $param_key = $this->paramIsExit($key, $this->param); $this->filter .= ' AND `' . $key . '` ' . $value[0] . ' :' . $param_key; diff --git a/script/test/test.php b/script/test/test.php new file mode 100644 index 0000000..8fcdb86 --- /dev/null +++ b/script/test/test.php @@ -0,0 +1,56 @@ +'2020-12-03' AND ProductId IN(3,7,9,10,15,16) +$list = $product_order_model->getList("OrderType=5 AND UpdateTime<'2020-12-06' AND UpdateTime>'2020-12-03' AND ProductId IN(3,7,9,10,15,16)"); + +$account_list = []; + +$order_list = []; + +foreach ($list as $info){ + $account_list[] = $info['Accounts']; + $order_list[$info['Accounts']] = $info; +} + +$account_model_list = $product_account_model->getList(['Account'=>['in',$account_list]]); +foreach ($account_model_list as $account) { + $endtime = strtotime($account['EndTime']) + handle_time($order_list[$account['Account']]['RefundRestTime']); + $data['EndTime'] = date('Y-m-d H:i:s', $endtime); + $product_account_model->updateOne(['Account'=>$account['Account']], $data); +} + + + + + + + + +//将剩余时间进行处理切割转换为秒 +function handle_time($rest_time) +{ + $time1 = explode('天', $rest_time); + $time2 = explode('时', $time1[1]); + $time3 = explode('分', $time2[1]); + + $time = $time1[0] * 86400 + $time2[0] * 3600 + $time3[0] * 60; + return $time; +} \ No newline at end of file