game2006api/webapp/models/InGameMall.php
hujiabin 9333f23db0 1
2024-04-19 15:22:49 +08:00

102 lines
2.6 KiB
PHP

<?php
namespace models;
use phpcommon\SqlHelper;
class InGameMall extends BaseModel {
const PENDING_STATE = 0;
const BUY_OK_STATE = 1;
const CANCEL_STATE = 2;
const HERO_TYPE = 1;
const CHIP_TYPE = 2;
const FRAGMENT_TYPE = 3;
const BOX_TYPE = 4;
const GOLD_TYPE = 5;
const SYSTEM_MALL_ACCOUNT = "kingsome";
public static function findByOrderId($orderId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getMysql(''),
't_ingame_mall',
array(
'order_id' => $orderId
)
);
return $row;
}
public static function add($orderId, $orderType, $goodsUniid,$itemId, $itemNum, $price)
{
SqlHelper::insert
(myself()->_getMysql(''),
't_ingame_mall',
array(
'order_id' => $orderId,
'order_type' => $orderType,
'seller' => myself()->_getAccountId(),
'seller_address' => myself()->_getAddress(),
'goods_uniid' => $goodsUniid,
'item_id' => $itemId,
'item_num' => $itemNum,
'price' => $price,
'last_modify_price_time' => myself()->_getNowTime(),
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
));
}
public static function modifyPrice($orderId, $price)
{
SqlHelper::update
(myself()->_getMysql(''),
't_ingame_mall',
array(
'order_id' => $orderId
),
array(
'price' => $price,
'last_modify_price_time' => myself()->_getNowTime(),
)
);
}
public static function cancel($orderId)
{
SqlHelper::update
(myself()->_getMysql(''),
't_ingame_mall',
array(
'order_id' => $orderId
),
array(
'status' => self::CANCEL_STATE,
'modifytime' => myself()->_getNowTime(),
)
);
}
public static function buyOk($orderId, $buyer)
{
SqlHelper::update
(myself()->_getMysql(''),
't_ingame_mall',
array(
'order_id' => $orderId
),
array(
'status' => self::BUY_OK_STATE,
'buyer' => $buyer,
'buy_ok_time' => myself()->_getNowTime()
)
);
}
}