再来一单
This commit is contained in:
@@ -55,24 +55,49 @@ class Shopping extends Base
|
||||
switch ($message['operate_type']) {
|
||||
// 初始化购物车
|
||||
case 'init':
|
||||
// 商户ID 和桌码ID
|
||||
$table_code = self::get_shopping_send_id($message);
|
||||
// 绑定桌码和 client_id
|
||||
Gateway::bindUid($client_id, $table_code);
|
||||
$rand = 'shopping_init' . Random::build();
|
||||
$time_dis_info = null;
|
||||
if(!empty($message['one_more_order'])) {
|
||||
// 再来一单
|
||||
if(empty($message['order_id'])) {
|
||||
Gateway::sendToClient($client_id, json_encode(['msg' => 'order_id 必传']));
|
||||
return;
|
||||
}
|
||||
$order_arr = Db::name('tb_order_detail')->where(['order_id' => $message['order_id']])->select()->toArray();
|
||||
foreach ($order_arr as $k => $order) {
|
||||
self::add_data([
|
||||
'shop_id' => $message['shop_id'],
|
||||
'sku_id' => $order['sku_id'],
|
||||
'product_id' => $order['product_id'],
|
||||
'number' => $order['num'],
|
||||
'table_code' => $message['table_code'],
|
||||
'product_name' => $order['product_name'],
|
||||
'sku_name' => $order['sku_name'],
|
||||
'product_type' => $order['product_type'],
|
||||
'is_print' => $order['is_print'],
|
||||
'create_time' => d(),
|
||||
]);
|
||||
}
|
||||
}else {
|
||||
// 商户ID 和桌码ID
|
||||
$table_code = self::get_shopping_send_id($message);
|
||||
// 绑定桌码和 client_id
|
||||
Gateway::bindUid($client_id, $table_code);
|
||||
|
||||
// 限时折扣
|
||||
$redis_str = Base::get_shopping_save_uid($message['shop_id'], $message['table_code']) . ':time_discount';
|
||||
$time_dis_info = Redis::get($redis_str);
|
||||
if($time_dis_info) {
|
||||
$time_dis_info = json_decode($time_dis_info, true);
|
||||
}else {
|
||||
$time_dis_info = null;
|
||||
}
|
||||
}
|
||||
$car = Db::query("
|
||||
SELECT * FROM `tb_cashier_cart` WHERE
|
||||
`shop_id`={$message['shop_id']} AND
|
||||
`table_code`='{$message['table_code']}'
|
||||
");
|
||||
// 限时折扣
|
||||
$redis_str = Base::get_shopping_save_uid($message['shop_id'], $message['table_code']) . ':time_discount';
|
||||
$time_dis_info = Redis::get($redis_str);
|
||||
if($time_dis_info) {
|
||||
$time_dis_info = json_decode($time_dis_info, true);
|
||||
}else {
|
||||
$time_dis_info = null;
|
||||
}
|
||||
$snd_data = [
|
||||
'msg' => '购物车初始化',
|
||||
'operate_type' => 'init',
|
||||
|
||||
Reference in New Issue
Block a user