Hi Mckay, I showed him your post. This was the error we are facing on the website. We are using socket io. database is on mysql. Will this error help to identify whats the issue? <p>Message: Undefined index: assetid</p>
public function deposit_item() {
if ($this->input->server('REQUEST_METHOD') == 'POST') {
$message = $_POST['items'];
pr($message['items_to_receive'],1);
$items_update_detail = array(
'name' => json_encode($message)
);
$this->Inventory_model->test_trade_update($items_update_detail);
if ($message['type'] == "deposit") {
$bot_id = $message['bot_id'];
$steam_id = $message['steam_id'];
$trade_id = $message['tradeid'];
$trade_offer_id = $message['tradeofferid'];
$trade_msg = $message['message'];
$deposit_detail = array(
'deposit_steam_id' => $steam_id,
'bot_id' => $bot_id,
'asset_id' => '',
'trade_offer_id' => $trade_offer_id,
'trade_id' => $trade_id,
'trade_message' => $trade_msg,
'trade_created' => date('Y-m-d H:i:s', $message['time_created']),
'trade_updated' => date('Y-m-d H:i:s', $message['time_updated']),
'trade_expiry' => date('Y-m-d H:i:s', $message['expiration_time']),
);
$reg_exp = "~Token: (.*?)$~";
preg_match($reg_exp, $trade_msg, $tokens);
$security_token = $tokens[1];
$items = $message['items_to_receive'];
$items_update_detail = array(
'name' => json_encode($items)
);
$this->Inventory_model->test_trade_update($items_update_detail);
//$new_items = $message['new_assets'];
$new_items = $_POST['new_items'];
$new_items_detail = array(
'name' => json_encode($new_items)
);
$this->Inventory_model->test_trade_update($new_items_detail);
$return_array = array();
$asset_ids = array();
foreach ($items as $key => $item) {
$asset_id = $item['assetid'];
$new_asset_id = $new_items[$key]['assetid'];
$asset_ids[] = $new_asset_id;
$item_detail = $this->Inventory_model->get_inventory_item_assetid($asset_id);
if (count($item_detail) > 0) {
$item_id = $item_detail['id'];
$update_inventory = array(
'new_asset_id' => $new_asset_id,
'item_type' => 1,
'class_id' => $new_items[$key]['classid'],
'instance_id' => $new_items[$key]['instanceid'],
'security_token' => $security_token
);
$test_trade_update_detail = array(
'name' => json_encode($update_inventory)
);
$this->Inventory_model->test_trade_update($test_trade_update_detail);
if ($this->Inventory_model->update_item($item_id, $update_inventory)) {
$deposit_detail['asset_id'] = $new_asset_id;
if ($this->Deposit_model->deposit_item($deposit_detail)) {
$return_array['status'] = 1;
}
}
}
}
$trade_asset_ids = implode(",", $asset_ids);
$bot_trade_detail = array(
'bot_id' => $bot_id,
'user_steam_id' => $steam_id,
'trade_id' => $trade_id,
'trade_offer_id' => $trade_offer_id,
'trade_type' => $message['type'],
'trade_status' => $message['trade_offer_state'],
'asset_ids' => $trade_asset_ids,
'security_token' => $security_token
);
$this->Deposit_model->add_bot_trade($bot_trade_detail);
// $return_array['deposit_items'] = $this->refresh_inventory_box($steam_id);
} else {
$return_array = array(
'status' => 0,
'msg' => 'Please try again..!!'
);
}
echo json_encode($return_array);
}
}
The scenario/issue we are facing, bots is able to trade and receive through socket communication, we are able to deposit 20 items, but the ajax which doesn't update the web inventory correctly, instead of having 20 items in our web inventory, we only received 10, or maybe 13/14 out of the 20 items. Thanks