作者 王智

222

... ... @@ -154,6 +154,11 @@ class Order extends Api
{
$user_id = $this->is_token($this->request->header());
$param = $this->request->param();
$quota = Db::name('user')->where('id', $user_id)->value('sy_quota');
if ($param['total'] > $quota) {
$this->error('下单金额大于总额度');
die;
}
$arr = json_decode(htmlspecialchars_decode($param['data']), true);
foreach ($arr as $k => $v) {
$stock[$k] = Db::name('product')->where(['id' => $v['product_id']])->value('stock');
... ...