aozhiwei f50a8d16f4 1
2023-08-05 16:19:40 +08:00

73 lines
1.7 KiB
PHP

<?php
namespace models;
use phpcommon\SqlHelper;
class Market extends BaseModel {
const PENDING_STATE = 0;
const BUY_OK_STATUS = 1;
const CANCEL_STATUS = 2;
public static function find($orderId){
$row = SqlHelper::ormSelectOne(
myself()->_getMysql(''),
't_market',
array(
'order_id' => $orderId
)
);
return $row;
}
public static function add($OrderId, $fieldsKv){
SqlHelper::upsert
(myself()->_getMysql(''),
't_market',
array(
'order_id' => $OrderId
),
array(
),
array(
'order_id' => $OrderId,
'order_type' => getXVal($fieldsKv,'order_type',0),
'account_id' => myself()->_getAccountId(),
'address' => myself()->_getAddress(),
'status' => 0,
'item_id' => $fieldsKv['item_id'],
'item_num' => $fieldsKv['item_num'],
'ext_data' => getXVal($fieldsKv,'ext_data',''),
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
'price' => $fieldsKv['price'],
)
);
}
public static function updatePrice($orderId, $currency, $price) {
}
public static function buyOk($orderId) {
}
public static function cancel($orderId) {
}
private static function update($OrderId, $fieldsKv){
SqlHelper::upsert
(myself()->_getMysql(''),
't_market',
array(
'order_id' => $OrderId
),
$fieldsKv
);
}
}