static function Assign($order) { $ccon = array('order_id' => $order['id']); $count = Table::Count('voucher', $ccon); //send_goods_confirm_by_platform if( ($order['service']=='alipay') && ($INI['alipay']['autosendgoods']='Y') && ($INI['alipay']['guarantee']!='Y') ) { alipay_send_goods($order['trade_no']); } while($count<$order['quantity']) { $voucher = self::GetValidVoucher($order['team_id']); if (!$voucher) break; $flag = Table::UpdateCache('voucher', $voucher['id'], array( 'user_id' => $order['user_id'], 'order_id' => $order['id'], )); if($flag){ $voucher = Table::Fetch('voucher', $voucher['id']); global $INI; if ($INI['sms']['auto']=='1') sms_voucher($voucher); } $count = Table::Count('voucher', $ccon); } }
} json("手机短信发送失败,错误码:{$code}", 'alert'); } else { if ($action == 'vouchersms') { $voucher = Table::Fetch('voucher', $cid); if ($voucher['sms'] >= 5 && !is_manager()) { json('短信发送商户券最多5次', 'alert'); } $interval = abs(intval($INI['sms']['interval'])); $lefttime = $interval + $voucher['sms_time'] - time(); if (!is_manager() && $lefttime > 0) { json("你好,请在{$lefttime}秒后,再次尝试短信发送商户券", 'alert'); } if (!$voucher || !is_login() || $voucher['user_id'] != ZLogin::GetLoginId() && !is_manager()) { json('非法下载', 'alert'); } $flag = sms_voucher($voucher); if ($flag === true) { json('手机短信发送成功,请及时查收', 'alert'); } else { if (is_string($flag)) { json($flag, 'alert'); } } json("手机短信发送失败,错误码:{$code}", 'alert'); } } } } } }