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_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格'],
|
||||||
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
|
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
|
||||||
['price_filter', '', '价格过滤(用|分割)'],
|
['price_filter', '', '价格过滤(用|分割)'],
|
||||||
['type_filter', '', '类型过滤 1:英雄 2:芯片 3:碎片 4:其它'],
|
['type_filter', '', '类型过滤 1:英雄 2:芯片 3:英雄碎片 4:芯片碎片 5:其它'],
|
||||||
['item_filter', '', 'itemId过滤'],
|
['item_filter', '', 'itemId过滤'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
@ -83,4 +83,44 @@ class InGameMall(object):
|
|||||||
_common.RspHead()
|
_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_id', '', '商品道具id'],
|
||||||
['item_num', '', '道具数量'],
|
['item_num', '', '道具数量'],
|
||||||
['price', '', '出售价格'],
|
['price', '', '出售价格'],
|
||||||
|
['status', '', '0:出售中 1:已购买 2:已取消'],
|
||||||
['createtime', 0, '上架时间'],
|
['createtime', 0, '上架时间'],
|
||||||
['last_modify_price_time', 0, '修改时间(更新价格等)'],
|
['last_modify_price_time', 0, '修改时间(更新价格等)'],
|
||||||
]
|
]
|
||||||
|
@ -133,8 +133,8 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
'ignore_empty' => true,
|
'ignore_empty' => true,
|
||||||
'custom_func' => function () use ($queryData) {
|
'custom_func' => function () use ($queryData) {
|
||||||
$typeFilter = $queryData['type_filter'];
|
$typeFilter = $queryData['type_filter'];
|
||||||
if ($typeFilter >= 4){
|
if ($typeFilter >= 5){
|
||||||
return "AND (order_type >= 4)";
|
return "AND (order_type >= 5)";
|
||||||
}else{
|
}else{
|
||||||
return "AND (order_type = '${typeFilter}')";
|
return "AND (order_type = '${typeFilter}')";
|
||||||
}
|
}
|
||||||
@ -144,6 +144,19 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
),
|
),
|
||||||
'orderBy' => $orderBy,
|
'orderBy' => $orderBy,
|
||||||
'handle' => function ($row) use(&$out) {
|
'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);
|
array_push($out['rows'], $row);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@ -174,6 +187,10 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
$this->_rspErr(1, 'param goods_unnid error');
|
$this->_rspErr(1, 'param goods_unnid error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ($heroDb['seal_type'] != 1){
|
||||||
|
$this->_rspErr(1, 'Shelf heroes need to be packaged first');
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case \mt\Item::CHIP_TYPE : {
|
case \mt\Item::CHIP_TYPE : {
|
||||||
@ -258,7 +275,7 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$orderId = OrderId::gen();
|
$orderId = OrderId::gen();
|
||||||
$orderType = $this->_getGoodsType($itemMeta['type']);
|
$orderType = $this->_getGoodsType($itemMeta);
|
||||||
InGameMall::add(
|
InGameMall::add(
|
||||||
$orderId,
|
$orderId,
|
||||||
$orderType,
|
$orderType,
|
||||||
@ -459,6 +476,45 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
myself()->_rspOk();
|
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){
|
private function _isNumber($number){
|
||||||
if (is_int($number) && $number > 0){
|
if (is_int($number) && $number > 0){
|
||||||
return true;
|
return true;
|
||||||
@ -481,8 +537,11 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _getGoodsType($type){
|
private function _getGoodsType($itemMeta){
|
||||||
switch ($type){
|
if (!$itemMeta){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
switch ($itemMeta['type']){
|
||||||
case \mt\Item::HERO_TYPE : {
|
case \mt\Item::HERO_TYPE : {
|
||||||
return InGameMall::HERO_TYPE;
|
return InGameMall::HERO_TYPE;
|
||||||
}
|
}
|
||||||
@ -490,7 +549,11 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
return InGameMall::CHIP_TYPE;
|
return InGameMall::CHIP_TYPE;
|
||||||
}
|
}
|
||||||
case \mt\Item::FRAGMENT_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 : {
|
case \mt\Item::BATTLE_REWARD_BOX : {
|
||||||
return InGameMall::BOX_TYPE;
|
return InGameMall::BOX_TYPE;
|
||||||
|
@ -12,9 +12,10 @@ class InGameMall extends BaseModel {
|
|||||||
|
|
||||||
const HERO_TYPE = 1;
|
const HERO_TYPE = 1;
|
||||||
const CHIP_TYPE = 2;
|
const CHIP_TYPE = 2;
|
||||||
const FRAGMENT_TYPE = 3;
|
const HERO_FRAGMENT_TYPE = 3;
|
||||||
const BOX_TYPE = 4;
|
const CHIP_FRAGMENT_TYPE = 4;
|
||||||
const GOLD_TYPE = 5;
|
const BOX_TYPE = 5;
|
||||||
|
const GOLD_TYPE = 6;
|
||||||
|
|
||||||
const SYSTEM_MALL_ACCOUNT = "kingsome";
|
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