1
This commit is contained in:
parent
4ac37781d6
commit
6d904e58aa
@ -18,7 +18,7 @@ class InGameMall(object):
|
||||
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格'],
|
||||
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
|
||||
['price_filter', '', '价格过滤(用|分割)'],
|
||||
['type_filter', '', '类型过滤 1:英雄 2:芯片 3:碎片 4:其它'],
|
||||
['type_filter', '', '类型过滤 1:英雄 2:芯片 3:英雄碎片 4:芯片碎片 5:其它'],
|
||||
['item_filter', '', 'itemId过滤'],
|
||||
],
|
||||
'response': [
|
||||
@ -83,4 +83,44 @@ class InGameMall(object):
|
||||
_common.RspHead()
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'sellList',
|
||||
'desc': '出售记录',
|
||||
'group': 'InGameMall',
|
||||
'url': 'webapp/index.php?c=InGameMall&a=sellList',
|
||||
'params':[
|
||||
_common.ReqHead(),
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['!list', [_common.InGameMallGoods()], '商品列表']
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'buyList',
|
||||
'desc': '购买记录',
|
||||
'group': 'InGameMall',
|
||||
'url': 'webapp/index.php?c=InGameMall&a=buyList',
|
||||
'params':[
|
||||
_common.ReqHead(),
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['!list', [_common.InGameMallGoods()], '商品列表']
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'shoppingCartList',
|
||||
'desc': '购物车列表',
|
||||
'group': 'InGameMall',
|
||||
'url': 'webapp/index.php?c=InGameMall&a=shoppingCartList',
|
||||
'params':[
|
||||
_common.ReqHead(),
|
||||
['order_ids', '', '订单id(多个订单用 | 隔开)'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['!list', [_common.InGameMallGoods()], '商品列表']
|
||||
]
|
||||
},
|
||||
]
|
||||
|
@ -1371,6 +1371,7 @@ class InGameMallGoods(object):
|
||||
['item_id', '', '商品道具id'],
|
||||
['item_num', '', '道具数量'],
|
||||
['price', '', '出售价格'],
|
||||
['status', '', '0:出售中 1:已购买 2:已取消'],
|
||||
['createtime', 0, '上架时间'],
|
||||
['last_modify_price_time', 0, '修改时间(更新价格等)'],
|
||||
]
|
||||
|
@ -133,8 +133,8 @@ class InGameMallController extends BaseAuthedController {
|
||||
'ignore_empty' => true,
|
||||
'custom_func' => function () use ($queryData) {
|
||||
$typeFilter = $queryData['type_filter'];
|
||||
if ($typeFilter >= 4){
|
||||
return "AND (order_type >= 4)";
|
||||
if ($typeFilter >= 5){
|
||||
return "AND (order_type >= 5)";
|
||||
}else{
|
||||
return "AND (order_type = '${typeFilter}')";
|
||||
}
|
||||
@ -144,6 +144,19 @@ class InGameMallController extends BaseAuthedController {
|
||||
),
|
||||
'orderBy' => $orderBy,
|
||||
'handle' => function ($row) use(&$out) {
|
||||
switch ($row['order_type']){
|
||||
case InGameMall::HERO_TYPE :{
|
||||
$row['item_info'] = Hero::mallInfo(Hero::findEx($row['goods_uniid']));
|
||||
}
|
||||
break;
|
||||
case InGameMall::CHIP_TYPE :{
|
||||
$row['item_info'] = Chip::toDto(Chip::findEx($row['goods_uniid']));
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
$row['item_info'] = array();
|
||||
}
|
||||
}
|
||||
array_push($out['rows'], $row);
|
||||
}
|
||||
),
|
||||
@ -174,6 +187,10 @@ class InGameMallController extends BaseAuthedController {
|
||||
$this->_rspErr(1, 'param goods_unnid error');
|
||||
return;
|
||||
}
|
||||
if ($heroDb['seal_type'] != 1){
|
||||
$this->_rspErr(1, 'Shelf heroes need to be packaged first');
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case \mt\Item::CHIP_TYPE : {
|
||||
@ -258,7 +275,7 @@ class InGameMallController extends BaseAuthedController {
|
||||
}
|
||||
|
||||
$orderId = OrderId::gen();
|
||||
$orderType = $this->_getGoodsType($itemMeta['type']);
|
||||
$orderType = $this->_getGoodsType($itemMeta);
|
||||
InGameMall::add(
|
||||
$orderId,
|
||||
$orderType,
|
||||
@ -459,6 +476,45 @@ class InGameMallController extends BaseAuthedController {
|
||||
myself()->_rspOk();
|
||||
}
|
||||
|
||||
public function sellList(){
|
||||
$list = array();
|
||||
InGameMall::getMySell(function ($row) use (&$list) {
|
||||
array_push($list,$row);
|
||||
});
|
||||
$this->_rspData(array(
|
||||
'list' => $list
|
||||
));
|
||||
}
|
||||
|
||||
public function buyList(){
|
||||
$list = array();
|
||||
InGameMall::getMyBuy(function ($row) use (&$list) {
|
||||
array_push($list,$row);
|
||||
});
|
||||
$this->_rspData(array(
|
||||
'list' => $list
|
||||
));
|
||||
}
|
||||
|
||||
public function shoppingCartList(){
|
||||
$orderIds = getReqVal('order_ids', '');
|
||||
if (!$orderIds){
|
||||
$this->_rspErr(1, 'param is not null');
|
||||
return;
|
||||
}
|
||||
$orderIdArr = explode("|",$orderIds);
|
||||
$list = array();
|
||||
foreach ($orderIdArr as $orderId){
|
||||
$orderDb = InGameMall::findByOrderId($orderId);
|
||||
if ($orderDb){
|
||||
array_push($list,$orderDb);
|
||||
}
|
||||
}
|
||||
$this->_rspData(array(
|
||||
'list' => $list
|
||||
));
|
||||
}
|
||||
|
||||
private function _isNumber($number){
|
||||
if (is_int($number) && $number > 0){
|
||||
return true;
|
||||
@ -481,8 +537,11 @@ class InGameMallController extends BaseAuthedController {
|
||||
}
|
||||
}
|
||||
|
||||
private function _getGoodsType($type){
|
||||
switch ($type){
|
||||
private function _getGoodsType($itemMeta){
|
||||
if (!$itemMeta){
|
||||
return ;
|
||||
}
|
||||
switch ($itemMeta['type']){
|
||||
case \mt\Item::HERO_TYPE : {
|
||||
return InGameMall::HERO_TYPE;
|
||||
}
|
||||
@ -490,7 +549,11 @@ class InGameMallController extends BaseAuthedController {
|
||||
return InGameMall::CHIP_TYPE;
|
||||
}
|
||||
case \mt\Item::FRAGMENT_TYPE : {
|
||||
return InGameMall::FRAGMENT_TYPE;
|
||||
if ($itemMeta['sub_type'] == \mt\Item::HERO_FRAGMENT_SUBTYPE){
|
||||
return InGameMall::HERO_FRAGMENT_TYPE;
|
||||
}else if ($itemMeta['sub_type'] == \mt\Item::CHIP_FRAGMENT_SUBTYPE){
|
||||
return InGameMall::CHIP_FRAGMENT_TYPE;
|
||||
}
|
||||
}
|
||||
case \mt\Item::BATTLE_REWARD_BOX : {
|
||||
return InGameMall::BOX_TYPE;
|
||||
|
@ -12,9 +12,10 @@ class InGameMall extends BaseModel {
|
||||
|
||||
const HERO_TYPE = 1;
|
||||
const CHIP_TYPE = 2;
|
||||
const FRAGMENT_TYPE = 3;
|
||||
const BOX_TYPE = 4;
|
||||
const GOLD_TYPE = 5;
|
||||
const HERO_FRAGMENT_TYPE = 3;
|
||||
const CHIP_FRAGMENT_TYPE = 4;
|
||||
const BOX_TYPE = 5;
|
||||
const GOLD_TYPE = 6;
|
||||
|
||||
const SYSTEM_MALL_ACCOUNT = "kingsome";
|
||||
|
||||
@ -96,6 +97,32 @@ class InGameMall extends BaseModel {
|
||||
);
|
||||
}
|
||||
|
||||
public static function getMySell($cb){
|
||||
SqlHelper::ormSelect(
|
||||
myself()->_getMysql(''),
|
||||
't_ingame_mall',
|
||||
array(
|
||||
'seller' => myself()->_getAccountId()
|
||||
),
|
||||
function ($row) use($cb) {
|
||||
$cb($row);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public static function getMyBuy($cb){
|
||||
SqlHelper::ormSelect(
|
||||
myself()->_getMysql(''),
|
||||
't_ingame_mall',
|
||||
array(
|
||||
'buyer' => myself()->_getAccountId()
|
||||
),
|
||||
function ($row) use($cb) {
|
||||
$cb($row);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user