本文整理汇总了PHP中Fn::gen_order_no方法的典型用法代码示例。如果您正苦于以下问题:PHP Fn::gen_order_no方法的具体用法?PHP Fn::gen_order_no怎么用?PHP Fn::gen_order_no使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fn
的用法示例。
在下文中一共展示了Fn::gen_order_no方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: order_submit
/**
* 订单确认
*
* @param Request $request
* @param Response $response
*/
public function order_submit(Request $request, Response $response)
{
if ($request->is_post()) {
$ret = ['flag' => 'FAIL', 'msg' => '订单提交失败'];
$uid = $GLOBALS['user']->uid;
if (!$uid) {
$ret['msg'] = '未登录, 请先在微信登录';
$response->sendJSON($ret);
}
$player_id = $request->post('player_id', 0);
$goods_type = $request->post('goods_type', 'flower');
$goods_amount = $request->post('amount', 0);
$pay_id = 2;
//2是微信支付,见ec payment表
// 检查数据
// 参赛者
if (!Node::playerExisted($player_id)) {
$ret['msg'] = "参赛者不存在(player_id={$player_id})";
$response->sendJSON($ret);
}
// 数量
$goods_amount = intval($goods_amount);
if (!$goods_amount) {
$ret['msg'] = 'flower' == $goods_type ? '送花数量不能为空' : '送吻数量不能为空';
$response->sendJSON($ret);
}
$order_amount = $goods_amount;
// 支付信息
$pay_info = Goods::getPaymentInfo($pay_id);
if (empty($pay_info)) {
$ret['msg'] = '该支付方式暂不可用,请重新选择';
$response->sendJSON($ret);
}
$order_sn = Fn::gen_order_no();
$order = ['order_sn' => $order_sn, 'user_id' => $uid, 'order_status' => OS_UNCONFIRMED, 'pay_status' => PS_UNPAYED, 'pay_id' => $pay_info['pay_id'], 'pay_name' => $pay_info['pay_name'], 'player_id' => $player_id, 'goods_type' => $goods_type, 'goods_amount' => $goods_amount, 'order_amount' => $order_amount, 'money_paid' => 0, 'add_time' => simphp_time()];
$order_id = D()->insert("order_info", $order);
if ($order_id) {
//订单表生成成功
$order['order_id'] = $order_id;
$true_amount = $order_amount;
// 处理表 pay_log
Trade_Model::insertPayLog($order_id, $order_sn, $true_amount, PAY_ORDER);
$jsApiParams = '';
if (2 == $pay_info['pay_id']) {
//微信支付
$jsApiParams = Wxpay::unifiedOrder($order, $GLOBALS['user']->openid);
}
$ret = ['flag' => 'SUC', 'msg' => '订单提交成功', 'order_id' => $order_id, 'order_sn' => $order_sn, 'js_api_params' => json_decode($jsApiParams)];
$response->sendJSON($ret);
} else {
$ret['msg'] = '订单生成失败,请返回购物车重新添加';
$response->sendJSON($ret);
}
} else {
$this->v->set_tplname('mod_trade_order_submit');
$this->nav_flag1 = 'order';
$this->nav_flag2 = 'order_submit';
$this->nav_no = 0;
if ($request->is_hashreq()) {
} else {
}
$response->send($this->v);
}
}